@zukhruf/nx 0.8.39 → 0.8.41
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 +54 -32
- package/dist/generators/auth/files.d.ts +2 -2
- package/dist/generators/auth/files.d.ts.map +1 -1
- package/dist/generators/auth/files.js +21 -20
- package/dist/generators/auth/files.js.map +1 -1
- package/dist/generators/auth/generator.d.ts.map +1 -1
- package/dist/generators/auth/generator.js +13 -17
- package/dist/generators/auth/generator.js.map +1 -1
- package/dist/generators/dokploy/files.d.ts.map +1 -1
- package/dist/generators/dokploy/files.js +16 -1
- package/dist/generators/dokploy/files.js.map +1 -1
- package/dist/generators/env-file.d.ts +8 -0
- package/dist/generators/env-file.d.ts.map +1 -0
- package/dist/generators/env-file.js +13 -0
- package/dist/generators/env-file.js.map +1 -0
- package/dist/generators/init/files.js +2 -2
- package/dist/generators/init/nx-json.d.ts +7 -0
- package/dist/generators/init/nx-json.d.ts.map +1 -1
- package/dist/generators/init/nx-json.js +19 -1
- package/dist/generators/init/nx-json.js.map +1 -1
- package/dist/generators/node-app/files.d.ts +3 -3
- package/dist/generators/node-app/files.d.ts.map +1 -1
- package/dist/generators/node-app/files.js +48 -35
- package/dist/generators/node-app/files.js.map +1 -1
- package/dist/generators/node-app/generator.d.ts.map +1 -1
- package/dist/generators/node-app/generator.js +32 -36
- package/dist/generators/node-app/generator.js.map +1 -1
- package/dist/generators/pair/files.d.ts +11 -2
- package/dist/generators/pair/files.d.ts.map +1 -1
- package/dist/generators/pair/files.js +51 -34
- package/dist/generators/pair/files.js.map +1 -1
- package/dist/generators/pair/generator.d.ts.map +1 -1
- package/dist/generators/pair/generator.js +22 -8
- package/dist/generators/pair/generator.js.map +1 -1
- package/dist/generators/portless-env.d.ts +14 -0
- package/dist/generators/portless-env.d.ts.map +1 -0
- package/dist/generators/portless-env.js +26 -0
- package/dist/generators/portless-env.js.map +1 -0
- package/dist/generators/prisma/files.d.ts.map +1 -1
- package/dist/generators/prisma/files.js +2 -0
- package/dist/generators/prisma/files.js.map +1 -1
- package/dist/generators/prisma/generator.d.ts +35 -1
- package/dist/generators/prisma/generator.d.ts.map +1 -1
- package/dist/generators/prisma/generator.js +57 -36
- package/dist/generators/prisma/generator.js.map +1 -1
- package/dist/generators/react-app/generator.js +10 -20
- package/dist/generators/react-app/generator.js.map +1 -1
- package/dist/generators/ui-package/files.d.ts.map +1 -1
- package/dist/generators/ui-package/files.js +7 -8
- package/dist/generators/ui-package/files.js.map +1 -1
- package/dist/generators/ui-package/generator.d.ts.map +1 -1
- package/dist/generators/ui-package/generator.js +3 -1
- package/dist/generators/ui-package/generator.js.map +1 -1
- package/dist/migrations/update-0-8-40/add-local-postgres.d.ts +14 -0
- package/dist/migrations/update-0-8-40/add-local-postgres.d.ts.map +1 -0
- package/dist/migrations/update-0-8-40/add-local-postgres.js +125 -0
- package/dist/migrations/update-0-8-40/add-local-postgres.js.map +1 -0
- package/dist/migrations/update-0-8-40/add-portless-proxy-env.d.ts +9 -0
- package/dist/migrations/update-0-8-40/add-portless-proxy-env.d.ts.map +1 -0
- package/dist/migrations/update-0-8-40/add-portless-proxy-env.js +21 -0
- package/dist/migrations/update-0-8-40/add-portless-proxy-env.js.map +1 -0
- package/dist/migrations/update-0-8-40/add-prisma-client-inputs.d.ts +11 -0
- package/dist/migrations/update-0-8-40/add-prisma-client-inputs.d.ts.map +1 -0
- package/dist/migrations/update-0-8-40/add-prisma-client-inputs.js +20 -0
- package/dist/migrations/update-0-8-40/add-prisma-client-inputs.js.map +1 -0
- package/dist/migrations/update-0-8-40/node-env-production.d.ts +13 -0
- package/dist/migrations/update-0-8-40/node-env-production.d.ts.map +1 -0
- package/dist/migrations/update-0-8-40/node-env-production.js +189 -0
- package/dist/migrations/update-0-8-40/node-env-production.js.map +1 -0
- package/dist/migrations/workspace.d.ts +31 -0
- package/dist/migrations/workspace.d.ts.map +1 -0
- package/dist/migrations/workspace.js +53 -0
- package/dist/migrations/workspace.js.map +1 -0
- package/migrations.json +24 -0
- package/package.json +51 -3
- package/release.json +30 -0
|
@@ -113,7 +113,9 @@ export function PackageName() {
|
|
|
113
113
|
}
|
|
114
114
|
// React DOM checks for a DOM when it loads, so the test loads it after it
|
|
115
115
|
// registers the DOM. Node cannot load .tsx, so the component comes from the
|
|
116
|
-
// built package.
|
|
116
|
+
// built package. The test runs under NODE_ENV=production (ADR 0016), where
|
|
117
|
+
// React has no act(), so flushSync of react-dom renders and unmounts
|
|
118
|
+
// synchronously.
|
|
117
119
|
export function componentTest(importPath) {
|
|
118
120
|
return `import assert from 'node:assert/strict';
|
|
119
121
|
import { test } from 'node:test';
|
|
@@ -124,25 +126,22 @@ test('PackageName renders the name of the package', async () => {
|
|
|
124
126
|
// Arrange
|
|
125
127
|
GlobalRegistrator.register();
|
|
126
128
|
try {
|
|
127
|
-
|
|
128
|
-
const {
|
|
129
|
+
const { createElement } = await import('react');
|
|
130
|
+
const { flushSync } = await import('react-dom');
|
|
129
131
|
const { createRoot } = await import('react-dom/client');
|
|
130
132
|
const { PackageName } = await import('${importPath}');
|
|
131
133
|
const container = document.body.appendChild(document.createElement('div'));
|
|
132
134
|
const root = createRoot(container);
|
|
133
135
|
try {
|
|
134
136
|
// Act
|
|
135
|
-
|
|
136
|
-
root.render(createElement(PackageName));
|
|
137
|
-
});
|
|
137
|
+
flushSync(() => root.render(createElement(PackageName)));
|
|
138
138
|
|
|
139
139
|
// Assert
|
|
140
140
|
assert.equal(container.textContent, '${importPath}');
|
|
141
141
|
} finally {
|
|
142
|
-
|
|
142
|
+
flushSync(() => root.unmount());
|
|
143
143
|
}
|
|
144
144
|
} finally {
|
|
145
|
-
Reflect.deleteProperty(globalThis, 'IS_REACT_ACT_ENVIRONMENT');
|
|
146
145
|
await GlobalRegistrator.unregister();
|
|
147
146
|
}
|
|
148
147
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../../src/generators/ui-package/files.ts"],"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"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/generators/ui-package/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EAMV,MAAM,YAAY,CAAC;AA0BpB,MAAM,WAAW,gBAAgB;IAC/B,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;CACpB;AAiBD;;;;GAIG;AACH,wBAA8B,kBAAkB,CAC9C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/generators/ui-package/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EAMV,MAAM,YAAY,CAAC;AA0BpB,MAAM,WAAW,gBAAgB;IAC/B,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;CACpB;AAiBD;;;;GAIG;AACH,wBAA8B,kBAAkB,CAC9C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAgJ5B"}
|
|
@@ -91,7 +91,9 @@ export default async function uiPackageGenerator(tree, options) {
|
|
|
91
91
|
...packageJson.nx,
|
|
92
92
|
targets: {
|
|
93
93
|
...packageJson.nx?.targets,
|
|
94
|
-
// The test imports the package through its export, which is dist.
|
|
94
|
+
// The test imports the package through its export, which is dist. It
|
|
95
|
+
// renders with flushSync, which production React has, so it runs
|
|
96
|
+
// under the production of targetDefaults.test (ADR 0016).
|
|
95
97
|
test: { dependsOn: ['...', 'build'] },
|
|
96
98
|
},
|
|
97
99
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../src/generators/ui-package/generator.ts"],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A+B,CAAC;YAC3C,wBAAwB,EAAE,QAAQ,CAAC,wBAAwB,CAAC;YAC5D,mBAAmB,EAAE,QAAQ,CAAC,mBAAmB,CAAC;YAClD,sBAAsB,EAAE,QAAQ,CAAC,sBAAsB,CAAC;YACxD,6BAA6B,EAAE,QAAQ,CAAC,6BAA6B,CAAC;YACtE,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC;YAClC,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,CAAC;SAC/C,CAAC;QACF,WAAW,CAAC,OAAO,GAAG,EAAE,CAAC;QACzB,WAAW,CAAC,EAAE,GAAG;YACf,GAAG,WAAW,CAAC,EAAE;YACjB,OAAO,EAAE;gBACP,GAAG,WAAW,CAAC,EAAE,EAAE,OAAO;gBAC1B,qEAAqE;gBACrE,iEAAiE;gBACjE,0DAA0D;gBAC1D,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE;aACtC;SACF,CAAC;QACF,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE;QACnC,eAAe,EAAE,iBAAiB;QAClC,sEAAsE;QACtE,0DAA0D;QAC1D,OAAO,EAAE;YACP,GAAG,YAAY;YACf,aAAa;YACb,qBAAqB;YACrB,KAAK;YACL,iBAAiB;SAClB;QACD,YAAY,EAAE,cAAc;KAC7B,CAAC,CAAC;IAEH,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;IACxB,OAAO,gBAAgB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Tree } from '@nx/devkit';
|
|
2
|
+
/**
|
|
3
|
+
* #4792, ADR 0012 decisions 16 and 17: the local Postgres of development. For
|
|
4
|
+
* each db package of the prisma generator (a `prisma.config.ts` that reads
|
|
5
|
+
* CONNECTION_STRING), a repo gets what it does not have: a root
|
|
6
|
+
* compose.dev.yml on port 5432 with the database named after the workspace
|
|
7
|
+
* scope, the `up` and `down` targets, the local CONNECTION_STRING in the env
|
|
8
|
+
* files of the package and of each backend that imports it, and `^up` in the
|
|
9
|
+
* dependsOn of that backend's serve. A compose.dev.yml that is there names the
|
|
10
|
+
* port and the database. A file without the shape that the generator wrote
|
|
11
|
+
* gets no edit, and the log says the step to take by hand.
|
|
12
|
+
*/
|
|
13
|
+
export default function addLocalPostgres(tree: Tree): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=add-local-postgres.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-local-postgres.d.ts","sourceRoot":"","sources":["../../../src/migrations/update-0-8-40/add-local-postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EAMV,MAAM,YAAY,CAAC;AA2BpB;;;;;;;;;;GAUG;AACH,wBAA8B,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BxE"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { formatFiles, joinPathFragments, logger, offsetFromRoot, readJson, } from '@nx/devkit';
|
|
2
|
+
import { addMissingKeys } from "../../generators/add-keys.js";
|
|
3
|
+
import { addEnvEntry } from "../../generators/env-file.js";
|
|
4
|
+
import { unique } from "../../generators/init/nx-json.js";
|
|
5
|
+
import { composeDevYml, localConnectionString, } from "../../generators/prisma/files.js";
|
|
6
|
+
import { localDatabaseTargets } from "../../generators/prisma/generator.js";
|
|
7
|
+
import { workspaceScope } from "../../generators/workspace-scope.js";
|
|
8
|
+
import { envValue, projectRootsWith, sourceFiles, updateJsonIfChanged, } from "../workspace.js";
|
|
9
|
+
const composePath = 'compose.dev.yml';
|
|
10
|
+
/**
|
|
11
|
+
* #4792, ADR 0012 decisions 16 and 17: the local Postgres of development. For
|
|
12
|
+
* each db package of the prisma generator (a `prisma.config.ts` that reads
|
|
13
|
+
* CONNECTION_STRING), a repo gets what it does not have: a root
|
|
14
|
+
* compose.dev.yml on port 5432 with the database named after the workspace
|
|
15
|
+
* scope, the `up` and `down` targets, the local CONNECTION_STRING in the env
|
|
16
|
+
* files of the package and of each backend that imports it, and `^up` in the
|
|
17
|
+
* dependsOn of that backend's serve. A compose.dev.yml that is there names the
|
|
18
|
+
* port and the database. A file without the shape that the generator wrote
|
|
19
|
+
* gets no edit, and the log says the step to take by hand.
|
|
20
|
+
*/
|
|
21
|
+
export default async function addLocalPostgres(tree) {
|
|
22
|
+
const packages = dbPackages(tree);
|
|
23
|
+
if (packages.length === 0)
|
|
24
|
+
return;
|
|
25
|
+
const database = localDatabase(tree, packages);
|
|
26
|
+
if (database === undefined)
|
|
27
|
+
return;
|
|
28
|
+
const connectionString = localConnectionString(database);
|
|
29
|
+
for (const db of packages) {
|
|
30
|
+
updateJsonIfChanged(tree, joinPathFragments(db.root, 'package.json'), (manifest) => {
|
|
31
|
+
manifest.nx = {
|
|
32
|
+
...manifest.nx,
|
|
33
|
+
targets: addMissingKeys(manifest.nx?.targets, localDatabaseTargets(offsetFromRoot(db.root), database)),
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
addConnectionString(tree, db.root, connectionString);
|
|
37
|
+
for (const backend of backendsOf(tree, db.name)) {
|
|
38
|
+
addUpToServe(tree, backend);
|
|
39
|
+
addConnectionString(tree, backend, connectionString);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
await formatFiles(tree);
|
|
43
|
+
}
|
|
44
|
+
/** Each db package of the prisma generator. One whose prisma.config.ts reads another variable is left alone. */
|
|
45
|
+
function dbPackages(tree) {
|
|
46
|
+
const packages = [];
|
|
47
|
+
for (const root of projectRootsWith(tree, 'prisma.config.ts')) {
|
|
48
|
+
const config = tree.read(joinPathFragments(root, 'prisma.config.ts'), 'utf-8') ?? '';
|
|
49
|
+
const { name } = readJson(tree, joinPathFragments(root, 'package.json'));
|
|
50
|
+
if (name === undefined)
|
|
51
|
+
continue;
|
|
52
|
+
if (!config.includes('CONNECTION_STRING')) {
|
|
53
|
+
logger.warn(`add-local-postgres: ${root}/prisma.config.ts does not read CONNECTION_STRING, so ${root} is not in the shape of @zukhruf/nx:prisma and got no edit. To take the local Postgres by hand, make prisma.config.ts read CONNECTION_STRING, and add what the prisma generator writes: the up and down targets of ${root}, the local CONNECTION_STRING in its .env.example and .env and in those of each backend that imports ${name}, and "^up" in the dependsOn of that backend's serve (ADR 0012 decisions 16 and 17 of @zukhruf/nx).`);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
packages.push({ root, name });
|
|
57
|
+
}
|
|
58
|
+
return packages;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The database of compose.dev.yml. A missing file is written on port 5432
|
|
62
|
+
* with the database of the workspace scope, as the prisma generator writes it
|
|
63
|
+
* with no port option. A file that is there must have the `database` service
|
|
64
|
+
* that the generator writes, or nothing is changed.
|
|
65
|
+
*/
|
|
66
|
+
function localDatabase(tree, packages) {
|
|
67
|
+
const compose = tree.read(composePath, 'utf-8');
|
|
68
|
+
if (compose === null) {
|
|
69
|
+
const database = { port: 5432, name: workspaceScope(tree) };
|
|
70
|
+
tree.write(composePath, composeDevYml(database, packages[0]?.name ?? ''));
|
|
71
|
+
return database;
|
|
72
|
+
}
|
|
73
|
+
const service = /^ {2}database:\n((?: {4,}.*\n|\s*\n)*)/m.exec(compose)?.[1];
|
|
74
|
+
const port = service && /['"]?127\.0\.0\.1:(\d+):5432['"]?/.exec(service)?.[1];
|
|
75
|
+
const name = service && /^\s+POSTGRES_DB:\s*['"]?([^'"\s]+)/m.exec(service)?.[1];
|
|
76
|
+
const credentials = service !== undefined &&
|
|
77
|
+
/^\s+POSTGRES_USER:\s*['"]?postgres['"]?\s*$/m.test(service) &&
|
|
78
|
+
/^\s+POSTGRES_PASSWORD:\s*['"]?postgres['"]?\s*$/m.test(service);
|
|
79
|
+
if (!port || !name || !credentials) {
|
|
80
|
+
logger.warn(`add-local-postgres: ${composePath} has no service "database" on 127.0.0.1:<port>:5432 with POSTGRES_USER postgres, POSTGRES_PASSWORD postgres and POSTGRES_DB, so ${packages.map((db) => db.root).join(', ')} got no up, down or CONNECTION_STRING. Give the service that shape, or add the up and down targets and the CONNECTION_STRING of your database by hand (ADR 0012 decisions 16 and 17 of @zukhruf/nx).`);
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
return { port: Number(port), name };
|
|
84
|
+
}
|
|
85
|
+
/** Each node-app whose source imports the db package, as the prisma generator wires one: `from '<package>'` in its src. */
|
|
86
|
+
function backendsOf(tree, packageName) {
|
|
87
|
+
const escaped = packageName.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&');
|
|
88
|
+
const imports = new RegExp(`['"]${escaped}(?:/[^'"]*)?['"]`);
|
|
89
|
+
return projectRootsWith(tree, 'sdk-it.config.ts').filter((root) => sourceFiles(tree, joinPathFragments(root, 'src')).some((path) => imports.test(tree.read(path, 'utf-8') ?? '')));
|
|
90
|
+
}
|
|
91
|
+
/** `^up` reaches the db package through the import graph (zukhruf/no-depends-on-project refuses a named project). */
|
|
92
|
+
function addUpToServe(tree, backend) {
|
|
93
|
+
const path = joinPathFragments(backend, 'package.json');
|
|
94
|
+
const serve = readJson(tree, path).nx?.targets?.['serve'];
|
|
95
|
+
if (serve === undefined) {
|
|
96
|
+
logger.warn(`add-local-postgres: ${path} has no serve target, so it got no "^up". Add "^up" to the dependsOn of the serve target of ${backend}, so serve starts the local Postgres first.`);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
updateJsonIfChanged(tree, path, (manifest) => {
|
|
100
|
+
const target = manifest.nx?.targets?.['serve'];
|
|
101
|
+
if (target === undefined)
|
|
102
|
+
return;
|
|
103
|
+
target.dependsOn = unique([...(target.dependsOn ?? []), '^up']);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The local URL in `.env.example`, and in `.env` where it is, when the file
|
|
108
|
+
* has no CONNECTION_STRING or has it empty, as the generator wrote it before.
|
|
109
|
+
* A value that is there stays.
|
|
110
|
+
*/
|
|
111
|
+
function addConnectionString(tree, root, connectionString) {
|
|
112
|
+
for (const file of ['.env.example', '.env']) {
|
|
113
|
+
const path = joinPathFragments(root, file);
|
|
114
|
+
const content = tree.read(path, 'utf-8');
|
|
115
|
+
if (content === null)
|
|
116
|
+
continue;
|
|
117
|
+
if (envValue(content, 'CONNECTION_STRING') === '') {
|
|
118
|
+
tree.write(path, content.replace(/^CONNECTION_STRING=$/m, `CONNECTION_STRING=${connectionString}`));
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
addEnvEntry(tree, path, 'CONNECTION_STRING', connectionString);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=add-local-postgres.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-local-postgres.js","sourceRoot":"","sources":["../../../src/migrations/update-0-8-40/add-local-postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,iBAAiB,EACjB,MAAM,EACN,cAAc,EACd,QAAQ,GACT,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAEL,aAAa,EACb,qBAAqB,GACtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAEL,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAOtC;;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AAO,CACb,uBAAuB,EACvB,qBAAqB,gBAAgB,EAAE,CACxC,CACF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Tree } from '@nx/devkit';
|
|
2
|
+
/**
|
|
3
|
+
* #4768: node-app and react-app add PORTLESS_UNPRIVILEGED=1 and
|
|
4
|
+
* PORTLESS_HTTPS=1 to `targetDefaults.portless.options.env` in nx.json. A
|
|
5
|
+
* repo with a `portless` target gets the keys it does not have; a key that is
|
|
6
|
+
* there stays, and no PORTLESS_TLD is added.
|
|
7
|
+
*/
|
|
8
|
+
export default function addPortlessProxyEnvMigration(tree: Tree): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=add-portless-proxy-env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-portless-proxy-env.d.ts","sourceRoot":"","sources":["../../../src/migrations/update-0-8-40/add-portless-proxy-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,IAAI,EAGV,MAAM,YAAY,CAAC;AAKpB;;;;;GAKG;AACH,wBAA8B,4BAA4B,CACxD,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,IAAI,CAAC,CASf"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { formatFiles, getProjects, } from '@nx/devkit';
|
|
2
|
+
import { addPortlessProxyEnv } from "../../generators/portless-env.js";
|
|
3
|
+
import { updateJsonIfChanged } from "../workspace.js";
|
|
4
|
+
/**
|
|
5
|
+
* #4768: node-app and react-app add PORTLESS_UNPRIVILEGED=1 and
|
|
6
|
+
* PORTLESS_HTTPS=1 to `targetDefaults.portless.options.env` in nx.json. A
|
|
7
|
+
* repo with a `portless` target gets the keys it does not have; a key that is
|
|
8
|
+
* there stays, and no PORTLESS_TLD is added.
|
|
9
|
+
*/
|
|
10
|
+
export default async function addPortlessProxyEnvMigration(tree) {
|
|
11
|
+
const portless = getProjects(tree)
|
|
12
|
+
.values()
|
|
13
|
+
.some((project) => project.targets?.['portless'] !== undefined);
|
|
14
|
+
if (!portless)
|
|
15
|
+
return;
|
|
16
|
+
updateJsonIfChanged(tree, 'nx.json', (nxJson) => {
|
|
17
|
+
addPortlessProxyEnv(nxJson);
|
|
18
|
+
});
|
|
19
|
+
await formatFiles(tree);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=add-portless-proxy-env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-portless-proxy-env.js","sourceRoot":"","sources":["../../../src/migrations/update-0-8-40/add-portless-proxy-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACX,WAAW,GACZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,4BAA4B,CACxD,IAAU;IAEV,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC;SAC/B,MAAM,EAAE;SACR,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,KAAK,SAAS,CAAC,CAAC;IAClE,IAAI,CAAC,QAAQ;QAAE,OAAO;IACtB,mBAAmB,CAAsB,IAAI,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE;QACnE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IACH,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Tree } from '@nx/devkit';
|
|
2
|
+
/**
|
|
3
|
+
* #4826: the prisma generator adds `...` and
|
|
4
|
+
* `{ "dependentTasksOutputFiles": "**\/*.ts" }` to the `inputs` of
|
|
5
|
+
* `targetDefaults.typecheck` and `targetDefaults.build`, so a changed schema
|
|
6
|
+
* changes the hash of a db package's build (ADR 0012 decision 6). A repo whose
|
|
7
|
+
* nx.json lists `@zukhruf/nx/prisma` gets the inputs it does not have; the
|
|
8
|
+
* inputs that are there stay.
|
|
9
|
+
*/
|
|
10
|
+
export default function addPrismaClientInputs(tree: Tree): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=add-prisma-client-inputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-prisma-client-inputs.d.ts","sourceRoot":"","sources":["../../../src/migrations/update-0-8-40/add-prisma-client-inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,IAAI,EAAe,MAAM,YAAY,CAAC;AAK9E;;;;;;;GAOG;AACH,wBAA8B,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAM7E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { formatFiles } from '@nx/devkit';
|
|
2
|
+
import { addPrismaTargetDefaults } from "../../generators/prisma/generator.js";
|
|
3
|
+
import { hasPlugin, updateJsonIfChanged } from "../workspace.js";
|
|
4
|
+
/**
|
|
5
|
+
* #4826: the prisma generator adds `...` and
|
|
6
|
+
* `{ "dependentTasksOutputFiles": "**\/*.ts" }` to the `inputs` of
|
|
7
|
+
* `targetDefaults.typecheck` and `targetDefaults.build`, so a changed schema
|
|
8
|
+
* changes the hash of a db package's build (ADR 0012 decision 6). A repo whose
|
|
9
|
+
* nx.json lists `@zukhruf/nx/prisma` gets the inputs it does not have; the
|
|
10
|
+
* inputs that are there stay.
|
|
11
|
+
*/
|
|
12
|
+
export default async function addPrismaClientInputs(tree) {
|
|
13
|
+
if (!hasPlugin(tree, '@zukhruf/nx/prisma'))
|
|
14
|
+
return;
|
|
15
|
+
updateJsonIfChanged(tree, 'nx.json', (nxJson) => {
|
|
16
|
+
addPrismaTargetDefaults(nxJson);
|
|
17
|
+
});
|
|
18
|
+
await formatFiles(tree);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=add-prisma-client-inputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-prisma-client-inputs.js","sourceRoot":"","sources":["../../../src/migrations/update-0-8-40/add-prisma-client-inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEjE;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,qBAAqB,CAAC,IAAU;IAC5D,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,oBAAoB,CAAC;QAAE,OAAO;IACnD,mBAAmB,CAAsB,IAAI,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE;QACnE,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IACH,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Tree } from '@nx/devkit';
|
|
2
|
+
/**
|
|
3
|
+
* #4833, ADR 0016: NODE_ENV is production in every setup, and code never
|
|
4
|
+
* reads it. A repo gets the configuration that the generators write now: the
|
|
5
|
+
* nx.json defaults of test and serve, the env of the generated targets, the
|
|
6
|
+
* web's two exceptions, NODE_ENV in each .env.example, the workflow env, and
|
|
7
|
+
* ALLOWED_ORIGINS in the production env of dokploy. A value that is there
|
|
8
|
+
* stays, except the development that the backend's generated targets set
|
|
9
|
+
* before. Source code is not rewritten: each NODE_ENV read is logged with its
|
|
10
|
+
* file and line, and zukhruf/no-node-env refuses it.
|
|
11
|
+
*/
|
|
12
|
+
export default function nodeEnvProduction(tree: Tree): Promise<void>;
|
|
13
|
+
//# sourceMappingURL=node-env-production.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-env-production.d.ts","sourceRoot":"","sources":["../../../src/migrations/update-0-8-40/node-env-production.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,IAAI,EAIV,MAAM,YAAY,CAAC;AAgBpB;;;;;;;;;GASG;AACH,wBAA8B,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAyCzE"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { formatFiles, joinPathFragments, logger, } from '@nx/devkit';
|
|
2
|
+
import { envMarker, infraRoot } from "../../generators/dokploy/files.js";
|
|
3
|
+
import { addEnvEntry } from "../../generators/env-file.js";
|
|
4
|
+
import { addProductionNodeEnvDefaults } from "../../generators/init/nx-json.js";
|
|
5
|
+
import { hasPlugin, projectRootsWith, sourceFiles, updateJsonIfChanged, } from "../workspace.js";
|
|
6
|
+
const envComment = '# Every setup runs under production; no code reads NODE_ENV (ADR 0016).';
|
|
7
|
+
/**
|
|
8
|
+
* #4833, ADR 0016: NODE_ENV is production in every setup, and code never
|
|
9
|
+
* reads it. A repo gets the configuration that the generators write now: the
|
|
10
|
+
* nx.json defaults of test and serve, the env of the generated targets, the
|
|
11
|
+
* web's two exceptions, NODE_ENV in each .env.example, the workflow env, and
|
|
12
|
+
* ALLOWED_ORIGINS in the production env of dokploy. A value that is there
|
|
13
|
+
* stays, except the development that the backend's generated targets set
|
|
14
|
+
* before. Source code is not rewritten: each NODE_ENV read is logged with its
|
|
15
|
+
* file and line, and zukhruf/no-node-env refuses it.
|
|
16
|
+
*/
|
|
17
|
+
export default async function nodeEnvProduction(tree) {
|
|
18
|
+
const backends = projectRootsWith(tree, 'sdk-it.config.ts');
|
|
19
|
+
const dbPackages = projectRootsWith(tree, 'prisma.config.ts');
|
|
20
|
+
// A react-app has an index.html beside its vite.config.ts; a ui-package, a
|
|
21
|
+
// Vite library, has none and gets no dev server.
|
|
22
|
+
const webs = hasPlugin(tree, '@nx/vite/plugin')
|
|
23
|
+
? projectRootsWith(tree, 'vite.config.ts').filter((root) => tree.exists(joinPathFragments(root, 'index.html')))
|
|
24
|
+
: [];
|
|
25
|
+
if (backends.length + dbPackages.length + webs.length === 0)
|
|
26
|
+
return;
|
|
27
|
+
if (tree.exists('nx.json')) {
|
|
28
|
+
updateJsonIfChanged(tree, 'nx.json', addProductionNodeEnvDefaults);
|
|
29
|
+
}
|
|
30
|
+
for (const root of backends) {
|
|
31
|
+
setTargetEnv(tree, root, ['serve', 'auth:generate', 'auth:check'], {
|
|
32
|
+
value: 'production',
|
|
33
|
+
replaces: 'development',
|
|
34
|
+
});
|
|
35
|
+
setTargetEnv(tree, joinPathFragments(root, '.sdk-it'), ['sdk'], {
|
|
36
|
+
value: 'production',
|
|
37
|
+
});
|
|
38
|
+
addNodeEnvLine(tree, root);
|
|
39
|
+
}
|
|
40
|
+
for (const root of dbPackages) {
|
|
41
|
+
setTargetEnv(tree, root, ['up'], { value: 'production' });
|
|
42
|
+
addNodeEnvLine(tree, root);
|
|
43
|
+
}
|
|
44
|
+
for (const root of webs)
|
|
45
|
+
addWebExceptions(tree, root);
|
|
46
|
+
addNodeEnvLine(tree, infraRoot);
|
|
47
|
+
for (const workflow of ['ci.yml', 'deploy.yml']) {
|
|
48
|
+
addWorkflowEnv(tree, joinPathFragments('.github/workflows', workflow));
|
|
49
|
+
}
|
|
50
|
+
addAllowedOrigins(tree);
|
|
51
|
+
logNodeEnvReads(tree);
|
|
52
|
+
await formatFiles(tree);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Sets NODE_ENV in the env of each named target that the project's
|
|
56
|
+
* package.json has. A NODE_ENV that is there stays, unless it is `replaces`,
|
|
57
|
+
* the value the generator wrote before.
|
|
58
|
+
*/
|
|
59
|
+
function setTargetEnv(tree, root, targets, { value, replaces }) {
|
|
60
|
+
const path = joinPathFragments(root, 'package.json');
|
|
61
|
+
if (!tree.exists(path))
|
|
62
|
+
return;
|
|
63
|
+
updateJsonIfChanged(tree, path, (manifest) => {
|
|
64
|
+
for (const name of targets) {
|
|
65
|
+
const target = manifest.nx?.targets?.[name];
|
|
66
|
+
if (target === undefined)
|
|
67
|
+
continue;
|
|
68
|
+
const env = { ...target.options?.env };
|
|
69
|
+
if (env['NODE_ENV'] === undefined || env['NODE_ENV'] === replaces) {
|
|
70
|
+
env['NODE_ENV'] = value;
|
|
71
|
+
}
|
|
72
|
+
target.options = { ...target.options, env };
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The web's two exceptions (ADR 0016): Vite turns React Fast Refresh off under
|
|
78
|
+
* production, so dev and serve run under development, and Testing Library
|
|
79
|
+
* renders through act(), which production React does not have, so test runs
|
|
80
|
+
* under test. A target with an env of its own keeps it.
|
|
81
|
+
*/
|
|
82
|
+
function addWebExceptions(tree, root) {
|
|
83
|
+
const path = joinPathFragments(root, 'package.json');
|
|
84
|
+
updateJsonIfChanged(tree, path, (manifest) => {
|
|
85
|
+
const targets = { ...manifest.nx?.targets };
|
|
86
|
+
for (const [name, value] of [
|
|
87
|
+
['dev', 'development'],
|
|
88
|
+
['serve', 'development'],
|
|
89
|
+
['test', 'test'],
|
|
90
|
+
]) {
|
|
91
|
+
const target = targets[name] ?? {};
|
|
92
|
+
if (target.options?.env !== undefined)
|
|
93
|
+
continue;
|
|
94
|
+
targets[name] = {
|
|
95
|
+
...target,
|
|
96
|
+
options: { ...target.options, env: { NODE_ENV: value } },
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
manifest.nx = { ...manifest.nx, targets };
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/** NODE_ENV=production in the .env.example of `root`, and in its .env where it is. */
|
|
103
|
+
function addNodeEnvLine(tree, root) {
|
|
104
|
+
for (const file of ['.env.example', '.env']) {
|
|
105
|
+
const path = joinPathFragments(root, file);
|
|
106
|
+
const content = tree.read(path, 'utf-8');
|
|
107
|
+
if (content === null || /^NODE_ENV=/m.test(content))
|
|
108
|
+
continue;
|
|
109
|
+
const separator = content === '' || content.endsWith('\n') ? '' : '\n';
|
|
110
|
+
tree.write(path, `${content}${separator}${envComment}\n`);
|
|
111
|
+
addEnvEntry(tree, path, 'NODE_ENV', 'production');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* NODE_ENV: production and npm_config_include: dev in the workflow-level env
|
|
116
|
+
* of a workflow that dokploy writes. npm omits devDependencies under
|
|
117
|
+
* NODE_ENV=production, and CI needs them.
|
|
118
|
+
*/
|
|
119
|
+
function addWorkflowEnv(tree, path) {
|
|
120
|
+
const content = tree.read(path, 'utf-8');
|
|
121
|
+
if (content === null)
|
|
122
|
+
return;
|
|
123
|
+
const lines = [
|
|
124
|
+
...(/^ {2}NODE_ENV:/m.test(content)
|
|
125
|
+
? []
|
|
126
|
+
: [
|
|
127
|
+
' # Every setup runs under production (ADR 0016 of @zukhruf/nx).',
|
|
128
|
+
' NODE_ENV: production',
|
|
129
|
+
]),
|
|
130
|
+
...(/^ {2}npm_config_include:/m.test(content)
|
|
131
|
+
? []
|
|
132
|
+
: [
|
|
133
|
+
' # npm omits devDependencies under NODE_ENV=production; CI needs them.',
|
|
134
|
+
' npm_config_include: dev',
|
|
135
|
+
]),
|
|
136
|
+
];
|
|
137
|
+
if (lines.length === 0)
|
|
138
|
+
return;
|
|
139
|
+
if (/^env:\n/m.test(content)) {
|
|
140
|
+
tree.write(path, content.replace(/^env:\n/m, `env:\n${lines.join('\n')}\n`));
|
|
141
|
+
}
|
|
142
|
+
else if (/^jobs:/m.test(content)) {
|
|
143
|
+
tree.write(path, content.replace(/^jobs:/m, `env:\n${lines.join('\n')}\n\njobs:`));
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
logger.warn(`node-env-production: ${path} has no workflow-level env and no jobs key, so it got no edit. Add "env: { NODE_ENV: production, npm_config_include: dev }" at its top level (ADR 0016 of @zukhruf/nx).`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* ALLOWED_ORIGINS in the production env of the dokploy infra: the generated
|
|
151
|
+
* backend now always derives the better-auth baseURL from its hosts, and
|
|
152
|
+
* better-auth refuses an empty list. The comment line ends the alignment
|
|
153
|
+
* group of tofu fmt, as the auth generator's lines do.
|
|
154
|
+
*/
|
|
155
|
+
function addAllowedOrigins(tree) {
|
|
156
|
+
const path = joinPathFragments(infraRoot, 'src/environments/production/main.tf');
|
|
157
|
+
const content = tree.read(path, 'utf-8');
|
|
158
|
+
if (content === null || /^\s+ALLOWED_ORIGINS\s*=/m.test(content))
|
|
159
|
+
return;
|
|
160
|
+
const marker = new RegExp(`^( +)${escape(envMarker)}$`, 'm');
|
|
161
|
+
if (!marker.test(content)) {
|
|
162
|
+
logger.warn(`node-env-production: ${path} has no "${envMarker}" line, so it got no ALLOWED_ORIGINS. Add ALLOWED_ORIGINS = "https://\${local.host}" to the env map of module "stack": the backend derives the better-auth baseURL from it (ADR 0016 of @zukhruf/nx).`);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
tree.write(path, content.replace(marker, (line, indent) => `${indent}# The public origin: CORS and better-auth trust it (ADR 0016).\n${indent}ALLOWED_ORIGINS = "https://\${local.host}"\n${line}`));
|
|
166
|
+
}
|
|
167
|
+
// The reads that zukhruf/no-node-env reports, as text. A write
|
|
168
|
+
// (`process.env.NODE_ENV = …`) is not a read.
|
|
169
|
+
const nodeEnvRead = /process\.env(?:\.NODE_ENV|\[\s*['"`]NODE_ENV['"`]\s*\])(?!\s*=[^=])|import\.meta\.env\.NODE_ENV|\{[^}]*\bNODE_ENV\b[^}]*\}\s*=\s*process\.env/;
|
|
170
|
+
/** Logs each NODE_ENV read in source, which the code change must replace by hand. */
|
|
171
|
+
function logNodeEnvReads(tree) {
|
|
172
|
+
const reads = [];
|
|
173
|
+
for (const path of sourceFiles(tree)) {
|
|
174
|
+
if (path.includes('/node_modules/') || path.endsWith('.d.ts'))
|
|
175
|
+
continue;
|
|
176
|
+
const lines = (tree.read(path, 'utf-8') ?? '').split('\n');
|
|
177
|
+
lines.forEach((line, index) => {
|
|
178
|
+
if (nodeEnvRead.test(line))
|
|
179
|
+
reads.push(`${path}:${index + 1}`);
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
if (reads.length === 0)
|
|
183
|
+
return;
|
|
184
|
+
logger.warn(`node-env-production: ${reads.length} NODE_ENV reads in source, which zukhruf/no-node-env refuses. Give each behavior its own setting (ALLOWED_ORIGINS, HOST, LOG_DIR, LOG_PRETTY, UI_ROOT), as ADR 0016 of @zukhruf/nx lists:\n${reads.join('\n')}`);
|
|
185
|
+
}
|
|
186
|
+
function escape(text) {
|
|
187
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=node-env-production.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-env-production.js","sourceRoot":"","sources":["../../../src/migrations/update-0-8-40/node-env-production.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACX,iBAAiB,EACjB,MAAM,GACP,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAEL,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,UAAU,GACd,yEAAyE,CAAC;AAE5E;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UA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AAe,CAAC,IAAU;IACjC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,SAAS;QACxE,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3D,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAC5B,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;gBAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACL,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAC/B,MAAM,CAAC,IAAI,CACT,wBAAwB,KAAK,CAAC,MAAM,8LAA8L,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACrP,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type TargetConfiguration, type Tree } from '@nx/devkit';
|
|
2
|
+
/** The package.json of a generated project: its targets are in its `nx` key. */
|
|
3
|
+
export interface ProjectManifest {
|
|
4
|
+
name?: string;
|
|
5
|
+
nx?: {
|
|
6
|
+
targets?: Record<string, TargetConfiguration>;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Changes a JSON file of the Tree only when `update` changes its value, so a
|
|
11
|
+
* second run writes nothing, and a file whose keys are in another order keeps
|
|
12
|
+
* its text. `update` changes the value it gets.
|
|
13
|
+
*/
|
|
14
|
+
export declare function updateJsonIfChanged<T extends object>(tree: Tree, path: string, update: (value: T) => void): void;
|
|
15
|
+
/**
|
|
16
|
+
* The root of each project that holds `marker`, the file a generator leaves
|
|
17
|
+
* in the projects of its kind: `sdk-it.config.ts` for a node-app and
|
|
18
|
+
* `prisma.config.ts` for a db package. Only a project root with a package.json
|
|
19
|
+
* counts, because the generators write their targets there.
|
|
20
|
+
*/
|
|
21
|
+
export declare function projectRootsWith(tree: Tree, marker: string): string[];
|
|
22
|
+
/** Whether nx.json registers the plugin, for example `@nx/vite/plugin`. */
|
|
23
|
+
export declare function hasPlugin(tree: Tree, plugin: string): boolean;
|
|
24
|
+
/** Each source file under `directory` that Git does not ignore, `.ts`, `.tsx`, `.js`, `.mjs` and the like. */
|
|
25
|
+
export declare function sourceFiles(tree: Tree, directory?: string): string[];
|
|
26
|
+
/**
|
|
27
|
+
* The value of `KEY` in an env file: undefined when the file has no line for
|
|
28
|
+
* the key, and `''` for `KEY=`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function envValue(content: string, key: string): string | undefined;
|
|
31
|
+
//# sourceMappingURL=workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/migrations/workspace.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,IAAI,EAMV,MAAM,YAAY,CAAC;AAIpB,gFAAgF;AAChF,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAA;KAAE,CAAC;CACxD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAClD,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GACzB,IAAI,CAKN;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CASrE;AAED,2EAA2E;AAC3E,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAI7D;AAID,8GAA8G;AAC9G,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,SAAK,GAAG,MAAM,EAAE,CAMhE;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEzE"}
|