diff --git a/.eslintignore b/.eslintignore index e4163d65..2f6730c1 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,2 @@ /src/generated/ +webpack.config.js diff --git a/.github/workflows/azure-static-web-apps-deploy.yml b/.github/workflows/azure-static-web-apps-deploy.yml index 3ad3422e..d0c56e84 100644 --- a/.github/workflows/azure-static-web-apps-deploy.yml +++ b/.github/workflows/azure-static-web-apps-deploy.yml @@ -14,6 +14,8 @@ jobs: if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') runs-on: ubuntu-latest name: Build and deploy + env: + URL_PROD: "https://lively-ground-0d7c50410-${{github.event.number}}.centralus.azurestaticapps.net" steps: - name: Checkout @@ -31,6 +33,7 @@ jobs: app_location: "/" # Built app content directory output_location: "dist" + app_build_command: "npm run build -- --env URL_PROD=$URL_PROD" cleanup_pull_request: if: github.event_name == 'pull_request' && github.event.action == 'closed' @@ -43,3 +46,17 @@ jobs: with: azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} action: "close" + + add-pr-comment: + needs: build_and_deploy + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - uses: mshick/add-pr-comment@v1 + with: + message: | + https://lively-ground-0d7c50410-${{github.event.number}}.centralus.azurestaticapps.net/manifest.prod.xml + repo-token: ${{ secrets.GITHUB_TOKEN }} + repo-token-user-login: "github-actions[bot]" # The user.login for temporary GitHub tokens + allow-repeats: false # Don't comment the same URL twice diff --git a/.github/workflows/comment-bot.yml b/.github/workflows/comment-bot.yml new file mode 100644 index 00000000..40ceff81 --- /dev/null +++ b/.github/workflows/comment-bot.yml @@ -0,0 +1,24 @@ +# name: Comment Manifest Url + +# on: +# push: +# branches: +# - main +# pull_request: +# types: [opened] +# branches: +# - main + +# jobs: +# test: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout +# uses: actions/checkout@v2 +# - uses: mshick/add-pr-comment@v1 +# with: +# message: | +# https://lively-ground-0d7c50410-${{github.event.number}}.centralus.azurestaticapps.net/manifest.prod.xml +# repo-token: ${{ secrets.GITHUB_TOKEN }} +# repo-token-user-login: "github-actions[bot]" # The user.login for temporary GitHub tokens +# allow-repeats: false # Don't comment the same URL twice diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 2138d502..1a3ba278 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -5,7 +5,6 @@ // List of extensions which should be recommended for users of this workspace. "recommendations": [ "msjsdiag.debugger-for-chrome", - "msjsdiag.debugger-for-edge", "msoffice.microsoft-office-add-in-debugger", "dbaeumer.vscode-eslint", "esbenp.prettier-vscode" diff --git a/webpack.config.js b/webpack.config.js index e395135b..a41442d2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -6,11 +6,10 @@ const HtmlWebpackPlugin = require("html-webpack-plugin"); const webpack = require("webpack"); var dotenv = require("dotenv").config({ path: __dirname + "/.env" }); -const urlDev = "https://localhost:3000/"; -const urlProd = "https://www.contoso.com/"; // CHANGE THIS TO YOUR PRODUCTION DEPLOYMENT LOCATION - module.exports = async (env, options) => { const dev = options.mode === "development"; + const urlDev = process.env.urlDev || "https://localhost:3000"; + const urlProd = env.URL_PROD || "https://www.contoso.com"; const buildType = dev ? "dev" : "prod"; const config = { devtool: "source-map", @@ -58,6 +57,10 @@ module.exports = async (env, options) => { to: "taskpane.css", from: "./src/taskpane/taskpane.css", }, + { + from: "./assets", + to: "assets", + }, { to: "[name]." + buildType + ".[ext]", from: "manifest*.xml", @@ -65,7 +68,9 @@ module.exports = async (env, options) => { if (dev) { return content; } else { - return content.toString().replace(new RegExp(urlDev, "g"), urlProd); + return content + .toString() + .replace(new RegExp(urlDev, "g"), urlProd); } }, }, @@ -105,7 +110,7 @@ module.exports = async (env, options) => { ? options.https : await devCerts.getHttpsServerOptions(), port: process.env.npm_package_config_dev_server_port || 3000, - } + }; } return config;