@nx/remix 16.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +120 -0
  2. package/generators.json +69 -0
  3. package/migrations.json +119 -0
  4. package/package.json +17 -0
  5. package/src/generators/action/action.impl.d.ts +3 -0
  6. package/src/generators/action/action.impl.js +41 -0
  7. package/src/generators/action/action.impl.js.map +1 -0
  8. package/src/generators/action/schema.d.ts +4 -0
  9. package/src/generators/action/schema.json +26 -0
  10. package/src/generators/application/application.impl.d.ts +3 -0
  11. package/src/generators/application/application.impl.js +94 -0
  12. package/src/generators/application/application.impl.js.map +1 -0
  13. package/src/generators/application/files/common/README.md__tmpl__ +54 -0
  14. package/src/generators/application/files/common/app/root.tsx__tmpl__ +32 -0
  15. package/src/generators/application/files/common/app/routes/index.tsx__tmpl__ +32 -0
  16. package/src/generators/application/files/common/public/favicon.ico +0 -0
  17. package/src/generators/application/files/common/remix.config.js__tmpl__ +11 -0
  18. package/src/generators/application/files/common/remix.env.d.ts__tmpl__ +2 -0
  19. package/src/generators/application/files/common/tsconfig.json__tmpl__ +18 -0
  20. package/src/generators/application/files/integrated/.gitignore__tmpl__ +4 -0
  21. package/src/generators/application/files/integrated/package.json__tmpl__ +32 -0
  22. package/src/generators/application/lib/normalize-options.d.ts +8 -0
  23. package/src/generators/application/lib/normalize-options.js +20 -0
  24. package/src/generators/application/lib/normalize-options.js.map +1 -0
  25. package/src/generators/application/schema.d.ts +6 -0
  26. package/src/generators/application/schema.json +32 -0
  27. package/src/generators/cypress/cypress.impl.d.ts +2 -0
  28. package/src/generators/cypress/cypress.impl.js +45 -0
  29. package/src/generators/cypress/cypress.impl.js.map +1 -0
  30. package/src/generators/cypress/schema.json +55 -0
  31. package/src/generators/library/library.impl.d.ts +3 -0
  32. package/src/generators/library/library.impl.js +57 -0
  33. package/src/generators/library/library.impl.js.map +1 -0
  34. package/src/generators/library/schema.d.ts +9 -0
  35. package/src/generators/library/schema.json +44 -0
  36. package/src/generators/loader/loader.impl.d.ts +3 -0
  37. package/src/generators/loader/loader.impl.js +41 -0
  38. package/src/generators/loader/loader.impl.js.map +1 -0
  39. package/src/generators/loader/schema.d.ts +4 -0
  40. package/src/generators/loader/schema.json +26 -0
  41. package/src/generators/meta/lib/normalize-options.d.ts +3 -0
  42. package/src/generators/meta/lib/normalize-options.js +15 -0
  43. package/src/generators/meta/lib/normalize-options.js.map +1 -0
  44. package/src/generators/meta/lib/v1.impl.d.ts +3 -0
  45. package/src/generators/meta/lib/v1.impl.js +30 -0
  46. package/src/generators/meta/lib/v1.impl.js.map +1 -0
  47. package/src/generators/meta/lib/v2.impl.d.ts +3 -0
  48. package/src/generators/meta/lib/v2.impl.js +30 -0
  49. package/src/generators/meta/lib/v2.impl.js.map +1 -0
  50. package/src/generators/meta/meta.impl.d.ts +3 -0
  51. package/src/generators/meta/meta.impl.js +22 -0
  52. package/src/generators/meta/meta.impl.js.map +1 -0
  53. package/src/generators/meta/schema.d.ts +5 -0
  54. package/src/generators/meta/schema.json +30 -0
  55. package/src/generators/preset/lib/normalize-options.d.ts +8 -0
  56. package/src/generators/preset/lib/normalize-options.js +18 -0
  57. package/src/generators/preset/lib/normalize-options.js.map +1 -0
  58. package/src/generators/preset/preset.impl.d.ts +3 -0
  59. package/src/generators/preset/preset.impl.js +29 -0
  60. package/src/generators/preset/preset.impl.js.map +1 -0
  61. package/src/generators/preset/schema.d.ts +4 -0
  62. package/src/generators/preset/schema.json +13 -0
  63. package/src/generators/resource-route/resource-route.impl.d.ts +3 -0
  64. package/src/generators/resource-route/resource-route.impl.js +35 -0
  65. package/src/generators/resource-route/resource-route.impl.js.map +1 -0
  66. package/src/generators/resource-route/schema.d.ts +7 -0
  67. package/src/generators/resource-route/schema.json +48 -0
  68. package/src/generators/route/route.impl.d.ts +3 -0
  69. package/src/generators/route/route.impl.js +65 -0
  70. package/src/generators/route/route.impl.js.map +1 -0
  71. package/src/generators/route/schema.d.ts +9 -0
  72. package/src/generators/route/schema.json +59 -0
  73. package/src/generators/setup/schema.json +13 -0
  74. package/src/generators/setup/setup.impl.d.ts +2 -0
  75. package/src/generators/setup/setup.impl.js +34 -0
  76. package/src/generators/setup/setup.impl.js.map +1 -0
  77. package/src/generators/style/schema.d.ts +4 -0
  78. package/src/generators/style/schema.json +33 -0
  79. package/src/generators/style/style.impl.d.ts +3 -0
  80. package/src/generators/style/style.impl.js +53 -0
  81. package/src/generators/style/style.impl.js.map +1 -0
  82. package/src/index.d.ts +0 -0
  83. package/src/index.js +1 -0
  84. package/src/index.js.map +1 -0
  85. package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.d.ts +6 -0
  86. package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.js +45 -0
  87. package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.js.map +1 -0
  88. package/src/migrations/update-15-8-6/update-remix-env-d.d.ts +6 -0
  89. package/src/migrations/update-15-8-6/update-remix-env-d.js +27 -0
  90. package/src/migrations/update-15-8-6/update-remix-env-d.js.map +1 -0
  91. package/src/utils/get-default-export-name.d.ts +2 -0
  92. package/src/utils/get-default-export-name.js +10 -0
  93. package/src/utils/get-default-export-name.js.map +1 -0
  94. package/src/utils/get-default-export.d.ts +2 -0
  95. package/src/utils/get-default-export.js +16 -0
  96. package/src/utils/get-default-export.js.map +1 -0
  97. package/src/utils/get-remix-projects.d.ts +2 -0
  98. package/src/utils/get-remix-projects.js +15 -0
  99. package/src/utils/get-remix-projects.js.map +1 -0
  100. package/src/utils/insert-import.d.ts +4 -0
  101. package/src/utils/insert-import.js +55 -0
  102. package/src/utils/insert-import.js.map +1 -0
  103. package/src/utils/insert-statement-after-imports.d.ts +5 -0
  104. package/src/utils/insert-statement-after-imports.js +29 -0
  105. package/src/utils/insert-statement-after-imports.js.map +1 -0
  106. package/src/utils/insert-statement-in-default-function.d.ts +2 -0
  107. package/src/utils/insert-statement-in-default-function.js +24 -0
  108. package/src/utils/insert-statement-in-default-function.js.map +1 -0
  109. package/src/utils/remix-config.d.ts +5 -0
  110. package/src/utils/remix-config.js +22 -0
  111. package/src/utils/remix-config.js.map +1 -0
  112. package/src/utils/remix-route-utils.d.ts +13 -0
  113. package/src/utils/remix-route-utils.js +64 -0
  114. package/src/utils/remix-route-utils.js.map +1 -0
  115. package/src/utils/versions.d.ts +11 -0
  116. package/src/utils/versions.js +24 -0
  117. package/src/utils/versions.js.map +1 -0
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": "<%= offsetFromRoot %>tsconfig.base.json",
3
+ "include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
4
+ "compilerOptions": {
5
+ "lib": ["DOM", "DOM.Iterable", "ES2019"],
6
+ "isolatedModules": true,
7
+ "esModuleInterop": true,
8
+ "jsx": "react-jsx",
9
+ "moduleResolution": "node",
10
+ "resolveJsonModule": true,
11
+ "target": "ES2019",
12
+ "strict": true,
13
+ "allowJs": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ // Remix takes care of building everything in `remix build`.
16
+ "noEmit": true
17
+ }
18
+ }
@@ -0,0 +1,4 @@
1
+ .cache
2
+ build
3
+ public/build
4
+ .env
@@ -0,0 +1,32 @@
1
+ {
2
+ "private": true,
3
+ "name": "<%= projectName %>",
4
+ "description": "",
5
+ "license": "",
6
+ "scripts": {
7
+ "build": "nx exec -- remix build",
8
+ "dev": "nx exec -- remix dev",
9
+ "start": "nx exec -- remix-serve build",
10
+ "typecheck": "nx exec -- tsc"
11
+ },
12
+ "dependencies": {
13
+ "@remix-run/node": "<%= remixVersion %>",
14
+ "@remix-run/react": "<%= remixVersion %>",
15
+ "@remix-run/serve": "<%= remixVersion %>",
16
+ "isbot": "<%= isbotVersion %>",
17
+ "react": "<%= reactVersion %>",
18
+ "react-dom": "<%= reactDomVersion %>"
19
+ },
20
+ "devDependencies": {
21
+ "@remix-run/dev": "<%= remixVersion %>",
22
+ "@remix-run/eslint-config": "<%= remixVersion %>",
23
+ "@types/react": "<%= typesReactVersion %>",
24
+ "@types/react-dom": "<%= typesReactDomVersion %>",
25
+ "eslint": "<%= eslintVersion %>",
26
+ "typescript": "<%= typescriptVersion %>"
27
+ },
28
+ "engines": {
29
+ "node": ">=14"
30
+ },
31
+ "sideEffects": false
32
+ }
@@ -0,0 +1,8 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { NxRemixGeneratorSchema } from '../schema';
3
+ export interface NormalizedSchema extends NxRemixGeneratorSchema {
4
+ projectName: string;
5
+ projectRoot: string;
6
+ parsedTags: string[];
7
+ }
8
+ export declare function normalizeOptions(tree: Tree, options: NxRemixGeneratorSchema): NormalizedSchema;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeOptions = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ function normalizeOptions(tree, options) {
6
+ const { appsDir } = (0, devkit_1.getWorkspaceLayout)(tree);
7
+ const name = (0, devkit_1.names)(options.name).fileName;
8
+ const projectName = name;
9
+ const projectRoot = options.rootProject
10
+ ? '.'
11
+ : (0, devkit_1.joinPathFragments)(appsDir, name);
12
+ const parsedTags = options.tags
13
+ ? options.tags.split(',').map((s) => s.trim())
14
+ : [];
15
+ return Object.assign(Object.assign({}, options), { projectName,
16
+ projectRoot,
17
+ parsedTags });
18
+ }
19
+ exports.normalizeOptions = normalizeOptions;
20
+ //# sourceMappingURL=normalize-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":";;;AAAA,uCAAgF;AAShF,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAA+B;IAE/B,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;IAC1C,MAAM,WAAW,GAAG,IAAI,CAAC;IACzB,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW;QACrC,CAAC,CAAC,GAAG;QACL,CAAC,CAAC,IAAA,0BAAiB,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACrC,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI;QAC7B,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9C,CAAC,CAAC,EAAE,CAAC;IAEP,uCACK,OAAO,KACV,WAAW;QACX,WAAW;QACX,UAAU,IACV;AACJ,CAAC;AApBD,4CAoBC"}
@@ -0,0 +1,6 @@
1
+ export interface NxRemixGeneratorSchema {
2
+ name: string;
3
+ tags?: string;
4
+ skipFormat?: boolean;
5
+ rootProject?: boolean;
6
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "NxRemixApplication",
4
+ "title": "Create an Application",
5
+ "type": "object",
6
+ "properties": {
7
+ "name": {
8
+ "type": "string",
9
+ "description": "",
10
+ "$default": {
11
+ "$source": "argv",
12
+ "index": 0
13
+ },
14
+ "x-prompt": "What is the name of the application?"
15
+ },
16
+ "tags": {
17
+ "type": "string",
18
+ "description": "Add tags to the project (used for linting)",
19
+ "alias": "t"
20
+ },
21
+ "skipFormat": {
22
+ "type": "boolean",
23
+ "description": "Skip formatting files",
24
+ "default": false
25
+ },
26
+ "rootProject": {
27
+ "type": "boolean",
28
+ "x-priority": "internal",
29
+ "default": false
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function (tree: Tree, options: any): Promise<() => Promise<void>>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nx/devkit");
5
+ const package_json_1 = require("nx/package.json");
6
+ function default_1(tree, options) {
7
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
+ const { cypressInitGenerator, cypressProjectGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', package_json_1.version);
9
+ const initSideEffects = yield cypressInitGenerator(tree, {});
10
+ const projSideEffects = yield cypressProjectGenerator(tree, Object.assign(Object.assign({}, options), { standaloneConfig: true }));
11
+ const config = (0, devkit_1.readProjectConfiguration)(tree, options.name);
12
+ tree.delete((0, devkit_1.joinPathFragments)(config.sourceRoot, 'support', 'app.po.ts'));
13
+ tree.write((0, devkit_1.joinPathFragments)(config.sourceRoot, 'e2e', 'app.cy.ts'), `describe('webapp', () => {
14
+ beforeEach(() => cy.visit('/'));
15
+
16
+ it('should display welcome message', () => {
17
+ cy.get('h1').contains('Welcome to Remix');
18
+ });
19
+ });`);
20
+ const supportFilePath = (0, devkit_1.joinPathFragments)(config.sourceRoot, 'support', 'e2e.ts');
21
+ const supportContent = tree.read(supportFilePath, 'utf-8');
22
+ tree.write(supportFilePath, `${supportContent}
23
+
24
+ // from https://github.com/remix-run/indie-stack
25
+ Cypress.on("uncaught:exception", (err) => {
26
+ // Cypress and React Hydrating the document don't get along
27
+ // for some unknown reason. Hopefully we figure out why eventually
28
+ // so we can remove this.
29
+ if (
30
+ /hydrat/i.test(err.message) ||
31
+ /Minified React error #418/.test(err.message) ||
32
+ /Minified React error #423/.test(err.message)
33
+ ) {
34
+ return false;
35
+ }
36
+ });`);
37
+ // returning this in case the cypress generator has any side effects
38
+ return () => tslib_1.__awaiter(this, void 0, void 0, function* () {
39
+ yield initSideEffects();
40
+ yield projSideEffects();
41
+ });
42
+ });
43
+ }
44
+ exports.default = default_1;
45
+ //# sourceMappingURL=cypress.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cypress.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/cypress/cypress.impl.ts"],"names":[],"mappings":";;;AAAA,uCAKoB;AAEpB,kDAAuD;AAEvD,mBAA+B,IAAU,EAAE,OAAY;;QACrD,MAAM,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,GAAG,IAAA,sBAAa,EACrE,aAAa,EACb,sBAAS,CACV,CAAC;QAEF,MAAM,eAAe,GAAG,MAAM,oBAAoB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC7D,MAAM,eAAe,GAAG,MAAM,uBAAuB,CAAC,IAAI,kCACrD,OAAO,KACV,gBAAgB,EAAE,IAAI,IACtB,CAAC;QAEH,MAAM,MAAM,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAC5D,IAAI,CAAC,MAAM,CAAC,IAAA,0BAAiB,EAAC,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;QAC1E,IAAI,CAAC,KAAK,CACR,IAAA,0BAAiB,EAAC,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,WAAW,CAAC,EACxD;;;;;;IAMA,CACD,CAAC;QAEF,MAAM,eAAe,GAAG,IAAA,0BAAiB,EACvC,MAAM,CAAC,UAAU,EACjB,SAAS,EACT,QAAQ,CACT,CAAC;QACF,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QAE3D,IAAI,CAAC,KAAK,CACR,eAAe,EACf,GAAG,cAAc;;;;;;;;;;;;;;IAcjB,CACD,CAAC;QAEF,oEAAoE;QACpE,OAAO,GAAS,EAAE;YAChB,MAAM,eAAe,EAAE,CAAC;YACxB,MAAM,eAAe,EAAE,CAAC;QAC1B,CAAC,CAAA,CAAC;IACJ,CAAC;CAAA;AAxDD,4BAwDC"}
@@ -0,0 +1,55 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "NxRemixCypress",
4
+ "title": "",
5
+ "type": "object",
6
+ "properties": {
7
+ "project": {
8
+ "type": "string",
9
+ "description": "The name of the frontend project to test.",
10
+ "$default": {
11
+ "$source": "projectName"
12
+ }
13
+ },
14
+ "baseUrl": {
15
+ "type": "string",
16
+ "description": "URL to access the application on",
17
+ "default": "http://localhost:3000"
18
+ },
19
+ "name": {
20
+ "type": "string",
21
+ "description": "Name of the E2E Project",
22
+ "$default": {
23
+ "$source": "argv",
24
+ "index": 0
25
+ },
26
+ "x-prompt": "What name would you like to use for the e2e project?"
27
+ },
28
+ "directory": {
29
+ "type": "string",
30
+ "description": "A directory where the project is placed"
31
+ },
32
+ "linter": {
33
+ "description": "The tool to use for running lint checks.",
34
+ "type": "string",
35
+ "enum": ["eslint", "none"],
36
+ "default": "eslint"
37
+ },
38
+ "js": {
39
+ "description": "Generate JavaScript files rather than TypeScript files",
40
+ "type": "boolean",
41
+ "default": false
42
+ },
43
+ "skipFormat": {
44
+ "description": "Skip formatting files",
45
+ "type": "boolean",
46
+ "default": false
47
+ },
48
+ "setParserOptionsProject": {
49
+ "type": "boolean",
50
+ "description": "Whether or not to configure the ESLint \"parserOptions.project\" option. We do not do this by default for lint performance reasons.",
51
+ "default": false
52
+ }
53
+ },
54
+ "required": ["name"]
55
+ }
@@ -0,0 +1,3 @@
1
+ import { GeneratorCallback, Tree } from '@nx/devkit';
2
+ import { NxRemixGeneratorSchema } from './schema';
3
+ export default function (tree: Tree, options: NxRemixGeneratorSchema): Promise<GeneratorCallback>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nx/devkit");
5
+ const linter_1 = require("@nx/linter");
6
+ const library_1 = require("@nx/react/src/generators/library/library");
7
+ const child_process_1 = require("child_process");
8
+ function default_1(tree, options) {
9
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
+ const tasks = [];
11
+ const name = (0, devkit_1.names)(options.name).fileName;
12
+ const pm = (0, devkit_1.detectPackageManager)();
13
+ const { libsDir } = (0, devkit_1.getWorkspaceLayout)(tree);
14
+ const projectRoot = (0, devkit_1.joinPathFragments)(libsDir, name);
15
+ const libGenTask = yield (0, library_1.libraryGenerator)(tree, {
16
+ name,
17
+ style: options.style,
18
+ unitTestRunner: 'jest',
19
+ tags: options.tags,
20
+ importPath: options.importPath,
21
+ skipFormat: false,
22
+ skipTsConfig: false,
23
+ linter: linter_1.Linter.EsLint,
24
+ component: true,
25
+ });
26
+ tasks.push(libGenTask);
27
+ // Nest dist under project root to we can link it
28
+ const project = (0, devkit_1.readProjectConfiguration)(tree, name);
29
+ project.targets.build.options = Object.assign(Object.assign({}, project.targets.build.options), { format: ['cjs'], outputPath: (0, devkit_1.joinPathFragments)(projectRoot, 'dist') });
30
+ (0, devkit_1.updateProjectConfiguration)(tree, name, project);
31
+ // Point to nested dist for yarn/npm/pnpm workspaces
32
+ (0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(projectRoot, 'package.json'), (json) => {
33
+ json.main = './dist/index.cjs.js';
34
+ json.typings = './dist/index.d.ts';
35
+ return json;
36
+ });
37
+ // Link workspaces
38
+ tasks.push(() => {
39
+ let command;
40
+ if (pm === 'npm') {
41
+ command = `npm install -ws`;
42
+ }
43
+ else if (pm === 'yarn') {
44
+ command = `yarn`;
45
+ }
46
+ else if (pm === 'pnpm') {
47
+ command = `pnpm install`;
48
+ }
49
+ (0, child_process_1.execSync)(command, {
50
+ stdio: [0, 1, 2],
51
+ });
52
+ });
53
+ return (0, devkit_1.runTasksInSerial)(...tasks);
54
+ });
55
+ }
56
+ exports.default = default_1;
57
+ //# sourceMappingURL=library.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/library/library.impl.ts"],"names":[],"mappings":";;;AAAA,uCAWoB;AACpB,uCAAoC;AACpC,sEAA4E;AAC5E,iDAAyC;AAGzC,mBAA+B,IAAU,EAAE,OAA+B;;QACxE,MAAM,KAAK,GAAwB,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;QAC1C,MAAM,EAAE,GAAG,IAAA,6BAAoB,GAAE,CAAC;QAClC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;QAC7C,MAAM,WAAW,GAAG,IAAA,0BAAiB,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAErD,MAAM,UAAU,GAAG,MAAM,IAAA,0BAAgB,EAAC,IAAI,EAAE;YAC9C,IAAI;YACJ,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,cAAc,EAAE,MAAM;YACtB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,UAAU,EAAE,KAAK;YACjB,YAAY,EAAE,KAAK;YACnB,MAAM,EAAE,eAAM,CAAC,MAAM;YACrB,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAEvB,iDAAiD;QACjD,MAAM,OAAO,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACrD,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,mCACxB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,KAChC,MAAM,EAAE,CAAC,KAAK,CAAC,EACf,UAAU,EAAE,IAAA,0BAAiB,EAAC,WAAW,EAAE,MAAM,CAAC,GACnD,CAAC;QACF,IAAA,mCAA0B,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAEhD,oDAAoD;QACpD,IAAA,mBAAU,EAAC,IAAI,EAAE,IAAA,0BAAiB,EAAC,WAAW,EAAE,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE;YACxE,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;YAClC,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC;YACnC,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,kBAAkB;QAClB,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;YACd,IAAI,OAAe,CAAC;YACpB,IAAI,EAAE,KAAK,KAAK,EAAE;gBAChB,OAAO,GAAG,iBAAiB,CAAC;aAC7B;iBAAM,IAAI,EAAE,KAAK,MAAM,EAAE;gBACxB,OAAO,GAAG,MAAM,CAAC;aAClB;iBAAM,IAAI,EAAE,KAAK,MAAM,EAAE;gBACxB,OAAO,GAAG,cAAc,CAAC;aAC1B;YACD,IAAA,wBAAQ,EAAC,OAAO,EAAE;gBAChB,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;aACjB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,IAAA,yBAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AApDD,4BAoDC"}
@@ -0,0 +1,9 @@
1
+ import { SupportedStyles } from '@nx/react';
2
+
3
+ export interface NxRemixGeneratorSchema {
4
+ name: string;
5
+ tags?: string;
6
+ importPath?: string;
7
+ js?: boolean;
8
+ style: SupportedStyles;
9
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "NxRemixLibrary",
4
+ "title": "Create a Library",
5
+ "type": "object",
6
+ "examples": [
7
+ {
8
+ "command": "g lib mylib --directory=myapp",
9
+ "description": "Generate libs/myapp/mylib"
10
+ }
11
+ ],
12
+ "properties": {
13
+ "name": {
14
+ "type": "string",
15
+ "description": "Library name",
16
+ "$default": {
17
+ "$source": "argv",
18
+ "index": 0
19
+ },
20
+ "x-prompt": "What name would you like to use for the library?",
21
+ "pattern": "^[a-zA-Z].*$"
22
+ },
23
+ "tags": {
24
+ "type": "string",
25
+ "description": "Add tags to the library (used for linting)"
26
+ },
27
+ "style": {
28
+ "type": "string",
29
+ "description": "Generate a stylesheet",
30
+ "enum": ["none", "css"],
31
+ "default": "css"
32
+ },
33
+ "importPath": {
34
+ "type": "string",
35
+ "description": "The library name used to import it, like @myorg/my-awesome-lib"
36
+ },
37
+ "js": {
38
+ "type": "boolean",
39
+ "description": "Generate JavaScript files rather than TypeScript files",
40
+ "default": false
41
+ }
42
+ },
43
+ "required": ["name"]
44
+ }
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { LoaderSchema } from './schema';
3
+ export default function (tree: Tree, schema: LoaderSchema): Promise<void>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nx/devkit");
5
+ const insert_import_1 = require("../../utils/insert-import");
6
+ const insert_statement_after_imports_1 = require("../../utils/insert-statement-after-imports");
7
+ const insert_statement_in_default_function_1 = require("../../utils/insert-statement-in-default-function");
8
+ const remix_route_utils_1 = require("../../utils/remix-route-utils");
9
+ function default_1(tree, schema) {
10
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
+ const routeFilePath = (0, remix_route_utils_1.resolveRemixRouteFile)(tree, schema.path, schema.project);
12
+ if (!tree.exists(routeFilePath)) {
13
+ throw new Error(`Route path does not exist: ${routeFilePath}. Please generate a Remix route first.`);
14
+ }
15
+ (0, insert_import_1.insertImport)(tree, routeFilePath, 'useLoaderData', '@remix-run/react');
16
+ (0, insert_import_1.insertImport)(tree, routeFilePath, 'json', '@remix-run/node');
17
+ (0, insert_import_1.insertImport)(tree, routeFilePath, 'LoaderArgs', '@remix-run/node', {
18
+ typeOnly: true,
19
+ });
20
+ (0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, routeFilePath, `
21
+ export const loader = async ({request}: LoaderArgs ) => {
22
+ return json({
23
+ message: 'Hello, world!',
24
+ })
25
+ };
26
+
27
+ `);
28
+ const statement = `\nconst data = useLoaderData<typeof loader>();`;
29
+ try {
30
+ (0, insert_statement_in_default_function_1.insertStatementInDefaultFunction)(tree, routeFilePath, statement);
31
+ // eslint-disable-next-line no-empty
32
+ }
33
+ catch (err) {
34
+ }
35
+ finally {
36
+ yield (0, devkit_1.formatFiles)(tree);
37
+ }
38
+ });
39
+ }
40
+ exports.default = default_1;
41
+ //# sourceMappingURL=loader.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/loader/loader.impl.ts"],"names":[],"mappings":";;;AAAA,uCAA+C;AAC/C,6DAAyD;AACzD,+FAAyF;AACzF,2GAAoG;AACpG,qEAAsE;AAGtE,mBAA+B,IAAU,EAAE,MAAoB;;QAC7D,MAAM,aAAa,GAAG,IAAA,yCAAqB,EACzC,IAAI,EACJ,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,OAAO,CACf,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;YAC/B,MAAM,IAAI,KAAK,CACb,8BAA8B,aAAa,wCAAwC,CACpF,CAAC;SACH;QAED,IAAA,4BAAY,EAAC,IAAI,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,CAAC,CAAC;QACvE,IAAA,4BAAY,EAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;QAC7D,IAAA,4BAAY,EAAC,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE;YACjE,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QAEH,IAAA,4DAA2B,EACzB,IAAI,EACJ,aAAa,EACb;;;;;;;KAOC,CACF,CAAC;QAEF,MAAM,SAAS,GAAG,gDAAgD,CAAC;QAEnE,IAAI;YACF,IAAA,uEAAgC,EAAC,IAAI,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;YACjE,oCAAoC;SACrC;QAAC,OAAO,GAAG,EAAE;SACb;gBAAS;YACR,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;IACH,CAAC;CAAA;AAzCD,4BAyCC"}
@@ -0,0 +1,4 @@
1
+ export interface LoaderSchema {
2
+ project: string;
3
+ path: string;
4
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "data-loader",
4
+ "type": "object",
5
+ "properties": {
6
+ "path": {
7
+ "type": "string",
8
+ "description": "The route path or path to the filename of the route.",
9
+ "$default": {
10
+ "$source": "argv",
11
+ "index": 0
12
+ },
13
+ "x-prompt": "What is the path of the route? (e.g. 'foo/bar')"
14
+ },
15
+ "project": {
16
+ "type": "string",
17
+ "description": "The name of the project.",
18
+ "$default": {
19
+ "$source": "projectName"
20
+ },
21
+ "x-prompt": "What project is this route for?",
22
+ "pattern": "^[a-zA-Z].*$"
23
+ }
24
+ },
25
+ "required": ["path", "project"]
26
+ }
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { MetaSchema } from '../schema';
3
+ export declare function normalizeOptions(tree: Tree, options: MetaSchema): MetaSchema;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeOptions = void 0;
4
+ const remix_config_1 = require("../../../utils/remix-config");
5
+ function normalizeOptions(tree, options) {
6
+ let normalizedVersion = options.version;
7
+ if (!normalizedVersion) {
8
+ // is the v2 future flag enabled?
9
+ const futureFlags = (0, remix_config_1.getRemixFutureFlags)(tree, options.project);
10
+ normalizedVersion = (futureFlags === null || futureFlags === void 0 ? void 0 : futureFlags.v2_meta) ? '2' : '1';
11
+ }
12
+ return Object.assign(Object.assign({}, options), { version: normalizedVersion });
13
+ }
14
+ exports.normalizeOptions = normalizeOptions;
15
+ //# sourceMappingURL=normalize-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/meta/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,8DAAkE;AAGlE,SAAgB,gBAAgB,CAAC,IAAU,EAAE,OAAmB;IAC9D,IAAI,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAExC,IAAI,CAAC,iBAAiB,EAAE;QACtB,iCAAiC;QACjC,MAAM,WAAW,GAAG,IAAA,kCAAmB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAE/D,iBAAiB,GAAG,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,EAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;KACtD;IAED,uCACK,OAAO,KACV,OAAO,EAAE,iBAAiB,IAC1B;AACJ,CAAC;AAdD,4CAcC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { MetaSchema } from '../schema';
3
+ export declare function v1MetaGenerator(tree: Tree, schema: MetaSchema): Promise<void>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.v1MetaGenerator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const get_default_export_name_1 = require("../../../utils/get-default-export-name");
7
+ const insert_import_1 = require("../../../utils/insert-import");
8
+ const insert_statement_after_imports_1 = require("../../../utils/insert-statement-after-imports");
9
+ const remix_route_utils_1 = require("../../../utils/remix-route-utils");
10
+ function v1MetaGenerator(tree, schema) {
11
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
12
+ const routeFilePath = (0, remix_route_utils_1.resolveRemixRouteFile)(tree, schema.path, schema.project);
13
+ if (!tree.exists(routeFilePath)) {
14
+ throw new Error(`Route path does not exist: ${routeFilePath}. Please generate a Remix route first.`);
15
+ }
16
+ (0, insert_import_1.insertImport)(tree, routeFilePath, 'MetaFunction', '@remix-run/node', {
17
+ typeOnly: true,
18
+ });
19
+ const defaultExportName = (0, get_default_export_name_1.getDefaultExportName)(tree, routeFilePath);
20
+ (0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, routeFilePath, `
21
+ export const meta: MetaFunction = () =>{
22
+ return { title: '${defaultExportName} Route' };
23
+ };
24
+
25
+ `);
26
+ yield (0, devkit_1.formatFiles)(tree);
27
+ });
28
+ }
29
+ exports.v1MetaGenerator = v1MetaGenerator;
30
+ //# sourceMappingURL=v1.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v1.impl.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/meta/lib/v1.impl.ts"],"names":[],"mappings":";;;;AAAA,uCAA+C;AAC/C,oFAA8E;AAC9E,gEAA4D;AAC5D,kGAA4F;AAC5F,wEAAyE;AAGzE,SAAsB,eAAe,CAAC,IAAU,EAAE,MAAkB;;QAClE,MAAM,aAAa,GAAG,IAAA,yCAAqB,EACzC,IAAI,EACJ,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,OAAO,CACf,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;YAC/B,MAAM,IAAI,KAAK,CACb,8BAA8B,aAAa,wCAAwC,CACpF,CAAC;SACH;QAED,IAAA,4BAAY,EAAC,IAAI,EAAE,aAAa,EAAE,cAAc,EAAE,iBAAiB,EAAE;YACnE,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QAEH,MAAM,iBAAiB,GAAG,IAAA,8CAAoB,EAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QACpE,IAAA,4DAA2B,EACzB,IAAI,EACJ,aAAa,EACb;;yBAEqB,iBAAiB;;;KAGrC,CACF,CAAC;QACF,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AA7BD,0CA6BC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { MetaSchema } from '../schema';
3
+ export declare function v2MetaGenerator(tree: Tree, schema: MetaSchema): Promise<void>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.v2MetaGenerator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const get_default_export_name_1 = require("../../../utils/get-default-export-name");
7
+ const insert_import_1 = require("../../../utils/insert-import");
8
+ const insert_statement_after_imports_1 = require("../../../utils/insert-statement-after-imports");
9
+ const remix_route_utils_1 = require("../../../utils/remix-route-utils");
10
+ function v2MetaGenerator(tree, schema) {
11
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
12
+ const routeFilePath = (0, remix_route_utils_1.resolveRemixRouteFile)(tree, schema.path, schema.project);
13
+ if (!tree.exists(routeFilePath)) {
14
+ throw new Error(`Route path does not exist: ${routeFilePath}. Please generate a Remix route first.`);
15
+ }
16
+ (0, insert_import_1.insertImport)(tree, routeFilePath, 'V2_MetaFunction', '@remix-run/node', {
17
+ typeOnly: true,
18
+ });
19
+ const defaultExportName = (0, get_default_export_name_1.getDefaultExportName)(tree, routeFilePath);
20
+ (0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, routeFilePath, `
21
+ export const meta: V2_MetaFunction = () =>{
22
+ return [{ title: '${defaultExportName} Route' }];
23
+ };
24
+
25
+ `);
26
+ yield (0, devkit_1.formatFiles)(tree);
27
+ });
28
+ }
29
+ exports.v2MetaGenerator = v2MetaGenerator;
30
+ //# sourceMappingURL=v2.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2.impl.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/meta/lib/v2.impl.ts"],"names":[],"mappings":";;;;AAAA,uCAA+C;AAC/C,oFAA8E;AAC9E,gEAA4D;AAC5D,kGAA4F;AAC5F,wEAAyE;AAGzE,SAAsB,eAAe,CAAC,IAAU,EAAE,MAAkB;;QAClE,MAAM,aAAa,GAAG,IAAA,yCAAqB,EACzC,IAAI,EACJ,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,OAAO,CACf,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;YAC/B,MAAM,IAAI,KAAK,CACb,8BAA8B,aAAa,wCAAwC,CACpF,CAAC;SACH;QAED,IAAA,4BAAY,EAAC,IAAI,EAAE,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EAAE;YACtE,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QAEH,MAAM,iBAAiB,GAAG,IAAA,8CAAoB,EAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QACpE,IAAA,4DAA2B,EACzB,IAAI,EACJ,aAAa,EACb;;0BAEsB,iBAAiB;;;KAGtC,CACF,CAAC;QACF,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AA7BD,0CA6BC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { MetaSchema } from './schema';
3
+ export default function (tree: Tree, schema: MetaSchema): Promise<void>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const normalize_options_1 = require("./lib/normalize-options");
5
+ const v1_impl_1 = require("./lib/v1.impl");
6
+ const v2_impl_1 = require("./lib/v2.impl");
7
+ function default_1(tree, schema) {
8
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+ const options = (0, normalize_options_1.normalizeOptions)(tree, schema);
10
+ if (options.version === '1') {
11
+ yield (0, v1_impl_1.v1MetaGenerator)(tree, options);
12
+ }
13
+ else if (options.version === '2') {
14
+ yield (0, v2_impl_1.v2MetaGenerator)(tree, options);
15
+ }
16
+ else {
17
+ throw new Error('Invalid version provided.');
18
+ }
19
+ });
20
+ }
21
+ exports.default = default_1;
22
+ //# sourceMappingURL=meta.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/meta/meta.impl.ts"],"names":[],"mappings":";;;AAGA,+DAA2D;AAC3D,2CAAgD;AAChD,2CAAgD;AAEhD,mBAA+B,IAAU,EAAE,MAAkB;;QAC3D,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAE/C,IAAI,OAAO,CAAC,OAAO,KAAK,GAAG,EAAE;YAC3B,MAAM,IAAA,yBAAe,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SACtC;aAAM,IAAI,OAAO,CAAC,OAAO,KAAK,GAAG,EAAE;YAClC,MAAM,IAAA,yBAAe,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SACtC;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAC9C;IACH,CAAC;CAAA;AAVD,4BAUC"}
@@ -0,0 +1,5 @@
1
+ export interface MetaSchema {
2
+ path: string;
3
+ project: string;
4
+ version?: '1' | '2';
5
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "meta",
4
+ "type": "object",
5
+ "properties": {
6
+ "path": {
7
+ "type": "string",
8
+ "description": "The route path or path to the filename of the route.",
9
+ "$default": {
10
+ "$source": "argv",
11
+ "index": 0
12
+ },
13
+ "x-prompt": "What is the path of the route? (e.g. 'foo/bar')"
14
+ },
15
+ "project": {
16
+ "type": "string",
17
+ "description": "The name of the project.",
18
+ "$default": {
19
+ "$source": "projectName"
20
+ },
21
+ "x-prompt": "What project is this route for?",
22
+ "pattern": "^[a-zA-Z].*$"
23
+ },
24
+ "version": {
25
+ "type": "string",
26
+ "description": "The version of the meta convention to use"
27
+ }
28
+ },
29
+ "required": ["path", "project"]
30
+ }