@nrwl/remix 1.0.0-alpha.12 → 1.0.0-alpha.13
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 +26 -1
- package/generators.json +7 -2
- package/package.json +1 -1
- package/src/generators/preset/preset.impl.js +3 -28
- package/src/generators/preset/preset.impl.js.map +1 -1
- package/src/generators/setup/schema.json +14 -0
- package/src/generators/setup/setup.impl.d.ts +4 -0
- package/src/generators/setup/setup.impl.js +65 -0
- package/src/generators/setup/setup.impl.js.map +1 -0
package/README.md
CHANGED
|
@@ -27,6 +27,31 @@ npx nx dev demo
|
|
|
27
27
|
|
|
28
28
|
You can also run `nx build demo` and `nx start demo`.
|
|
29
29
|
|
|
30
|
+
## Existing workspaces
|
|
31
|
+
|
|
32
|
+
You can add Remix to any existing Nx workspace.
|
|
33
|
+
|
|
34
|
+
First, install the plugin:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install --save-dev @nrwl/remix
|
|
38
|
+
|
|
39
|
+
# Or with yarn
|
|
40
|
+
yarn add -D @nrwl/remix
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then, run the setup generator:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npx nx g @nrwl/remix:setup
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
You can then add your first app and run it:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npx nx g @nrwl/remix:app demo
|
|
53
|
+
```
|
|
54
|
+
|
|
30
55
|
## Workspace libraries
|
|
31
56
|
|
|
32
57
|
The Remix setup leverages npm/yarn/pnpm workspaces and Nx buildable libraries.
|
|
@@ -55,7 +80,7 @@ export default function App() {
|
|
|
55
80
|
}
|
|
56
81
|
```
|
|
57
82
|
|
|
58
|
-
Now, run the dev server again to see the new library in action
|
|
83
|
+
Now, run the dev server again to see the new library in action.
|
|
59
84
|
|
|
60
85
|
```bash
|
|
61
86
|
npx nx dev demo
|
package/generators.json
CHANGED
|
@@ -7,12 +7,17 @@
|
|
|
7
7
|
"preset": {
|
|
8
8
|
"factory": "./src/generators/preset/preset.impl",
|
|
9
9
|
"schema": "./src/generators/preset/schema.json",
|
|
10
|
-
"description": "Generate a new
|
|
10
|
+
"description": "Generate a new Remix workspace"
|
|
11
|
+
},
|
|
12
|
+
"setup": {
|
|
13
|
+
"factory": "./src/generators/setup/setup.impl",
|
|
14
|
+
"schema": "./src/generators/setup/schema.json",
|
|
15
|
+
"description": "Setup a Remix workspace"
|
|
11
16
|
},
|
|
12
17
|
"application": {
|
|
13
18
|
"factory": "./src/generators/application/application.impl",
|
|
14
19
|
"schema": "./src/generators/application/schema.json",
|
|
15
|
-
"description": "Generate a new
|
|
20
|
+
"description": "Generate a new Remix application",
|
|
16
21
|
"aliases": ["app"],
|
|
17
22
|
"x-type": "application"
|
|
18
23
|
},
|
package/package.json
CHANGED
|
@@ -4,45 +4,20 @@ 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 setup_impl_1 = require("../setup/setup.impl");
|
|
7
8
|
const run_tasks_in_serial_1 = require("@nrwl/workspace/src/utilities/run-tasks-in-serial");
|
|
8
9
|
function default_1(tree, _options) {
|
|
9
10
|
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
10
11
|
const options = (0, normalize_options_1.normalizeOptions)(tree, _options);
|
|
11
12
|
const tasks = [];
|
|
12
|
-
const pm = (0, devkit_1.detectPackageManager)();
|
|
13
13
|
const appGenTask = yield (0, application_impl_1.default)(tree, {
|
|
14
14
|
name: options.projectName,
|
|
15
15
|
tags: options.tags,
|
|
16
16
|
skipFormat: true,
|
|
17
17
|
});
|
|
18
18
|
tasks.push(appGenTask);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
|
22
|
-
var _a;
|
|
23
|
-
(_a = json.workspaces) !== null && _a !== void 0 ? _a : (json.workspaces = ['libs/*']);
|
|
24
|
-
return json;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
tree.write('pnpm-workspace.yaml', `packages:
|
|
29
|
-
- 'libs/*`);
|
|
30
|
-
}
|
|
31
|
-
// Ignore nested project files
|
|
32
|
-
const ignoreFile = tree.read('.gitignore').toString();
|
|
33
|
-
tree.write('.gitignore', `${ignoreFile
|
|
34
|
-
.replace('/dist', 'dist')
|
|
35
|
-
.replace('/node_modules', 'node_modules')}
|
|
36
|
-
# Remix files
|
|
37
|
-
apps/**/build
|
|
38
|
-
apps/**/.cache
|
|
39
|
-
`);
|
|
40
|
-
(0, devkit_1.updateJson)(tree, 'nx.json', (json) => {
|
|
41
|
-
json.targetDependencies.dev = [
|
|
42
|
-
{ target: 'build', projects: 'dependencies' },
|
|
43
|
-
];
|
|
44
|
-
return json;
|
|
45
|
-
});
|
|
19
|
+
const setupGenTask = yield (0, setup_impl_1.default)(tree, {});
|
|
20
|
+
tasks.push(setupGenTask);
|
|
46
21
|
// No need for workspace.json in latest Nx
|
|
47
22
|
tree.delete('workspace.json');
|
|
48
23
|
yield (0, devkit_1.formatFiles)(tree);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset.impl.js","sourceRoot":"","sources":["../../../../../../packages/nx-remix/src/generators/preset/preset.impl.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"preset.impl.js","sourceRoot":"","sources":["../../../../../../packages/nx-remix/src/generators/preset/preset.impl.ts"],"names":[],"mappings":";;;AAAA,yCAAoE;AAGpE,+DAA2D;AAC3D,sEAAmE;AACnE,oDAAiD;AACjD,2FAAqF;AAErF,mBAA+B,IAAU,EAAE,QAAgC;;QACzE,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjD,MAAM,KAAK,GAAwB,EAAE,CAAC;QAEtC,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,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAEvB,MAAM,YAAY,GAAG,MAAM,IAAA,oBAAc,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACpD,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAEzB,0CAA0C;QAC1C,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAE9B,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,OAAO,IAAA,sCAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AApBD,4BAoBC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"cli": "nx",
|
|
4
|
+
"$id": "NxRemixSetup",
|
|
5
|
+
"title": "",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"packageManager": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The package manager to setup for",
|
|
11
|
+
"enum": ["yarn", "npm", "pnpm"]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
function default_1(tree, options) {
|
|
6
|
+
var _a;
|
|
7
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
8
|
+
const pm = (_a = options.packageManager) !== null && _a !== void 0 ? _a : (0, devkit_1.detectPackageManager)();
|
|
9
|
+
// Enable yarn/npm/pnpm workspaces for buildable libs
|
|
10
|
+
if (pm !== 'pnpm') {
|
|
11
|
+
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
|
12
|
+
var _a;
|
|
13
|
+
if (!json.workspaces) {
|
|
14
|
+
(_a = json.workspaces) !== null && _a !== void 0 ? _a : (json.workspaces = ['libs/*']);
|
|
15
|
+
}
|
|
16
|
+
return json;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
if (!tree.exists('pnpm-workspace.yaml')) {
|
|
21
|
+
tree.write('pnpm-workspace.yaml', `packages:
|
|
22
|
+
- 'libs/*`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
// Ignore nested project files
|
|
26
|
+
let ignoreFile = tree.read('.gitignore').toString();
|
|
27
|
+
if (ignoreFile.indexOf('/dist') !== -1) {
|
|
28
|
+
ignoreFile = ignoreFile.replace('/dist', 'dist');
|
|
29
|
+
}
|
|
30
|
+
if (ignoreFile.indexOf('/node_modules') !== -1) {
|
|
31
|
+
ignoreFile = ignoreFile.replace('/node_modules', 'node_modules');
|
|
32
|
+
}
|
|
33
|
+
if (ignoreFile.indexOf('# Remix files') === -1) {
|
|
34
|
+
ignoreFile = `${ignoreFile
|
|
35
|
+
.replace('/dist', 'dist')
|
|
36
|
+
.replace('/node_modules', 'node_modules')}
|
|
37
|
+
# Remix files
|
|
38
|
+
apps/**/build
|
|
39
|
+
apps/**/.cache
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
42
|
+
tree.write('.gitignore', ignoreFile);
|
|
43
|
+
(0, devkit_1.updateJson)(tree, 'nx.json', (json) => {
|
|
44
|
+
var _a;
|
|
45
|
+
if (Array.isArray((_a = json.targetDependencies) === null || _a === void 0 ? void 0 : _a.dev)) {
|
|
46
|
+
if (!json.targetDependencies.dev.some((x) => x.target === 'build' && x.projects === 'dependencies')) {
|
|
47
|
+
json.targetDependencies.dev.push({
|
|
48
|
+
target: 'build',
|
|
49
|
+
projects: 'dependencies',
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
json.targetDependencies = Object.assign(Object.assign({}, json.targetDependencies), { dev: [{ target: 'build', projects: 'dependencies' }] });
|
|
55
|
+
}
|
|
56
|
+
return json;
|
|
57
|
+
});
|
|
58
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
59
|
+
return () => {
|
|
60
|
+
// Reserved for additional processing needed
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
exports.default = default_1;
|
|
65
|
+
//# sourceMappingURL=setup.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.impl.js","sourceRoot":"","sources":["../../../../../../packages/nx-remix/src/generators/setup/setup.impl.ts"],"names":[],"mappings":";;;AAAA,yCAKsB;AAEtB,mBACE,IAAU,EACV,OAEC;;;QAED,MAAM,EAAE,GAAG,MAAA,OAAO,CAAC,cAAc,mCAAI,IAAA,6BAAoB,GAAE,CAAC;QAE5D,qDAAqD;QACrD,IAAI,EAAE,KAAK,MAAM,EAAE;YACjB,IAAA,mBAAU,EAAC,IAAI,EAAE,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE;;gBACxC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;oBACpB,MAAA,IAAI,CAAC,UAAU,oCAAf,IAAI,CAAC,UAAU,GAAK,CAAC,QAAQ,CAAC,EAAC;iBAChC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE;gBACvC,IAAI,CAAC,KAAK,CACR,qBAAqB,EACrB;YACI,CACL,CAAC;aACH;SACF;QAED,8BAA8B;QAC9B,IAAI,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,QAAQ,EAA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