@nrwl/remix 1.0.0-alpha.2 → 1.0.0-alpha.6

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.
package/README.md CHANGED
@@ -1,7 +1,72 @@
1
- # nx-remix
1
+ <p style="text-align: center;"><img src="https://github.com/nrwl/nx-labs/raw/main/packages/nx-remix/nx-remix.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p>
2
2
 
3
- This library was generated with [Nx](https://nx.dev).
3
+ ## Creating new Remix workspace
4
4
 
5
- ## Running unit tests
5
+ Use `--project=@nrwl/remix` when creating new workspace.
6
+
7
+ e.g.
8
+
9
+ ```bash
10
+ npx create-nx-workspace@latest acme \
11
+ --preset=@nrwl/remix \
12
+ --project=demo
13
+ ```
14
+
15
+ Now, you can go into the `acme` folder and start development.
16
+
17
+ ```bash
18
+ cd acme
19
+ npx nx dev demo
20
+ ```
21
+
22
+ **Note:** This command runs the `dev` script in `apps/demo/package.json`.
23
+
24
+ You can also run `nx build demo` and `nx start demo`.
25
+
26
+ ## Workspace libraries
27
+
28
+ The Remix setup leverages npm/yarn/pnpm workspaces and Nx buildable libraries.
29
+
30
+ ```bash
31
+ npx nx g @nrwl/remix:lib mylib
32
+ ```
33
+
34
+ Import the new library in your app.
35
+
36
+ ```typescript jsx
37
+ // apps/demo/app/root.tsx
38
+ import { Mylib } from '@acme/mylib';
39
+
40
+ // ...
41
+
42
+ export default function App() {
43
+ return (
44
+ <Document>
45
+ <Layout>
46
+ <Mylib />
47
+ <Outlet />
48
+ </Layout>
49
+ </Document>
50
+ );
51
+ }
52
+ ```
53
+
54
+ Now, run the dev server again to see the new library in action!
55
+
56
+ ```bash
57
+ npx nx dev demo
58
+ ```
59
+
60
+ **Note:** You must restart the server if you make any changes to your library. Luckily, with Nx cache this operation should be super fast.
61
+
62
+ ## Contributing
63
+
64
+ ### Running unit tests
6
65
 
7
66
  Run `nx test nx-remix` to execute the unit tests via [Jest](https://jestjs.io).
67
+
68
+ ### Publishing
69
+
70
+ ```bash
71
+ nx publish nx-remix --ver=[version]
72
+ ```
package/generators.json CHANGED
@@ -8,6 +8,20 @@
8
8
  "factory": "./src/generators/preset/preset.impl",
9
9
  "schema": "./src/generators/preset/schema.json",
10
10
  "description": "Generate a new remix workspace"
11
+ },
12
+ "application": {
13
+ "factory": "./src/generators/application/application.impl",
14
+ "schema": "./src/generators/application/schema.json",
15
+ "description": "Generate a new remix application",
16
+ "aliases": ["app"],
17
+ "x-type": "application"
18
+ },
19
+ "library": {
20
+ "factory": "./src/generators/library/library.impl",
21
+ "schema": "./src/generators/library/schema.json",
22
+ "description": "Generate a new library",
23
+ "aliases": ["lib"],
24
+ "x-type": "library"
11
25
  }
12
26
  }
13
27
  }
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@nrwl/remix",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.6",
4
4
  "main": "src/index.js",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
7
- "@nrwl/devkit": "^13.3.9",
8
- "@nrwl/react": "^13.3.9",
7
+ "@nrwl/devkit": "^13.4.1",
8
+ "@nrwl/js": "^13.4.1",
9
+ "@nrwl/react": "^13.4.1",
9
10
  "tslib": "^2.3.1"
10
11
  },
11
12
  "typings": "./src/index.d.ts"
@@ -11,8 +11,8 @@ function default_1(tree, _options) {
11
11
  const tasks = [];
12
12
  (0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
13
13
  root: options.projectRoot,
14
- projectType: 'library',
15
- sourceRoot: `${options.projectRoot}/src`,
14
+ sourceRoot: `${options.projectRoot}`,
15
+ projectType: 'application',
16
16
  tags: options.parsedTags,
17
17
  });
18
18
  const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {
@@ -1 +1 @@
1
- {"version":3,"file":"application.impl.js","sourceRoot":"","sources":["../../../../../../packages/nx-remix/src/generators/application/application.impl.ts"],"names":[],"mappings":";;;AAAA,yCAQsB;AAEtB,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AI,CAAC,CAAC;SACzB;QAED,OAAO,IAAA,sCAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AAnDD,4BAmDC"}
1
+ {"version":3,"file":"application.impl.js","sourceRoot":"","sources":["../../../../../../packages/nx-remix/src/generators/application/application.impl.ts"],"names":[],"mappings":";;;AAAA,yCAQsB;AAEtB,+DAA2D;AAC3D,2FAAqF;AACrF,iDAAyC;AAEzC,mBAA+B,IAAU,EAAE,QAAgC;;QACzE,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjD,MAAM,KAAK,GAAwB,EAAE,CAAC;QAEtC,IAAA,gCAAuB,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE;YACjD,IAAI,EAAE,OAAO,CAAC,WAAW;YACzB,UAAU,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE;YACpC,WAAW,EAAE,aAAa;YAC1B,IAAI,EAAE,OAAO,CAAC,UAAU;SACzB,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,IAAA,qCAA4B,EAC9C,IAAI,EACJ;YACE,kBAAkB,EAAE,QAAQ;YAC5B,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,SAAS;YACtB,KAAK,EAAE,QAAQ;YACf,kBAAkB,EAAE,QAAQ;SAC7B,EACD;YACE,gBAAgB,EAAE,QAAQ;YAC1B,cAAc,EAAE,UAAU;YAC1B,kBAAkB,EAAE,SAAS;YAC7B,UAAU,EAAE,QAAQ;SACrB,CACF,CAAC;QACF,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAExB,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,EACrC,OAAO,CAAC,WAAW,kCAEd,OAAO,KACV,IAAI,EAAE,EAAE,IAEX,CAAC;QAEF,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;YACd,IAAA,wBAAQ,EAAC,iBAAiB,EAAE;gBAC1B,GAAG,EAAE,OAAO,CAAC,WAAW;gBACxB,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;aACjB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,IAAA,sCAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AAnDD,4BAmDC"}
@@ -1,13 +1,14 @@
1
- # Welcome to Remix!
1
+ # Welcome to Nx + Remix!
2
2
 
3
3
  - [Remix Docs](https://remix.run/docs)
4
+ - [Nx Docs](https://nx.dev)
4
5
 
5
6
  ## Development
6
7
 
7
8
  From your terminal:
8
9
 
9
10
  ```sh
10
- npm run dev
11
+ npx nx dev <%= projectName %>
11
12
  ```
12
13
 
13
14
  This starts your app in development mode, rebuilding assets on file changes.
@@ -17,13 +18,13 @@ This starts your app in development mode, rebuilding assets on file changes.
17
18
  First, build your app for production:
18
19
 
19
20
  ```sh
20
- npm run build
21
+ npx nx build <%= projectName %>
21
22
  ```
22
23
 
23
24
  Then run the app in production mode:
24
25
 
25
26
  ```sh
26
- npm start
27
+ npx nx start <%= projectName %>
27
28
  ```
28
29
 
29
30
  Now you'll need to pick a host to deploy it to.
@@ -34,8 +35,8 @@ If you're familiar with deploying node applications, the built-in Remix app serv
34
35
 
35
36
  Make sure to deploy the output of `remix build`
36
37
 
37
- - `build/`
38
- - `public/build/`
38
+ - `packages/<%= projectName %>/build/`
39
+ - `packages/<%= projectName %>/public/build/`
39
40
 
40
41
  ### Using a Template
41
42
 
@@ -10,8 +10,8 @@ import {
10
10
  } from "remix";
11
11
  import type { LinksFunction } from "remix";
12
12
 
13
- import globalStylesUrl from "./styles/global.css";
14
- import darkStylesUrl from "./styles/dark.css";
13
+ import globalStylesUrl from "~/styles/global.css";
14
+ import darkStylesUrl from "~/styles/dark.css";
15
15
 
16
16
  // https://remix.run/api/app#links
17
17
  export let links: LinksFunction = () => {
@@ -1,7 +1,7 @@
1
1
  import { Outlet } from "remix";
2
2
  import type { MetaFunction, LinksFunction } from "remix";
3
3
 
4
- import stylesUrl from "../../styles/demos/about.css";
4
+ import stylesUrl from "~/styles/demos/about.css";
5
5
 
6
6
  export let meta: MetaFunction = () => {
7
7
  return {
@@ -1,5 +1,4 @@
1
1
  {
2
- "extends": "../../tsconfig.base.json",
3
2
  "include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
4
3
  "compilerOptions": {
5
4
  "lib": ["DOM", "DOM.Iterable", "ES2019"],
@@ -9,7 +8,9 @@
9
8
  "resolveJsonModule": true,
10
9
  "target": "ES2019",
11
10
  "strict": true,
12
-
11
+ "paths": {
12
+ "~/*": ["./app/*"]
13
+ },
13
14
  // Remix takes care of building everything in `remix build`.
14
15
  "noEmit": true
15
16
  }
@@ -5,7 +5,7 @@ const devkit_1 = require("@nrwl/devkit");
5
5
  function normalizeOptions(tree, options) {
6
6
  const name = (0, devkit_1.names)(options.name).fileName;
7
7
  const projectName = name;
8
- const projectRoot = `packages/${name}`;
8
+ const projectRoot = `apps/${name}`;
9
9
  const parsedTags = options.tags
10
10
  ? options.tags.split(',').map((s) => s.trim())
11
11
  : [];
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/nx-remix/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAQ3C,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAA+B;IAE/B,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;IAC1C,MAAM,WAAW,GAAG,IAAI,CAAC;IACzB,MAAM,WAAW,GAAG,YAAY,IAAI,EAAE,CAAC;IACvC,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;AAjBD,4CAiBC"}
1
+ {"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/nx-remix/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,yCAAuE;AAQvE,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAA+B;IAE/B,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;IAC1C,MAAM,WAAW,GAAG,IAAI,CAAC;IACzB,MAAM,WAAW,GAAG,QAAQ,IAAI,EAAE,CAAC;IACnC,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;AAjBD,4CAiBC"}
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
3
  "cli": "nx",
4
- "$id": "NxRemix",
5
- "title": "",
4
+ "$id": "NxRemixApplication",
5
+ "title": "Create an Application",
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "name": {
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ import { NxRemixGeneratorSchema } from './schema';
3
+ export default function (tree: Tree, options: NxRemixGeneratorSchema): Promise<import("@nrwl/devkit").GeneratorCallback>;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nrwl/devkit");
5
+ const library_1 = require("@nrwl/react/src/generators/library/library");
6
+ const linter_1 = require("@nrwl/linter");
7
+ function default_1(tree, options) {
8
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
9
+ const name = (0, devkit_1.names)(options.name).fileName;
10
+ const task = yield (0, library_1.libraryGenerator)(tree, {
11
+ name,
12
+ // Remix can only work with buildable libs and yarn/npm workspaces
13
+ buildable: true,
14
+ compiler: 'babel',
15
+ style: 'css',
16
+ unitTestRunner: 'jest',
17
+ tags: options.tags,
18
+ importPath: options.importPath,
19
+ skipFormat: false,
20
+ skipTsConfig: false,
21
+ linter: linter_1.Linter.EsLint,
22
+ component: true,
23
+ });
24
+ const project = (0, devkit_1.readProjectConfiguration)(tree, name);
25
+ project.targets.build.options = Object.assign(Object.assign({}, project.targets.build.options), { outputPath: `libs/${name}/dist` });
26
+ (0, devkit_1.updateProjectConfiguration)(tree, name, project);
27
+ return task;
28
+ });
29
+ }
30
+ exports.default = default_1;
31
+ //# sourceMappingURL=library.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.impl.js","sourceRoot":"","sources":["../../../../../../packages/nx-remix/src/generators/library/library.impl.ts"],"names":[],"mappings":";;;AAAA,yCAKsB;AACtB,wEAA8E;AAE9E,yCAAsC;AAEtC,mBAA+B,IAAU,EAAE,OAA+B;;QACxE,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;QAE1C,MAAM,IAAI,GAAG,MAAM,IAAA,0BAAgB,EAAC,IAAI,EAAE;YACxC,IAAI;YAEJ,kEAAkE;YAClE,SAAS,EAAE,IAAI;YACf,QAAQ,EAAE,OAAO;YAEjB,KAAK,EAAE,KAAK;YACZ,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;QAEH,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,UAAU,EAAE,QAAQ,IAAI,OAAO,GAChC,CAAC;QACF,IAAA,mCAA0B,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAEhD,OAAO,IAAI,CAAC;IACd,CAAC;CAAA;AA5BD,4BA4BC"}
@@ -0,0 +1,6 @@
1
+ export interface NxRemixGeneratorSchema {
2
+ name: string;
3
+ tags?: string;
4
+ importPath?: string;
5
+ js?: boolean;
6
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "NxRemixLibrary",
4
+ "cli": "nx",
5
+ "title": "Create a Library",
6
+ "type": "object",
7
+ "examples": [
8
+ {
9
+ "command": "g lib mylib --directory=myapp",
10
+ "description": "Generate libs/myapp/mylib"
11
+ }
12
+ ],
13
+ "properties": {
14
+ "name": {
15
+ "type": "string",
16
+ "description": "Library name",
17
+ "$default": {
18
+ "$source": "argv",
19
+ "index": 0
20
+ },
21
+ "x-prompt": "What name would you like to use for the library?",
22
+ "pattern": "^[a-zA-Z].*$"
23
+ },
24
+ "tags": {
25
+ "type": "string",
26
+ "description": "Add tags to the library (used for linting)"
27
+ },
28
+ "importPath": {
29
+ "type": "string",
30
+ "description": "The library name used to import it, like @myorg/my-awesome-lib"
31
+ },
32
+ "js": {
33
+ "type": "boolean",
34
+ "description": "Generate JavaScript files rather than TypeScript files",
35
+ "default": false
36
+ }
37
+ },
38
+ "required": ["name"]
39
+ }
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeOptions = void 0;
4
4
  const devkit_1 = require("@nrwl/devkit");
5
5
  function normalizeOptions(tree, options) {
6
- const name = (0, devkit_1.names)(options.project).fileName;
6
+ var _a;
7
+ const name = (0, devkit_1.names)((_a = options.project) !== null && _a !== void 0 ? _a : 'webapp').fileName;
7
8
  const projectName = name;
8
9
  const projectRoot = `packages/${name}`;
9
10
  const parsedTags = options.tags
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/nx-remix/src/generators/preset/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAQ3C,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAA+B;IAE/B,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;IAC7C,MAAM,WAAW,GAAG,IAAI,CAAC;IACzB,MAAM,WAAW,GAAG,YAAY,IAAI,EAAE,CAAC;IACvC,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;AAjBD,4CAiBC"}
1
+ {"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/nx-remix/src/generators/preset/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,yCAAyC;AAQzC,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAA+B;;IAE/B,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,MAAA,OAAO,CAAC,OAAO,mCAAI,QAAQ,CAAC,CAAC,QAAQ,CAAC;IACzD,MAAM,WAAW,GAAG,IAAI,CAAC;IACzB,MAAM,WAAW,GAAG,YAAY,IAAI,EAAE,CAAC;IACvC,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;AAjBD,4CAiBC"}
@@ -1,3 +1,3 @@
1
- import { Tree } from '@nrwl/devkit';
1
+ import { GeneratorCallback, Tree } from '@nrwl/devkit';
2
2
  import { NxRemixGeneratorSchema } from './schema';
3
- export default function (tree: Tree, _options: NxRemixGeneratorSchema): Promise<import("@nrwl/devkit").GeneratorCallback>;
3
+ export default function (tree: Tree, _options: NxRemixGeneratorSchema): Promise<GeneratorCallback>;
@@ -4,24 +4,64 @@ const tslib_1 = require("tslib");
4
4
  const devkit_1 = require("@nrwl/devkit");
5
5
  const normalize_options_1 = require("./lib/normalize-options");
6
6
  const application_impl_1 = require("../application/application.impl");
7
+ const run_tasks_in_serial_1 = require("@nrwl/workspace/src/utilities/run-tasks-in-serial");
8
+ const child_process_1 = require("child_process");
7
9
  function default_1(tree, _options) {
8
10
  return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
9
11
  const options = (0, normalize_options_1.normalizeOptions)(tree, _options);
10
- const workspaceConfig = (0, devkit_1.readWorkspaceConfiguration)(tree);
11
- workspaceConfig.workspaceLayout = {
12
- appsDir: 'packages',
13
- libsDir: 'packages',
14
- };
15
- (0, devkit_1.updateWorkspaceConfiguration)(tree, workspaceConfig);
16
- const task = yield (0, application_impl_1.default)(tree, {
12
+ const tasks = [];
13
+ const pm = (0, devkit_1.detectPackageManager)();
14
+ const appGenTask = yield (0, application_impl_1.default)(tree, {
17
15
  name: options.projectName,
18
16
  tags: options.tags,
19
17
  skipFormat: true,
20
18
  });
21
- tree.delete('apps');
22
- tree.delete('libs');
19
+ tasks.push(appGenTask);
20
+ // Enable yarn/npm/pnpm workspaces for buildable libs
21
+ if (pm !== 'pnpm') {
22
+ (0, devkit_1.updateJson)(tree, 'package.json', (json) => {
23
+ var _a;
24
+ (_a = json.workspaces) !== null && _a !== void 0 ? _a : (json.workspaces = ['libs/*']);
25
+ return json;
26
+ });
27
+ }
28
+ else {
29
+ tree.write('pnpm-workspace.yaml', `packages:
30
+ - 'libs/*`);
31
+ }
32
+ // Ignore nested project files
33
+ const ignoreFile = tree.read('.gitignore').toString();
34
+ tree.write('.gitignore', `${ignoreFile
35
+ .replace('/dist', 'dist')
36
+ .replace('/node_modules', 'node_modules')}
37
+ // Remix files
38
+ apps/**/build
39
+ apps/**/.cache
40
+ `);
41
+ const nxJson = (0, devkit_1.readJson)(tree, 'nx.json');
42
+ nxJson.targetDependencies.dev = [
43
+ { target: 'build', projects: 'dependencies' },
44
+ ];
45
+ // No need for workspace.json in latest Nx
46
+ tree.delete('workspace.json');
23
47
  yield (0, devkit_1.formatFiles)(tree);
24
- return task;
48
+ // Setup workspaces
49
+ tasks.push(() => {
50
+ let command;
51
+ if (pm === 'npm') {
52
+ command = `npm install -ws`;
53
+ }
54
+ else if (pm === 'yarn') {
55
+ command = `yarn`;
56
+ }
57
+ else if (pm === 'pnpm') {
58
+ command = `pnpm install`;
59
+ }
60
+ (0, child_process_1.execSync)(command, {
61
+ stdio: [0, 1, 2],
62
+ });
63
+ });
64
+ return (0, run_tasks_in_serial_1.runTasksInSerial)(...tasks);
25
65
  });
26
66
  }
27
67
  exports.default = default_1;
@@ -1 +1 @@
1
- {"version":3,"file":"preset.impl.js","sourceRoot":"","sources":["../../../../../../packages/nx-remix/src/generators/preset/preset.impl.ts"],"names":[],"mappings":";;;AAAA,yCAKsB;AAGtB,+DAA2D;AAC3D,sEAAmE;AAEnE,mBAA+B,IAAU,EAAE,QAAgC;;QACzE,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEjD,MAAM,eAAe,GAAG,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC;QACzD,eAAe,CAAC,eAAe,GAAG;YAChC,OAAO,EAAE,UAAU;YACnB,OAAO,EAAE,UAAU;SACpB,CAAC;QACF,IAAA,qCAA4B,EAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAEpD,MAAM,IAAI,GAAG,MAAM,IAAA,0BAAoB,EAAC,IAAI,EAAE;YAC5C,IAAI,EAAE,OAAO,CAAC,WAAW;YACzB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACpB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEpB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,OAAO,IAAI,CAAC;IACd,CAAC;CAAA;AAtBD,4BAsBC"}
1
+ {"version":3,"file":"preset.impl.js","sourceRoot":"","sources":["../../../../../../packages/nx-remix/src/generators/preset/preset.impl.ts"],"names":[],"mappings":";;;AAAA,yCAQsB;AAGtB,+DAA2D;AAC3D,sEAAmE;AACnE,2FAAqF;AACrF,iDAAyC;AAEzC,mBAA+B,IAAU,EAAE,QAAgC;;QACzE,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjD,MAAM,KAAK,GAAwB,EAAE,CAAC;QACtC,MAAM,EAAE,GAAG,IAAA,6BAAoB,GAAE,CAAC;QAElC,MAAM,UAAU,GAAG,MAAM,IAAA,0BAAoB,EAAC,IAAI,EAAE;YAClD,IAAI,EAAE,OAAO,CAAC,WAAW;YACzB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QACH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