From f231cfc01b48ba4ca8dd84be1dbc08983bdabb17 Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Thu, 20 Jan 2022 12:00:51 -0500 Subject: [PATCH] feat(repo): move gatsby plugin to nx-labs repo (#8617) --- .circleci/config.yml | 4 +- .cz-config.js | 1 - .github/workflows/e2e-matrix.yml | 4 +- .github/workflows/e2e-windows.yml | 2 +- CONTRIBUTING.md | 1 - dep-graph/client/src/assets/graphs/nx.json | 23 - docs/generated/api-gatsby/executors/build.md | 52 -- docs/generated/api-gatsby/executors/server.md | 48 - .../api-gatsby/generators/application.md | 108 --- .../api-gatsby/generators/component.md | 112 --- docs/generated/api-gatsby/generators/page.md | 112 --- docs/generated/executors.json | 1 - docs/generated/generators.json | 1 - docs/map.json | 37 - docs/shared/gatsby-plugin.md | 76 -- docs/shared/getting-started/nx-and-react.md | 2 +- docs/shared/migration/adding-to-monorepo.md | 2 +- e2e/gatsby/jest.config.js | 10 - e2e/gatsby/project.json | 34 - e2e/gatsby/src/gatsby.test.ts | 110 --- e2e/gatsby/tsconfig.json | 13 - e2e/gatsby/tsconfig.spec.json | 19 - e2e/utils/index.ts | 1 - .../src/create-nx-workspace.test.ts | 13 - .../src/lib/menu.utils.ts | 1 - .../generated/api-gatsby/executors/build.md | 52 -- .../generated/api-gatsby/executors/server.md | 48 - .../api-gatsby/generators/application.md | 108 --- .../api-gatsby/generators/component.md | 112 --- .../generated/api-gatsby/generators/page.md | 112 --- .../generated/api-js/executors/node.md | 8 + .../documentation/generated/executors.json | 1 - .../documentation/generated/generators.json | 1 - nx-dev/nx-dev/public/documentation/map.json | 37 - .../documentation/shared/gatsby-plugin.md | 76 -- .../shared/getting-started/nx-and-react.md | 2 +- .../shared/migration/adding-to-monorepo.md | 2 +- .../bin/create-nx-workspace.ts | 17 +- packages/gatsby/.eslintrc.json | 24 - packages/gatsby/README.md | 13 - packages/gatsby/babel.ts | 31 - packages/gatsby/executors.json | 26 - packages/gatsby/generators.json | 55 -- packages/gatsby/index.ts | 3 - packages/gatsby/jest.config.js | 10 - packages/gatsby/migrations.json | 458 ---------- packages/gatsby/migrations.spec.ts | 12 - packages/gatsby/package.json | 45 - .../nx-gatsby-ext-plugin/gatsby-config.ts | 3 - .../nx-gatsby-ext-plugin/gatsby-node.ts | 26 - .../plugins/nx-gatsby-ext-plugin/package.json | 6 - packages/gatsby/project.json | 87 -- .../gatsby/src/executors/build/build.impl.ts | 75 -- packages/gatsby/src/executors/build/compat.ts | 5 - .../gatsby/src/executors/build/schema.d.ts | 8 - .../gatsby/src/executors/build/schema.json | 36 - .../gatsby/src/executors/server/compat.ts | 5 - .../gatsby/src/executors/server/schema.d.ts | 7 - .../gatsby/src/executors/server/schema.json | 32 - .../src/executors/server/server.impl.ts | 167 ---- .../application/application.spec.ts | 407 --------- .../src/generators/application/application.ts | 49 -- .../application/files/.babelrc__tmpl__ | 11 - .../generators/application/files/.gitignore | 69 -- .../application/files/.prettierignore | 4 - .../generators/application/files/.prettierrc | 4 - .../src/generators/application/files/LICENSE | 22 - .../generators/application/files/README.md | 99 --- .../application/files/gatsby-browser.js | 7 - .../files/gatsby-config.js__tmpl__ | 58 -- .../application/files/gatsby-node.js | 7 - .../application/files/gatsby-ssr.js | 7 - .../generators/application/files/package.json | 11 - .../application/files/src/images/logo.svg | 8 - .../application/files/src/pages/404.js | 5 - .../files/src/pages/index.module.__style__ | 401 --------- .../files/src/pages/index.none.tsx__tmpl__ | 817 ----------------- .../files/src/pages/index.spec.tsx__tmpl__ | 13 - .../files/src/pages/index.tsx__tmpl__ | 38 - .../files/tsconfig.app.json__tmpl__ | 12 - .../application/files/tsconfig.json__tmpl__ | 22 - .../generators/application/lib/add-cypress.ts | 18 - .../application/lib/add-git-ignore-entry.ts | 12 - .../generators/application/lib/add-jest.ts | 24 - .../generators/application/lib/add-linting.ts | 60 -- .../lib/add-prettier-ignore-entry.ts | 12 - .../generators/application/lib/add-project.ts | 51 -- .../lib/create-application-files.helpers.ts | 819 ------------------ .../lib/create-application-files.ts | 55 -- .../application/lib/normalize-options.ts | 53 -- .../application/lib/set-defaults.ts | 33 - .../application/lib/update-jest-config.ts | 14 - .../src/generators/application/schema.d.ts | 13 - .../src/generators/application/schema.json | 99 --- .../generators/component/component.spec.ts | 50 -- .../src/generators/component/component.ts | 36 - .../src/generators/component/schema.json | 108 --- .../gatsby/src/generators/init/init.spec.ts | 33 - packages/gatsby/src/generators/init/init.ts | 97 --- .../gatsby/src/generators/init/schema.d.ts | 5 - .../gatsby/src/generators/init/schema.json | 27 - .../gatsby/src/generators/page/page.spec.ts | 32 - packages/gatsby/src/generators/page/page.ts | 40 - .../gatsby/src/generators/page/schema.json | 108 --- packages/gatsby/src/index.ts | 0 .../add-js-include-11-6-0.spec.ts | 42 - .../update-11-6-0/add-js-include-11-6-0.ts | 29 - ...replace-node-sass-with-sass-12-6-1.spec.ts | 44 - .../replace-node-sass-with-sass-12-6-1.ts | 37 - ...ge-with-gatsby-plugin-image-12-9-1.spec.ts | 94 -- ...y-image-with-gatsby-plugin-image-12-9-1.ts | 135 --- packages/gatsby/src/utils/styles.ts | 69 -- packages/gatsby/src/utils/versions.ts | 25 - packages/gatsby/tsconfig.json | 16 - packages/gatsby/tsconfig.lib.json | 11 - packages/gatsby/tsconfig.spec.json | 21 - packages/next/src/generators/init/init.ts | 7 - packages/tao/src/commands/migrate.spec.ts | 2 - packages/tao/src/commands/migrate.ts | 1 - .../update-existing-babelrc-files.spec.ts | 12 - .../update-existing-babelrc-files.ts | 3 +- packages/workspace/package.json | 1 - packages/workspace/src/command-line/report.ts | 1 - packages/workspace/src/generators/new/new.ts | 3 - .../src/generators/preset/preset.spec.ts | 16 - .../workspace/src/generators/preset/preset.ts | 11 - .../workspace/src/generators/utils/presets.ts | 1 - scripts/check-imports.js | 1 - scripts/depcheck/missing.ts | 1 - scripts/e2e-build-package-publish.ts | 2 - scripts/nx-release.js | 1 - scripts/package.sh | 12 +- scripts/readme-fragments/content.md | 1 - tsconfig.base.json | 1 - workspace.json | 2 - 135 files changed, 26 insertions(+), 6943 deletions(-) delete mode 100644 docs/generated/api-gatsby/executors/build.md delete mode 100644 docs/generated/api-gatsby/executors/server.md delete mode 100644 docs/generated/api-gatsby/generators/application.md delete mode 100644 docs/generated/api-gatsby/generators/component.md delete mode 100644 docs/generated/api-gatsby/generators/page.md delete mode 100644 docs/shared/gatsby-plugin.md delete mode 100644 e2e/gatsby/jest.config.js delete mode 100644 e2e/gatsby/project.json delete mode 100644 e2e/gatsby/src/gatsby.test.ts delete mode 100644 e2e/gatsby/tsconfig.json delete mode 100644 e2e/gatsby/tsconfig.spec.json delete mode 100644 nx-dev/nx-dev/public/documentation/generated/api-gatsby/executors/build.md delete mode 100644 nx-dev/nx-dev/public/documentation/generated/api-gatsby/executors/server.md delete mode 100644 nx-dev/nx-dev/public/documentation/generated/api-gatsby/generators/application.md delete mode 100644 nx-dev/nx-dev/public/documentation/generated/api-gatsby/generators/component.md delete mode 100644 nx-dev/nx-dev/public/documentation/generated/api-gatsby/generators/page.md delete mode 100644 nx-dev/nx-dev/public/documentation/shared/gatsby-plugin.md delete mode 100644 packages/gatsby/.eslintrc.json delete mode 100644 packages/gatsby/README.md delete mode 100644 packages/gatsby/babel.ts delete mode 100644 packages/gatsby/executors.json delete mode 100644 packages/gatsby/generators.json delete mode 100644 packages/gatsby/index.ts delete mode 100644 packages/gatsby/jest.config.js delete mode 100644 packages/gatsby/migrations.json delete mode 100644 packages/gatsby/migrations.spec.ts delete mode 100644 packages/gatsby/package.json delete mode 100644 packages/gatsby/plugins/nx-gatsby-ext-plugin/gatsby-config.ts delete mode 100644 packages/gatsby/plugins/nx-gatsby-ext-plugin/gatsby-node.ts delete mode 100644 packages/gatsby/plugins/nx-gatsby-ext-plugin/package.json delete mode 100644 packages/gatsby/project.json delete mode 100644 packages/gatsby/src/executors/build/build.impl.ts delete mode 100644 packages/gatsby/src/executors/build/compat.ts delete mode 100644 packages/gatsby/src/executors/build/schema.d.ts delete mode 100644 packages/gatsby/src/executors/build/schema.json delete mode 100644 packages/gatsby/src/executors/server/compat.ts delete mode 100644 packages/gatsby/src/executors/server/schema.d.ts delete mode 100644 packages/gatsby/src/executors/server/schema.json delete mode 100644 packages/gatsby/src/executors/server/server.impl.ts delete mode 100644 packages/gatsby/src/generators/application/application.spec.ts delete mode 100644 packages/gatsby/src/generators/application/application.ts delete mode 100644 packages/gatsby/src/generators/application/files/.babelrc__tmpl__ delete mode 100644 packages/gatsby/src/generators/application/files/.gitignore delete mode 100644 packages/gatsby/src/generators/application/files/.prettierignore delete mode 100644 packages/gatsby/src/generators/application/files/.prettierrc delete mode 100644 packages/gatsby/src/generators/application/files/LICENSE delete mode 100644 packages/gatsby/src/generators/application/files/README.md delete mode 100644 packages/gatsby/src/generators/application/files/gatsby-browser.js delete mode 100644 packages/gatsby/src/generators/application/files/gatsby-config.js__tmpl__ delete mode 100644 packages/gatsby/src/generators/application/files/gatsby-node.js delete mode 100644 packages/gatsby/src/generators/application/files/gatsby-ssr.js delete mode 100644 packages/gatsby/src/generators/application/files/package.json delete mode 100644 packages/gatsby/src/generators/application/files/src/images/logo.svg delete mode 100644 packages/gatsby/src/generators/application/files/src/pages/404.js delete mode 100644 packages/gatsby/src/generators/application/files/src/pages/index.module.__style__ delete mode 100644 packages/gatsby/src/generators/application/files/src/pages/index.none.tsx__tmpl__ delete mode 100644 packages/gatsby/src/generators/application/files/src/pages/index.spec.tsx__tmpl__ delete mode 100644 packages/gatsby/src/generators/application/files/src/pages/index.tsx__tmpl__ delete mode 100644 packages/gatsby/src/generators/application/files/tsconfig.app.json__tmpl__ delete mode 100644 packages/gatsby/src/generators/application/files/tsconfig.json__tmpl__ delete mode 100644 packages/gatsby/src/generators/application/lib/add-cypress.ts delete mode 100644 packages/gatsby/src/generators/application/lib/add-git-ignore-entry.ts delete mode 100644 packages/gatsby/src/generators/application/lib/add-jest.ts delete mode 100644 packages/gatsby/src/generators/application/lib/add-linting.ts delete mode 100644 packages/gatsby/src/generators/application/lib/add-prettier-ignore-entry.ts delete mode 100644 packages/gatsby/src/generators/application/lib/add-project.ts delete mode 100644 packages/gatsby/src/generators/application/lib/create-application-files.helpers.ts delete mode 100644 packages/gatsby/src/generators/application/lib/create-application-files.ts delete mode 100644 packages/gatsby/src/generators/application/lib/normalize-options.ts delete mode 100644 packages/gatsby/src/generators/application/lib/set-defaults.ts delete mode 100644 packages/gatsby/src/generators/application/lib/update-jest-config.ts delete mode 100644 packages/gatsby/src/generators/application/schema.d.ts delete mode 100644 packages/gatsby/src/generators/application/schema.json delete mode 100644 packages/gatsby/src/generators/component/component.spec.ts delete mode 100644 packages/gatsby/src/generators/component/component.ts delete mode 100644 packages/gatsby/src/generators/component/schema.json delete mode 100644 packages/gatsby/src/generators/init/init.spec.ts delete mode 100644 packages/gatsby/src/generators/init/init.ts delete mode 100644 packages/gatsby/src/generators/init/schema.d.ts delete mode 100644 packages/gatsby/src/generators/init/schema.json delete mode 100644 packages/gatsby/src/generators/page/page.spec.ts delete mode 100644 packages/gatsby/src/generators/page/page.ts delete mode 100644 packages/gatsby/src/generators/page/schema.json delete mode 100644 packages/gatsby/src/index.ts delete mode 100644 packages/gatsby/src/migrations/update-11-6-0/add-js-include-11-6-0.spec.ts delete mode 100644 packages/gatsby/src/migrations/update-11-6-0/add-js-include-11-6-0.ts delete mode 100644 packages/gatsby/src/migrations/update-12-6-1/replace-node-sass-with-sass-12-6-1.spec.ts delete mode 100644 packages/gatsby/src/migrations/update-12-6-1/replace-node-sass-with-sass-12-6-1.ts delete mode 100644 packages/gatsby/src/migrations/update-12-9-1/replace-gatsby-image-with-gatsby-plugin-image-12-9-1.spec.ts delete mode 100644 packages/gatsby/src/migrations/update-12-9-1/replace-gatsby-image-with-gatsby-plugin-image-12-9-1.ts delete mode 100644 packages/gatsby/src/utils/styles.ts delete mode 100644 packages/gatsby/src/utils/versions.ts delete mode 100644 packages/gatsby/tsconfig.json delete mode 100644 packages/gatsby/tsconfig.lib.json delete mode 100644 packages/gatsby/tsconfig.spec.json diff --git a/.circleci/config.yml b/.circleci/config.yml index afd3dce0ff..65cb446c3f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -197,7 +197,7 @@ jobs: - run: name: Run E2E Tests command: | - npx nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --exclude=e2e-react-native,e2e-detox,e2e-gatsby --parallel=1 + npx nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --exclude=e2e-react-native,e2e-detox --parallel=1 no_output_timeout: 45m - run: name: Stop All Running Agents for This CI Run @@ -223,7 +223,7 @@ jobs: - run: name: Run E2E Tests command: | - npx nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --exclude=e2e-detox,e2e-js,e2e-next,e2e-gatsby,e2e-workspace-create,e2e-workspace-integrations,e2e-workspace-core,e2e-react,e2e-web,e2e-angular-extensions,e2e-angular-core,e2e-cli,e2e-nx-plugin,e2e-storybook,e2e-cypress,e2e-node,e2e-linter,e2e-jest,e2e-add-nx-to-monorepo --parallel=1 + npx nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --exclude=e2e-detox,e2e-js,e2e-next,e2e-workspace-create,e2e-workspace-integrations,e2e-workspace-core,e2e-react,e2e-web,e2e-angular-extensions,e2e-angular-core,e2e-cli,e2e-nx-plugin,e2e-storybook,e2e-cypress,e2e-node,e2e-linter,e2e-jest,e2e-add-nx-to-monorepo --parallel=1 no_output_timeout: 45m - run: name: Stop All Running Agents for This CI Run diff --git a/.cz-config.js b/.cz-config.js index 8fd44e6b25..ec42e173cc 100644 --- a/.cz-config.js +++ b/.cz-config.js @@ -18,7 +18,6 @@ module.exports = { { name: 'core', description: 'anything Nx core specific' }, { name: 'nxdev', description: 'anything related to docs infrastructure' }, { name: 'nextjs', description: 'anything Next specific' }, - { name: 'gatsby', description: 'anything Gatsby specific' }, { name: 'nest', description: 'anything Nest specific' }, { name: 'node', description: 'anything Node specific' }, { name: 'js', description: 'anything TS->JS specific' }, diff --git a/.github/workflows/e2e-matrix.yml b/.github/workflows/e2e-matrix.yml index 3e292a297d..c0cf322308 100644 --- a/.github/workflows/e2e-matrix.yml +++ b/.github/workflows/e2e-matrix.yml @@ -42,7 +42,7 @@ jobs: - e2e-angular-core,e2e-angular-extensions - e2e-cli,e2e-nx-plugin,e2e-jest,e2e-linter - e2e-cypress - - e2e-gatsby,e2e-react + - e2e-react - e2e-next - e2e-node - e2e-web @@ -69,7 +69,7 @@ jobs: - os: macos-latest packages: e2e-cypress - os: macos-latest - packages: e2e-gatsby,e2e-react + packages: e2e-react - os: macos-latest packages: e2e-next - os: macos-latest diff --git a/.github/workflows/e2e-windows.yml b/.github/workflows/e2e-windows.yml index ce1b8effde..0579e6180f 100644 --- a/.github/workflows/e2e-windows.yml +++ b/.github/workflows/e2e-windows.yml @@ -32,7 +32,7 @@ jobs: - e2e-angular-core,e2e-angular-extensions - e2e-cli,e2e-nx-plugin,e2e-jest,e2e-linter - e2e-cypress - - e2e-gatsby,e2e-react + - e2e-react - e2e-next - e2e-node - e2e-web diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b22aa0985c..bd6586f3e9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -237,7 +237,6 @@ The scope must be one of the following: - dep-graph - anything dep-graph app specific - detox - anything Detox specific - devkit - devkit-related changes -- gatsby - anything Gatsby specific - express - anything Express specific - js - anything related to @nrwl/js package or general js/ts support - linter - anything Linter specific diff --git a/dep-graph/client/src/assets/graphs/nx.json b/dep-graph/client/src/assets/graphs/nx.json index fd24d373a1..c45647d417 100644 --- a/dep-graph/client/src/assets/graphs/nx.json +++ b/dep-graph/client/src/assets/graphs/nx.json @@ -157,11 +157,6 @@ "type": "lib", "data": { "tags": [], "root": "packages/devkit", "files": [] } }, - { - "name": "gatsby", - "type": "lib", - "data": { "tags": [], "root": "packages/gatsby", "files": [] } - }, { "name": "linter", "type": "lib", @@ -261,11 +256,6 @@ "type": "lib", "data": { "tags": [], "root": "packages/nx", "files": [] } }, - { - "name": "e2e-gatsby", - "type": "app", - "data": { "tags": [], "root": "e2e/gatsby", "files": [] } - }, { "name": "e2e-linter", "type": "app", @@ -476,15 +466,6 @@ } ], "devkit": [{ "source": "devkit", "target": "tao", "type": "static" }], - "gatsby": [ - { "source": "gatsby", "target": "tao", "type": "static" }, - { "source": "gatsby", "target": "workspace", "type": "static" }, - { "source": "gatsby", "target": "devkit", "type": "static" }, - { "source": "gatsby", "target": "cypress", "type": "static" }, - { "source": "gatsby", "target": "linter", "type": "static" }, - { "source": "gatsby", "target": "jest", "type": "static" }, - { "source": "gatsby", "target": "react", "type": "static" } - ], "linter": [ { "source": "linter", "target": "eslint-plugin-nx", "type": "implicit" }, { "source": "linter", "target": "devkit", "type": "static" }, @@ -644,10 +625,6 @@ { "source": "e2e-cypress", "target": "e2e-utils", "type": "static" } ], "nx": [{ "source": "nx", "target": "cli", "type": "static" }], - "e2e-gatsby": [ - { "source": "e2e-gatsby", "target": "gatsby", "type": "implicit" }, - { "source": "e2e-gatsby", "target": "e2e-utils", "type": "static" } - ], "e2e-linter": [ { "source": "e2e-linter", "target": "linter", "type": "implicit" }, { "source": "e2e-linter", "target": "e2e-utils", "type": "static" } diff --git a/docs/generated/api-gatsby/executors/build.md b/docs/generated/api-gatsby/executors/build.md deleted file mode 100644 index f67e659231..0000000000 --- a/docs/generated/api-gatsby/executors/build.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: '@nrwl/gatsby:build executor' -description: 'Build a Gatsby app' ---- - -# @nrwl/gatsby:build - -Build a Gatsby app - -Options can be configured in `workspace.json` when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/configuration/projectjson#targets. - -## Options - -### color - -Default: `true` - -Type: `boolean` - -Enable colored terminal output. - -### graphqlTracing - -Type: `boolean` - -Trace every graphql resolver, may have performance implications. - -### openTracingConfigFile - -Type: `string` - -Tracer configuration file (OpenTracing compatible). - -### prefixPaths - -Type: `boolean` - -Build site with link paths prefixed (set pathPrefix in your config). - -### profile - -Type: `boolean` - -Build site with react profiling. - -### uglify - -Default: `true` - -Type: `boolean` - -Build site without uglifying JS bundles (true by default). diff --git a/docs/generated/api-gatsby/executors/server.md b/docs/generated/api-gatsby/executors/server.md deleted file mode 100644 index 089c1c0385..0000000000 --- a/docs/generated/api-gatsby/executors/server.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: '@nrwl/gatsby:server executor' -description: 'Starts server for app' ---- - -# @nrwl/gatsby:server - -Starts server for app - -Options can be configured in `workspace.json` when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/configuration/projectjson#targets. - -## Options - -### buildTarget - -Type: `string` - -Target which builds the application - -### host - -Default: `localhost` - -Type: `string` - -Host to listen on. - -### https - -Default: `false` - -Type: `boolean` - -Serve using HTTPS. - -### open - -Type: `boolean` - -Open the site in your (default) browser for you. - -### port - -Default: `4200` - -Type: `number` - -Port to listen on. diff --git a/docs/generated/api-gatsby/generators/application.md b/docs/generated/api-gatsby/generators/application.md deleted file mode 100644 index 066cb740da..0000000000 --- a/docs/generated/api-gatsby/generators/application.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -title: '@nrwl/gatsby:application generator' -description: 'Create an application' ---- - -# @nrwl/gatsby:application - -Create an application - -## Usage - -```bash -nx generate application ... -``` - -```bash -nx g app ... # same -``` - -By default, Nx will search for `application` in the default collection provisioned in `workspace.json`. - -You can specify the collection explicitly as follows: - -```bash -nx g @nrwl/gatsby:application ... -``` - -Show what will be generated without writing to disk: - -```bash -nx g application ... --dry-run -``` - -## Options - -### name (_**required**_) - -Type: `string` - -### directory - -Alias(es): d - -Type: `string` - -A directory where the project is placed - -### e2eTestRunner - -Default: `cypress` - -Type: `string` - -Possible values: `cypress`, `none` - -Adds the specified e2e test runner - -### js - -Default: `false` - -Type: `boolean` - -Generate JavaScript files rather than TypeScript files - -### setParserOptionsProject - -Default: `false` - -Type: `boolean` - -Whether or not to configure the ESLint "parserOptions.project" option. We do not do this by default for lint performance reasons. - -### standaloneConfig - -Type: `boolean` - -Split the project configuration into /project.json rather than including it inside workspace.json - -### style - -Alias(es): s - -Default: `css` - -Type: `string` - -Possible values: `css`, `scss`, `styl`, `less`, `styled-components`, `@emotion/styled`, `styled-jsx`, `none` - -The file extension to be used for style files. - -### tags - -Alias(es): t - -Type: `string` - -Add tags to the project (used for linting) - -### unitTestRunner - -Default: `jest` - -Type: `string` - -Possible values: `jest`, `none` - -Adds the specified unit test runner diff --git a/docs/generated/api-gatsby/generators/component.md b/docs/generated/api-gatsby/generators/component.md deleted file mode 100644 index a79ef064e8..0000000000 --- a/docs/generated/api-gatsby/generators/component.md +++ /dev/null @@ -1,112 +0,0 @@ ---- -title: '@nrwl/gatsby:component generator' -description: 'Create a component' ---- - -# @nrwl/gatsby:component - -Create a component - -## Usage - -```bash -nx generate component ... -``` - -By default, Nx will search for `component` in the default collection provisioned in `workspace.json`. - -You can specify the collection explicitly as follows: - -```bash -nx g @nrwl/gatsby:component ... -``` - -Show what will be generated without writing to disk: - -```bash -nx g component ... --dry-run -``` - -### Examples - -Generate a component in the mylib library: - -```bash -nx g component my-component --project=mylib -``` - -Generate a class component in the mylib library: - -```bash -nx g component my-component --project=mylib --classComponent -``` - -## Options - -### name (_**required**_) - -Type: `string` - -The name of the component. - -### project (_**required**_) - -Alias(es): p - -Type: `string` - -The name of the project. - -### directory - -Alias(es): dir - -Type: `string` - -Create the component under this directory (can be nested). - -### export - -Alias(es): e - -Default: `false` - -Type: `boolean` - -When true, the component is exported from the project index.ts (if it exists). - -### flat - -Default: `false` - -Type: `boolean` - -Create component at the source root rather than its own directory. - -### js - -Default: `false` - -Type: `boolean` - -Generate JavaScript files rather than TypeScript files. - -### skipTests - -Default: `false` - -Type: `boolean` - -When true, does not create "spec.ts" test files for the new component. - -### style - -Alias(es): s - -Default: `css` - -Type: `string` - -Possible values: `css`, `scss`, `styl`, `less`, `styled-components`, `@emotion/styled`, `styled-jsx`, `none` - -The file extension to be used for style files. diff --git a/docs/generated/api-gatsby/generators/page.md b/docs/generated/api-gatsby/generators/page.md deleted file mode 100644 index 9d70c6a171..0000000000 --- a/docs/generated/api-gatsby/generators/page.md +++ /dev/null @@ -1,112 +0,0 @@ ---- -title: '@nrwl/gatsby:page generator' -description: 'Create a page' ---- - -# @nrwl/gatsby:page - -Create a page - -## Usage - -```bash -nx generate page ... -``` - -By default, Nx will search for `page` in the default collection provisioned in `workspace.json`. - -You can specify the collection explicitly as follows: - -```bash -nx g @nrwl/gatsby:page ... -``` - -Show what will be generated without writing to disk: - -```bash -nx g page ... --dry-run -``` - -### Examples - -Generate a page in the mylib library: - -```bash -nx g page my-page --project=mylib -``` - -Generate a class component in the mylib library: - -```bash -nx g page my-page --project=mylib --classComponent -``` - -## Options - -### name (_**required**_) - -Type: `string` - -The name of the component. - -### project (_**required**_) - -Alias(es): p - -Type: `string` - -The name of the project. - -### directory - -Alias(es): dir - -Type: `string` - -Create the component under this directory (can be nested). - -### export - -Alias(es): e - -Default: `false` - -Type: `boolean` - -When true, the component is exported from the project index.ts (if it exists). - -### flat - -Default: `false` - -Type: `boolean` - -Create component at the source root rather than its own directory. - -### js - -Default: `false` - -Type: `boolean` - -Generate JavaScript files rather than TypeScript files. - -### skipTests - -Default: `false` - -Type: `boolean` - -When true, does not create "spec.ts" test files for the new component. - -### style - -Alias(es): s - -Default: `css` - -Type: `string` - -Possible values: `css`, `scss`, `styl`, `less`, `styled-components`, `@emotion/styled`, `styled-jsx`, `none` - -The file extension to be used for style files. diff --git a/docs/generated/executors.json b/docs/generated/executors.json index cb26dd84b8..d935d32a41 100644 --- a/docs/generated/executors.json +++ b/docs/generated/executors.json @@ -2,7 +2,6 @@ "angular", "cypress", "detox", - "gatsby", "jest", "js", "linter", diff --git a/docs/generated/generators.json b/docs/generated/generators.json index 4bc621d6ae..0605d7e687 100644 --- a/docs/generated/generators.json +++ b/docs/generated/generators.json @@ -3,7 +3,6 @@ "cypress", "detox", "express", - "gatsby", "jest", "js", "linter", diff --git a/docs/map.json b/docs/map.json index 4a9117c7c3..06bd305f50 100644 --- a/docs/map.json +++ b/docs/map.json @@ -1128,43 +1128,6 @@ } ] }, - { - "name": "gatsby", - "id": "gatsby", - "itemList": [ - { - "id": "overview", - "name": "Overview", - "searchResultsName": "@nrwl/gatsby Overview", - "file": "shared/gatsby-plugin" - }, - { - "name": "application generator", - "id": "application", - "file": "generated/api-gatsby/generators/application" - }, - { - "name": "component generator", - "id": "component", - "file": "generated/api-gatsby/generators/component" - }, - { - "name": "page generator", - "id": "page", - "file": "generated/api-gatsby/generators/page" - }, - { - "name": "build executor", - "id": "build", - "file": "generated/api-gatsby/executors/build" - }, - { - "name": "server executor", - "id": "server", - "file": "generated/api-gatsby/executors/server" - } - ] - }, { "name": "detox", "id": "detox", diff --git a/docs/shared/gatsby-plugin.md b/docs/shared/gatsby-plugin.md deleted file mode 100644 index a4cecfe04c..0000000000 --- a/docs/shared/gatsby-plugin.md +++ /dev/null @@ -1,76 +0,0 @@ -# Gatsby Plugin - -The Nx Plugin for Gatsby contains executors and generators for managing Gatsby applications and libraries within an Nx workspace. It provides: - -- Scaffolding for creating, building, serving, linting, and testing Gatsby applications. -- Integration with building, serving, and exporting a Gatsby application. -- Integration with React libraries within the workspace. - -## Installing the Gatsby Plugin - -Installing the Gatsby plugin to a workspace can be done with the following: - -```bash -yarn add -D @nrwl/gatsby -``` - -```bash -npm install -D @nrwl/gatsby -``` - -## Applications - -Generating new applications can be done with the following: - -```bash -nx generate @nrwl/gatsby:application -``` - -This creates the following app structure: - -```treeview -myorg/ -├── apps/ -│ ├── myapp/ -│ │ ├── src/ -│ │ │ ├── pages/ -│ │ │ │ ├── index.module.css -│ │ │ │ └── index.tsx -│ │ ├── jest.conf.js -│ │ ├── tsconfig.json -│ │ ├── tsconfig.app.json -│ │ ├── tsconfig.spec.json -│ │ └── .eslintrc.json -│ └── myapp-e2e/ -│ │ ├── src/ -│ │ │ ├── integrations/ -│ │ │ │ └── app.spec.ts -│ │ │ ├── fixtures/ -│ │ │ ├── plugins/ -│ │ │ └── support/ -│ │ ├── cypress.json -│ │ ├── tsconfig.e2e.json -│ │ └── .eslintrc.json -├── libs/ -├── workspace.json -├── nx.json -├── package.json -├── tools/ -├── tsconfig.base.json -└── .eslintrc.json -``` - -## See Also - -- [Using Gatsby](https://www.gatsbyjs.com/docs/quick-start/) - -## Executors / Builders - -- [build](/gatsby/build) - Builds a Gatsby application -- [server](/gatsby/server) - Builds and serves a Gatsby application - -## Generators - -- [application](/gatsby/application) - Create a Gatsby application -- [component](/gatsby/component) - Create a Gatsby component -- [page](/gatsby/page) - Create a Gatsby page diff --git a/docs/shared/getting-started/nx-and-react.md b/docs/shared/getting-started/nx-and-react.md index 202babf572..3d259ef8ee 100644 --- a/docs/shared/getting-started/nx-and-react.md +++ b/docs/shared/getting-started/nx-and-react.md @@ -19,7 +19,7 @@ It is also a good idea to read the [mental model guide](/using-nx/mental-model) Nx plugins help you develop [React](/react/overview) applications with fully integrated support for modern tools and libraries like [Jest](/jest/overview), [Cypress](/cypress/overview), Storybook, [ESLint](/linter/eslint), and more. Nx also supports React -frameworks like [Gatsby](/gatsby/overview), [Next.js](/guides/nextjs), Remix, and has great support for [React Native](/react-native/overview). +frameworks like [Next.js](/guides/nextjs), Remix, and has great support for [React Native](/react-native/overview). diff --git a/docs/shared/migration/adding-to-monorepo.md b/docs/shared/migration/adding-to-monorepo.md index 9bbecca402..568e5627a2 100644 --- a/docs/shared/migration/adding-to-monorepo.md +++ b/docs/shared/migration/adding-to-monorepo.md @@ -163,7 +163,7 @@ faster and with better dev ergonomics. But Nx enables much more than that. Nx is like a VS Code of build tools. It has a very powerful core, but it's really the plugins and extra capabilities that really transform how you develop. -Nx has first class support for React, Next.js, Gatsby, React Native, Angular, Node, NestJS, Jest, Cypress, Storybook and +Nx has first class support for React, Next.js, React Native, Angular, Node, NestJS, Jest, Cypress, Storybook and many more. All the plugins are designed to work together and create a cohesive and pleasant to use dev environment. In addition, Nx makes a lot of things much easier, like building large apps incrementally, distributing CI (no point in diff --git a/e2e/gatsby/jest.config.js b/e2e/gatsby/jest.config.js deleted file mode 100644 index bde33b2220..0000000000 --- a/e2e/gatsby/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - preset: '../../jest.preset.js', - transform: { - '^.+\\.[tj]sx?$': 'ts-jest', - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'], - maxWorkers: 1, - globals: { 'ts-jest': { tsconfig: '/tsconfig.spec.json' } }, - displayName: 'e2e-gatsby', -}; diff --git a/e2e/gatsby/project.json b/e2e/gatsby/project.json deleted file mode 100644 index 0477d1855f..0000000000 --- a/e2e/gatsby/project.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "root": "e2e/gatsby", - "sourceRoot": "e2e/gatsby", - "projectType": "application", - "targets": { - "e2e": { - "executor": "@nrwl/workspace:run-commands", - "options": { - "commands": [ - { - "command": "yarn e2e-start-local-registry" - }, - { - "command": "yarn e2e-build-package-publish" - }, - { - "command": "nx run-e2e-tests e2e-gatsby" - } - ], - "parallel": false - } - }, - "run-e2e-tests": { - "executor": "@nrwl/jest:jest", - "options": { - "jestConfig": "e2e/gatsby/jest.config.js", - "passWithNoTests": true, - "runInBand": true - }, - "outputs": ["coverage/e2e/gatsby"] - } - }, - "implicitDependencies": ["gatsby"] -} diff --git a/e2e/gatsby/src/gatsby.test.ts b/e2e/gatsby/src/gatsby.test.ts deleted file mode 100644 index dcca720a78..0000000000 --- a/e2e/gatsby/src/gatsby.test.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { - checkFilesExist, - expectTestsPass, - newProject, - runCLI, - runCLIAsync, - uniq, - updateFile, -} from '@nrwl/e2e/utils'; - -describe('Gatsby Applications', () => { - let proj: string; - - beforeEach(() => (proj = newProject())); - - it('should generate a valid gatsby application', async () => { - const appName = uniq('app'); - runCLI(`generate @nrwl/gatsby:app ${appName} --style css --no-interactive`); - runCLI( - `generate @nrwl/gatsby:component header --project ${appName} --style css --no-interactive` - ); - - checkFilesExist( - `apps/${appName}/package.json`, - `apps/${appName}/src/components/header.tsx`, - `apps/${appName}/src/components/header.spec.tsx`, - `apps/${appName}/src/pages/index.tsx`, - `apps/${appName}/src/pages/index.spec.tsx` - ); - - updateFile(`apps/${appName}/src/pages/index.tsx`, (content) => { - let updated = `import Header from '../components/header';\n${content}`; - updated = updated.replace('
', '
'); - return updated; - }); - - runCLI(`build ${appName}`); - checkFilesExist( - `apps/${appName}/public/index.html`, - `apps/${appName}/public/404.html`, - `apps/${appName}/public/manifest.webmanifest` - ); - - const result = runCLI(`lint ${appName}`); - expect(result).toContain('All files pass linting.'); - - expectTestsPass(await runCLIAsync(`test ${appName}`)); - }, 600000); - - it('should support styled-jsx', async () => { - const appName = uniq('app'); - - runCLI( - `generate @nrwl/gatsby:app ${appName} --style styled-jsx --no-interactive` - ); - - runCLI(`build ${appName}`); - checkFilesExist( - `apps/${appName}/public/index.html`, - `apps/${appName}/public/404.html`, - `apps/${appName}/public/manifest.webmanifest` - ); - - const result = runCLI(`lint ${appName}`); - expect(result).toContain('All files pass linting.'); - - expectTestsPass(await runCLIAsync(`test ${appName}`)); - }, 300000); - - it('should support scss', async () => { - const appName = uniq('app'); - - runCLI( - `generate @nrwl/gatsby:app ${appName} --style scss --no-interactive` - ); - - runCLI(`build ${appName}`); - checkFilesExist( - `apps/${appName}/public/index.html`, - `apps/${appName}/public/404.html`, - `apps/${appName}/public/manifest.webmanifest` - ); - - const result = runCLI(`lint ${appName}`); - expect(result).toContain('All files pass linting.'); - - expectTestsPass(await runCLIAsync(`test ${appName}`)); - }, 300000); - - it('should support --js option', async () => { - const app = uniq('app'); - runCLI( - `generate @nrwl/gatsby:app ${app} --js --style css --no-interactive` - ); - - checkFilesExist( - `apps/${app}/package.json`, - `apps/${app}/src/pages/index.js`, - `apps/${app}/src/pages/index.spec.js` - ); - - runCLI(`build ${app}`); - checkFilesExist( - `apps/${app}/public/index.html`, - `apps/${app}/public/404.html`, - `apps/${app}/public/manifest.webmanifest` - ); - expectTestsPass(await runCLIAsync(`test ${app}`)); - }, 300000); -}); diff --git a/e2e/gatsby/tsconfig.json b/e2e/gatsby/tsconfig.json deleted file mode 100644 index 6d5abf8483..0000000000 --- a/e2e/gatsby/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "types": ["node", "jest"] - }, - "include": [], - "files": [], - "references": [ - { - "path": "./tsconfig.spec.json" - } - ] -} diff --git a/e2e/gatsby/tsconfig.spec.json b/e2e/gatsby/tsconfig.spec.json deleted file mode 100644 index 1ad559c708..0000000000 --- a/e2e/gatsby/tsconfig.spec.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", - "types": ["jest", "node"] - }, - "include": [ - "**/*.test.ts", - "**/*.spec.ts", - "**/*.spec.tsx", - "**/*.test.tsx", - "**/*.spec.js", - "**/*.test.js", - "**/*.spec.jsx", - "**/*.test.jsx", - "**/*.d.ts" - ] -} diff --git a/e2e/utils/index.ts b/e2e/utils/index.ts index 20e9d4675e..b54aa1c787 100644 --- a/e2e/utils/index.ts +++ b/e2e/utils/index.ts @@ -223,7 +223,6 @@ export function newProject({ `@nrwl/angular`, `@nrwl/eslint-plugin-nx`, `@nrwl/express`, - `@nrwl/gatsby`, `@nrwl/jest`, `@nrwl/js`, `@nrwl/linter`, diff --git a/e2e/workspace-create/src/create-nx-workspace.test.ts b/e2e/workspace-create/src/create-nx-workspace.test.ts index 2b415c33d8..71b5693f99 100644 --- a/e2e/workspace-create/src/create-nx-workspace.test.ts +++ b/e2e/workspace-create/src/create-nx-workspace.test.ts @@ -96,19 +96,6 @@ describe('create-nx-workspace', () => { expectNoAngularDevkit(); }); - xit('should be able to create an gatsby workspace', () => { - const wsName = uniq('gatsby'); - const appName = uniq('app'); - runCreateWorkspace(wsName, { - preset: 'gatsby', - style: 'css', - appName, - packageManager, - }); - - expectNoAngularDevkit(); - }); - it('should be able to create an web-components workspace', () => { const wsName = uniq('web-components'); const appName = uniq('app'); diff --git a/nx-dev/data-access-documents/src/lib/menu.utils.ts b/nx-dev/data-access-documents/src/lib/menu.utils.ts index 8cf24ca5ed..0c76f4b5a7 100644 --- a/nx-dev/data-access-documents/src/lib/menu.utils.ts +++ b/nx-dev/data-access-documents/src/lib/menu.utils.ts @@ -103,7 +103,6 @@ export function getApiSection(items: MenuItem[]): MenuSection { m.id === 'express' || m.id === 'nest' || m.id === 'next' || - m.id === 'gatsby' || m.id === 'detox' || m.id === 'react-native' || m.id === 'nx-plugin' || diff --git a/nx-dev/nx-dev/public/documentation/generated/api-gatsby/executors/build.md b/nx-dev/nx-dev/public/documentation/generated/api-gatsby/executors/build.md deleted file mode 100644 index f67e659231..0000000000 --- a/nx-dev/nx-dev/public/documentation/generated/api-gatsby/executors/build.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: '@nrwl/gatsby:build executor' -description: 'Build a Gatsby app' ---- - -# @nrwl/gatsby:build - -Build a Gatsby app - -Options can be configured in `workspace.json` when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/configuration/projectjson#targets. - -## Options - -### color - -Default: `true` - -Type: `boolean` - -Enable colored terminal output. - -### graphqlTracing - -Type: `boolean` - -Trace every graphql resolver, may have performance implications. - -### openTracingConfigFile - -Type: `string` - -Tracer configuration file (OpenTracing compatible). - -### prefixPaths - -Type: `boolean` - -Build site with link paths prefixed (set pathPrefix in your config). - -### profile - -Type: `boolean` - -Build site with react profiling. - -### uglify - -Default: `true` - -Type: `boolean` - -Build site without uglifying JS bundles (true by default). diff --git a/nx-dev/nx-dev/public/documentation/generated/api-gatsby/executors/server.md b/nx-dev/nx-dev/public/documentation/generated/api-gatsby/executors/server.md deleted file mode 100644 index 089c1c0385..0000000000 --- a/nx-dev/nx-dev/public/documentation/generated/api-gatsby/executors/server.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: '@nrwl/gatsby:server executor' -description: 'Starts server for app' ---- - -# @nrwl/gatsby:server - -Starts server for app - -Options can be configured in `workspace.json` when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/configuration/projectjson#targets. - -## Options - -### buildTarget - -Type: `string` - -Target which builds the application - -### host - -Default: `localhost` - -Type: `string` - -Host to listen on. - -### https - -Default: `false` - -Type: `boolean` - -Serve using HTTPS. - -### open - -Type: `boolean` - -Open the site in your (default) browser for you. - -### port - -Default: `4200` - -Type: `number` - -Port to listen on. diff --git a/nx-dev/nx-dev/public/documentation/generated/api-gatsby/generators/application.md b/nx-dev/nx-dev/public/documentation/generated/api-gatsby/generators/application.md deleted file mode 100644 index 066cb740da..0000000000 --- a/nx-dev/nx-dev/public/documentation/generated/api-gatsby/generators/application.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -title: '@nrwl/gatsby:application generator' -description: 'Create an application' ---- - -# @nrwl/gatsby:application - -Create an application - -## Usage - -```bash -nx generate application ... -``` - -```bash -nx g app ... # same -``` - -By default, Nx will search for `application` in the default collection provisioned in `workspace.json`. - -You can specify the collection explicitly as follows: - -```bash -nx g @nrwl/gatsby:application ... -``` - -Show what will be generated without writing to disk: - -```bash -nx g application ... --dry-run -``` - -## Options - -### name (_**required**_) - -Type: `string` - -### directory - -Alias(es): d - -Type: `string` - -A directory where the project is placed - -### e2eTestRunner - -Default: `cypress` - -Type: `string` - -Possible values: `cypress`, `none` - -Adds the specified e2e test runner - -### js - -Default: `false` - -Type: `boolean` - -Generate JavaScript files rather than TypeScript files - -### setParserOptionsProject - -Default: `false` - -Type: `boolean` - -Whether or not to configure the ESLint "parserOptions.project" option. We do not do this by default for lint performance reasons. - -### standaloneConfig - -Type: `boolean` - -Split the project configuration into /project.json rather than including it inside workspace.json - -### style - -Alias(es): s - -Default: `css` - -Type: `string` - -Possible values: `css`, `scss`, `styl`, `less`, `styled-components`, `@emotion/styled`, `styled-jsx`, `none` - -The file extension to be used for style files. - -### tags - -Alias(es): t - -Type: `string` - -Add tags to the project (used for linting) - -### unitTestRunner - -Default: `jest` - -Type: `string` - -Possible values: `jest`, `none` - -Adds the specified unit test runner diff --git a/nx-dev/nx-dev/public/documentation/generated/api-gatsby/generators/component.md b/nx-dev/nx-dev/public/documentation/generated/api-gatsby/generators/component.md deleted file mode 100644 index a79ef064e8..0000000000 --- a/nx-dev/nx-dev/public/documentation/generated/api-gatsby/generators/component.md +++ /dev/null @@ -1,112 +0,0 @@ ---- -title: '@nrwl/gatsby:component generator' -description: 'Create a component' ---- - -# @nrwl/gatsby:component - -Create a component - -## Usage - -```bash -nx generate component ... -``` - -By default, Nx will search for `component` in the default collection provisioned in `workspace.json`. - -You can specify the collection explicitly as follows: - -```bash -nx g @nrwl/gatsby:component ... -``` - -Show what will be generated without writing to disk: - -```bash -nx g component ... --dry-run -``` - -### Examples - -Generate a component in the mylib library: - -```bash -nx g component my-component --project=mylib -``` - -Generate a class component in the mylib library: - -```bash -nx g component my-component --project=mylib --classComponent -``` - -## Options - -### name (_**required**_) - -Type: `string` - -The name of the component. - -### project (_**required**_) - -Alias(es): p - -Type: `string` - -The name of the project. - -### directory - -Alias(es): dir - -Type: `string` - -Create the component under this directory (can be nested). - -### export - -Alias(es): e - -Default: `false` - -Type: `boolean` - -When true, the component is exported from the project index.ts (if it exists). - -### flat - -Default: `false` - -Type: `boolean` - -Create component at the source root rather than its own directory. - -### js - -Default: `false` - -Type: `boolean` - -Generate JavaScript files rather than TypeScript files. - -### skipTests - -Default: `false` - -Type: `boolean` - -When true, does not create "spec.ts" test files for the new component. - -### style - -Alias(es): s - -Default: `css` - -Type: `string` - -Possible values: `css`, `scss`, `styl`, `less`, `styled-components`, `@emotion/styled`, `styled-jsx`, `none` - -The file extension to be used for style files. diff --git a/nx-dev/nx-dev/public/documentation/generated/api-gatsby/generators/page.md b/nx-dev/nx-dev/public/documentation/generated/api-gatsby/generators/page.md deleted file mode 100644 index 9d70c6a171..0000000000 --- a/nx-dev/nx-dev/public/documentation/generated/api-gatsby/generators/page.md +++ /dev/null @@ -1,112 +0,0 @@ ---- -title: '@nrwl/gatsby:page generator' -description: 'Create a page' ---- - -# @nrwl/gatsby:page - -Create a page - -## Usage - -```bash -nx generate page ... -``` - -By default, Nx will search for `page` in the default collection provisioned in `workspace.json`. - -You can specify the collection explicitly as follows: - -```bash -nx g @nrwl/gatsby:page ... -``` - -Show what will be generated without writing to disk: - -```bash -nx g page ... --dry-run -``` - -### Examples - -Generate a page in the mylib library: - -```bash -nx g page my-page --project=mylib -``` - -Generate a class component in the mylib library: - -```bash -nx g page my-page --project=mylib --classComponent -``` - -## Options - -### name (_**required**_) - -Type: `string` - -The name of the component. - -### project (_**required**_) - -Alias(es): p - -Type: `string` - -The name of the project. - -### directory - -Alias(es): dir - -Type: `string` - -Create the component under this directory (can be nested). - -### export - -Alias(es): e - -Default: `false` - -Type: `boolean` - -When true, the component is exported from the project index.ts (if it exists). - -### flat - -Default: `false` - -Type: `boolean` - -Create component at the source root rather than its own directory. - -### js - -Default: `false` - -Type: `boolean` - -Generate JavaScript files rather than TypeScript files. - -### skipTests - -Default: `false` - -Type: `boolean` - -When true, does not create "spec.ts" test files for the new component. - -### style - -Alias(es): s - -Default: `css` - -Type: `string` - -Possible values: `css`, `scss`, `styl`, `less`, `styled-components`, `@emotion/styled`, `styled-jsx`, `none` - -The file extension to be used for style files. diff --git a/nx-dev/nx-dev/public/documentation/generated/api-js/executors/node.md b/nx-dev/nx-dev/public/documentation/generated/api-js/executors/node.md index da08ffc8f2..3f8d56c1c6 100644 --- a/nx-dev/nx-dev/public/documentation/generated/api-js/executors/node.md +++ b/nx-dev/nx-dev/public/documentation/generated/api-js/executors/node.md @@ -58,3 +58,11 @@ Extra args passed to the node process Type: `array` The targets to run to before starting the node app + +### watch + +Default: `true` + +Type: `boolean` + +Enable re-building when files change. diff --git a/nx-dev/nx-dev/public/documentation/generated/executors.json b/nx-dev/nx-dev/public/documentation/generated/executors.json index cb26dd84b8..d935d32a41 100644 --- a/nx-dev/nx-dev/public/documentation/generated/executors.json +++ b/nx-dev/nx-dev/public/documentation/generated/executors.json @@ -2,7 +2,6 @@ "angular", "cypress", "detox", - "gatsby", "jest", "js", "linter", diff --git a/nx-dev/nx-dev/public/documentation/generated/generators.json b/nx-dev/nx-dev/public/documentation/generated/generators.json index 4bc621d6ae..0605d7e687 100644 --- a/nx-dev/nx-dev/public/documentation/generated/generators.json +++ b/nx-dev/nx-dev/public/documentation/generated/generators.json @@ -3,7 +3,6 @@ "cypress", "detox", "express", - "gatsby", "jest", "js", "linter", diff --git a/nx-dev/nx-dev/public/documentation/map.json b/nx-dev/nx-dev/public/documentation/map.json index 4a9117c7c3..06bd305f50 100644 --- a/nx-dev/nx-dev/public/documentation/map.json +++ b/nx-dev/nx-dev/public/documentation/map.json @@ -1128,43 +1128,6 @@ } ] }, - { - "name": "gatsby", - "id": "gatsby", - "itemList": [ - { - "id": "overview", - "name": "Overview", - "searchResultsName": "@nrwl/gatsby Overview", - "file": "shared/gatsby-plugin" - }, - { - "name": "application generator", - "id": "application", - "file": "generated/api-gatsby/generators/application" - }, - { - "name": "component generator", - "id": "component", - "file": "generated/api-gatsby/generators/component" - }, - { - "name": "page generator", - "id": "page", - "file": "generated/api-gatsby/generators/page" - }, - { - "name": "build executor", - "id": "build", - "file": "generated/api-gatsby/executors/build" - }, - { - "name": "server executor", - "id": "server", - "file": "generated/api-gatsby/executors/server" - } - ] - }, { "name": "detox", "id": "detox", diff --git a/nx-dev/nx-dev/public/documentation/shared/gatsby-plugin.md b/nx-dev/nx-dev/public/documentation/shared/gatsby-plugin.md deleted file mode 100644 index a4cecfe04c..0000000000 --- a/nx-dev/nx-dev/public/documentation/shared/gatsby-plugin.md +++ /dev/null @@ -1,76 +0,0 @@ -# Gatsby Plugin - -The Nx Plugin for Gatsby contains executors and generators for managing Gatsby applications and libraries within an Nx workspace. It provides: - -- Scaffolding for creating, building, serving, linting, and testing Gatsby applications. -- Integration with building, serving, and exporting a Gatsby application. -- Integration with React libraries within the workspace. - -## Installing the Gatsby Plugin - -Installing the Gatsby plugin to a workspace can be done with the following: - -```bash -yarn add -D @nrwl/gatsby -``` - -```bash -npm install -D @nrwl/gatsby -``` - -## Applications - -Generating new applications can be done with the following: - -```bash -nx generate @nrwl/gatsby:application -``` - -This creates the following app structure: - -```treeview -myorg/ -├── apps/ -│ ├── myapp/ -│ │ ├── src/ -│ │ │ ├── pages/ -│ │ │ │ ├── index.module.css -│ │ │ │ └── index.tsx -│ │ ├── jest.conf.js -│ │ ├── tsconfig.json -│ │ ├── tsconfig.app.json -│ │ ├── tsconfig.spec.json -│ │ └── .eslintrc.json -│ └── myapp-e2e/ -│ │ ├── src/ -│ │ │ ├── integrations/ -│ │ │ │ └── app.spec.ts -│ │ │ ├── fixtures/ -│ │ │ ├── plugins/ -│ │ │ └── support/ -│ │ ├── cypress.json -│ │ ├── tsconfig.e2e.json -│ │ └── .eslintrc.json -├── libs/ -├── workspace.json -├── nx.json -├── package.json -├── tools/ -├── tsconfig.base.json -└── .eslintrc.json -``` - -## See Also - -- [Using Gatsby](https://www.gatsbyjs.com/docs/quick-start/) - -## Executors / Builders - -- [build](/gatsby/build) - Builds a Gatsby application -- [server](/gatsby/server) - Builds and serves a Gatsby application - -## Generators - -- [application](/gatsby/application) - Create a Gatsby application -- [component](/gatsby/component) - Create a Gatsby component -- [page](/gatsby/page) - Create a Gatsby page diff --git a/nx-dev/nx-dev/public/documentation/shared/getting-started/nx-and-react.md b/nx-dev/nx-dev/public/documentation/shared/getting-started/nx-and-react.md index 202babf572..3d259ef8ee 100644 --- a/nx-dev/nx-dev/public/documentation/shared/getting-started/nx-and-react.md +++ b/nx-dev/nx-dev/public/documentation/shared/getting-started/nx-and-react.md @@ -19,7 +19,7 @@ It is also a good idea to read the [mental model guide](/using-nx/mental-model) Nx plugins help you develop [React](/react/overview) applications with fully integrated support for modern tools and libraries like [Jest](/jest/overview), [Cypress](/cypress/overview), Storybook, [ESLint](/linter/eslint), and more. Nx also supports React -frameworks like [Gatsby](/gatsby/overview), [Next.js](/guides/nextjs), Remix, and has great support for [React Native](/react-native/overview). +frameworks like [Next.js](/guides/nextjs), Remix, and has great support for [React Native](/react-native/overview). diff --git a/nx-dev/nx-dev/public/documentation/shared/migration/adding-to-monorepo.md b/nx-dev/nx-dev/public/documentation/shared/migration/adding-to-monorepo.md index 9bbecca402..568e5627a2 100644 --- a/nx-dev/nx-dev/public/documentation/shared/migration/adding-to-monorepo.md +++ b/nx-dev/nx-dev/public/documentation/shared/migration/adding-to-monorepo.md @@ -163,7 +163,7 @@ faster and with better dev ergonomics. But Nx enables much more than that. Nx is like a VS Code of build tools. It has a very powerful core, but it's really the plugins and extra capabilities that really transform how you develop. -Nx has first class support for React, Next.js, Gatsby, React Native, Angular, Node, NestJS, Jest, Cypress, Storybook and +Nx has first class support for React, Next.js, React Native, Angular, Node, NestJS, Jest, Cypress, Storybook and many more. All the plugins are designed to work together and create a cohesive and pleasant to use dev environment. In addition, Nx makes a lot of things much easier, like building large apps incrementally, distributing CI (no point in diff --git a/packages/create-nx-workspace/bin/create-nx-workspace.ts b/packages/create-nx-workspace/bin/create-nx-workspace.ts index 01bf331c52..d416042aeb 100644 --- a/packages/create-nx-workspace/bin/create-nx-workspace.ts +++ b/packages/create-nx-workspace/bin/create-nx-workspace.ts @@ -31,7 +31,6 @@ export enum Preset { ReactWithExpress = 'react-express', ReactNative = 'react-native', NextJs = 'next', - Gatsby = 'gatsby', Nest = 'nest', Express = 'express', } @@ -66,10 +65,6 @@ const presetOptions: { name: Preset; message: string }[] = [ message: 'next.js [a workspace with a single Next.js application]', }, - { - name: Preset.Gatsby, - message: 'gatsby [a workspace with a single Gatsby application]', - }, { name: Preset.Nest, message: 'nest [a workspace with a single Nest application]', @@ -201,7 +196,7 @@ function showHelp() { cli CLI to power the Nx workspace (options: "nx", "angular") style Default style option to be used when a non-empty preset is selected - options: ("css", "scss", "less") plus ("styl") for all non-Angular and ("styled-components", "@emotion/styled", "styled-jsx") for React, Next.js, Gatsby + options: ("css", "scss", "less") plus ("styl") for all non-Angular and ("styled-components", "@emotion/styled", "styled-jsx") for React, Next.js interactive Enable interactive mode when using presets (boolean) @@ -424,14 +419,7 @@ function determineStyle(preset: Preset, parsedArgs: any) { }); } - if ( - [ - Preset.ReactWithExpress, - Preset.React, - Preset.NextJs, - Preset.Gatsby, - ].includes(preset) - ) { + if ([Preset.ReactWithExpress, Preset.React, Preset.NextJs].includes(preset)) { choices.push( { name: 'styled-components', @@ -689,7 +677,6 @@ function pointToTutorialAndCourse(preset: Preset) { case Preset.React: case Preset.ReactWithExpress: case Preset.NextJs: - case Preset.Gatsby: output.addVerticalSeparator(); output.note({ title, diff --git a/packages/gatsby/.eslintrc.json b/packages/gatsby/.eslintrc.json deleted file mode 100644 index 9a5af4e073..0000000000 --- a/packages/gatsby/.eslintrc.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "extends": "../../.eslintrc", - "rules": {}, - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": {} - }, - { - "files": ["**/*.ts"], - "excludedFiles": ["./src/migrations/**"], - "rules": { - "no-restricted-imports": [ - "error", - "@nrwl/workspace", - "@angular-devkit/core", - "@angular-devkit/schematics", - "@angular-devkit/architect" - ] - } - } - ], - "ignorePatterns": ["!**/*"] -} diff --git a/packages/gatsby/README.md b/packages/gatsby/README.md deleted file mode 100644 index cf55c2a6e2..0000000000 --- a/packages/gatsby/README.md +++ /dev/null @@ -1,13 +0,0 @@ -

Nx - Smart, Fast and Extensible Build System

- -{{links}} - -
- -# Nx: Smart, Fast and Extensible Build System - -Nx is a next generation build system with first class monorepo support and powerful integrations. - -This package is a [Gatsby plugin for Nx](https://nx.dev/gatsby/overview). - -{{content} diff --git a/packages/gatsby/babel.ts b/packages/gatsby/babel.ts deleted file mode 100644 index b6f9cf70ec..0000000000 --- a/packages/gatsby/babel.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Babel preset to provide Gatsby support for Nx. - */ - -interface GatsbyBabelOptions { - reactRuntime?: string; - reactImportSource?: string; -} - -module.exports = function (api: any, presetOptions: GatsbyBabelOptions) { - api.assertVersion(7); - return { - presets: [ - '@nrwl/web/babel', - [ - require.resolve('babel-preset-gatsby'), - getGatsbyBabelOptions({ presetOptions }), - ], - ], - }; -}; - -function getGatsbyBabelOptions({ presetOptions }) { - const gatsbyPresetOptions: Record = { - reactRuntime: presetOptions.reactRuntime ?? 'automatic', - }; - if (presetOptions.reactImportSource) { - gatsbyPresetOptions.reactImportSource = presetOptions.reactImportSource; - } - return gatsbyPresetOptions; -} diff --git a/packages/gatsby/executors.json b/packages/gatsby/executors.json deleted file mode 100644 index 88c99d87d7..0000000000 --- a/packages/gatsby/executors.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "executors": { - "build": { - "implementation": "./src/executors/build/build.impl", - "schema": "./src/executors/build/schema.json", - "description": "Build a Gatsby app" - }, - "server": { - "implementation": "./src/executors/server/server.impl", - "schema": "./src/executors/server/schema.json", - "description": "Starts server for app" - } - }, - "builders": { - "build": { - "implementation": "./src/executors/build/compat", - "schema": "./src/executors/build/schema.json", - "description": "Build a Gatsby app" - }, - "server": { - "implementation": "./src/executors/server/compat", - "schema": "./src/executors/server/schema.json", - "description": "Starts server for app" - } - } -} diff --git a/packages/gatsby/generators.json b/packages/gatsby/generators.json deleted file mode 100644 index 9b913854a9..0000000000 --- a/packages/gatsby/generators.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "nx/gatsby", - "version": "0.1", - "extends": ["@nrwl/react"], - "schematics": { - "init": { - "factory": "./src/generators/init/init#gatsbyInitSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Initialize the @nrwl/gatsby plugin", - "hidden": true - }, - "application": { - "factory": "./src/generators/application/application#applicationSchematic", - "schema": "./src/generators/application/schema.json", - "aliases": ["app"], - "x-type": "application", - "description": "Create an application" - }, - "component": { - "factory": "./src/generators/component/component#componentSchematic", - "schema": "./src/generators/component/schema.json", - "description": "Create a component" - }, - "page": { - "factory": "./src/generators/page/page#pageSchematic", - "schema": "./src/generators/page/schema.json", - "description": "Create a page" - } - }, - "generators": { - "init": { - "factory": "./src/generators/init/init", - "schema": "./src/generators/init/schema.json", - "description": "Initialize the @nrwl/gatsby plugin", - "hidden": true - }, - "application": { - "factory": "./src/generators/application/application", - "schema": "./src/generators/application/schema.json", - "aliases": ["app"], - "x-type": "application", - "description": "Create an application" - }, - "component": { - "factory": "./src/generators/component/component", - "schema": "./src/generators/component/schema.json", - "description": "Create a component" - }, - "page": { - "factory": "./src/generators/page/page", - "schema": "./src/generators/page/schema.json", - "description": "Create a page" - } - } -} diff --git a/packages/gatsby/index.ts b/packages/gatsby/index.ts deleted file mode 100644 index d89670cbf0..0000000000 --- a/packages/gatsby/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { applicationGenerator } from './src/generators/application/application'; -export { componentGenerator } from './src/generators/component/component'; -export { pageGenerator } from './src/generators/page/page'; diff --git a/packages/gatsby/jest.config.js b/packages/gatsby/jest.config.js deleted file mode 100644 index b1ed06522c..0000000000 --- a/packages/gatsby/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - preset: '../../jest.preset.js', - transform: { - '^.+\\.[tj]sx?$': 'ts-jest', - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'], - globals: { 'ts-jest': { tsconfig: '/tsconfig.spec.json' } }, - displayName: 'gatsby', - testEnvironment: 'node', -}; diff --git a/packages/gatsby/migrations.json b/packages/gatsby/migrations.json deleted file mode 100644 index 63d7288f95..0000000000 --- a/packages/gatsby/migrations.json +++ /dev/null @@ -1,458 +0,0 @@ -{ - "schematics": { - "add-js-include-11.6.0": { - "cli": "nx", - "version": "11.6.0-beta.0", - "description": "Add js patterns to tsconfig.app.json", - "factory": "./src/migrations/update-11-6-0/add-js-include-11-6-0" - }, - "replace-node-sass-with-sass-12-6-1": { - "cli": "nx", - "version": "12.6.0-beta.12", - "description": "Replace node-sass with sass in package.json", - "factory": "./src/migrations/update-12-6-1/replace-node-sass-with-sass-12-6-1" - }, - "replace-gatsby-image-with-gatsby-plugin-image-12.9.1": { - "cli": "nx", - "version": "12.9.1-beta.1", - "description": "Replace gatsby-image with gatsby-image-plugin in package.json", - "factory": "./src/migrations/update-12-9-1/replace-gatsby-image-with-gatsby-plugin-image-12-9-1" - } - }, - "packageJsonUpdates": { - "12.0.0": { - "version": "12.0.0-beta.0", - "packages": { - "gatsby": { - "version": "3.1.3", - "alwaysAddToPackageJson": false - }, - "gatsby-image": { - "version": "3.1.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-manifest": { - "version": "3.1.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-offline": { - "version": "4.1.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-react-helmet": { - "version": "4.1.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-sharp": { - "version": "3.1.3", - "alwaysAddToPackageJson": false - }, - "gatsby-source-filesystem": { - "version": "3.1.0", - "alwaysAddToPackageJson": false - }, - "gatsby-transformer-sharp": { - "version": "3.1.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-typescript": { - "version": "3.1.0", - "alwaysAddToPackageJson": false - }, - "@testing-library/react": { - "version": "11.2.6", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-emotion": { - "version": "6.1.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-styled-components": { - "version": "4.1.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-sass": { - "version": "4.1.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-less": { - "version": "5.1.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-stylus": { - "version": "3.1.0", - "alwaysAddToPackageJson": false - }, - "node-sass": { - "version": "5.0.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-svgr": { - "version": "3.0.0-beta.0", - "alwaysAddToPackageJson": false - } - } - }, - "12.3.0": { - "version": "12.3.0-beta.0", - "packages": { - "gatsby": { - "version": "3.5.0", - "alwaysAddToPackageJson": false - }, - "gatsby-image": { - "version": "3.5.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-manifest": { - "version": "3.5.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-offline": { - "version": "4.5.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-react-helmet": { - "version": "4.5.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-sharp": { - "version": "3.5.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-styled-jsx": { - "version": "4.5.0", - "alwaysAddToPackageJson": false - }, - "gatsby-source-filesystem": { - "version": "3.5.0", - "alwaysAddToPackageJson": false - }, - "gatsby-transformer-sharp": { - "version": "3.5.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-typescript": { - "version": "3.5.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-emotion": { - "version": "6.5.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-styled-components": { - "version": "4.5.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-sass": { - "version": "4.5.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-less": { - "version": "5.5.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-stylus": { - "version": "3.5.0", - "alwaysAddToPackageJson": false - } - } - }, - "12.6.0": { - "version": "12.6.0-beta.12", - "packages": { - "gatsby": { - "version": "3.10.0", - "alwaysAddToPackageJson": false - }, - "gatsby-image": { - "version": "3.10.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-manifest": { - "version": "3.10.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-offline": { - "version": "4.10.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-react-helmet": { - "version": "4.10.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-sharp": { - "version": "3.10.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-styled-jsx": { - "version": "4.10.0", - "alwaysAddToPackageJson": false - }, - "gatsby-source-filesystem": { - "version": "3.10.0", - "alwaysAddToPackageJson": false - }, - "gatsby-transformer-sharp": { - "version": "3.10.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-typescript": { - "version": "3.10.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-emotion": { - "version": "6.10.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-styled-components": { - "version": "4.10.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-sass": { - "version": "4.10.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-less": { - "version": "5.10.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-stylus": { - "version": "3.10.0", - "alwaysAddToPackageJson": false - }, - "@testing-library/react": { - "version": "12.0.0", - "alwaysAddToPackageJson": false - } - } - }, - "12.9.1": { - "version": "12.9.1-beta.1", - "packages": { - "gatsby": { - "version": "3.14.0", - "alwaysAddToPackageJson": false - }, - "gatsby-image": { - "version": "3.11.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-manifest": { - "version": "3.14.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-offline": { - "version": "4.14.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-react-helmet": { - "version": "4.14.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-sharp": { - "version": "3.14.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-styled-jsx": { - "version": "4.14.0", - "alwaysAddToPackageJson": false - }, - "gatsby-source-filesystem": { - "version": "3.14.0", - "alwaysAddToPackageJson": false - }, - "gatsby-transformer-sharp": { - "version": "3.14.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-typescript": { - "version": "3.14.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-emotion": { - "version": "6.14.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-styled-components": { - "version": "4.14.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-sass": { - "version": "4.14.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-less": { - "version": "5.14.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-pnpm": { - "version": "1.2.8", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-stylus": { - "version": "3.14.0", - "alwaysAddToPackageJson": false - }, - "sass": { - "version": "1.41.1", - "alwaysAddToPackageJson": false - }, - "@testing-library/react": { - "version": "12.1.0", - "alwaysAddToPackageJson": false - } - } - }, - "13.2.0": { - "version": "13.2.0-beta.0", - "packages": { - "gatsby": { - "version": "4.1.3", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-image": { - "version": "2.1.1", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-manifest": { - "version": "4.1.2", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-offline": { - "version": "5.1.2", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-react-helmet": { - "version": "5.1.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-sharp": { - "version": "4.1.2", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-styled-jsx": { - "version": "5.1.0", - "alwaysAddToPackageJson": false - }, - "gatsby-source-filesystem": { - "version": "4.1.1", - "alwaysAddToPackageJson": false - }, - "gatsby-transformer-sharp": { - "version": "4.1.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-typescript": { - "version": "4.1.1", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-emotion": { - "version": "7.1.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-styled-components": { - "version": "5.1.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-sass": { - "version": "5.1.1", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-less": { - "version": "6.1.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-stylus": { - "version": "4.1.0", - "alwaysAddToPackageJson": false - }, - "sass": { - "version": "1.41.1", - "alwaysAddToPackageJson": false - }, - "@testing-library/react": { - "version": "12.1.2", - "alwaysAddToPackageJson": false - } - } - }, - "13.2.1": { - "version": "13.2.0-beta.0", - "packages": { - "gatsby": { - "version": "4.2.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-image": { - "version": "2.2.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-manifest": { - "version": "4.2.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-offline": { - "version": "5.2.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-react-helmet": { - "version": "5.2.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-sharp": { - "version": "4.2.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-styled-jsx": { - "version": "5.2.0", - "alwaysAddToPackageJson": false - }, - "gatsby-source-filesystem": { - "version": "4.2.0", - "alwaysAddToPackageJson": false - }, - "gatsby-transformer-sharp": { - "version": "4.2.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-typescript": { - "version": "4.2.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-emotion": { - "version": "7.2.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-styled-components": { - "version": "5.2.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-sass": { - "version": "5.2.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-less": { - "version": "6.2.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-stylus": { - "version": "4.2.0", - "alwaysAddToPackageJson": false - }, - "gatsby-plugin-pnpm": { - "version": "1.2.9", - "alwaysAddToPackageJson": false - }, - "babel-preset-gatsby": { - "version": "2.2.0", - "alwaysAddToPackageJson": false - }, - "babel-plugin-module-resolver": { - "version": "4.1.0", - "alwaysAddToPackageJson": false - } - } - } - } -} diff --git a/packages/gatsby/migrations.spec.ts b/packages/gatsby/migrations.spec.ts deleted file mode 100644 index 6ea4938bbd..0000000000 --- a/packages/gatsby/migrations.spec.ts +++ /dev/null @@ -1,12 +0,0 @@ -import path = require('path'); -import json = require('./migrations.json'); - -describe('Gatsby migrations', () => { - it('should have valid paths', () => { - Object.values(json.schematics).forEach((m) => { - expect(() => - require.resolve(path.join(__dirname, `${m.factory}.ts`)) - ).not.toThrow(); - }); - }); -}); diff --git a/packages/gatsby/package.json b/packages/gatsby/package.json deleted file mode 100644 index 611b1ff0b6..0000000000 --- a/packages/gatsby/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "@nrwl/gatsby", - "version": "0.0.1", - "description": "Gatsby Plugin for Nx", - "repository": { - "type": "git", - "url": "https://github.com/nrwl/nx.git", - "directory": "packages/gatsby" - }, - "keywords": [ - "Monorepo", - "Gatsby", - "Web", - "Jest", - "Cypress", - "CLI" - ], - "main": "./index.js", - "typings": "./index.d.ts", - "author": "Victor Savkin", - "license": "MIT", - "bugs": { - "url": "https://github.com/nrwl/nx/issues" - }, - "homepage": "https://nx.dev", - "schematics": "./generators.json", - "builders": "./executors.json", - "ng-update": { - "requirements": {}, - "migrations": "./migrations.json" - }, - "peerDependencies": { - "gatsby": "^4.2.0" - }, - "dependencies": { - "@nrwl/cypress": "*", - "@nrwl/linter": "*", - "@nrwl/devkit": "*", - "@nrwl/jest": "*", - "@nrwl/react": "*", - "@nrwl/workspace": "*", - "gatsby-cli": "^4.2.0", - "gatsby-codemods": "^3.2.0" - } -} diff --git a/packages/gatsby/plugins/nx-gatsby-ext-plugin/gatsby-config.ts b/packages/gatsby/plugins/nx-gatsby-ext-plugin/gatsby-config.ts deleted file mode 100644 index 7b21fd565d..0000000000 --- a/packages/gatsby/plugins/nx-gatsby-ext-plugin/gatsby-config.ts +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - plugins: [`gatsby-plugin-typescript`], -}; diff --git a/packages/gatsby/plugins/nx-gatsby-ext-plugin/gatsby-node.ts b/packages/gatsby/plugins/nx-gatsby-ext-plugin/gatsby-node.ts deleted file mode 100644 index 02a4184a1c..0000000000 --- a/packages/gatsby/plugins/nx-gatsby-ext-plugin/gatsby-node.ts +++ /dev/null @@ -1,26 +0,0 @@ -import * as path from 'path'; -import { appRootPath } from '@nrwl/tao/src/utils/app-root'; -import { readJsonFile } from '@nrwl/devkit'; - -function onCreateBabelConfig({ actions }, options) { - const tsConfig = readJsonFile(path.join(appRootPath, 'tsconfig.base.json')); - const tsConfigPaths: { [key: string]: Array } = - tsConfig.compilerOptions.paths; - - const paths = Object.entries(tsConfigPaths).reduce((result, [key, paths]) => { - return { - ...result, - [key]: paths.map((p) => path.join(appRootPath, p)), - }; - }, {}); - - actions.setBabelPlugin({ - name: require.resolve(`babel-plugin-module-resolver`), - options: { - root: ['./src'], - alias: paths, - }, - }); -} - -export { onCreateBabelConfig }; diff --git a/packages/gatsby/plugins/nx-gatsby-ext-plugin/package.json b/packages/gatsby/plugins/nx-gatsby-ext-plugin/package.json deleted file mode 100644 index e52d3bcad0..0000000000 --- a/packages/gatsby/plugins/nx-gatsby-ext-plugin/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "nx-gatsby-ext-plugin", - "version": "1.0.0", - "main": "gatsby-config.js", - "license": "MIT" -} diff --git a/packages/gatsby/project.json b/packages/gatsby/project.json deleted file mode 100644 index 0fb9f68c23..0000000000 --- a/packages/gatsby/project.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "root": "packages/gatsby", - "sourceRoot": "packages/gatsby", - "projectType": "library", - "targets": { - "test": { - "executor": "@nrwl/jest:jest", - "options": { - "jestConfig": "packages/gatsby/jest.config.js", - "passWithNoTests": true - }, - "outputs": ["coverage/packages/gatsby"] - }, - "build-base": { - "executor": "@nrwl/js:tsc", - "options": { - "outputPath": "build/packages/gatsby", - "tsConfig": "packages/gatsby/tsconfig.lib.json", - "main": "packages/gatsby/index.ts", - "assets": [ - { - "input": "packages/gatsby/src", - "glob": "**/.babelrc*", - "output": "./src" - }, - { - "input": "packages/gatsby/src", - "glob": "**/*.!(ts)", - "output": "./src" - }, - { - "input": "packages/gatsby/plugins", - "glob": "**/*.!(ts)", - "output": "./plugins" - }, - { - "input": "packages/gatsby", - "glob": "**/*.json", - "ignore": ["**/tsconfig*.json", "project.json"], - "output": "/" - }, - { - "input": "packages/gatsby", - "glob": "**/*.js", - "ignore": ["**/jest.config.js"], - "output": "/" - }, - { - "input": "packages/gatsby", - "glob": "**/*.d.ts", - "output": "/" - }, - "LICENSE" - ] - }, - "outputs": ["{options.outputPath}"] - }, - "build": { - "executor": "@nrwl/workspace:run-commands", - "outputs": ["build/packages/gatsby"], - "options": { - "commands": [ - { - "command": "node ./scripts/copy-readme.js gatsby" - } - ], - "parallel": false - } - }, - "lint": { - "executor": "@nrwl/linter:eslint", - "options": { - "lintFilePatterns": [ - "packages/gatsby/**/*.ts", - "packages/gatsby/**/*.spec.ts", - "packages/gatsby/**/*_spec.ts", - "packages/gatsby/**/*.spec.tsx", - "packages/gatsby/**/*.spec.js", - "packages/gatsby/**/*.spec.jsx", - "packages/gatsby/**/*.d.ts" - ] - }, - "outputs": ["{options.outputFile}"] - } - }, - "tags": [] -} diff --git a/packages/gatsby/src/executors/build/build.impl.ts b/packages/gatsby/src/executors/build/build.impl.ts deleted file mode 100644 index 18f24344aa..0000000000 --- a/packages/gatsby/src/executors/build/build.impl.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { fork } from 'child_process'; -import { join } from 'path'; -import { GatsbyPluginBuilderSchema } from './schema'; -import { ExecutorContext } from '@nrwl/tao/src/shared/workspace'; - -export default async function buildExecutor( - options: GatsbyPluginBuilderSchema, - context: ExecutorContext -) { - const projectRoot = context.workspace.projects[context.projectName].root; - await runGatsbyBuild(context.root, projectRoot, context.projectName, options); - - return { success: true }; -} - -export function runGatsbyBuild( - workspaceRoot: string, - projectRoot: string, - projectName: string, - options: GatsbyPluginBuilderSchema -) { - return new Promise((resolve, reject) => { - const cp = fork( - require.resolve('gatsby-cli'), - ['build', ...createGatsbyBuildOptions(options)], - { - cwd: join(workspaceRoot, projectRoot), - } - ); - - // Ensure the child process is killed when the parent exits - process.on('exit', () => cp.kill()); - process.on('SIGTERM', () => cp.kill()); - - cp.on('error', (err) => { - reject(err); - }); - - cp.on('exit', (code) => { - if (code === 0) { - resolve(); - } else { - reject( - new Error(`Could not build "${projectName}". See errors above.`) - ); - } - }); - }); -} - -function createGatsbyBuildOptions(options: GatsbyPluginBuilderSchema) { - return Object.keys(options).reduce((acc, k) => { - const val = options[k]; - if (typeof val === 'undefined') return acc; - switch (k) { - case 'prefixPaths': - return val ? acc.concat(`--prefix-paths`) : acc; - case 'uglify': - return val ? acc : acc.concat('--no-uglify'); - case 'color': - return val ? acc : acc.concat('--no-color'); - case 'profile': - return val ? acc.concat('--profile') : acc; - case 'openTracingConfigFile': - return val ? acc.concat([`--open-tracing-config-file`, val]) : acc; - case 'graphqlTracing': - return val ? acc.concat('--graphql-tracing') : acc; - case 'serve': - case 'host': - case 'port': - default: - return acc; - } - }, []); -} diff --git a/packages/gatsby/src/executors/build/compat.ts b/packages/gatsby/src/executors/build/compat.ts deleted file mode 100644 index 477ba0be5f..0000000000 --- a/packages/gatsby/src/executors/build/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nrwl/devkit'; - -import buildExecutor from './build.impl'; - -export default convertNxExecutor(buildExecutor); diff --git a/packages/gatsby/src/executors/build/schema.d.ts b/packages/gatsby/src/executors/build/schema.d.ts deleted file mode 100644 index c92517fb0d..0000000000 --- a/packages/gatsby/src/executors/build/schema.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export interface GatsbyPluginBuilderSchema { - prefixPaths?: boolean; - uglify?: boolean; - profile?: boolean; - openTracingConfigFile?: string; - graphqlTracing?: boolean; - color?: boolean; -} diff --git a/packages/gatsby/src/executors/build/schema.json b/packages/gatsby/src/executors/build/schema.json deleted file mode 100644 index 68f10fb056..0000000000 --- a/packages/gatsby/src/executors/build/schema.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "cli": "nx", - "$schema": "http://json-schema.org/schema", - "title": "GatsbyPlugin builder", - "description": "", - "type": "object", - "properties": { - "prefixPaths": { - "type": "boolean", - "description": "Build site with link paths prefixed (set pathPrefix in your config)." - }, - "uglify": { - "type": "boolean", - "description": "Build site without uglifying JS bundles (true by default).", - "default": true - }, - "profile": { - "type": "boolean", - "description": "Build site with react profiling." - }, - "openTracingConfigFile": { - "type": "string", - "description": "Tracer configuration file (OpenTracing compatible)." - }, - "graphqlTracing": { - "type": "boolean", - "description": "Trace every graphql resolver, may have performance implications." - }, - "color": { - "type": "boolean", - "description": "Enable colored terminal output.", - "default": true - } - }, - "required": [] -} diff --git a/packages/gatsby/src/executors/server/compat.ts b/packages/gatsby/src/executors/server/compat.ts deleted file mode 100644 index c70f628f39..0000000000 --- a/packages/gatsby/src/executors/server/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nrwl/devkit'; - -import serverExecutor from './server.impl'; - -export default convertNxExecutor(serverExecutor); diff --git a/packages/gatsby/src/executors/server/schema.d.ts b/packages/gatsby/src/executors/server/schema.d.ts deleted file mode 100644 index 5fe0d97842..0000000000 --- a/packages/gatsby/src/executors/server/schema.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface GatsbyPluginBuilderSchema { - buildTarget: string; - host: string; - port: string; - open: boolean; - https: boolean; -} diff --git a/packages/gatsby/src/executors/server/schema.json b/packages/gatsby/src/executors/server/schema.json deleted file mode 100644 index c0d8d38b3c..0000000000 --- a/packages/gatsby/src/executors/server/schema.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "cli": "nx", - "title": "Gatsby development server", - "description": "Gatsby development server", - "type": "object", - "properties": { - "buildTarget": { - "type": "string", - "description": "Target which builds the application" - }, - "port": { - "type": "number", - "description": "Port to listen on.", - "default": 4200 - }, - "host": { - "type": "string", - "description": "Host to listen on.", - "default": "localhost" - }, - "https": { - "type": "boolean", - "description": "Serve using HTTPS.", - "default": false - }, - "open": { - "type": "boolean", - "description": "Open the site in your (default) browser for you." - } - }, - "required": [] -} diff --git a/packages/gatsby/src/executors/server/server.impl.ts b/packages/gatsby/src/executors/server/server.impl.ts deleted file mode 100644 index 2f8a4da737..0000000000 --- a/packages/gatsby/src/executors/server/server.impl.ts +++ /dev/null @@ -1,167 +0,0 @@ -import { - ExecutorContext, - parseTargetString, - readTargetOptions, -} from '@nrwl/devkit'; -import { ChildProcess, fork } from 'child_process'; -import { join } from 'path'; -import { runGatsbyBuild } from '../build/build.impl'; -import { GatsbyPluginBuilderSchema as BuildBuilderSchema } from '../build/schema'; -import { GatsbyPluginBuilderSchema } from './schema'; - -export default async function* serverExecutor( - options: GatsbyPluginBuilderSchema, - context: ExecutorContext -) { - const buildTarget = parseTargetString(options.buildTarget); - const baseUrl = `${options.https ? 'https' : 'http'}://${options.host}:${ - options.port - }`; - const projectRoot = context.workspace.projects[context.projectName].root; - const buildOptions = readTargetOptions( - buildTarget, - context - ); - - try { - if (context.configurationName === 'production') { - await runGatsbyBuild( - context.root, - projectRoot, - context.projectName, - buildOptions - ); - - await runGatsbyServe(context.root, projectRoot, options); - - yield { baseUrl, success: true }; - } else { - const success = await runGatsbyDevelop( - context.root, - projectRoot, - createGatsbyOptions(options) - ); - - yield { - baseUrl, - success, - }; - } - - // This Promise intentionally never resolves, leaving the process running - await new Promise<{ success: boolean }>(() => {}); - } finally { - if (childProcess) { - childProcess.kill(); - } - } -} - -function createGatsbyOptions(options) { - return Object.keys(options).reduce((acc, k) => { - if (k === 'port' || k === 'host' || k === 'https' || k === 'open') - acc.push(`--${k}=${options[k]}`); - return acc; - }, []); -} - -let childProcess: ChildProcess; - -async function runGatsbyDevelop(workspaceRoot, projectRoot, options) { - return new Promise((resolve, reject) => { - childProcess = fork( - require.resolve('gatsby-cli'), - ['develop', ...options], - { - cwd: join(workspaceRoot, projectRoot), - env: { - ...process.env, - }, - stdio: ['inherit', 'inherit', 'inherit', 'ipc'], - } - ); - - childProcess.on('message', ({ action }: any) => { - if ( - action?.type === 'ACTIVITY_END' && - action?.payload?.status === 'SUCCESS' && - action?.payload?.id === 'webpack-develop' - ) { - resolve(true); - } - }); - - childProcess.on('error', (err) => { - reject(err); - }); - - childProcess.on('exit', (code) => { - if (code !== 0) { - reject( - new Error( - 'Could not start Gatsby Development Server. See errors above.' - ) - ); - } - }); - }); -} - -function runGatsbyServe( - workspaceRoot: string, - projectRoot: string, - options: GatsbyPluginBuilderSchema -) { - return new Promise((resolve, reject) => { - childProcess = fork( - require.resolve('gatsby-cli'), - ['serve', ...createGatsbyServeOptions(options)], - { cwd: join(workspaceRoot, projectRoot) } - ); - - childProcess.on('message', ({ action }: any) => { - if ( - action?.type === 'LOG' && - action?.payload?.text?.includes(options.host) && - action?.payload?.text?.includes(options.port) - ) { - resolve(true); - } - }); - - childProcess.on('error', (err) => { - reject(err); - }); - - childProcess.on('exit', (code) => { - if (code === 0) { - resolve(code); - } else { - reject( - new Error( - 'Could not start Gatsby Production Server. See errors above.' - ) - ); - } - }); - }); -} - -function createGatsbyServeOptions(options: GatsbyPluginBuilderSchema) { - return Object.keys(options).reduce((acc, k) => { - const val = options[k]; - if (typeof val === 'undefined') return acc; - switch (k) { - case 'host': - return val ? acc.concat([`--host`, val]) : acc; - case 'open': - return val ? acc.concat(`--open`) : acc; - case 'prefixPaths': - return val ? acc.concat(`--prefix-paths`) : acc; - case 'port': - return val ? acc.concat([`--port`, val]) : acc; - default: - return acc; - } - }, []); -} diff --git a/packages/gatsby/src/generators/application/application.spec.ts b/packages/gatsby/src/generators/application/application.spec.ts deleted file mode 100644 index 39025515ad..0000000000 --- a/packages/gatsby/src/generators/application/application.spec.ts +++ /dev/null @@ -1,407 +0,0 @@ -import { NxJsonConfiguration, readProjectConfiguration } from '@nrwl/devkit'; -import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; -import { applicationGenerator } from './application'; -import { readJson, Tree } from '@nrwl/devkit'; - -describe('app', () => { - let tree: Tree; - - beforeEach(() => { - tree = createTreeWithEmptyWorkspace(); - tree.write('.gitignore', '# empty'); - tree.write('.prettierignore', '# empty'); - }); - - it('should update workspace.json', async () => { - await applicationGenerator(tree, { - name: 'myApp', - style: 'css', - standaloneConfig: false, - }); - const workspaceJson = readJson(tree, '/workspace.json'); - const nxJson = readJson(tree, 'nx.json'); - - expect(workspaceJson.projects['my-app'].root).toEqual('apps/my-app'); - expect(workspaceJson.projects['my-app-e2e'].root).toEqual( - 'apps/my-app-e2e' - ); - expect(nxJson.defaultProject).toEqual('my-app'); - }); - - it('should update tags + implicitDependencies', async () => { - await applicationGenerator(tree, { - name: 'myApp', - style: 'css', - tags: 'one,two', - standaloneConfig: false, - }); - const myAppConfig = readProjectConfiguration(tree, 'my-app'); - const myAppConfigE2E = readProjectConfiguration(tree, 'my-app-e2e'); - expect({ - 'my-app': { tags: myAppConfig.tags }, - 'my-app-e2e': { - tags: myAppConfigE2E.tags, - implicitDependencies: myAppConfigE2E.implicitDependencies, - }, - }).toEqual({ - 'my-app': { - tags: ['one', 'two'], - }, - 'my-app-e2e': { - tags: [], - implicitDependencies: ['my-app'], - }, - }); - }); - - it('should generate files', async () => { - await applicationGenerator(tree, { - name: 'myApp', - style: 'css', - standaloneConfig: false, - }); - expect(tree.exists('apps/my-app/tsconfig.json')).toBeTruthy(); - expect(tree.exists('apps/my-app/tsconfig.app.json')).toBeTruthy(); - expect(tree.exists('apps/my-app/src/pages/index.tsx')).toBeTruthy(); - expect(tree.exists('apps/my-app/src/pages/index.spec.tsx')).toBeTruthy(); - expect(tree.exists('apps/my-app/src/pages/index.module.css')).toBeTruthy(); - }); - - describe('--style scss', () => { - it('should generate scss styles', async () => { - await applicationGenerator(tree, { - name: 'myApp', - style: 'scss', - standaloneConfig: false, - }); - expect( - tree.exists('apps/my-app/src/pages/index.module.scss') - ).toBeTruthy(); - - const indexContent = tree - .read('apps/my-app/src/pages/index.tsx') - .toString(); - expect(indexContent).toContain( - `import * as styles from './index.module.scss'` - ); - - const nxJson = readJson(tree, 'nx.json'); - expect(nxJson.generators['@nrwl/gatsby'].application.style).toEqual( - 'scss' - ); - }); - }); - - describe('--style less', () => { - it('should generate less styles', async () => { - await applicationGenerator(tree, { - name: 'myApp', - style: 'less', - standaloneConfig: false, - }); - expect( - tree.exists('apps/my-app/src/pages/index.module.less') - ).toBeTruthy(); - - const indexContent = tree - .read('apps/my-app/src/pages/index.tsx') - .toString(); - expect(indexContent).toContain( - `import * as styles from './index.module.less'` - ); - - const nxJson = readJson(tree, 'nx.json'); - expect(nxJson.generators['@nrwl/gatsby'].application.style).toEqual( - 'less' - ); - }); - }); - - describe('--style styl', () => { - it('should generate stylus styles', async () => { - await applicationGenerator(tree, { - name: 'myApp', - style: 'styl', - standaloneConfig: false, - }); - expect( - tree.exists('apps/my-app/src/pages/index.module.styl') - ).toBeTruthy(); - - const indexContent = tree - .read('apps/my-app/src/pages/index.tsx') - .toString(); - expect(indexContent).toContain( - `import * as styles from './index.module.styl'` - ); - - const nxJson = readJson(tree, 'nx.json'); - expect(nxJson.generators['@nrwl/gatsby'].application.style).toEqual( - 'styl' - ); - }); - }); - - describe('--style styled-components', () => { - it('should generate scss styles', async () => { - await applicationGenerator(tree, { - name: 'myApp', - style: 'styled-components', - standaloneConfig: false, - }); - expect( - tree.exists('apps/my-app/src/pages/index.module.styled-components') - ).toBeFalsy(); - - const indexContent = tree - .read('apps/my-app/src/pages/index.tsx') - .toString(); - expect(indexContent).not.toContain( - `import * as styles from './index.module` - ); - expect(indexContent).toContain(`import styled from 'styled-components'`); - - const nxJson = readJson(tree, 'nx.json'); - expect(nxJson.generators['@nrwl/gatsby'].application.style).toEqual( - 'styled-components' - ); - }); - }); - - describe('--style @emotion/styled', () => { - it('should generate emotion styles', async () => { - await applicationGenerator(tree, { - name: 'myApp', - style: '@emotion/styled', - standaloneConfig: false, - }); - expect( - tree.exists('apps/my-app/src/pages/index.module.styled-components') - ).toBeFalsy(); - - const indexContent = tree - .read('apps/my-app/src/pages/index.tsx') - .toString(); - expect(indexContent).not.toContain( - `import * as styles from './index.module` - ); - expect(indexContent).toContain(`import styled from '@emotion/styled'`); - - const nxJson = readJson(tree, 'nx.json'); - expect(nxJson.generators['@nrwl/gatsby'].application.style).toEqual( - '@emotion/styled' - ); - }); - }); - - describe('--style styled-jsx', () => { - it('should use ` : `` %> - <%- appContent %> - > - ); -}; - -export default Index; diff --git a/packages/gatsby/src/generators/application/files/tsconfig.app.json__tmpl__ b/packages/gatsby/src/generators/application/files/tsconfig.app.json__tmpl__ deleted file mode 100644 index d1cb9e25d0..0000000000 --- a/packages/gatsby/src/generators/application/files/tsconfig.app.json__tmpl__ +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "<%= offsetFromRoot %>dist/out-tsc", - "types": [ - <% if (style === 'styled-jsx') { %>"styled-jsx",<% } %> - "node" - ] - }, - "exclude": ["**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", "**/*.test.tsx", "**/*.spec.js", "**/*.test.js", "**/*.spec.jsx", "**/*.test.jsx"], - "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"] -} diff --git a/packages/gatsby/src/generators/application/files/tsconfig.json__tmpl__ b/packages/gatsby/src/generators/application/files/tsconfig.json__tmpl__ deleted file mode 100644 index b6056551ec..0000000000 --- a/packages/gatsby/src/generators/application/files/tsconfig.json__tmpl__ +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "<%= offsetFromRoot %>tsconfig.base.json", - "compilerOptions": { - "jsx": "preserve", - "allowJs": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": false, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "resolveJsonModule": true, - "isolatedModules": true - }, - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.app.json" - } - ], - "exclude": ["node_modules"] -} diff --git a/packages/gatsby/src/generators/application/lib/add-cypress.ts b/packages/gatsby/src/generators/application/lib/add-cypress.ts deleted file mode 100644 index 54afddaeb7..0000000000 --- a/packages/gatsby/src/generators/application/lib/add-cypress.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { cypressProjectGenerator } from '@nrwl/cypress'; -import { Tree } from '@nrwl/devkit'; -import { NormalizedSchema } from './normalize-options'; -import { Linter } from '@nrwl/linter'; - -export async function addCypress(host: Tree, options: NormalizedSchema) { - if (options?.e2eTestRunner !== 'cypress') { - return () => {}; - } - - return cypressProjectGenerator(host, { - ...options, - linter: Linter.EsLint, - name: `${options.name}-e2e`, - directory: options.directory, - project: options.projectName, - }); -} diff --git a/packages/gatsby/src/generators/application/lib/add-git-ignore-entry.ts b/packages/gatsby/src/generators/application/lib/add-git-ignore-entry.ts deleted file mode 100644 index 7d6d3e7d2d..0000000000 --- a/packages/gatsby/src/generators/application/lib/add-git-ignore-entry.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { logger, Tree } from '@nrwl/devkit'; -import { NormalizedSchema } from './normalize-options'; - -export function addGitIgnoreEntry(host: Tree, options: NormalizedSchema) { - if (host.exists('.gitignore')) { - let content = host.read('.gitignore', 'utf-8'); - content = `${content}\n/apps/${options.projectName}/node_modules\n/apps/${options.projectName}/public\n/apps/${options.projectName}/.cache\n`; - host.write('.gitignore', content); - } else { - logger.warn(`Couldn't find .gitignore file to update`); - } -} diff --git a/packages/gatsby/src/generators/application/lib/add-jest.ts b/packages/gatsby/src/generators/application/lib/add-jest.ts deleted file mode 100644 index d11e28dc43..0000000000 --- a/packages/gatsby/src/generators/application/lib/add-jest.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { jestProjectGenerator } from '@nrwl/jest'; -import { NormalizedSchema } from './normalize-options'; -import { Tree, updateJson } from '@nrwl/devkit'; - -export async function addJest(host: Tree, options: NormalizedSchema) { - if (options?.unitTestRunner !== 'jest') { - return () => {}; - } - - const installTask = await jestProjectGenerator(host, { - project: options.projectName, - supportTsx: true, - skipSerializers: true, - setupFile: 'none', - compiler: 'babel', - }); - - updateJson(host, `${options.projectRoot}/tsconfig.spec.json`, (json) => { - json.compilerOptions.jsx = 'react'; - return json; - }); - - return installTask; -} diff --git a/packages/gatsby/src/generators/application/lib/add-linting.ts b/packages/gatsby/src/generators/application/lib/add-linting.ts deleted file mode 100644 index b1175c2637..0000000000 --- a/packages/gatsby/src/generators/application/lib/add-linting.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { Tree } from '@nrwl/tao/src/shared/tree'; -import { runTasksInSerial } from '@nrwl/workspace/src/utilities/run-tasks-in-serial'; -import { Linter, lintProjectGenerator } from '@nrwl/linter'; -import { - addDependenciesToPackageJson, - joinPathFragments, - updateJson, -} from '@nrwl/devkit'; -import { extraEslintDependencies, createReactEslintJson } from '@nrwl/react'; -import type { Linter as ESLintLinter } from 'eslint'; -import { NormalizedSchema } from './normalize-options'; - -export async function addLinting(host: Tree, options: NormalizedSchema) { - const lintTask = await lintProjectGenerator(host, { - linter: Linter.EsLint, - project: options.projectName, - tsConfigPaths: [ - joinPathFragments(options.projectRoot, 'tsconfig.app.json'), - ], - eslintFilePatterns: [`${options.projectRoot}/**/*.{ts,tsx,js,jsx}`], - skipFormat: true, - }); - - const reactEslintJson = createReactEslintJson( - options.projectRoot, - options.setParserOptionsProject - ); - - updateJson( - host, - joinPathFragments(options.projectRoot, '.eslintrc.json'), - (json: ESLintLinter.Config) => { - json = reactEslintJson; - json.ignorePatterns = ['!**/*', 'public', '.cache']; - - for (const override of json.overrides) { - if (!override.files || override.files.length !== 2) { - continue; - } - if ( - !(override.files.includes('*.ts') && override.files.includes('*.tsx')) - ) { - continue; - } - override.rules = override.rules || {}; - override.rules['@typescript-eslint/camelcase'] = 'off'; - } - - return json; - } - ); - - const installTask = await addDependenciesToPackageJson( - host, - extraEslintDependencies.dependencies, - extraEslintDependencies.devDependencies - ); - - return runTasksInSerial(lintTask, installTask); -} diff --git a/packages/gatsby/src/generators/application/lib/add-prettier-ignore-entry.ts b/packages/gatsby/src/generators/application/lib/add-prettier-ignore-entry.ts deleted file mode 100644 index 5d19f5310a..0000000000 --- a/packages/gatsby/src/generators/application/lib/add-prettier-ignore-entry.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { logger, Tree } from '@nrwl/devkit'; -import { NormalizedSchema } from './normalize-options'; - -export function addPrettierIgnoreEntry(host: Tree, options: NormalizedSchema) { - if (host.exists('.prettierignore')) { - let content = host.read('.prettierignore', 'utf-8'); - content = `${content}\n/apps/${options.projectName}/node_modules\n/apps/${options.projectName}/public\n/apps/${options.projectName}/.cache\n`; - host.write('.prettierignore', content); - } else { - logger.warn(`Couldn't find .prettierignore file to update`); - } -} diff --git a/packages/gatsby/src/generators/application/lib/add-project.ts b/packages/gatsby/src/generators/application/lib/add-project.ts deleted file mode 100644 index 08f5cffad1..0000000000 --- a/packages/gatsby/src/generators/application/lib/add-project.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { NormalizedSchema } from './normalize-options'; -import { - addProjectConfiguration, - joinPathFragments, - ProjectConfiguration, - Tree, -} from '@nrwl/devkit'; - -export function addProject(host: Tree, options: NormalizedSchema) { - const targets: Record = {}; - - targets.build = { - builder: '@nrwl/gatsby:build', - options: { - outputPath: `${options.projectRoot}/public`, - uglify: true, - color: true, - profile: false, - }, - configurations: { - production: {}, - }, - }; - - targets.serve = { - builder: '@nrwl/gatsby:server', - options: { - buildTarget: `${options.projectName}:build`, - }, - configurations: { - production: { - buildTarget: `${options.projectName}:build:production`, - }, - }, - }; - - const project: ProjectConfiguration = { - root: options.projectRoot, - sourceRoot: joinPathFragments(options.projectRoot, 'src'), - projectType: 'application', - targets, - tags: options.parsedTags, - }; - - addProjectConfiguration( - host, - options.projectName, - project, - options.standaloneConfig - ); -} diff --git a/packages/gatsby/src/generators/application/lib/create-application-files.helpers.ts b/packages/gatsby/src/generators/application/lib/create-application-files.helpers.ts deleted file mode 100644 index 6c702e9514..0000000000 --- a/packages/gatsby/src/generators/application/lib/create-application-files.helpers.ts +++ /dev/null @@ -1,819 +0,0 @@ -export function createAppJsx(name: string) { - return ` -