diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml new file mode 100644 index 00000000000..d10c5244d79 --- /dev/null +++ b/.github/actions/build/action.yml @@ -0,0 +1,16 @@ +name: 'Install, build & cache' +description: 'Installs dependencies, builds all packages, and saves the cache of Nx' +runs: + using: composite + steps: + - uses: ./.github/actions/setup + with: + load-cache: 'false' + - uses: actions/cache@v3 + id: nx-cache + with: + path: node_modules/.cache/nx + key: nx-${{ github.sha }} + - if: steps.nx-cache.outputs.cache-hit != 'true' + run: npm run build + shell: bash diff --git a/.github/actions/e2e-atomic-angular/action.yml b/.github/actions/e2e-atomic-angular/action.yml index 95aac893ace..34658ac5e61 100644 --- a/.github/actions/e2e-atomic-angular/action.yml +++ b/.github/actions/e2e-atomic-angular/action.yml @@ -16,9 +16,8 @@ runs: name: Run Cypress with: browser: chrome - command-prefix: 'npx cypress-repeat run -n 3 --until-passes --rerun-failed-only --' - working-directory: ./packages/samples/angular - start: npm run dev + command-prefix: 'npx -w @coveo/atomic-angular-samples cypress-repeat run -n 3 --until-passes --rerun-failed-only --' + start: npx nx run atomic-angular-samples:dev wait-on: 'http://localhost:4200' install: false record: false diff --git a/.github/actions/e2e-atomic-hosted-page/action.yml b/.github/actions/e2e-atomic-hosted-page/action.yml index 90cdac13646..c4839c46f61 100644 --- a/.github/actions/e2e-atomic-hosted-page/action.yml +++ b/.github/actions/e2e-atomic-hosted-page/action.yml @@ -12,9 +12,8 @@ runs: name: Run Cypress with: browser: chrome - command-prefix: 'npx cypress-repeat run -n 3 --until-passes --rerun-failed-only --' - working-directory: ./packages/atomic-hosted-page - start: npm run dev + command-prefix: 'npx -w @coveo/atomic-hosted-page cypress-repeat run -n 3 --until-passes --rerun-failed-only --' + start: npx nx run atomic-hosted-page:dev wait-on: 'http://localhost:3335' install: false record: false diff --git a/.github/actions/e2e-atomic-insight-panel/action.yml b/.github/actions/e2e-atomic-insight-panel/action.yml index c964d9bdc3e..904776725f8 100644 --- a/.github/actions/e2e-atomic-insight-panel/action.yml +++ b/.github/actions/e2e-atomic-insight-panel/action.yml @@ -12,10 +12,9 @@ runs: name: Run Cypress with: browser: chrome - command-prefix: 'npx cypress-repeat run -n 3 --until-passes --rerun-failed-only --' - working-directory: ./packages/atomic + command-prefix: 'npx -w @coveo/atomic cypress-repeat run -n 3 --until-passes --rerun-failed-only --' config-file: cypress-insight-panel.config.ts - start: npm run prod + start: npx nx run atomic:prod wait-on: 'http://localhost:3333' install: false record: false diff --git a/.github/actions/e2e-atomic-next/action.yml b/.github/actions/e2e-atomic-next/action.yml index 85697f0b693..7e1c5d9da09 100644 --- a/.github/actions/e2e-atomic-next/action.yml +++ b/.github/actions/e2e-atomic-next/action.yml @@ -12,9 +12,8 @@ runs: name: Run Cypress with: browser: chrome - command-prefix: 'npx cypress-repeat run -n 3 --until-passes --rerun-failed-only --' - working-directory: ./packages/samples/atomic-next - start: npm run dev + command-prefix: 'npx -w @coveo/atomic-next-samples cypress-repeat run -n 3 --until-passes --rerun-failed-only --' + start: npx nx run atomic-next-samples:dev wait-on: 'http://localhost:3000' install: false record: false diff --git a/.github/actions/e2e-atomic-react/action.yml b/.github/actions/e2e-atomic-react/action.yml index b343f528128..1a3e58d36a0 100644 --- a/.github/actions/e2e-atomic-react/action.yml +++ b/.github/actions/e2e-atomic-react/action.yml @@ -12,9 +12,8 @@ runs: name: Run Cypress with: browser: chrome - command-prefix: 'npx cypress-repeat run -n 3 --until-passes --rerun-failed-only --' - working-directory: ./packages/samples/atomic-react - start: npm run dev + command-prefix: 'npx -w @coveo/atomic-react-samples cypress-repeat run -n 3 --until-passes --rerun-failed-only --' + start: npx nx run atomic-react-samples:dev wait-on: 'http://localhost:3000' install: false record: false diff --git a/.github/actions/e2e-atomic-screenshots/action.yml b/.github/actions/e2e-atomic-screenshots/action.yml index 3e05fc204cd..cd4606b120e 100644 --- a/.github/actions/e2e-atomic-screenshots/action.yml +++ b/.github/actions/e2e-atomic-screenshots/action.yml @@ -12,10 +12,9 @@ runs: name: Run Cypress with: browser: chrome - command-prefix: 'npx cypress-repeat run -n 3 --until-passes --rerun-failed-only --' - working-directory: ./packages/atomic + command-prefix: 'npx -w @coveo/atomic cypress-repeat run -n 3 --until-passes --rerun-failed-only --' config-file: cypress-screenshots.config.ts - start: npm run prod + start: npx nx run atomic:prod wait-on: 'http://localhost:3333' install: false record: false diff --git a/.github/actions/e2e-atomic/action.yml b/.github/actions/e2e-atomic/action.yml index 54e7d4a4561..76408e74edd 100644 --- a/.github/actions/e2e-atomic/action.yml +++ b/.github/actions/e2e-atomic/action.yml @@ -15,10 +15,9 @@ runs: name: Run Cypress with: browser: chrome - command-prefix: 'npx cypress-repeat run -n 3 --until-passes --rerun-failed-only --' - working-directory: ./packages/atomic + command-prefix: 'npx -w @coveo/atomic cypress-repeat run -n 3 --until-passes --rerun-failed-only --' spec: ${{ inputs.spec }} - start: npm run prod + start: npx nx run atomic:prod wait-on: 'http://localhost:3333' install: false record: false diff --git a/.github/actions/e2e-headless-ssr/action.yml b/.github/actions/e2e-headless-ssr/action.yml index 212f71f433a..11d284d150d 100644 --- a/.github/actions/e2e-headless-ssr/action.yml +++ b/.github/actions/e2e-headless-ssr/action.yml @@ -12,9 +12,8 @@ runs: name: Run Cypress with: browser: chrome - command-prefix: 'npm run e2e' - working-directory: ./packages/samples/headless-ssr - start: npm run prod + command-prefix: 'npm run -w @coveo/headless-ssr-samples e2e' + start: npx nx run headless-ssr-samples:prod wait-on: 'http://localhost:3000' install: false record: false diff --git a/.github/actions/e2e-iife/action.yml b/.github/actions/e2e-iife/action.yml index 0a648543c23..3e4146496ab 100644 --- a/.github/actions/e2e-iife/action.yml +++ b/.github/actions/e2e-iife/action.yml @@ -12,9 +12,8 @@ runs: name: Run Cypress with: browser: chrome - command-prefix: 'npx cypress-repeat run -n 3 --until-passes --rerun-failed-only --' - working-directory: ./packages/samples/iife - start: npm run prod + command-prefix: 'npx -w @coveo/iife-samples cypress-repeat run -n 3 --until-passes --rerun-failed-only --' + start: npx nx run iife-samples:prod wait-on: 'http://localhost:3000' install: false record: false diff --git a/.github/actions/e2e-quantic-setup/action.yml b/.github/actions/e2e-quantic-setup/action.yml index 902f0aa1e86..61eecd61026 100644 --- a/.github/actions/e2e-quantic-setup/action.yml +++ b/.github/actions/e2e-quantic-setup/action.yml @@ -10,6 +10,8 @@ inputs: runs: using: composite steps: + - run: npx nx run quantic:build + shell: bash - run: | echo "${{ env.SFDX_AUTH_JWT_KEY }}" > server.key npx --no-install sfdx force:auth:jwt:grant \ diff --git a/.github/actions/e2e-stencil/action.yml b/.github/actions/e2e-stencil/action.yml index 064162bda36..1019a602d2e 100644 --- a/.github/actions/e2e-stencil/action.yml +++ b/.github/actions/e2e-stencil/action.yml @@ -12,9 +12,8 @@ runs: name: Run Cypress with: browser: chrome - command-prefix: 'npx cypress-repeat run -n 3 --until-passes --rerun-failed-only --' - working-directory: ./packages/samples/stencil - start: npm run dev + command-prefix: 'npx -w @coveo/atomic-stencil-samples cypress-repeat run -n 3 --until-passes --rerun-failed-only --' + start: npx nx run atomic-stencil-samples:dev wait-on: 'http://localhost:3666' install: false record: false diff --git a/.github/actions/e2e-vuejs/action.yml b/.github/actions/e2e-vuejs/action.yml index 6e86e7d5569..ca3fd205cec 100644 --- a/.github/actions/e2e-vuejs/action.yml +++ b/.github/actions/e2e-vuejs/action.yml @@ -12,9 +12,8 @@ runs: name: Run Cypress with: browser: chrome - command-prefix: 'npx cypress-repeat run -n 3 --until-passes --rerun-failed-only --' - working-directory: ./packages/samples/vuejs - start: npm run dev + command-prefix: 'npx -w @coveo/atomic-vuejs-samples cypress-repeat run -n 3 --until-passes --rerun-failed-only --' + start: npx nx run atomic-vuejs-samples:dev wait-on: 'http://localhost:8080' install: false record: false diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 0bd3bda2952..3b6a6bc91cd 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -1,51 +1,43 @@ name: 'Setup & build' description: 'Setup node, install dependencies & build' +inputs: + load-cache: + description: "Whether to restore the Nx cache." + required: false + default: 'true' runs: using: composite steps: - uses: actions/setup-node@v3 with: node-version-file: '.nvmrc' + - name: Ensure Nx cache can be shared between different CI environments # Source: https://nx.dev/recipes/troubleshooting/unknown-local-cache + run: echo "NX_REJECT_UNKNOWN_LOCAL_CACHE=0" >> $GITHUB_ENV + shell: bash - name: Install npm run: npm i -g npm@9 shell: bash - uses: actions/cache@v3 - id: build-cache + id: npm-cache with: path: | - packages/bueno/dist - packages/headless/dist - packages/auth/dist - packages/atomic/dist - packages/atomic/docs - packages/atomic/loader - packages/atomic/www - packages/atomic/src/components/search/atomic-search-interface/lang/ - packages/atomic/src/external-builds/ - packages/atomic/src/generated/ - packages/quantic/docs/out - packages/atomic-react/dist - packages/atomic-hosted-page/dist - packages/atomic-angular/projects/atomic-angular/dist - packages/samples/headless-react - packages/samples/iife/www/cdn - packages/samples/headless-ssr/.next - packages/quantic/force-app/main/default/staticresources/coveoheadless - packages/quantic/force-app/main/default/staticresources/coveobueno - utils/atomic-storybook/storybook-static - !node_modules - !**/node_modules - key: ${{ github.sha }} - - uses: actions/cache@v3 - with: - path: ~/.npm - key: npm-${{ hashFiles('**/package-lock.json') }} + **/node_modules/ + !node_modules/.cache/nx/ + key: npm-${{ hashFiles('package-lock.json') }}-${{ hashFiles('utils/atomic-storybook/package-lock.json') }} - uses: actions/cache@v3 with: path: ~/.cache/Cypress - key: cy-${{ hashFiles('**/package-lock.json') }} - - run: npm ci + key: cy-${{ hashFiles('package-lock.json') }}-${{ hashFiles('utils/atomic-storybook/package-lock.json') }} + - if: inputs.load-cache == 'true' + uses: actions/cache/restore@v3 + id: nx-cache + with: + path: node_modules/.cache/nx + key: nx-${{ github.sha }} + fail-on-cache-miss: true + - if: steps.npm-cache.outputs.cache-hit != 'true' + run: npm ci shell: bash - - if: steps.build-cache.outputs.cache-hit != 'true' + - if: steps.nx-cache.outputs.cache-hit != 'true' run: npm run build shell: bash diff --git a/.github/workflows/create-quantic-package.yml b/.github/workflows/create-quantic-package.yml index 26239904c5b..d91b872bc79 100644 --- a/.github/workflows/create-quantic-package.yml +++ b/.github/workflows/create-quantic-package.yml @@ -41,7 +41,7 @@ jobs: run_id: context.runId }) - name: Setup - uses: ./.github/actions/setup + uses: ./.github/actions/build - name: Create package version working-directory: ./packages/quantic run: | diff --git a/.github/workflows/masterbot.yml b/.github/workflows/masterbot.yml index 92dcaec7d12..cb797484ece 100644 --- a/.github/workflows/masterbot.yml +++ b/.github/workflows/masterbot.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/setup + - uses: ./.github/actions/build lint-check: name: 'Check with linter' needs: build diff --git a/.github/workflows/prbot.yml b/.github/workflows/prbot.yml index 133007088d8..e463cfdce0b 100644 --- a/.github/workflows/prbot.yml +++ b/.github/workflows/prbot.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/setup + - uses: ./.github/actions/build - uses: ./.github/actions/commit-generated-files lint-check: name: 'Check with linter' diff --git a/internal-docs/scripts-and-tasks.md b/internal-docs/scripts-and-tasks.md index 04cc605508e..85a1d0ba500 100644 --- a/internal-docs/scripts-and-tasks.md +++ b/internal-docs/scripts-and-tasks.md @@ -31,6 +31,79 @@ Some scripts may be nested under other scripts using the colon (`:`) symbol. Thi - Doesn't expect another script from the same project to be run before this script. - If the build fails, exits with an error. +### Caching builds + +When running tasks using [Nx](https://nx.dev/), packages and dependencies are automatically built if needed. To avoid the need to run tasks without Nx, builds are [cached](https://nx.dev/concepts/how-caching-works#how-caching-works) and should only be re-built when their source files are changed. + +By default, when adding new packages, builds aren't cached. In order to make a project's builds cache-able, you should follow these steps: + +1. Create a [`project.json` file](https://nx.dev/recipes/tips-n-tricks/integrated-in-package-based#project.json) at the root of the project. + + - How: + + - You can copy this scaffold (replace all instances of "turtle" with the name of your project): + + ```json + { + "name": "turtle", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "namedInputs": {}, + "targets": { + "cached:build": { + "executor": "nx:run-commands", + "options": { + "commands": [ + "rimraf ./dist", + "mkdir ./dist", + "echo \"hello\" > ./dist/hello.txt", + "cp ./dist/hello.txt ./dist/world.txt" + ], + "parallel": false, + "cwd": "packages/turtle" + } + }, + "build": { + "dependsOn": ["cached:build"], + "executor": "nx:noop" + } + } + } + ``` + +2. In your new `project.json` file, adapt the "cached:build" [task](https://nx.dev/core-features/run-tasks#define-tasks) (tasks are sometimes referred to as "targets") so that it builds your project. + + - Ensure it runs the correct command. + - How: + - A good place to start is by looking at the [`nx:run-commands` executor's documentation](https://nx.dev/packages/nx/executors/run-commands). + - Make sure to prefix commands that come from dependencies with "npx ". + - Do not rename it. + - Why: + - The name of the task must be "cached:build" since Nx only caches tasks whose name is part of the [cacheable operations](https://nx.dev/nx-cloud/reference/config#cacheable-operations). We defined "cached:build" as a cacheable operation in [`nx.json`](/nx.json). + - Define the correct [inputs](https://nx.dev/concepts/more-concepts/customizing-inputs#customizing-inputs-and-named-inputs). + - When: + - If some files which aren't part of the default inputs (defined in [`nx.json`](/nx.json)) and affect the final build output are outside the project's directory. + - If some auto-generated files from a different task or a different project are part of the current directory. + - If you **really** want to be selective about which changes in your project's directory will invalidate their cache. + - How: + - If possible, only customize the `buildInputs` [named inputs](https://nx.dev/concepts/more-concepts/customizing-inputs#customizing-inputs-and-named-inputs). + - The default inputs for build tasks defined in [`nx.json`](/nx.json) uses the `buildInputs` in addition to some other files. + - Input glob patterns should match every file that can affect the final build output. + - Why: + - When a build task is triggered, Nx will verify if any of its inputs was changed. If none of its input was changed, it will skip re-building the package and may load its outputs from the cache. + - Define the correct [outputs](https://nx.dev/concepts/how-caching-works#what-is-cached). + - When: + - If the default outputs defined in [`nx.json`](/nx.json) either don't match every file generated by the task or match some files that aren't generated by the task. + - How: + - The output glob patterns should match all the files generated by the build task, and no more than that. + - You must also copy all these glob patterns to the `negativeBuildOutputs` [named inputs](https://nx.dev/concepts/more-concepts/customizing-inputs#customizing-inputs-and-named-inputs), but prefix them with an exclamation symbol (`!`). + - The default inputs defined in [`nx.json`](/nx.json) won't match files which are also matched in `negativeBuildOutputs`. + - Why: + - After Nx runs your task, it will save every file matched by the output glob patterns. The next time you run the same task, Nx may restore the files it saved. + +3. Replace the `build` script in your `package.json` + - How: + - Simply replace it with `nx build`. + ## `dev` script - Generates all the files needed for a dependent project to run. diff --git a/nx.json b/nx.json index 4cf327f3e46..dffd1ae9954 100644 --- a/nx.json +++ b/nx.json @@ -3,24 +3,61 @@ "default": { "runner": "nx/tasks-runners/default", "options": { - "cacheableOperations": ["cached:build:stencil"] + "cacheableOperations": ["cached:build", "cached:build:stencil"] } } }, "plugins": ["@coveo/nx-plugin"], "namedInputs": { - "sharedGlobals": [{"runtime": "node -v"}], - "sharedTypescriptSources": [ + "sharedGlobals": [ + { + "runtime": "node -v" + } + ], + "commonConfigTypescript": [ "{workspaceRoot}/tsconfig.json", "{projectRoot}/tsconfig.json", - "{projectRoot}/src/**", - "!{projectRoot}/src/**/?(*.)+({{spec.{ts,tsx},spec.{ts,tsx}.snap},{?(*([^.]).)stories.{tsx,css},mdx}})" + "{projectRoot}/tsconfig.*.json" + ], + "commonScripts": [ + "{projectRoot}/.env", + "{projectRoot}/*.m?js", + "{projectRoot}/*.ts", + "{projectRoot}/scripts/**" + ], + "negativeCommonNonProduction": [ + "!{projectRoot}/.eslintrc.json", + "!{projectRoot}/.gitignore", + "!{projectRoot}/.editorconfig", + "!{projectRoot}/.lint-staged.config.js", + "!{projectRoot}/jest.{config,setup}.js", + "!{projectRoot}/cypress.config.ts", + "!{projectRoot}/cypress", + "!{projectRoot}/.vscode", + "!{projectRoot}/*.md", + "!{projectRoot}/*.tsbuildinfo", + "!{projectRoot}/LICENSE", + "!{projectRoot}/**/?(*.)+({{spec.{ts,tsx},spec.{ts,tsx}.snap},{?(*([^.]).)stories.{tsx,css},mdx}})" ], + "negativeBuildOutputs": [ + "!{projectRoot}/dist", + "!{projectRoot}/www", + "!{projectRoot}/temp", + "!{projectRoot}/build", + "!{projectRoot}/.angular", + "!{projectRoot}/.next", + "!{projectRoot}/next-env.d.ts" + ], + "negativeNonBuildOutputs": [], + "buildInputs": ["{projectRoot}/**"], "production": [ "sharedGlobals", - "{projectRoot}/**", - "!{projectRoot}/**/?(*.)+({{spec.{ts,tsx},spec.{ts,tsx}.snap},{?(*([^.]).)stories.{tsx,css},mdx}})", - "!{projectRoot}/{dist,www,temp}/**" + "commonConfigTypescript", + "commonScripts", + "buildInputs", + "negativeNonBuildOutputs", + "negativeBuildOutputs", + "negativeCommonNonProduction" ] }, "targetDefaults": { @@ -28,6 +65,19 @@ "inputs": ["^production", "production"], "dependsOn": ["^build"] }, + "cached:build": { + "inputs": ["^production", "production"], + "outputs": [ + "{projectRoot}/dist", + "{projectRoot}/www", + "{projectRoot}/temp", + "{projectRoot}/build", + "{projectRoot}/.angular", + "{projectRoot}/.next", + "{projectRoot}/next-env.d.ts" + ], + "dependsOn": ["^build"] + }, "dev": { "dependsOn": ["^build"] }, @@ -58,5 +108,6 @@ "dependsOn": ["release:build", "release:phase1"] } }, - "defaultBase": "master" + "defaultBase": "master", + "$schema": "./node_modules/nx/schemas/nx-schema.json" } diff --git a/package-lock.json b/package-lock.json index c52b1f93f66..ccda5d680c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,7 +58,7 @@ "husky": "5.2.0", "jest": "27.5.1", "lint-staged": "13.1.0", - "nx": "15.7.0", + "nx": "16.7.1", "patch-package": "8.0.0", "prettier": "2.7.1", "react": "18.2.0", @@ -5840,13 +5840,6 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/@nrwl/cli": { - "version": "15.7.0", - "license": "MIT", - "dependencies": { - "nx": "15.7.0" - } - }, "node_modules/@nrwl/devkit": { "version": "15.7.0", "license": "MIT", @@ -5888,8 +5881,22 @@ "version": "4.0.0", "license": "ISC" }, - "node_modules/@nrwl/nx-darwin-arm64": { - "version": "15.7.0", + "node_modules/@nrwl/tao": { + "version": "16.7.1", + "resolved": "https://registry.npmjs.org/@nrwl/tao/-/tao-16.7.1.tgz", + "integrity": "sha512-oIjph3gm+FOB8mB2OTfCejQykpY+LGKdrGe5RpO3fBZzrkADHTdRWhaqaxktmGcRRt1AwMBofEv3mH4+VUOa/g==", + "dependencies": { + "nx": "16.7.1", + "tslib": "^2.3.0" + }, + "bin": { + "tao": "index.js" + } + }, + "node_modules/@nx/nx-darwin-arm64": { + "version": "16.7.1", + "resolved": "https://registry.npmjs.org/@nx/nx-darwin-arm64/-/nx-darwin-arm64-16.7.1.tgz", + "integrity": "sha512-g9N0eOYyirOnVZdpzsmby2VX2ovL/QBzjvT5OlLteKE4XmvksgSjQAhQeUUNY772AW6HoIK5MVxS2Jg3PECatQ==", "cpu": [ "arm64" ], @@ -5901,14 +5908,139 @@ "node": ">= 10" } }, - "node_modules/@nrwl/tao": { - "version": "15.7.0", - "license": "MIT", - "dependencies": { - "nx": "15.7.0" - }, - "bin": { - "tao": "index.js" + "node_modules/@nx/nx-darwin-x64": { + "version": "16.7.1", + "resolved": "https://registry.npmjs.org/@nx/nx-darwin-x64/-/nx-darwin-x64-16.7.1.tgz", + "integrity": "sha512-ZoV4J4pR6z7YtBJoxrdNJTYJmjY653iA2M31PZL/WaS/3SHfzf4YYsnbLK5sF6GJI9n0XmOh3mPPHoJMYbQPIQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nx/nx-freebsd-x64": { + "version": "16.7.1", + "resolved": "https://registry.npmjs.org/@nx/nx-freebsd-x64/-/nx-freebsd-x64-16.7.1.tgz", + "integrity": "sha512-vpAi4FHtNwcBIjkRf86Oa98r09oN5OirCXT7cInvwCZWRMVUxT5WHs6gEMY1lvMlnTWqAVdWPcec5VipI9EhQA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nx/nx-linux-arm-gnueabihf": { + "version": "16.7.1", + "resolved": "https://registry.npmjs.org/@nx/nx-linux-arm-gnueabihf/-/nx-linux-arm-gnueabihf-16.7.1.tgz", + "integrity": "sha512-In9qaTpUPsle1jf20lBV/c0WrfSo4Qy64OleweZwIea3RW1TsQg4xxORoULtkU+6KB85XOb5Xd5G/zXpLRMykw==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nx/nx-linux-arm64-gnu": { + "version": "16.7.1", + "resolved": "https://registry.npmjs.org/@nx/nx-linux-arm64-gnu/-/nx-linux-arm64-gnu-16.7.1.tgz", + "integrity": "sha512-+RXFQqGl5SLrcFl0zKAZOZ4pgA3yhXZnI2xYnuhlPOvuNT4Flc6cdPPz12uKhkWIg0nEBnbvsLDyD1PXDNxKJg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nx/nx-linux-arm64-musl": { + "version": "16.7.1", + "resolved": "https://registry.npmjs.org/@nx/nx-linux-arm64-musl/-/nx-linux-arm64-musl-16.7.1.tgz", + "integrity": "sha512-DiJ6Vpq9w2vaE9JgQs9M7K04QF75jAcqpuSlo25TYGU/GLiSZM6QpiAzsXhwZwFHfUjv0mL3iTmAcBmO1z9PBw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nx/nx-linux-x64-gnu": { + "version": "16.7.1", + "resolved": "https://registry.npmjs.org/@nx/nx-linux-x64-gnu/-/nx-linux-x64-gnu-16.7.1.tgz", + "integrity": "sha512-fc/2whXm4ao91LFQ5++2rgYeTIitQKXkfTrHLKLuMynou2Qd+jMUZVcVk+avaHVPKKu6ALbCUQ0YSTGdEfEx3Q==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nx/nx-linux-x64-musl": { + "version": "16.7.1", + "resolved": "https://registry.npmjs.org/@nx/nx-linux-x64-musl/-/nx-linux-x64-musl-16.7.1.tgz", + "integrity": "sha512-3CzyUg5+/q83g/Pln71HPdkfjpU3dIBriiyuvJan8LwjKuhAdTFubAmu3CUp3ht1gZOdnwBQW1cdG1vx9EuBww==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nx/nx-win32-arm64-msvc": { + "version": "16.7.1", + "resolved": "https://registry.npmjs.org/@nx/nx-win32-arm64-msvc/-/nx-win32-arm64-msvc-16.7.1.tgz", + "integrity": "sha512-1uhQGwWEa76jQyEVohcB4g4H5Wn4YNLx49eJe1SHLwMgbPZZZ5PgnSzwECu+I9E/ZCRaCJk2sHiuRGxDa29Dzg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nx/nx-win32-x64-msvc": { + "version": "16.7.1", + "resolved": "https://registry.npmjs.org/@nx/nx-win32-x64-msvc/-/nx-win32-x64-msvc-16.7.1.tgz", + "integrity": "sha512-DLyME4yJKVhNTMgR3gDx7wVQ6ov6d9j2inGbTwoGoigMvzdaSqeoceMR5CSLOAeq9YBnH8FCbugTccg0iyZtvw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" } }, "node_modules/@octokit/app": { @@ -10974,8 +11106,9 @@ "license": "BSD-2-Clause" }, "node_modules/@yarnpkg/parsers": { - "version": "3.0.0-rc.44", - "license": "BSD-2-Clause", + "version": "3.0.0-rc.46", + "resolved": "https://registry.npmjs.org/@yarnpkg/parsers/-/parsers-3.0.0-rc.46.tgz", + "integrity": "sha512-aiATs7pSutzda/rq8fnuPwTglyVwjM22bNnK2ZgjrpAjQHSSl3lztd2f9evst1W/qnC58DRz7T7QndUDumAR4Q==", "dependencies": { "js-yaml": "^3.10.0", "tslib": "^2.4.0" @@ -10986,7 +11119,8 @@ }, "node_modules/@yarnpkg/parsers/node_modules/js-yaml": { "version": "3.14.1", - "license": "MIT", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -26130,6 +26264,11 @@ "version": "0.4.0", "license": "MIT" }, + "node_modules/node-machine-id": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/node-machine-id/-/node-machine-id-1.1.12.tgz", + "integrity": "sha512-QNABxbrPa3qEIfrE6GOJ7BYIuignnJw7iQ2YPbc3Nla1HzRJjXzZOiikfF8m7eAMfichLt3M4VgLOetqgDmgGQ==" + }, "node_modules/node-releases": { "version": "2.0.13", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", @@ -26401,22 +26540,22 @@ "license": "MIT" }, "node_modules/nx": { - "version": "15.7.0", + "version": "16.7.1", + "resolved": "https://registry.npmjs.org/nx/-/nx-16.7.1.tgz", + "integrity": "sha512-WdzUpoyPMjYyIwYyxiNqGc76HTked/5DiAdVPEjL9MbjNZVwtFE+aMmyf+qS6GV64yNBlUrQphABfP3GiCbuSQ==", "hasInstallScript": true, - "license": "MIT", "dependencies": { - "@nrwl/cli": "15.7.0", - "@nrwl/tao": "15.7.0", + "@nrwl/tao": "16.7.1", "@parcel/watcher": "2.0.4", "@yarnpkg/lockfile": "^1.1.0", - "@yarnpkg/parsers": "^3.0.0-rc.18", + "@yarnpkg/parsers": "3.0.0-rc.46", "@zkochan/js-yaml": "0.0.6", "axios": "^1.0.0", "chalk": "^4.1.0", "cli-cursor": "3.1.0", "cli-spinners": "2.6.1", "cliui": "^7.0.2", - "dotenv": "~10.0.0", + "dotenv": "~16.3.1", "enquirer": "~2.3.6", "fast-glob": "3.2.7", "figures": "3.2.0", @@ -26428,9 +26567,10 @@ "jsonc-parser": "3.2.0", "lines-and-columns": "~2.0.3", "minimatch": "3.0.5", + "node-machine-id": "1.1.12", "npm-run-path": "^4.0.1", "open": "^8.4.0", - "semver": "7.3.4", + "semver": "7.5.3", "string-width": "^4.2.3", "strong-log-transformer": "^2.1.0", "tar-stream": "~2.2.0", @@ -26445,15 +26585,16 @@ "nx": "bin/nx.js" }, "optionalDependencies": { - "@nrwl/nx-darwin-arm64": "15.7.0", - "@nrwl/nx-darwin-x64": "15.7.0", - "@nrwl/nx-linux-arm-gnueabihf": "15.7.0", - "@nrwl/nx-linux-arm64-gnu": "15.7.0", - "@nrwl/nx-linux-arm64-musl": "15.7.0", - "@nrwl/nx-linux-x64-gnu": "15.7.0", - "@nrwl/nx-linux-x64-musl": "15.7.0", - "@nrwl/nx-win32-arm64-msvc": "15.7.0", - "@nrwl/nx-win32-x64-msvc": "15.7.0" + "@nx/nx-darwin-arm64": "16.7.1", + "@nx/nx-darwin-x64": "16.7.1", + "@nx/nx-freebsd-x64": "16.7.1", + "@nx/nx-linux-arm-gnueabihf": "16.7.1", + "@nx/nx-linux-arm64-gnu": "16.7.1", + "@nx/nx-linux-arm64-musl": "16.7.1", + "@nx/nx-linux-x64-gnu": "16.7.1", + "@nx/nx-linux-x64-musl": "16.7.1", + "@nx/nx-win32-arm64-msvc": "16.7.1", + "@nx/nx-win32-x64-msvc": "16.7.1" }, "peerDependencies": { "@swc-node/register": "^1.4.2", @@ -26476,6 +26617,17 @@ "concat-map": "0.0.1" } }, + "node_modules/nx/node_modules/dotenv": { + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", + "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/motdotla/dotenv?sponsor=1" + } + }, "node_modules/nx/node_modules/fast-glob": { "version": "3.2.7", "license": "MIT", @@ -26529,7 +26681,8 @@ }, "node_modules/nx/node_modules/lru-cache": { "version": "6.0.0", - "license": "ISC", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dependencies": { "yallist": "^4.0.0" }, @@ -26558,8 +26711,9 @@ } }, "node_modules/nx/node_modules/semver": { - "version": "7.3.4", - "license": "ISC", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==", "dependencies": { "lru-cache": "^6.0.0" }, @@ -26591,7 +26745,8 @@ }, "node_modules/nx/node_modules/yallist": { "version": "4.0.0", - "license": "ISC" + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/nx/node_modules/yargs-parser": { "version": "21.1.1", diff --git a/package.json b/package.json index 8379660a724..9d5510c6cd7 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "postinstall": "husky install && patch-package && nx run-many --target=install:isolated", "reset:install": "git checkout origin/master package-lock.json && npm ci", "clean:install": "rimraf **/node_modules && npm run reset:install", - "dev:atomic": "concurrently \"nx run headless:dev\" \"nx run atomic:dev\"", + "dev:atomic": "concurrently \"npm run -w @coveo/headless dev\" \"npm run -w @coveo/atomic dev\"", "build": "nx run-many --target=build", "test": "nx run-many --target=test", "e2e": "nx run-many --target=e2e", @@ -62,7 +62,7 @@ "husky": "5.2.0", "jest": "27.5.1", "lint-staged": "13.1.0", - "nx": "15.7.0", + "nx": "16.7.1", "patch-package": "8.0.0", "prettier": "2.7.1", "react": "18.2.0", diff --git a/packages/atomic-angular/package.json b/packages/atomic-angular/package.json index 570f0f3c1e6..792f554d80b 100644 --- a/packages/atomic-angular/package.json +++ b/packages/atomic-angular/package.json @@ -4,7 +4,7 @@ "scripts": { "ng": "ng", "dev": "ng serve", - "build": "npm run build:bundles && npm run build:assets", + "build": "nx build", "build:bundles": "ng build", "build:assets": "ncp ../atomic/dist/atomic/assets projects/atomic-angular/dist/assets && ncp ../atomic/dist/atomic/lang projects/atomic-angular/dist/lang" }, diff --git a/packages/atomic-angular/project.json b/packages/atomic-angular/project.json index e76f1c4e6a3..c139febff70 100644 --- a/packages/atomic-angular/project.json +++ b/packages/atomic-angular/project.json @@ -1,6 +1,24 @@ { "name": "atomic-angular-builder", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "namedInputs": { + "negativeBuildOutputs": ["!{projectRoot}/projects/atomic-angular/dist"] + }, "targets": { + "cached:build": { + "outputs": ["{projectRoot}/projects/atomic-angular/dist"], + "dependsOn": ["^build", "clean"], + "executor": "nx:run-commands", + "options": { + "commands": ["npm run build:bundles", "npm run build:assets"], + "parallel": false, + "cwd": "packages/atomic-angular" + } + }, + "build": { + "dependsOn": ["cached:build"], + "executor": "nx:noop" + }, "release:phase1": { "executor": "nx:run-commands", "options": { @@ -11,12 +29,12 @@ "release:phase2": { "executor": "nx:run-commands", "options": { - "parallel": false, "commands": [ "cp ../../../../../.npmrc .", "npm link ../../../../../node_modules/@coveo/release", "npx -p=@coveo/release npm-publish" ], + "parallel": true, "cwd": "packages/atomic-angular/projects/atomic-angular/dist" } } diff --git a/packages/atomic-angular/projects/atomic-angular/project.json b/packages/atomic-angular/projects/atomic-angular/project.json index 2639d27682f..3fdd499c3a8 100644 --- a/packages/atomic-angular/projects/atomic-angular/project.json +++ b/packages/atomic-angular/projects/atomic-angular/project.json @@ -1,5 +1,6 @@ { "name": "atomic-angular", + "$schema": "../../../../node_modules/nx/schemas/project-schema.json", "implicitDependencies": ["atomic-angular-builder"], "targets": { "promote:npm:latest": { diff --git a/packages/atomic-hosted-page/project.json b/packages/atomic-hosted-page/project.json index d1c40081dc1..9bdd15912db 100644 --- a/packages/atomic-hosted-page/project.json +++ b/packages/atomic-hosted-page/project.json @@ -1,9 +1,11 @@ { + "name": "atomic-hosted-page", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "namedInputs": { - "production": [ - "sharedGlobals", - "sharedTypescriptSources", - "{projectRoot}/stencil.config.ts", + "negativeBuildOutputs": [ + "!{projectRoot}/dist", + "!{projectRoot}/www", + "!{projectRoot}/loader", "!{projectRoot}/src/components.d.ts" ] }, diff --git a/packages/atomic-react/package.json b/packages/atomic-react/package.json index 6caa708bfd6..f2e62f53747 100644 --- a/packages/atomic-react/package.json +++ b/packages/atomic-react/package.json @@ -9,7 +9,7 @@ "directory": "packages/atomic-react" }, "scripts": { - "build": "npm run clean && npm run build:bundles && npm run build:assets", + "build": "nx build", "clean": "rimraf -rf dist", "build:bundles:esm": "tsc -p tsconfig.esm.json", "build:bundles:cjs": "tsc -p tsconfig.cjs.json", diff --git a/packages/atomic-react/project.json b/packages/atomic-react/project.json index 0967ef424bc..567787e8dc4 100644 --- a/packages/atomic-react/project.json +++ b/packages/atomic-react/project.json @@ -1 +1,19 @@ -{} +{ + "name": "atomic-react", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "targets": { + "cached:build": { + "dependsOn": ["^build", "clean"], + "executor": "nx:run-commands", + "options": { + "commands": ["npm run build:bundles", "npm run build:assets"], + "parallel": false, + "cwd": "packages/atomic-react" + } + }, + "build": { + "dependsOn": ["cached:build"], + "executor": "nx:noop" + } + } +} diff --git a/packages/atomic/project.json b/packages/atomic/project.json index c4a4b635581..70f93ae6e8f 100644 --- a/packages/atomic/project.json +++ b/packages/atomic/project.json @@ -1,14 +1,20 @@ { + "name": "atomic", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "namedInputs": { - "production": [ - "sharedGlobals", - "sharedTypescriptSources", + "negativeBuildOutputs": [ + "!{projectRoot}/dist", + "!{projectRoot}/www", + "!{projectRoot}/docs", + "!{projectRoot}/loader", + "!{projectRoot}/src/components.d.ts" + ], + "buildInputs": [ "{projectRoot}/stencil.config.ts", "{projectRoot}/collection-manifest.json", "{projectRoot}/tailwind.config.js", "{projectRoot}/svg.transform.js", "{projectRoot}/stencil-plugin/**", - "!{projectRoot}/src/components.d.ts", "!{projectRoot}/src/external-builds/**", "!{projectRoot}/src/generated/**", "!{projectRoot}/src/components/search/atomic-search-interface/lang/**" diff --git a/packages/auth/package.json b/packages/auth/package.json index 7b0a8e36951..51aa0ed0cfd 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -13,7 +13,7 @@ ], "scripts": { "dev": "concurrently \"npm run build:definitions -- -w\" \"npm run build:bundles -- dev\"", - "build": "npm run build:definitions && npm run build:bundles", + "build": "nx build", "test": "jest", "test:watch": "jest --watch --colors --no-cache --silent=false", "build:bundles": "node esbuild.mjs", diff --git a/packages/auth/project.json b/packages/auth/project.json index 0967ef424bc..1b09d50e9f1 100644 --- a/packages/auth/project.json +++ b/packages/auth/project.json @@ -1 +1,18 @@ -{} +{ + "name": "auth", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "targets": { + "cached:build": { + "executor": "nx:run-commands", + "options": { + "commands": ["npm run build:bundles", "npm run build:definitions"], + "parallel": true, + "cwd": "packages/auth" + } + }, + "build": { + "dependsOn": ["cached:build"], + "executor": "nx:noop" + } + } +} diff --git a/packages/bueno/package.json b/packages/bueno/package.json index e84a6a09db6..5c3c4684caa 100644 --- a/packages/bueno/package.json +++ b/packages/bueno/package.json @@ -19,7 +19,7 @@ ], "scripts": { "dev": "concurrently \"npm run build:definitions -- -w\" \"npm run build:bundles -- dev\"", - "build": "npm run build:definitions && npm run build:bundles", + "build": "nx build", "build:bundles": "node esbuild.mjs", "build:definitions": "tsc -d --emitDeclarationOnly --declarationDir dist/definitions", "clean": "rimraf -rf dist/*", diff --git a/packages/bueno/project.json b/packages/bueno/project.json index 0967ef424bc..3584f094f9e 100644 --- a/packages/bueno/project.json +++ b/packages/bueno/project.json @@ -1 +1,18 @@ -{} +{ + "name": "bueno", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "targets": { + "cached:build": { + "executor": "nx:run-commands", + "options": { + "commands": ["npm run build:bundles", "npm run build:definitions"], + "parallel": true, + "cwd": "packages/bueno" + } + }, + "build": { + "dependsOn": ["cached:build"], + "executor": "nx:noop" + } + } +} diff --git a/packages/headless/package.json b/packages/headless/package.json index 971cfa1bebf..0201838fe59 100644 --- a/packages/headless/package.json +++ b/packages/headless/package.json @@ -26,7 +26,7 @@ ], "scripts": { "dev": "concurrently \"npm run build:definitions -- -w\" \"npm run build:bundles -- dev\"", - "build": "npm run build:prod && npm run build:doc", + "build": "nx build", "build:prod": "npm run build:definitions && npm run build:bundles", "build:bundles": "node esbuild.mjs", "build:definitions": "tsc -p src/tsconfig.build.json -d --emitDeclarationOnly --declarationDir dist/definitions", diff --git a/packages/headless/project.json b/packages/headless/project.json index 0967ef424bc..37e9f2db36f 100644 --- a/packages/headless/project.json +++ b/packages/headless/project.json @@ -1 +1,30 @@ -{} +{ + "name": "headless", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "namedInputs": { + "negativeBuildOutputs": [ + "!{projectRoot}/dist", + "!{projectRoot}/temp", + "!{workspaceRoot}/packages/atomic/src/external-builds" + ] + }, + "targets": { + "cached:build": { + "outputs": [ + "{projectRoot}/dist", + "{projectRoot}/temp", + "{workspaceRoot}/packages/atomic/src/external-builds" + ], + "executor": "nx:run-commands", + "options": { + "commands": ["npm run build:prod", "npm run build:doc"], + "parallel": false, + "cwd": "packages/headless" + } + }, + "build": { + "dependsOn": ["cached:build"], + "executor": "nx:noop" + } + } +} diff --git a/packages/quantic/package.json b/packages/quantic/package.json index 5ea2bfd8c3e..5e4dbd332bb 100644 --- a/packages/quantic/package.json +++ b/packages/quantic/package.json @@ -17,7 +17,7 @@ "lint:fix:js": "eslint --fix force-app/main/default/lwc/ && eslint --fix force-app/examples/main/lwc/ && prettier \"force-app/{,**}/*.js\" --write", "lint:fix:apex": "prettier \"force-app/{,**}/*.{cls,trigger}\" --write", "build:staticresources": "node copy-static-resources.js", - "build": "npm run build:staticresources && npm run build:doc", + "build": "nx build", "dev": "npx rimraf .localdevserver && npm run build:staticresources && npm run dev:sfdx", "dev:sfdx": "sfdx force:source:deploy -p force-app/main && sfdx force:lightning:lwc:start --port 3334", "test:unit": "lwc-jest", diff --git a/packages/quantic/project.json b/packages/quantic/project.json index 0ca8eda0dab..b45c15926c1 100644 --- a/packages/quantic/project.json +++ b/packages/quantic/project.json @@ -1,5 +1,32 @@ { + "name": "quantic", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "namedInputs": { + "negativeBuildOutputs": [ + "!{projectRoot}/docs/out", + "!{projectRoot}/force-app/main/default/staticresources/coveobueno", + "!{projectRoot}/force-app/main/default/staticresources/coveoheadless" + ], + "negativeNonBuildOutputs": ["!{projectRoot}/reports"] + }, "targets": { + "cached:build": { + "outputs": [ + "{projectRoot}/docs/out", + "{projectRoot}/force-app/main/default/staticresources/coveobueno", + "{projectRoot}/force-app/main/default/staticresources/coveoheadless" + ], + "executor": "nx:run-commands", + "options": { + "commands": ["npm run build:staticresources", "npm run build:doc"], + "parallel": true, + "cwd": "packages/quantic" + } + }, + "build": { + "dependsOn": ["cached:build"], + "executor": "nx:noop" + }, "promote:sfdx": { "dependsOn": ["build"], "inputs": [], diff --git a/packages/samples/angular/angular.json b/packages/samples/angular/angular.json index a85d8f742d7..1092c91bb2d 100644 --- a/packages/samples/angular/angular.json +++ b/packages/samples/angular/angular.json @@ -83,5 +83,8 @@ } } }, - "defaultProject": "angular" + "defaultProject": "angular", + "cli": { + "analytics": false + } } diff --git a/packages/samples/angular/package.json b/packages/samples/angular/package.json index dbfb18a6dca..eb96db0dfd6 100644 --- a/packages/samples/angular/package.json +++ b/packages/samples/angular/package.json @@ -3,6 +3,8 @@ "version": "0.0.0", "scripts": { "ng": "ng", + "build": "nx build", + "build:angular": "ng build", "dev": "npm run build:assets && npm run dev:angular", "dev:angular": "ng serve --host=0.0.0.0", "build:assets": "ncp ../../atomic-angular/projects/atomic-angular/dist/assets src/assets && ncp ../../atomic-angular/projects/atomic-angular/dist/lang src/lang" diff --git a/packages/samples/angular/project.json b/packages/samples/angular/project.json index 3337ad505d2..0acb475365c 100644 --- a/packages/samples/angular/project.json +++ b/packages/samples/angular/project.json @@ -1,3 +1,19 @@ { - "name": "atomic-angular-samples" + "name": "atomic-angular-samples", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "targets": { + "cached:build": { + "dependsOn": ["^build", "clean"], + "executor": "nx:run-commands", + "options": { + "commands": ["npm run build:assets", "npm run build:angular"], + "parallel": false, + "cwd": "packages/samples/angular" + } + }, + "build": { + "dependsOn": ["cached:build"], + "executor": "nx:noop" + } + } } diff --git a/packages/samples/atomic-next/package.json b/packages/samples/atomic-next/package.json index db2ece229ef..5b2dd835aef 100644 --- a/packages/samples/atomic-next/package.json +++ b/packages/samples/atomic-next/package.json @@ -19,7 +19,7 @@ "typescript": "4.6.4" }, "scripts": { - "build": "tsc --noEmit && tsc --module commonjs --noEmit", + "build": "nx build", "dev": "npm run build:assets && npm run dev:nextjs", "dev:nextjs": "next dev", "build:assets": "ncp ../../atomic-react/dist/assets public/assets && ncp ../../atomic-react/dist/lang public/lang public/assets", diff --git a/packages/samples/atomic-next/project.json b/packages/samples/atomic-next/project.json index dc4587aa78f..87776124b46 100644 --- a/packages/samples/atomic-next/project.json +++ b/packages/samples/atomic-next/project.json @@ -1,3 +1,22 @@ { - "name": "atomic-next-samples" + "name": "atomic-next-samples", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "targets": { + "cached:build": { + "executor": "nx:run-commands", + "options": { + "commands": [ + "npx next build", + "tsc --noEmit", + "tsc --module commonjs --noEmit" + ], + "parallel": true, + "cwd": "packages/samples/atomic-next" + } + }, + "build": { + "dependsOn": ["cached:build"], + "executor": "nx:noop" + } + } } diff --git a/packages/samples/atomic-react/package.json b/packages/samples/atomic-react/package.json index 62b9baaf1b9..b0c224b37f1 100644 --- a/packages/samples/atomic-react/package.json +++ b/packages/samples/atomic-react/package.json @@ -27,7 +27,7 @@ "webpack-dev-server": "4.10.0" }, "scripts": { - "build": "tsc --noEmit && tsc --module commonjs --noEmit", + "build": "nx build", "dev": "npm run build:assets && npm run dev:webpack", "dev:webpack": "webpack serve", "build:assets": "ncp ../../atomic-react/dist/assets public/assets && ncp ../../atomic-react/dist/lang public/lang public/assets && ncp ../../atomic/dist/atomic/themes public/themes", diff --git a/packages/samples/atomic-react/project.json b/packages/samples/atomic-react/project.json index 559c360d0d2..ae6826d3a38 100644 --- a/packages/samples/atomic-react/project.json +++ b/packages/samples/atomic-react/project.json @@ -1,3 +1,22 @@ { - "name": "atomic-react-samples" + "name": "atomic-react-samples", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "namedInputs": { + "negativeBuildOutputs": ["!{projectRoot}/public/dist"] + }, + "targets": { + "cached:build": { + "outputs": ["{projectRoot}/public/dist"], + "executor": "nx:run-commands", + "options": { + "commands": ["tsc --noEmit", "tsc --module commonjs --noEmit"], + "parallel": true, + "cwd": "packages/samples/atomic-react" + } + }, + "build": { + "dependsOn": ["cached:build"], + "executor": "nx:noop" + } + } } diff --git a/packages/samples/headless-react/package.json b/packages/samples/headless-react/package.json index 243cbba8be4..f31b146d960 100644 --- a/packages/samples/headless-react/package.json +++ b/packages/samples/headless-react/package.json @@ -30,7 +30,7 @@ }, "scripts": { "dev": "react-scripts start", - "build": "npm run build:client && npm run build:server", + "build": "nx build", "build:client": "tsc --noEmit && tsc --module commonjs --noEmit", "build:server": "tsc --project ./tsconfig.server.json", "test": "react-scripts test", diff --git a/packages/samples/headless-react/project.json b/packages/samples/headless-react/project.json index c1d9e4ae967..b47547e6e55 100644 --- a/packages/samples/headless-react/project.json +++ b/packages/samples/headless-react/project.json @@ -1,3 +1,18 @@ { - "name": "headless-react-samples" + "name": "headless-react-samples", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "targets": { + "cached:build": { + "executor": "nx:run-commands", + "options": { + "commands": ["npm run build:client", "npm run build:server"], + "parallel": true, + "cwd": "packages/samples/headless-react" + } + }, + "build": { + "dependsOn": ["cached:build"], + "executor": "nx:noop" + } + } } diff --git a/packages/samples/headless-ssr/package.json b/packages/samples/headless-ssr/package.json index e138ec3b115..7035ea07628 100644 --- a/packages/samples/headless-ssr/package.json +++ b/packages/samples/headless-ssr/package.json @@ -5,7 +5,8 @@ "private": true, "scripts": { "dev": "next dev", - "build": "next build", + "build": "nx build", + "build:next": "next build", "prod": "next start", "lint": "next lint", "e2e": "cypress run --browser chrome --e2e", diff --git a/packages/samples/headless-ssr/project.json b/packages/samples/headless-ssr/project.json index 0f94b9b3e55..f96ec45700e 100644 --- a/packages/samples/headless-ssr/project.json +++ b/packages/samples/headless-ssr/project.json @@ -1,3 +1,17 @@ { - "name": "headless-ssr-samples" + "name": "headless-ssr-samples", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "targets": { + "cached:build": { + "executor": "nx:run-commands", + "options": { + "command": "npm run build:next", + "cwd": "packages/samples/headless-ssr" + } + }, + "build": { + "dependsOn": ["cached:build"], + "executor": "nx:noop" + } + } } diff --git a/packages/samples/iife/build-assets.mjs b/packages/samples/iife/build-assets.mjs index 34d5712c9b7..a5d8985171d 100644 --- a/packages/samples/iife/build-assets.mjs +++ b/packages/samples/iife/build-assets.mjs @@ -71,6 +71,9 @@ function getDeploymentPipelineAssets() { */ const assets = []; for (const [source, phasesWithSameSource] of Object.entries(phasesBySource)) { + if (source === 'utils/atomic-storybook/storybook-static') { + continue; + } const relativeDestinations = new Set( phasesWithSameSource.map((phase) => getRelativeDestination(phase.s3.directory) diff --git a/packages/samples/iife/package.json b/packages/samples/iife/package.json index f2561d36136..97eeea84473 100644 --- a/packages/samples/iife/package.json +++ b/packages/samples/iife/package.json @@ -6,7 +6,6 @@ "clean": "rimraf www/cdn", "dev": "npm run build && npm run prod", "prod": "serve www", - "build": "npm run clean && npm run build:assets", "build:assets": "node build-assets.mjs", "e2e:watch": "cypress open --browser chrome --e2e", "e2e": "cypress run --browser chrome" diff --git a/packages/samples/iife/project.json b/packages/samples/iife/project.json index 4349dd8038a..ee6e6ea959b 100644 --- a/packages/samples/iife/project.json +++ b/packages/samples/iife/project.json @@ -1,3 +1,22 @@ { - "name": "iife-samples" + "name": "iife-samples", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "namedInputs": { + "negativeBuildOutputs": ["!{projectRoot}/www/cdn"] + }, + "targets": { + "cached:build": { + "dependsOn": ["^build", "clean"], + "outputs": ["{projectRoot}/www/cdn"], + "executor": "nx:run-commands", + "options": { + "command": "npm run build:assets", + "cwd": "packages/samples/iife" + } + }, + "build": { + "dependsOn": ["cached:build"], + "executor": "nx:noop" + } + } } diff --git a/packages/samples/stencil/project.json b/packages/samples/stencil/project.json index 470f9f187af..0308d7b292d 100644 --- a/packages/samples/stencil/project.json +++ b/packages/samples/stencil/project.json @@ -1,10 +1,9 @@ { "name": "atomic-stencil-samples", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", "namedInputs": { - "production": [ - "sharedGlobals", - "sharedTypescriptSources", - "{projectRoot}/stencil.config.ts", + "negativeBuildOutputs": [ + "!{projectRoot}/www", "!{projectRoot}/src/components.d.ts" ] }, diff --git a/packages/samples/vuejs/package.json b/packages/samples/vuejs/package.json index d7ea2bad5eb..b9d34d73c3f 100644 --- a/packages/samples/vuejs/package.json +++ b/packages/samples/vuejs/package.json @@ -3,6 +3,8 @@ "version": "0.1.0", "private": true, "scripts": { + "build": "nx build", + "build:vue": "vue-cli-service build", "dev:vue": "vue-cli-service serve", "lint": "vue-cli-service lint", "dev": "npm run build:assets && npm run dev:vue", diff --git a/packages/samples/vuejs/project.json b/packages/samples/vuejs/project.json index e4cdb0147e0..75896f12bac 100644 --- a/packages/samples/vuejs/project.json +++ b/packages/samples/vuejs/project.json @@ -1,3 +1,19 @@ { - "name": "atomic-vuejs-samples" + "name": "atomic-vuejs-samples", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "targets": { + "cached:build": { + "dependsOn": ["^build", "clean"], + "executor": "nx:run-commands", + "options": { + "commands": ["npm run build:assets", "npm run build:vue"], + "parallel": false, + "cwd": "packages/samples/vuejs" + } + }, + "build": { + "dependsOn": ["cached:build"], + "executor": "nx:noop" + } + } } diff --git a/scripts/reports/bundle-size/command.mjs b/scripts/reports/bundle-size/command.mjs index c9c092e3443..e45dc5a8de9 100644 --- a/scripts/reports/bundle-size/command.mjs +++ b/scripts/reports/bundle-size/command.mjs @@ -9,7 +9,7 @@ async function setup() { async function buildFiles() { console.log('building files'); - await execute('npm', ['run', 'build']); + await execute('npx', ['nx', 'run', 'headless:build']); } function readFileSizes() { diff --git a/utils/atomic-storybook/package.json b/utils/atomic-storybook/package.json index fdc70ef38cd..5d66bd4d060 100644 --- a/utils/atomic-storybook/package.json +++ b/utils/atomic-storybook/package.json @@ -28,7 +28,7 @@ "typescript": "4.6.4" }, "scripts": { - "build": "storybook build", + "build": "nx build", "dev": "storybook dev -p 6006" } } diff --git a/utils/atomic-storybook/project.json b/utils/atomic-storybook/project.json index 7e935f12366..963bd2ec676 100644 --- a/utils/atomic-storybook/project.json +++ b/utils/atomic-storybook/project.json @@ -1,5 +1,10 @@ { + "name": "atomic-storybook", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "implicitDependencies": ["atomic"], + "namedInputs": { + "negativeBuildOutputs": ["!{projectRoot}/storybook-static"] + }, "targets": { "install:isolated": { "dependsOn": [], @@ -39,16 +44,19 @@ ], "executor": "nx:noop" }, - "build": { + "cached:build": { "dependsOn": ["prepare-and-validate"], - "inputs": [], - "outputs": [], + "outputs": ["{projectRoot}/storybook-static"], "executor": "nx:run-commands", "options": { - "command": "npm run build", + "command": "npx storybook build", "cwd": "utils/atomic-storybook" } }, + "build": { + "dependsOn": ["cached:build"], + "executor": "nx:noop" + }, "dev": { "dependsOn": ["prepare-and-validate"], "inputs": [], diff --git a/utils/release/project.json b/utils/release/project.json index 0967ef424bc..139ae740a77 100644 --- a/utils/release/project.json +++ b/utils/release/project.json @@ -1 +1,4 @@ -{} +{ + "name": "release", + "$schema": "../../node_modules/nx/schemas/project-schema.json" +}