From 277dd634e169e7341272e304f715a542047396d7 Mon Sep 17 00:00:00 2001 From: vnugent Date: Thu, 10 Aug 2023 22:08:54 -0400 Subject: Introduce builds using vnbuild for the website --- .gitignore | 7 +--- Module.Taskfile.yaml | 25 ++++++++++++ back-end/Taskfile.yaml | 48 +++++++++++++++++++++++ back-end/src/CMNext.sample.json | 44 +++++++++++++++++++++ back-end/src/Content.Publishing.Blog.Admin.csproj | 3 +- front-end/.env | 2 +- front-end/Taskfile.yaml | 28 +++++++++++++ front-end/package-lock.json | 2 + front-end/package.json | 10 ++++- lib/Taskfile.yaml | 31 +++++++++++++++ lib/admin/package.json | 5 +++ lib/client/package.json | 11 +++++- 12 files changed, 205 insertions(+), 11 deletions(-) create mode 100644 Module.Taskfile.yaml create mode 100644 back-end/Taskfile.yaml create mode 100644 back-end/src/CMNext.sample.json create mode 100644 front-end/Taskfile.yaml create mode 100644 lib/Taskfile.yaml diff --git a/.gitignore b/.gitignore index 3646982..71da0fe 100644 --- a/.gitignore +++ b/.gitignore @@ -362,11 +362,6 @@ MigrationBackup/ # Fody - auto-generated XML schema FodyWeavers.xsd -/.task/checksum -*[Tt]askfile.* - -*.sln - # Logs logs *.log @@ -392,4 +387,4 @@ dist-ssr *.sln *.sw? -/back-end/*/*.json +/back-end/*/CMNext.json diff --git a/Module.Taskfile.yaml b/Module.Taskfile.yaml new file mode 100644 index 0000000..29bde03 --- /dev/null +++ b/Module.Taskfile.yaml @@ -0,0 +1,25 @@ + +#This allows the Task build system to run commands to build components of the project +#You must install Task before executing this file, https://taskfile.dev + +version: '3' + +tasks: + + #update project source code + update: + cmds: + - git remote update + - git reset --hard + - git pull origin {{.BRANCH_NAME}} --verify-signatures + + build: + cmds: + + #copy artifacts to temp directory + postbuild_success: + cmds: + + #clean hook + clean: + cmds: \ No newline at end of file diff --git a/back-end/Taskfile.yaml b/back-end/Taskfile.yaml new file mode 100644 index 0000000..07bcaf6 --- /dev/null +++ b/back-end/Taskfile.yaml @@ -0,0 +1,48 @@ + +#taskfile for building the libraries for admin and clients and creating their packages + +version: '3' + +vars: + DOTNET_BUILD_FLAGS: '/p:RunAnalyzersDuringBuild=false /p:BuildInParallel=true /p:MultiProcessorCompilation=true' + +tasks: + + build: + dir: '{{.USER_WORKING_DIR}}' + cmds: + #build project + - dotnet publish -c release {{.DOTNET_BUILD_FLAGS}} + + #postbuild to package artifaces into the archives for upload + postbuild_success: + dir: '{{.USER_WORKING_DIR}}' + vars: + #output directory for the build artifacts + OUT_DIR: 'bin/release/{{.TARGET_FRAMEWORK}}/publish' + + cmds: + #pack up source code + - task: packsource + + #copy license to output dir + - powershell -Command "cp '{{.MODULE_DIR}}/LICENSE.txt' -Destination '{{.OUT_DIR}}/LICENSE.txt'" + + #tar the plugin output and put it in the bin dir + - cd {{.OUT_DIR}} && tar -czvf '{{.USER_WORKING_DIR}}/bin/release.tgz' . + + packsource: + dir: '{{.USER_WORKING_DIR}}' + internal: true + cmds: + #copy source code to target + - powershell -Command "Get-ChildItem -Include *.cs,*.csproj -Recurse | Where { \$_.FullName -notlike '*\obj\*' -and \$_.FullName -notlike '*\bin\*' } | Resolve-Path -Relative | tar --files-from - -cvzf 'bin/src.tgz'" + + #clean hook + clean: + dir: '{{.USER_WORKING_DIR}}' + ignore_error: true + cmds: + - dotnet clean -c release + - powershell -Command "Remove-Item -Recurse bin" + - powershell -Command "Remove-Item -Recurse obj" \ No newline at end of file diff --git a/back-end/src/CMNext.sample.json b/back-end/src/CMNext.sample.json new file mode 100644 index 0000000..1b3c516 --- /dev/null +++ b/back-end/src/CMNext.sample.json @@ -0,0 +1,44 @@ +{ + //Enables debug logging + "debug": false, + + "post_endpoint": { + "path": "/blog/posts" + }, + + "channel_endpoint": { + "path": "/blog/channels" + }, + + "content_endpoint": { + "path": "/blog/content", + "max_content_length": 50000000 + }, + + "blog_channels": { + //The index file for storing channel configuration + "index_file_name": "blogs/channels.json" + }, + + //S3 setup with vault secrets + "disabled s3_config": { + "server_address": "", + "access_key": "", + "bucket": "", + "use_ssl": true, + "Region": null + }, + + "disabled ftp_config": { + "url": "", + "username": "", + //Base path within the ftp user's directory + "base_path": "" + }, + + "secrets": { + //Set the vault path to the s3 secret + "s3_secret": "", + "ftp_password": "" + } +} \ No newline at end of file diff --git a/back-end/src/Content.Publishing.Blog.Admin.csproj b/back-end/src/Content.Publishing.Blog.Admin.csproj index cb6ade1..afbc9e1 100644 --- a/back-end/src/Content.Publishing.Blog.Admin.csproj +++ b/back-end/src/Content.Publishing.Blog.Admin.csproj @@ -7,6 +7,7 @@ README.md Content.Publishing.Blog.Admin CMNext + 0.1.1 @@ -38,7 +39,7 @@ - + Always diff --git a/front-end/.env b/front-end/.env index 1b4c9eb..cae7853 100644 --- a/front-end/.env +++ b/front-end/.env @@ -1,5 +1,5 @@ #The base url for all api requests -VITE_API_URL="/api" +VITE_API_URL="/" VITE_CORS_ENABLED=false #The VNLib.Plugins.Essentials.Accounts plugin security header value diff --git a/front-end/Taskfile.yaml b/front-end/Taskfile.yaml new file mode 100644 index 0000000..86bf0dc --- /dev/null +++ b/front-end/Taskfile.yaml @@ -0,0 +1,28 @@ + +#taskfile for building the libraries for admin and clients and creating their packages + +version: '3' + +tasks: + + build: + cmds: + #install deps and run build + - npm install + - npm run build + + #copy artifacts to temp directory + postbuild_success: + cmds: + - powershell -Command "mkdir bin -Force" + #tar the dist output and put it in the output dir + - cd dist && tar -czf '../bin/release.tgz' . + + #clean hook + clean: + ignore_error: true + cmds: + - cmd: powershell -Command "Remove-Item -Recurse -Force node_modules" + - cmd: powershell -Command "Remove-Item -Recurse -Force dist" + - cmd: powershell -Command "Remove-Item -Recurse -Force bin" + - cmd: powershell -Command "Remove-Item release.tgz" \ No newline at end of file diff --git a/front-end/package-lock.json b/front-end/package-lock.json index f4aa9e6..868d074 100644 --- a/front-end/package-lock.json +++ b/front-end/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "@vnuge/cmnext-front-end", "version": "0.1.1", + "license": "agpl3", "dependencies": { "@chenfengyuan/vue-qrcode": "^2.0.0", "@fontsource/nunito": "^5.0.3", @@ -53,6 +54,7 @@ } }, "../lib/admin": { + "name": "@vnuge/cmnext-admin", "version": "0.1.1", "license": "agpl3", "devDependencies": { diff --git a/front-end/package.json b/front-end/package.json index c41c456..091599c 100644 --- a/front-end/package.json +++ b/front-end/package.json @@ -3,13 +3,21 @@ "private": true, "version": "0.1.1", "type": "module", - "main": "index.html", + "copyright": "Copyright \u00A9 2023 Vaughn Nugent", "description": "The CMNext admin web UI, built with Tailwindcss and Vuejs", + "repository": "https://github.com/VnUgE/CMNext/tree/master/front-end", + "author": "Vaughn Nugent", + "output_dir": "bin", + + "main": "index.html", + "license": "agpl3", + "scripts": { "dev": "vite", "build": "vite build", "preview": "vite preview" }, + "dependencies": { "@chenfengyuan/vue-qrcode": "^2.0.0", "@fontsource/nunito": "^5.0.3", diff --git a/lib/Taskfile.yaml b/lib/Taskfile.yaml new file mode 100644 index 0000000..e2989c2 --- /dev/null +++ b/lib/Taskfile.yaml @@ -0,0 +1,31 @@ + +#taskfile for building the libraries for admin and clients and creating their packages + +version: '3' + +tasks: + + build: + dir: '{{.USER_WORKING_DIR}}' + cmds: + #install deps and run build + - npm install + - npm run build + + #copy artifacts to temp directory + postbuild_success: + dir: '{{.USER_WORKING_DIR}}' + cmds: + - powershell -Command "mkdir bin -Force" + #tar the package and put it in the output dir + - tar --exclude="./node_modules" --exclude="./src" --exclude="./.git" --exclude="./bin" --exclude=".gitignore" --exclude="*.yaml" -czf bin/release.tgz . + + #clean hook + clean: + dir: '{{.USER_WORKING_DIR}}' + ignore_error: true + cmds: + - cmd: powershell -Command "Remove-Item -Recurse node_modules" + - cmd: powershell -Command "Remove-Item -Recurse dist" + - cmd: powershell -Command "Remove-Item -Recurse -Force bin" + - cmd: powershell -Command "Remove-Item release.tgz" \ No newline at end of file diff --git a/lib/admin/package.json b/lib/admin/package.json index 4405d3e..14a7850 100644 --- a/lib/admin/package.json +++ b/lib/admin/package.json @@ -3,6 +3,11 @@ "version": "0.1.1", "author": "Vaughn Nugent", "description": "A browser client library for CMNext admin UI development", + "copyright": "Copyright \u00A9 2023 Vaughn Nugent", + "repository": "https://github.com/VnUgE/CMNext/tree/master/lib/admin", + "output_dir": "bin", + "type": "module", + "main": "./dist/index.js", "types": "./dist/index.d.ts", "typings": "./dist/index.d.ts", diff --git a/lib/client/package.json b/lib/client/package.json index 430503f..26923cb 100644 --- a/lib/client/package.json +++ b/lib/client/package.json @@ -1,8 +1,15 @@ { "name": "@vnuge/cmnext-client", - "version": "0.1.0", + "version": "0.1.1", + "type": "module", + "copyright": "Copyright \u00A9 2023 Vaughn Nugent", "author": "Vaughn Nugent", "description": "A browser client library to access your CMNext content from its http static storage", + "repository": "https://github.com/VnUgE/CMNext/tree/master/lib/client", + "output_dir": "bin", + + "license": "agpl3", + "main": "./dist/index.js", "types": "./dist/index.d.ts", "typings": "./dist/index.d.ts", @@ -11,7 +18,7 @@ "build": "tsc", "clean": "if exist dist ( rd /S /Q lib)" }, - "license": "agpl3", + "devDependencies": { "@babel/types": "^7.x", "@types/lodash-es": "^4.14.194", -- cgit