From 6c42595d49d4bd5a093b3e00408b8ea820b34f9e Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 15:26:12 -0600 Subject: [PATCH 01/20] testing out a new script for writing the version --- ...c-web-apps-victorious-flower-0ea52481e.yml | 6 +++++- SBOLCanvasFrontend/package.json | 2 +- SBOLCanvasFrontend/write-version-file.sh | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 SBOLCanvasFrontend/write-version-file.sh diff --git a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml index 8b26138f..74ec4e14 100644 --- a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml +++ b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml @@ -4,6 +4,10 @@ on: push: branches: - final + - frontend-build-fix + paths: + - '.github/**' + - 'SBOLCanvasFrontend/**' pull_request: types: [opened, synchronize, reopened, closed] branches: @@ -20,7 +24,7 @@ jobs: submodules: true lfs: false - name: Configure git - run: sudo git config --system --add safe.directory /github/workspace + run: sudo git config --system --add safe.directory '*' - name: Build And Deploy id: builddeploy uses: Azure/static-web-apps-deploy@v1 diff --git a/SBOLCanvasFrontend/package.json b/SBOLCanvasFrontend/package.json index d09187e0..0abecd15 100644 --- a/SBOLCanvasFrontend/package.json +++ b/SBOLCanvasFrontend/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "scripts": { "bundle-report": "ng build --configuration production --stats-json && webpack-bundle-analyzer dist/SBOLCanvasFrontend/stats.json", - "prebuild": "npm rebuild sass && ts-node -O \"{\\\"module\\\":\\\"commonjs\\\"}\" git.version.ts && node assetBundler.js", + "prebuild": "npm rebuild sass && node assetBundler.js && sudo bash ./write-version-file.sh", "build": "ng build --configuration production --base-href=/canvas/", "predev": "npm run prebuild", "dev": "ng serve -o", diff --git a/SBOLCanvasFrontend/write-version-file.sh b/SBOLCanvasFrontend/write-version-file.sh new file mode 100644 index 00000000..dab094c9 --- /dev/null +++ b/SBOLCanvasFrontend/write-version-file.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +git_hash=$(git rev-parse --short "$GITHUB_SHA") +git_branch=${GITHUB_REF#refs/heads/} + +sudo apt-get install jq +version=$(jq -r '.version' package.json) + +file_contents=$(cat < src/environments/versions.ts \ No newline at end of file From d9baf7c3c24deb6935108b8241cd737d3754da71 Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 15:30:25 -0600 Subject: [PATCH 02/20] fix --- SBOLCanvasFrontend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SBOLCanvasFrontend/package.json b/SBOLCanvasFrontend/package.json index 0abecd15..088a2a05 100644 --- a/SBOLCanvasFrontend/package.json +++ b/SBOLCanvasFrontend/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "scripts": { "bundle-report": "ng build --configuration production --stats-json && webpack-bundle-analyzer dist/SBOLCanvasFrontend/stats.json", - "prebuild": "npm rebuild sass && node assetBundler.js && sudo bash ./write-version-file.sh", + "prebuild": "npm rebuild sass && node assetBundler.js && bash ./write-version-file.sh", "build": "ng build --configuration production --base-href=/canvas/", "predev": "npm run prebuild", "dev": "ng serve -o", From 1861d79a4563ba55d4574f88ab8c1d52880052d7 Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 15:35:32 -0600 Subject: [PATCH 03/20] still trying --- .../azure-static-web-apps-victorious-flower-0ea52481e.yml | 2 -- SBOLCanvasFrontend/write-version-file.sh | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml index 74ec4e14..8ae21af7 100644 --- a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml +++ b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml @@ -23,8 +23,6 @@ jobs: with: submodules: true lfs: false - - name: Configure git - run: sudo git config --system --add safe.directory '*' - name: Build And Deploy id: builddeploy uses: Azure/static-web-apps-deploy@v1 diff --git a/SBOLCanvasFrontend/write-version-file.sh b/SBOLCanvasFrontend/write-version-file.sh index dab094c9..cdb34d70 100644 --- a/SBOLCanvasFrontend/write-version-file.sh +++ b/SBOLCanvasFrontend/write-version-file.sh @@ -1,9 +1,11 @@ #!/bin/bash +git config --global --add safe.directory "$(pwd)" +git config --system --add safe.directory "$(pwd)" git_hash=$(git rev-parse --short "$GITHUB_SHA") git_branch=${GITHUB_REF#refs/heads/} -sudo apt-get install jq +apt-get install jq version=$(jq -r '.version' package.json) file_contents=$(cat < Date: Thu, 24 Oct 2024 15:39:18 -0600 Subject: [PATCH 04/20] trying different user for build step --- .../azure-static-web-apps-victorious-flower-0ea52481e.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml index 8ae21af7..f7703d82 100644 --- a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml +++ b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml @@ -17,6 +17,8 @@ jobs: build_and_deploy_job: if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') runs-on: ubuntu-latest + container: + options: --user 1001 name: Build and Deploy Job steps: - uses: actions/checkout@v3 From 4e1bf69443ed62c54cf61e646b045736497e9566 Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 15:40:29 -0600 Subject: [PATCH 05/20] come on --- .../azure-static-web-apps-victorious-flower-0ea52481e.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml index f7703d82..382825e8 100644 --- a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml +++ b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml @@ -18,6 +18,7 @@ jobs: if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') runs-on: ubuntu-latest container: + image: ubuntu:latest options: --user 1001 name: Build and Deploy Job steps: From e490119bbd67562d226716d8ad85155814249c9a Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 15:48:57 -0600 Subject: [PATCH 06/20] trying adding github info from workflow file --- ...azure-static-web-apps-victorious-flower-0ea52481e.yml | 5 ++--- SBOLCanvasFrontend/git.version.ts | 9 ++++++--- SBOLCanvasFrontend/package.json | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml index 382825e8..d7710125 100644 --- a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml +++ b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml @@ -17,15 +17,14 @@ jobs: build_and_deploy_job: if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') runs-on: ubuntu-latest - container: - image: ubuntu:latest - options: --user 1001 name: Build and Deploy Job steps: - uses: actions/checkout@v3 with: submodules: true lfs: false + - name: Write version file + run: npm run gitversion -- ${{ github.sha }} ${{ github.head_ref }} - name: Build And Deploy id: builddeploy uses: Azure/static-web-apps-deploy@v1 diff --git a/SBOLCanvasFrontend/git.version.ts b/SBOLCanvasFrontend/git.version.ts index f4941f14..81f72322 100644 --- a/SBOLCanvasFrontend/git.version.ts +++ b/SBOLCanvasFrontend/git.version.ts @@ -5,9 +5,12 @@ import * as child from 'child_process'; const exec = promisify(child.exec); async function createVersionsFile(filename: string) { - const revision = (await exec('git rev-parse --short HEAD')).stdout.toString().trim(); - const branch = (await exec('git rev-parse --abbrev-ref HEAD')).stdout.toString().trim(); - let version = (await exec('git tag --points-at HEAD')).stdout.toString().trim(); + const revision = process.argv[2] + ?? (await exec('git rev-parse --short HEAD')).stdout.toString().trim(); + const branch = process.argv[3] + ??(await exec('git rev-parse --abbrev-ref HEAD')).stdout.toString().trim(); + let version = process.env.npm_package_version + ?? (await exec('git tag --points-at HEAD')).stdout.toString().trim(); if(version == ''){ version = 'Latest'; diff --git a/SBOLCanvasFrontend/package.json b/SBOLCanvasFrontend/package.json index 088a2a05..d4bbee73 100644 --- a/SBOLCanvasFrontend/package.json +++ b/SBOLCanvasFrontend/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "scripts": { "bundle-report": "ng build --configuration production --stats-json && webpack-bundle-analyzer dist/SBOLCanvasFrontend/stats.json", - "prebuild": "npm rebuild sass && node assetBundler.js && bash ./write-version-file.sh", + "prebuild": "npm rebuild sass && node assetBundler.js", "build": "ng build --configuration production --base-href=/canvas/", "predev": "npm run prebuild", "dev": "ng serve -o", From b31c5e854e18ebe766dfa041818b73704bdd3039 Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 15:50:26 -0600 Subject: [PATCH 07/20] change dir in version file command --- .../azure-static-web-apps-victorious-flower-0ea52481e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml index d7710125..5bed304b 100644 --- a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml +++ b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml @@ -24,7 +24,7 @@ jobs: submodules: true lfs: false - name: Write version file - run: npm run gitversion -- ${{ github.sha }} ${{ github.head_ref }} + run: cd SBOLCanvasFrontend && npm run gitversion -- ${{ github.sha }} ${{ github.head_ref }} - name: Build And Deploy id: builddeploy uses: Azure/static-web-apps-deploy@v1 From e5fd6921a818cd91096edf5607382543409a6baa Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 15:53:15 -0600 Subject: [PATCH 08/20] changed version gen file to regular js file --- .../{git.version.ts => git.version.js} | 21 +++++++++---------- SBOLCanvasFrontend/package.json | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) rename SBOLCanvasFrontend/{git.version.ts => git.version.js} (54%) diff --git a/SBOLCanvasFrontend/git.version.ts b/SBOLCanvasFrontend/git.version.js similarity index 54% rename from SBOLCanvasFrontend/git.version.ts rename to SBOLCanvasFrontend/git.version.js index 81f72322..5081b70d 100644 --- a/SBOLCanvasFrontend/git.version.ts +++ b/SBOLCanvasFrontend/git.version.js @@ -1,10 +1,9 @@ import { writeFileSync } from 'fs'; -import { dedent } from 'tslint/lib/utils'; import { promisify } from 'util'; import * as child from 'child_process'; const exec = promisify(child.exec); -async function createVersionsFile(filename: string) { +async function createVersionsFile(filename) { const revision = process.argv[2] ?? (await exec('git rev-parse --short HEAD')).stdout.toString().trim(); const branch = process.argv[3] @@ -16,17 +15,17 @@ async function createVersionsFile(filename: string) { version = 'Latest'; } - console.log(`version: '${process.env.npm_package_version}', revision: '${revision}', branch: '${branch}', version: '${version}'`); + console.log(`revision: '${revision}', branch: '${branch}', version: '${version}'`); - const content = dedent` - // this file is automatically generated by git.version.ts script - export const versions = { - revision: '${revision}', - branch: '${branch}', - version: '${version}' - };`; + const content = ` +// this file is automatically generated by git.version.ts script +export const versions = { + revision: '${revision}', + branch: '${branch}', + version: '${version}' +};`; writeFileSync(filename, content, {encoding: 'utf8'}); } -createVersionsFile('src/environments/versions.ts'); \ No newline at end of file +await createVersionsFile('src/environments/versions.ts'); \ No newline at end of file diff --git a/SBOLCanvasFrontend/package.json b/SBOLCanvasFrontend/package.json index d4bbee73..2fc25be4 100644 --- a/SBOLCanvasFrontend/package.json +++ b/SBOLCanvasFrontend/package.json @@ -7,7 +7,7 @@ "build": "ng build --configuration production --base-href=/canvas/", "predev": "npm run prebuild", "dev": "ng serve -o", - "gitversion": "ts-node -O \"{\\\"module\\\":\\\"commonjs\\\"}\" git.version.ts", + "gitversion": "node git.version.js", "postinstall": "patch-package" }, "private": true, From 1f1c1d34a5ede464374a68ef482171456ab4909b Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 15:55:45 -0600 Subject: [PATCH 09/20] changed to commonjs --- SBOLCanvasFrontend/git.version.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/SBOLCanvasFrontend/git.version.js b/SBOLCanvasFrontend/git.version.js index 5081b70d..6340e0f8 100644 --- a/SBOLCanvasFrontend/git.version.js +++ b/SBOLCanvasFrontend/git.version.js @@ -1,31 +1,31 @@ -import { writeFileSync } from 'fs'; -import { promisify } from 'util'; -import * as child from 'child_process'; +const { writeFileSync } = require('fs'); +const { promisify } = require('util'); +const child = require('child_process'); const exec = promisify(child.exec); async function createVersionsFile(filename) { const revision = process.argv[2] ?? (await exec('git rev-parse --short HEAD')).stdout.toString().trim(); const branch = process.argv[3] - ??(await exec('git rev-parse --abbrev-ref HEAD')).stdout.toString().trim(); + ?? (await exec('git rev-parse --abbrev-ref HEAD')).stdout.toString().trim(); let version = process.env.npm_package_version ?? (await exec('git tag --points-at HEAD')).stdout.toString().trim(); - if(version == ''){ + if (version == '') { version = 'Latest'; } console.log(`revision: '${revision}', branch: '${branch}', version: '${version}'`); const content = ` -// this file is automatically generated by git.version.ts script -export const versions = { +// this file is automatically generated by git.version.js script +exports.versions = { revision: '${revision}', branch: '${branch}', version: '${version}' };`; - writeFileSync(filename, content, {encoding: 'utf8'}); + writeFileSync(filename, content, { encoding: 'utf8' }); } -await createVersionsFile('src/environments/versions.ts'); \ No newline at end of file +createVersionsFile('src/environments/versions.js'); From 95da14a99b7e4886f06a574496873a274a224f9a Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 15:59:42 -0600 Subject: [PATCH 10/20] remove bash script --- SBOLCanvasFrontend/write-version-file.sh | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 SBOLCanvasFrontend/write-version-file.sh diff --git a/SBOLCanvasFrontend/write-version-file.sh b/SBOLCanvasFrontend/write-version-file.sh deleted file mode 100644 index cdb34d70..00000000 --- a/SBOLCanvasFrontend/write-version-file.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -git config --global --add safe.directory "$(pwd)" -git config --system --add safe.directory "$(pwd)" -git_hash=$(git rev-parse --short "$GITHUB_SHA") -git_branch=${GITHUB_REF#refs/heads/} - -apt-get install jq -version=$(jq -r '.version' package.json) - -file_contents=$(cat < src/environments/versions.ts \ No newline at end of file From 2fca9141b4161d0d9ee9b577ad4230ebc1e2fc75 Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 16:00:07 -0600 Subject: [PATCH 11/20] added output location --- .../azure-static-web-apps-victorious-flower-0ea52481e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml index 5bed304b..068ce093 100644 --- a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml +++ b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml @@ -36,7 +36,7 @@ jobs: # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig app_location: "./SBOLCanvasFrontend" # App source code path api_location: "" # Api source code path - optional - output_location: "{angular.json#Object.values(data.projects)[0].architect.build.options.outputPath}" # Built app content directory - optional + output_location: "dist" # Built app content directory - optional ###### End of Repository/Build Configurations ###### close_pull_request_job: From 4902ff5dfed370c0442befb16e66136c22325ef4 Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 16:10:38 -0600 Subject: [PATCH 12/20] added some logging --- SBOLCanvasFrontend/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/SBOLCanvasFrontend/package.json b/SBOLCanvasFrontend/package.json index 2fc25be4..79389d78 100644 --- a/SBOLCanvasFrontend/package.json +++ b/SBOLCanvasFrontend/package.json @@ -5,6 +5,7 @@ "bundle-report": "ng build --configuration production --stats-json && webpack-bundle-analyzer dist/SBOLCanvasFrontend/stats.json", "prebuild": "npm rebuild sass && node assetBundler.js", "build": "ng build --configuration production --base-href=/canvas/", + "postbuild": "ls -la dist", "predev": "npm run prebuild", "dev": "ng serve -o", "gitversion": "node git.version.js", From b74eb42403aa91a23e73350c8bcda8f6625cd962 Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 16:14:14 -0600 Subject: [PATCH 13/20] fixed output folder --- .../azure-static-web-apps-victorious-flower-0ea52481e.yml | 2 +- SBOLCanvasFrontend/package.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml index 068ce093..1cd1a87c 100644 --- a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml +++ b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml @@ -36,7 +36,7 @@ jobs: # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig app_location: "./SBOLCanvasFrontend" # App source code path api_location: "" # Api source code path - optional - output_location: "dist" # Built app content directory - optional + output_location: "dist/browser" # Built app content directory - optional ###### End of Repository/Build Configurations ###### close_pull_request_job: diff --git a/SBOLCanvasFrontend/package.json b/SBOLCanvasFrontend/package.json index 79389d78..2fc25be4 100644 --- a/SBOLCanvasFrontend/package.json +++ b/SBOLCanvasFrontend/package.json @@ -5,7 +5,6 @@ "bundle-report": "ng build --configuration production --stats-json && webpack-bundle-analyzer dist/SBOLCanvasFrontend/stats.json", "prebuild": "npm rebuild sass && node assetBundler.js", "build": "ng build --configuration production --base-href=/canvas/", - "postbuild": "ls -la dist", "predev": "npm run prebuild", "dev": "ng serve -o", "gitversion": "node git.version.js", From af23eed0150310f01575528167b88568ea4e8056 Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 17:06:18 -0600 Subject: [PATCH 14/20] removed baseurl --- SBOLCanvasFrontend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SBOLCanvasFrontend/package.json b/SBOLCanvasFrontend/package.json index 2fc25be4..58819789 100644 --- a/SBOLCanvasFrontend/package.json +++ b/SBOLCanvasFrontend/package.json @@ -4,7 +4,7 @@ "scripts": { "bundle-report": "ng build --configuration production --stats-json && webpack-bundle-analyzer dist/SBOLCanvasFrontend/stats.json", "prebuild": "npm rebuild sass && node assetBundler.js", - "build": "ng build --configuration production --base-href=/canvas/", + "build": "ng build --configuration production", "predev": "npm run prebuild", "dev": "ng serve -o", "gitversion": "node git.version.js", From f81c0d8555d6e231237f21031d3c6a916d55b750 Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 17:07:12 -0600 Subject: [PATCH 15/20] added check for env variable for backend url --- SBOLCanvasFrontend/src/environments/environment.prod.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SBOLCanvasFrontend/src/environments/environment.prod.ts b/SBOLCanvasFrontend/src/environments/environment.prod.ts index d3809ef9..1eafe9f6 100644 --- a/SBOLCanvasFrontend/src/environments/environment.prod.ts +++ b/SBOLCanvasFrontend/src/environments/environment.prod.ts @@ -1,5 +1,5 @@ export const environment = { production: true, - backendURL: '/api', + backendURL: process.env.CANVAS_BACKEND_URL || '/api', baseURI: "https://sbolcanvas.org" }; From 1cda80ff20ff5f76fb4a576a7b44e697ed6eca7c Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 17:10:55 -0600 Subject: [PATCH 16/20] testing api usage in github action --- .../azure-static-web-apps-victorious-flower-0ea52481e.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml index 1cd1a87c..e5c963fd 100644 --- a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml +++ b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml @@ -28,6 +28,8 @@ jobs: - name: Build And Deploy id: builddeploy uses: Azure/static-web-apps-deploy@v1 + env: + CANVAS_BACKEND_URL: "https://canvas-api.greensky-6cc75ee4.westus.azurecontainerapps.io/api" with: azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_DEPLOYMENT_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) From 661d37cd03200c9958adabe80fb8c380eeda746b Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 17:20:07 -0600 Subject: [PATCH 17/20] added correct environment --- .../azure-static-web-apps-victorious-flower-0ea52481e.yml | 2 -- SBOLCanvasFrontend/src/environments/environment.prod.ts | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml index e5c963fd..1cd1a87c 100644 --- a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml +++ b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml @@ -28,8 +28,6 @@ jobs: - name: Build And Deploy id: builddeploy uses: Azure/static-web-apps-deploy@v1 - env: - CANVAS_BACKEND_URL: "https://canvas-api.greensky-6cc75ee4.westus.azurecontainerapps.io/api" with: azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_DEPLOYMENT_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) diff --git a/SBOLCanvasFrontend/src/environments/environment.prod.ts b/SBOLCanvasFrontend/src/environments/environment.prod.ts index 1eafe9f6..9208a92b 100644 --- a/SBOLCanvasFrontend/src/environments/environment.prod.ts +++ b/SBOLCanvasFrontend/src/environments/environment.prod.ts @@ -1,5 +1,5 @@ export const environment = { production: true, - backendURL: process.env.CANVAS_BACKEND_URL || '/api', + backendURL: "https://sbolcanvas-api.victoriouswater-326a4bf8.westcentralus.azurecontainerapps.io/api", baseURI: "https://sbolcanvas.org" }; From 88521678bff6b43189c03511ae22652e3641a2c5 Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 17:29:58 -0600 Subject: [PATCH 18/20] added split environment --- .../azure-static-web-apps-victorious-flower-0ea52481e.yml | 1 + Dockerfile | 2 +- SBOLCanvasFrontend/angular.json | 3 +++ SBOLCanvasFrontend/package.json | 2 +- SBOLCanvasFrontend/src/environments/environment.prod.ts | 2 +- SBOLCanvasFrontend/src/environments/environment.split.ts | 5 +++++ 6 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 SBOLCanvasFrontend/src/environments/environment.split.ts diff --git a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml index 1cd1a87c..601c61f5 100644 --- a/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml +++ b/.github/workflows/azure-static-web-apps-victorious-flower-0ea52481e.yml @@ -35,6 +35,7 @@ jobs: ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig app_location: "./SBOLCanvasFrontend" # App source code path + app_build_command: "npm run build -- --configuration split" api_location: "" # Api source code path - optional output_location: "dist/browser" # Built app content directory - optional ###### End of Repository/Build Configurations ###### diff --git a/Dockerfile b/Dockerfile index a22be12d..8a7d8e7e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ WORKDIR /opt/canvas/SBOLCanvasFrontend RUN npm install RUN npm run gitversion -RUN npm run build +RUN npm run build -- --configuration production # RUN npm run debug-build diff --git a/SBOLCanvasFrontend/angular.json b/SBOLCanvasFrontend/angular.json index 2b4445aa..63bb4642 100644 --- a/SBOLCanvasFrontend/angular.json +++ b/SBOLCanvasFrontend/angular.json @@ -74,6 +74,9 @@ "maximumError": "5mb" } ] + }, + "split": { + "sourceMap": true } } }, diff --git a/SBOLCanvasFrontend/package.json b/SBOLCanvasFrontend/package.json index 58819789..b85c9be6 100644 --- a/SBOLCanvasFrontend/package.json +++ b/SBOLCanvasFrontend/package.json @@ -4,7 +4,7 @@ "scripts": { "bundle-report": "ng build --configuration production --stats-json && webpack-bundle-analyzer dist/SBOLCanvasFrontend/stats.json", "prebuild": "npm rebuild sass && node assetBundler.js", - "build": "ng build --configuration production", + "build": "ng build", "predev": "npm run prebuild", "dev": "ng serve -o", "gitversion": "node git.version.js", diff --git a/SBOLCanvasFrontend/src/environments/environment.prod.ts b/SBOLCanvasFrontend/src/environments/environment.prod.ts index 9208a92b..3d6df713 100644 --- a/SBOLCanvasFrontend/src/environments/environment.prod.ts +++ b/SBOLCanvasFrontend/src/environments/environment.prod.ts @@ -1,5 +1,5 @@ export const environment = { production: true, - backendURL: "https://sbolcanvas-api.victoriouswater-326a4bf8.westcentralus.azurecontainerapps.io/api", + backendURL: "/api", baseURI: "https://sbolcanvas.org" }; diff --git a/SBOLCanvasFrontend/src/environments/environment.split.ts b/SBOLCanvasFrontend/src/environments/environment.split.ts new file mode 100644 index 00000000..43b4920a --- /dev/null +++ b/SBOLCanvasFrontend/src/environments/environment.split.ts @@ -0,0 +1,5 @@ +export const environment = { + production: false, + backendURL: "https://sbolcanvas-api.victoriouswater-326a4bf8.westcentralus.azurecontainerapps.io/api", + baseURI: "https://sbolcanvas.org" +}; From 5b8eb29b24a22667fb26903228542c22d35476ea Mon Sep 17 00:00:00 2001 From: Zach Sents Date: Thu, 24 Oct 2024 17:35:39 -0600 Subject: [PATCH 19/20] added file replacement for split environemnt --- SBOLCanvasFrontend/angular.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SBOLCanvasFrontend/angular.json b/SBOLCanvasFrontend/angular.json index 63bb4642..015d4ac0 100644 --- a/SBOLCanvasFrontend/angular.json +++ b/SBOLCanvasFrontend/angular.json @@ -76,6 +76,12 @@ ] }, "split": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.split.ts" + } + ], "sourceMap": true } } From c688b990df231c4c483d39c0bec1ed6586aeb5ea Mon Sep 17 00:00:00 2001 From: Chris Myers Date: Sat, 26 Oct 2024 19:32:39 -0600 Subject: [PATCH 20/20] Restore --base-href=/canvas/ --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8a7d8e7e..94cc5aac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ WORKDIR /opt/canvas/SBOLCanvasFrontend RUN npm install RUN npm run gitversion -RUN npm run build -- --configuration production +RUN npm run build -- --configuration production --base-href=/canvas/ # RUN npm run debug-build