@zukhruf/nx 0.8.30 → 0.8.32
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 +375 -19
- package/dist/generators/add-keys.d.ts +7 -0
- package/dist/generators/add-keys.d.ts.map +1 -0
- package/dist/generators/add-keys.js +14 -0
- package/dist/generators/add-keys.js.map +1 -0
- package/dist/generators/add-lines.d.ts +8 -0
- package/dist/generators/add-lines.d.ts.map +1 -0
- package/dist/generators/add-lines.js +21 -0
- package/dist/generators/add-lines.js.map +1 -0
- package/dist/generators/app-directory.d.ts +17 -0
- package/dist/generators/app-directory.d.ts.map +1 -0
- package/dist/generators/app-directory.js +34 -0
- package/dist/generators/app-directory.js.map +1 -0
- package/dist/generators/dokploy/files.d.ts +23 -0
- package/dist/generators/dokploy/files.d.ts.map +1 -0
- package/dist/generators/dokploy/files.js +733 -0
- package/dist/generators/dokploy/files.js.map +1 -0
- package/dist/generators/dokploy/generator.d.ts +75 -0
- package/dist/generators/dokploy/generator.d.ts.map +1 -0
- package/dist/generators/dokploy/generator.js +146 -0
- package/dist/generators/dokploy/generator.js.map +1 -0
- package/dist/generators/dokploy/providers.d.ts +15 -0
- package/dist/generators/dokploy/providers.d.ts.map +1 -0
- package/dist/generators/dokploy/providers.js +114 -0
- package/dist/generators/dokploy/providers.js.map +1 -0
- package/dist/generators/init/files.d.ts.map +1 -1
- package/dist/generators/init/files.js +11 -5
- package/dist/generators/init/files.js.map +1 -1
- package/dist/generators/init/generator.d.ts.map +1 -1
- package/dist/generators/init/generator.js +1 -16
- package/dist/generators/init/generator.js.map +1 -1
- package/dist/generators/init/nx-json.d.ts +16 -3
- package/dist/generators/init/nx-json.d.ts.map +1 -1
- package/dist/generators/init/nx-json.js +20 -5
- package/dist/generators/init/nx-json.js.map +1 -1
- package/dist/generators/init/root-package-json.d.ts +6 -0
- package/dist/generators/init/root-package-json.d.ts.map +1 -1
- package/dist/generators/init/root-package-json.js +15 -12
- package/dist/generators/init/root-package-json.js.map +1 -1
- package/dist/generators/node-app/files.d.ts +43 -0
- package/dist/generators/node-app/files.d.ts.map +1 -0
- package/dist/generators/node-app/files.js +522 -0
- package/dist/generators/node-app/files.js.map +1 -0
- package/dist/generators/node-app/generator.d.ts +17 -0
- package/dist/generators/node-app/generator.d.ts.map +1 -0
- package/dist/generators/node-app/generator.js +322 -0
- package/dist/generators/node-app/generator.js.map +1 -0
- package/dist/generators/nx-plugin.d.ts +16 -0
- package/dist/generators/nx-plugin.d.ts.map +1 -0
- package/dist/generators/nx-plugin.js +27 -0
- package/dist/generators/nx-plugin.js.map +1 -0
- package/dist/generators/pair/files.d.ts +4 -0
- package/dist/generators/pair/files.d.ts.map +1 -0
- package/dist/generators/pair/files.js +73 -0
- package/dist/generators/pair/files.js.map +1 -0
- package/dist/generators/pair/generator.d.ts +19 -0
- package/dist/generators/pair/generator.d.ts.map +1 -0
- package/dist/generators/pair/generator.js +70 -0
- package/dist/generators/pair/generator.js.map +1 -0
- package/dist/generators/prisma/files.d.ts +20 -0
- package/dist/generators/prisma/files.d.ts.map +1 -0
- package/dist/generators/prisma/files.js +183 -0
- package/dist/generators/prisma/files.js.map +1 -0
- package/dist/generators/prisma/generator.d.ts +17 -0
- package/dist/generators/prisma/generator.d.ts.map +1 -0
- package/dist/generators/prisma/generator.js +258 -0
- package/dist/generators/prisma/generator.js.map +1 -0
- package/dist/generators/react-app/files.d.ts +7 -0
- package/dist/generators/react-app/files.d.ts.map +1 -0
- package/dist/generators/react-app/files.js +188 -0
- package/dist/generators/react-app/files.js.map +1 -0
- package/dist/generators/react-app/generator.d.ts +12 -0
- package/dist/generators/react-app/generator.d.ts.map +1 -0
- package/dist/generators/react-app/generator.js +243 -0
- package/dist/generators/react-app/generator.js.map +1 -0
- package/dist/generators/react.d.ts +29 -0
- package/dist/generators/react.d.ts.map +1 -0
- package/dist/generators/react.js +64 -0
- package/dist/generators/react.js.map +1 -0
- package/dist/generators/root-dependencies.d.ts +30 -0
- package/dist/generators/root-dependencies.d.ts.map +1 -0
- package/dist/generators/root-dependencies.js +63 -0
- package/dist/generators/root-dependencies.js.map +1 -0
- package/dist/generators/ui-package/files.d.ts +39 -0
- package/dist/generators/ui-package/files.d.ts.map +1 -0
- package/dist/generators/ui-package/files.js +163 -0
- package/dist/generators/ui-package/files.js.map +1 -0
- package/dist/generators/ui-package/generator.d.ts +14 -0
- package/dist/generators/ui-package/generator.d.ts.map +1 -0
- package/dist/generators/ui-package/generator.js +116 -0
- package/dist/generators/ui-package/generator.js.map +1 -0
- package/dist/generators/versions.d.ts +50 -1
- package/dist/generators/versions.d.ts.map +1 -1
- package/dist/generators/versions.js +64 -1
- package/dist/generators/versions.js.map +1 -1
- package/generators.json +30 -0
- package/package.json +24 -5
- package/src/generators/dokploy/schema.json +48 -0
- package/src/generators/node-app/schema.json +22 -0
- package/src/generators/pair/schema.json +18 -0
- package/src/generators/prisma/schema.json +21 -0
- package/src/generators/react-app/schema.json +17 -0
- package/src/generators/ui-package/schema.json +22 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { readJson, updateJson } from '@nx/devkit';
|
|
2
|
+
import { addMissingKeys } from "./add-keys.js";
|
|
3
|
+
import { pinNxFamily, sortKeys, } from "./init/root-package-json.js";
|
|
4
|
+
/** The names in the root `dependencies` and `devDependencies`, before an Nx generator runs. */
|
|
5
|
+
export function rootDependencyNames(tree) {
|
|
6
|
+
const { dependencies, devDependencies } = readJson(tree, 'package.json');
|
|
7
|
+
return new Set([
|
|
8
|
+
...Object.keys(dependencies ?? {}),
|
|
9
|
+
...Object.keys(devDependencies ?? {}),
|
|
10
|
+
]);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The install-script decision for fsevents, which vite brings to react-app and
|
|
14
|
+
* ui-package and @nx/jest brings to node-app. It ships prebuilt for macOS, so
|
|
15
|
+
* its script does not run, and strict-allow-scripts stops an install that has
|
|
16
|
+
* no decision for it.
|
|
17
|
+
*/
|
|
18
|
+
export const fseventsScript = { fsevents: false };
|
|
19
|
+
/**
|
|
20
|
+
* Settles the root package.json after an Nx generator ran: each package of
|
|
21
|
+
* `devDependencies` that was not there before gets its version, also over the
|
|
22
|
+
* version that the Nx generator wrote; each name of `residue` that the run
|
|
23
|
+
* added goes; and `nx` and each `@nx/*` get `nxVersion` (#4532).
|
|
24
|
+
*/
|
|
25
|
+
export function settleRootDependencies(tree, before, settings) {
|
|
26
|
+
updateJson(tree, 'package.json', (packageJson) => {
|
|
27
|
+
const dependencies = { ...packageJson.dependencies };
|
|
28
|
+
const devDependencies = { ...packageJson.devDependencies };
|
|
29
|
+
for (const [name, version] of Object.entries(settings.devDependencies)) {
|
|
30
|
+
if (before.has(name))
|
|
31
|
+
continue;
|
|
32
|
+
if (name in dependencies) {
|
|
33
|
+
dependencies[name] = version;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
devDependencies[name] = version;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
for (const name of settings.residue ?? []) {
|
|
40
|
+
if (before.has(name))
|
|
41
|
+
continue;
|
|
42
|
+
delete dependencies[name];
|
|
43
|
+
delete devDependencies[name];
|
|
44
|
+
}
|
|
45
|
+
pinNxFamily(dependencies);
|
|
46
|
+
pinNxFamily(devDependencies);
|
|
47
|
+
if (Object.keys(dependencies).length > 0) {
|
|
48
|
+
packageJson.dependencies = sortKeys(dependencies);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
delete packageJson.dependencies;
|
|
52
|
+
}
|
|
53
|
+
packageJson.devDependencies = sortKeys(devDependencies);
|
|
54
|
+
if (settings.allowScripts) {
|
|
55
|
+
packageJson.allowScripts = addMissingKeys(packageJson.allowScripts, settings.allowScripts);
|
|
56
|
+
}
|
|
57
|
+
if (settings.overrides) {
|
|
58
|
+
packageJson.overrides = addMissingKeys(packageJson.overrides, settings.overrides);
|
|
59
|
+
}
|
|
60
|
+
return packageJson;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=root-dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root-dependencies.js","sourceRoot":"","sources":["../../src/generators/root-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAEL,WAAW,EACX,QAAQ,GACT,MAAM,6BAA6B,CAAC;AAErC,+FAA+F;AAC/F,MAAM,UAAU,mBAAmB,CAAC,IAAU;IAC5C,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,GAAG,QAAQ,CAChD,IAAI,EACJ,cAAc,CACf,CAAC;IACF,OAAO,IAAI,GAAG,CAAC;QACb,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC;QAClC,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE,CAAC;KACtC,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAalD;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAAU,EACV,MAAmB,EACnB,QAA0B;IAE1B,UAAU,CAAC,IAAI,EAAE,cAAc,EAAE,CAAC,WAA4B,EAAE,EAAE;QAChE,MAAM,YAAY,GAAG,EAAE,GAAG,WAAW,CAAC,YAAY,EAAE,CAAC;QACrD,MAAM,eAAe,GAAG,EAAE,GAAG,WAAW,CAAC,eAAe,EAAE,CAAC;QAC3D,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;YACvE,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;gBAAE,SAAS;YAC/B,IAAI,IAAI,IAAI,YAAY,EAAE,CAAC;gBACzB,YAAY,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;YAC/B,CAAC;iBAAM,CAAC;gBACN,eAAe,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;YAClC,CAAC;QACH,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;YAC1C,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;gBAAE,SAAS;YAC/B,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;YAC1B,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;QACD,WAAW,CAAC,YAAY,CAAC,CAAC;QAC1B,WAAW,CAAC,eAAe,CAAC,CAAC;QAC7B,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzC,WAAW,CAAC,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;QACpD,CAAC;aAAM,CAAC;YACN,OAAO,WAAW,CAAC,YAAY,CAAC;QAClC,CAAC;QACD,WAAW,CAAC,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;QACxD,IAAI,QAAQ,CAAC,YAAY,EAAE,CAAC;YAC1B,WAAW,CAAC,YAAY,GAAG,cAAc,CACvC,WAAW,CAAC,YAAY,EACxB,QAAQ,CAAC,YAAY,CACtB,CAAC;QACJ,CAAC;QACD,IAAI,QAAQ,CAAC,SAAS,EAAE,CAAC;YACvB,WAAW,CAAC,SAAS,GAAG,cAAc,CACpC,WAAW,CAAC,SAAS,EACrB,QAAQ,CAAC,SAAS,CACnB,CAAC;QACJ,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare function viteConfig(projectRoot: string, rootOffset: string, importPath: string): string;
|
|
2
|
+
export declare function rootTsconfig(rootOffset: string): {
|
|
3
|
+
extends: string;
|
|
4
|
+
files: never[];
|
|
5
|
+
include: never[];
|
|
6
|
+
references: {
|
|
7
|
+
path: string;
|
|
8
|
+
}[];
|
|
9
|
+
};
|
|
10
|
+
export declare function libraryTsconfig(rootOffset: string): {
|
|
11
|
+
extends: string;
|
|
12
|
+
compilerOptions: {
|
|
13
|
+
lib: string[];
|
|
14
|
+
outDir: string;
|
|
15
|
+
types: string[];
|
|
16
|
+
rootDir: string;
|
|
17
|
+
jsx: string;
|
|
18
|
+
tsBuildInfoFile: string;
|
|
19
|
+
};
|
|
20
|
+
exclude: string[];
|
|
21
|
+
include: string[];
|
|
22
|
+
};
|
|
23
|
+
export declare function specTsconfig(rootOffset: string): {
|
|
24
|
+
extends: string;
|
|
25
|
+
compilerOptions: {
|
|
26
|
+
rootDir: string;
|
|
27
|
+
outDir: string;
|
|
28
|
+
tsBuildInfoFile: string;
|
|
29
|
+
types: string[];
|
|
30
|
+
};
|
|
31
|
+
include: string[];
|
|
32
|
+
references: {
|
|
33
|
+
path: string;
|
|
34
|
+
}[];
|
|
35
|
+
};
|
|
36
|
+
export declare function packageNameComponent(importPath: string): string;
|
|
37
|
+
export declare function componentTest(importPath: string): string;
|
|
38
|
+
export declare function publicApiTest(importPath: string): string;
|
|
39
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/generators/ui-package/files.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,CACxB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,MAAM,CAgDR;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM;;;;;;;EAU9C;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM;;;;;;;;;;;;EA6BjD;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM;;;;;;;;;;;;EAY9C;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAO/D;AAKD,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAiCxD;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAWxD"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// The content of each file that ui-package writes. Each is a string in a .ts
|
|
2
|
+
// module, so tsc puts it in dist with no copy step (ADR 0009).
|
|
3
|
+
export function viteConfig(projectRoot, rootOffset, importPath) {
|
|
4
|
+
return `import path from 'node:path';
|
|
5
|
+
|
|
6
|
+
import babel from '@rolldown/plugin-babel';
|
|
7
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
8
|
+
import react, { reactCompilerPreset } from '@vitejs/plugin-react';
|
|
9
|
+
import { defineConfig } from 'vite';
|
|
10
|
+
import dts from 'vite-plugin-dts';
|
|
11
|
+
|
|
12
|
+
export default defineConfig(() => ({
|
|
13
|
+
root: import.meta.dirname,
|
|
14
|
+
cacheDir: '${rootOffset}node_modules/.vite/${projectRoot}',
|
|
15
|
+
plugins: [
|
|
16
|
+
react(),
|
|
17
|
+
babel({ presets: [reactCompilerPreset()] }),
|
|
18
|
+
tailwindcss(),
|
|
19
|
+
dts({
|
|
20
|
+
entryRoot: 'src',
|
|
21
|
+
tsconfigPath: path.join(import.meta.dirname, 'tsconfig.lib.json'),
|
|
22
|
+
}),
|
|
23
|
+
],
|
|
24
|
+
assetsInclude: ['**/*.css'],
|
|
25
|
+
build: {
|
|
26
|
+
outDir: './dist',
|
|
27
|
+
emptyOutDir: true,
|
|
28
|
+
reportCompressedSize: true,
|
|
29
|
+
sourcemap: true,
|
|
30
|
+
commonjsOptions: { transformMixedEsModules: true },
|
|
31
|
+
lib: {
|
|
32
|
+
entry: 'src/index.ts',
|
|
33
|
+
name: '${importPath}',
|
|
34
|
+
fileName: 'index',
|
|
35
|
+
formats: ['es' as const],
|
|
36
|
+
},
|
|
37
|
+
rolldownOptions: {
|
|
38
|
+
external: (id) =>
|
|
39
|
+
id.startsWith('node:') ||
|
|
40
|
+
!(
|
|
41
|
+
id.startsWith('.') ||
|
|
42
|
+
path.isAbsolute(id) ||
|
|
43
|
+
id.startsWith('\\0') ||
|
|
44
|
+
id.includes(':')
|
|
45
|
+
),
|
|
46
|
+
output: { assetFileNames: 'assets/[name][extname]' },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
}));
|
|
50
|
+
`;
|
|
51
|
+
}
|
|
52
|
+
export function rootTsconfig(rootOffset) {
|
|
53
|
+
return {
|
|
54
|
+
extends: `${rootOffset}tsconfig.base.json`,
|
|
55
|
+
files: [],
|
|
56
|
+
include: [],
|
|
57
|
+
references: [
|
|
58
|
+
{ path: './tsconfig.lib.json' },
|
|
59
|
+
{ path: './tsconfig.spec.json' },
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export function libraryTsconfig(rootOffset) {
|
|
64
|
+
return {
|
|
65
|
+
extends: `${rootOffset}tsconfig.base.json`,
|
|
66
|
+
compilerOptions: {
|
|
67
|
+
lib: ['DOM', 'DOM.Iterable', 'DOM.AsyncIterable'],
|
|
68
|
+
outDir: 'dist',
|
|
69
|
+
types: [
|
|
70
|
+
'node',
|
|
71
|
+
'@nx/react/typings/cssmodule.d.ts',
|
|
72
|
+
'@nx/react/typings/image.d.ts',
|
|
73
|
+
'vite/client',
|
|
74
|
+
],
|
|
75
|
+
rootDir: 'src',
|
|
76
|
+
jsx: 'react-jsx',
|
|
77
|
+
tsBuildInfoFile: 'dist/tsconfig.lib.tsbuildinfo',
|
|
78
|
+
},
|
|
79
|
+
exclude: [
|
|
80
|
+
'out-tsc',
|
|
81
|
+
'dist',
|
|
82
|
+
'**/*.spec.ts',
|
|
83
|
+
'**/*.test.ts',
|
|
84
|
+
'**/*.spec.tsx',
|
|
85
|
+
'**/*.test.tsx',
|
|
86
|
+
'eslint.config.js',
|
|
87
|
+
'eslint.config.cjs',
|
|
88
|
+
'eslint.config.mjs',
|
|
89
|
+
],
|
|
90
|
+
include: ['src/**/*.js', 'src/**/*.jsx', 'src/**/*.ts', 'src/**/*.tsx'],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export function specTsconfig(rootOffset) {
|
|
94
|
+
return {
|
|
95
|
+
extends: `${rootOffset}tsconfig.base.json`,
|
|
96
|
+
compilerOptions: {
|
|
97
|
+
rootDir: '.',
|
|
98
|
+
outDir: 'out-tsc/spec',
|
|
99
|
+
tsBuildInfoFile: 'out-tsc/spec/tsconfig.spec.tsbuildinfo',
|
|
100
|
+
types: ['node', 'vite/client'],
|
|
101
|
+
},
|
|
102
|
+
include: ['vite.config.ts'],
|
|
103
|
+
references: [{ path: './tsconfig.lib.json' }],
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export function packageNameComponent(importPath) {
|
|
107
|
+
return `export const packageName = '${importPath}';
|
|
108
|
+
|
|
109
|
+
export function PackageName() {
|
|
110
|
+
return <span>{packageName}</span>;
|
|
111
|
+
}
|
|
112
|
+
`;
|
|
113
|
+
}
|
|
114
|
+
// React DOM checks for a DOM when it loads, so the test loads it after it
|
|
115
|
+
// registers the DOM. Node cannot load .tsx, so the component comes from the
|
|
116
|
+
// built package.
|
|
117
|
+
export function componentTest(importPath) {
|
|
118
|
+
return `import assert from 'node:assert/strict';
|
|
119
|
+
import { test } from 'node:test';
|
|
120
|
+
|
|
121
|
+
import { GlobalRegistrator } from '@happy-dom/global-registrator';
|
|
122
|
+
|
|
123
|
+
test('PackageName renders the name of the package', async () => {
|
|
124
|
+
// Arrange
|
|
125
|
+
GlobalRegistrator.register();
|
|
126
|
+
try {
|
|
127
|
+
Reflect.set(globalThis, 'IS_REACT_ACT_ENVIRONMENT', true);
|
|
128
|
+
const { act, createElement } = await import('react');
|
|
129
|
+
const { createRoot } = await import('react-dom/client');
|
|
130
|
+
const { PackageName } = await import('${importPath}');
|
|
131
|
+
const container = document.body.appendChild(document.createElement('div'));
|
|
132
|
+
const root = createRoot(container);
|
|
133
|
+
try {
|
|
134
|
+
// Act
|
|
135
|
+
await act(async () => {
|
|
136
|
+
root.render(createElement(PackageName));
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// Assert
|
|
140
|
+
assert.equal(container.textContent, '${importPath}');
|
|
141
|
+
} finally {
|
|
142
|
+
await act(async () => root.unmount());
|
|
143
|
+
}
|
|
144
|
+
} finally {
|
|
145
|
+
Reflect.deleteProperty(globalThis, 'IS_REACT_ACT_ENVIRONMENT');
|
|
146
|
+
await GlobalRegistrator.unregister();
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
`;
|
|
150
|
+
}
|
|
151
|
+
export function publicApiTest(importPath) {
|
|
152
|
+
const packageName = importPath.split('/').at(-1);
|
|
153
|
+
return `import assert from 'node:assert/strict';
|
|
154
|
+
import { test } from 'node:test';
|
|
155
|
+
|
|
156
|
+
import { packageName } from '${importPath}';
|
|
157
|
+
|
|
158
|
+
test('${packageName} is importable through its public package export', () => {
|
|
159
|
+
assert.equal(packageName, '${importPath}');
|
|
160
|
+
});
|
|
161
|
+
`;
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../../src/generators/ui-package/files.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,+DAA+D;AAE/D,MAAM,UAAU,UAAU,CACxB,WAAmB,EACnB,UAAkB,EAClB,UAAkB;IAElB,OAAO;;;;;;;;;;eAUM,UAAU,sBAAsB,WAAW;;;;;;;;;;;;;;;;;;;eAmB3C,UAAU;;;;;;;;;;;;;;;;;CAiBxB,CAAC;AACF,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,UAAkB;IAC7C,OAAO;QACL,OAAO,EAAE,GAAG,UAAU,oBAAoB;QAC1C,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,EAAE;QACX,UAAU,EAAE;YACV,EAAE,IAAI,EAAE,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;;;;;;;;;6CAUT,UAAU;;;;;;;;;CAStD,CAAC;AACF,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,UAAkB;IAC9C,MAAM,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,OAAO;;;+BAGsB,UAAU;;QAEjC,WAAW;+BACY,UAAU;;CAExC,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type GeneratorCallback, type Tree } from '@nx/devkit';
|
|
2
|
+
export interface UiPackageOptions {
|
|
3
|
+
/** The package folder under packages/, for example `packages/ui`. */
|
|
4
|
+
directory: string;
|
|
5
|
+
/** The package name, for example `@acme/ui`. */
|
|
6
|
+
importPath: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A buildable React package: a Vite library build with types, a `development`
|
|
10
|
+
* export condition that points at the source, a node test of the public
|
|
11
|
+
* export, and a node test that renders its component in happy-dom. It runs `init` first. A second run keeps the package as it is.
|
|
12
|
+
*/
|
|
13
|
+
export default function uiPackageGenerator(tree: Tree, options: UiPackageOptions): Promise<GeneratorCallback>;
|
|
14
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,CA8I5B"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { formatFiles, readJson, runTasksInSerial, updateJson, writeJson, } from '@nx/devkit';
|
|
2
|
+
import { appDirectory } from "../app-directory.js";
|
|
3
|
+
import initGenerator from "../init/generator.js";
|
|
4
|
+
import { nxPlugin } from "../nx-plugin.js";
|
|
5
|
+
import { reactEslintConfig, reactResidue, reactRootPackages, } from "../react.js";
|
|
6
|
+
import { fseventsScript, rootDependencyNames, settleRootDependencies, } from "../root-dependencies.js";
|
|
7
|
+
import { appPackageVersions as versions } from "../versions.js";
|
|
8
|
+
import { componentTest, libraryTsconfig, packageNameComponent, publicApiTest, rootTsconfig, specTsconfig, viteConfig, } from "./files.js";
|
|
9
|
+
/**
|
|
10
|
+
* A buildable React package: a Vite library build with types, a `development`
|
|
11
|
+
* export condition that points at the source, a node test of the public
|
|
12
|
+
* export, and a node test that renders its component in happy-dom. It runs `init` first. A second run keeps the package as it is.
|
|
13
|
+
*/
|
|
14
|
+
export default async function uiPackageGenerator(tree, options) {
|
|
15
|
+
const initTask = await initGenerator(tree);
|
|
16
|
+
const { projectRoot, rootOffset } = appDirectory(options.directory);
|
|
17
|
+
if (!projectRoot.startsWith('packages/')) {
|
|
18
|
+
throw new Error(`A UI package goes under packages/, not ${JSON.stringify(options.directory)}.`);
|
|
19
|
+
}
|
|
20
|
+
if (!/^@[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*$/.test(options.importPath)) {
|
|
21
|
+
throw new Error(`The import path ${JSON.stringify(options.importPath)} is not a scoped package name, for example "@acme/ui".`);
|
|
22
|
+
}
|
|
23
|
+
const packageJsonPath = `${projectRoot}/package.json`;
|
|
24
|
+
if (tree.exists(packageJsonPath)) {
|
|
25
|
+
const existing = readJson(tree, packageJsonPath);
|
|
26
|
+
if (existing.name !== options.importPath) {
|
|
27
|
+
throw new Error(existing.name === undefined
|
|
28
|
+
? `${packageJsonPath} already exists and has no name.`
|
|
29
|
+
: `${projectRoot} already belongs to ${existing.name}.`);
|
|
30
|
+
}
|
|
31
|
+
return initTask;
|
|
32
|
+
}
|
|
33
|
+
const before = rootDependencyNames(tree);
|
|
34
|
+
const { libraryGenerator } = nxPlugin('@nx/react');
|
|
35
|
+
const libraryTask = await libraryGenerator(tree, {
|
|
36
|
+
directory: projectRoot,
|
|
37
|
+
importPath: options.importPath,
|
|
38
|
+
bundler: 'vite',
|
|
39
|
+
compiler: 'babel',
|
|
40
|
+
component: false,
|
|
41
|
+
linter: 'eslint',
|
|
42
|
+
strict: true,
|
|
43
|
+
style: 'none',
|
|
44
|
+
unitTestRunner: 'none',
|
|
45
|
+
useProjectJson: false,
|
|
46
|
+
addPlugin: true,
|
|
47
|
+
skipFormat: true,
|
|
48
|
+
});
|
|
49
|
+
tree.delete(`${projectRoot}/.babelrc`);
|
|
50
|
+
tree.delete(`${projectRoot}/README.md`);
|
|
51
|
+
tree.delete(`${projectRoot}/vite.config.mts`);
|
|
52
|
+
tree.write(`${projectRoot}/vite.config.ts`, viteConfig(projectRoot, rootOffset, options.importPath));
|
|
53
|
+
tree.write(`${projectRoot}/eslint.config.mjs`, reactEslintConfig(rootOffset, ['tailwind']));
|
|
54
|
+
writeJson(tree, `${projectRoot}/tsconfig.json`, rootTsconfig(rootOffset));
|
|
55
|
+
writeJson(tree, `${projectRoot}/tsconfig.lib.json`, libraryTsconfig(rootOffset));
|
|
56
|
+
writeJson(tree, `${projectRoot}/tsconfig.spec.json`, specTsconfig(rootOffset));
|
|
57
|
+
tree.write(`${projectRoot}/src/index.ts`, `export { PackageName, packageName } from './package-name.tsx';\n`);
|
|
58
|
+
tree.write(`${projectRoot}/src/package-name.tsx`, packageNameComponent(options.importPath));
|
|
59
|
+
tree.write(`${projectRoot}/tests/public-api.test.mjs`, publicApiTest(options.importPath));
|
|
60
|
+
tree.write(`${projectRoot}/tests/package-name.test.mjs`, componentTest(options.importPath));
|
|
61
|
+
updateJson(tree, packageJsonPath, (packageJson) => {
|
|
62
|
+
packageJson.name = options.importPath;
|
|
63
|
+
packageJson.version = '0.1.0';
|
|
64
|
+
packageJson.private = true;
|
|
65
|
+
packageJson.type = 'module';
|
|
66
|
+
packageJson.main = './dist/index.js';
|
|
67
|
+
packageJson.module = './dist/index.js';
|
|
68
|
+
packageJson.types = './dist/index.d.ts';
|
|
69
|
+
packageJson.exports = {
|
|
70
|
+
'./package.json': './package.json',
|
|
71
|
+
'.': {
|
|
72
|
+
development: './src/index.ts',
|
|
73
|
+
types: './dist/index.d.ts',
|
|
74
|
+
import: './dist/index.js',
|
|
75
|
+
default: './dist/index.js',
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
packageJson.dependencies = { react: versions.react };
|
|
79
|
+
packageJson.devDependencies = {
|
|
80
|
+
'@happy-dom/global-registrator': versions['@happy-dom/global-registrator'],
|
|
81
|
+
'@rolldown/plugin-babel': versions['@rolldown/plugin-babel'],
|
|
82
|
+
'@tailwindcss/vite': versions['@tailwindcss/vite'],
|
|
83
|
+
'@vitejs/plugin-react': versions['@vitejs/plugin-react'],
|
|
84
|
+
'babel-plugin-react-compiler': versions['babel-plugin-react-compiler'],
|
|
85
|
+
'react-dom': versions['react-dom'],
|
|
86
|
+
vite: versions.vite,
|
|
87
|
+
'vite-plugin-dts': versions['vite-plugin-dts'],
|
|
88
|
+
};
|
|
89
|
+
packageJson.scripts = {};
|
|
90
|
+
packageJson.nx = {
|
|
91
|
+
...packageJson.nx,
|
|
92
|
+
targets: {
|
|
93
|
+
...packageJson.nx?.targets,
|
|
94
|
+
// The test imports the package through its export, which is dist.
|
|
95
|
+
test: { dependsOn: ['...', 'build'] },
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
return packageJson;
|
|
99
|
+
});
|
|
100
|
+
settleRootDependencies(tree, before, {
|
|
101
|
+
devDependencies: reactRootPackages,
|
|
102
|
+
// The babel compiler and vite-plugin-dts of @nx/react go to the root;
|
|
103
|
+
// the package declares what its own vite.config.ts loads.
|
|
104
|
+
residue: [
|
|
105
|
+
...reactResidue,
|
|
106
|
+
'@babel/core',
|
|
107
|
+
'@babel/preset-react',
|
|
108
|
+
'ajv',
|
|
109
|
+
'vite-plugin-dts',
|
|
110
|
+
],
|
|
111
|
+
allowScripts: fseventsScript,
|
|
112
|
+
});
|
|
113
|
+
await formatFiles(tree);
|
|
114
|
+
return runTasksInSerial(initTask, libraryTask);
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../src/generators/ui-package/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,SAAS,GACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,aAAa,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,kBAAkB,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EACL,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,UAAU,GACX,MAAM,YAAY,CAAC;AAwBpB;;;;GAIG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,kBAAkB,CAC9C,IAAU,EACV,OAAyB;IAEzB,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpE,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,WAAW,CAA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AAC,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"}
|
|
@@ -9,11 +9,60 @@ export declare const nxFamily: string[];
|
|
|
9
9
|
/**
|
|
10
10
|
* The other root tools, at exact versions. A generator adds a missing one and
|
|
11
11
|
* keeps a version that is there. TypeScript 7 compiles and TypeScript 6 gives
|
|
12
|
-
* its API to typescript-eslint and `@nx/js` (monorepo standard
|
|
12
|
+
* its API to typescript-eslint and `@nx/js` (README, monorepo standard). The ESLint
|
|
13
13
|
* packages are the peers of @zukhruf/eslint that the root config loads, with
|
|
14
14
|
* the 2 of `@zukhruf/eslint/modern-node`.
|
|
15
15
|
*/
|
|
16
16
|
export declare const rootToolVersions: Record<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* The packages of the app generators, at exact versions, each the latest on
|
|
19
|
+
* 2026-11-18 (#3338). A generator adds a missing package, and keeps a version
|
|
20
|
+
* that was there before it ran. Each `@nx/*` plugin gets `nxVersion`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const appPackageVersions: {
|
|
23
|
+
readonly '@godaddy/terminus': "4.12.1";
|
|
24
|
+
readonly '@hono/node-server': "2.1.9";
|
|
25
|
+
readonly '@sdk-it/cli': "0.46.11";
|
|
26
|
+
readonly '@sdk-it/hono': "0.46.11";
|
|
27
|
+
readonly esbuild: "0.28.2";
|
|
28
|
+
readonly '@types/node': "26.6.6";
|
|
29
|
+
readonly tslib: "2.9.1";
|
|
30
|
+
readonly evlog: "2.35.1";
|
|
31
|
+
readonly hono: "4.13.19";
|
|
32
|
+
readonly zod: "4.6.7";
|
|
33
|
+
readonly 'fast-content-type-parse': "3.0.0";
|
|
34
|
+
readonly '@eslint-react/eslint-plugin': "5.30.4";
|
|
35
|
+
readonly '@juristr/nx-tailwind-sync': "0.0.9";
|
|
36
|
+
readonly '@rolldown/plugin-babel': "0.3.1";
|
|
37
|
+
readonly '@tailwindcss/vite': "4.3.5";
|
|
38
|
+
readonly '@types/react': "19.3.0";
|
|
39
|
+
readonly '@types/react-dom': "19.3.0";
|
|
40
|
+
readonly '@vitejs/plugin-react': "6.3.0";
|
|
41
|
+
readonly 'babel-plugin-react-compiler': "1.0.0";
|
|
42
|
+
readonly 'eslint-plugin-jsx-a11y-x': "0.2.0";
|
|
43
|
+
readonly 'eslint-plugin-react-hooks': "7.1.1";
|
|
44
|
+
readonly 'eslint-plugin-react-you-might-not-need-an-effect': "1.2.0";
|
|
45
|
+
readonly 'prettier-plugin-tailwindcss': "0.8.1";
|
|
46
|
+
readonly react: "19.3.1";
|
|
47
|
+
readonly 'react-dom': "19.3.1";
|
|
48
|
+
readonly 'react-router': "8.5.1";
|
|
49
|
+
readonly tailwindcss: "4.3.5";
|
|
50
|
+
readonly vite: "8.3.8";
|
|
51
|
+
readonly 'vite-plugin-compression2': "2.5.4";
|
|
52
|
+
readonly 'vite-plugin-dts': "5.1.2";
|
|
53
|
+
readonly '@testing-library/dom': "10.4.2";
|
|
54
|
+
readonly '@testing-library/jest-dom': "7.0.1";
|
|
55
|
+
readonly '@testing-library/react': "16.3.3";
|
|
56
|
+
readonly '@vitest/coverage-v8': "5.1.1";
|
|
57
|
+
readonly 'happy-dom': "21.0.4";
|
|
58
|
+
readonly vitest: "5.1.1";
|
|
59
|
+
readonly '@happy-dom/global-registrator': "21.0.4";
|
|
60
|
+
readonly prisma: "7.10.1";
|
|
61
|
+
readonly '@prisma/client': "7.10.1";
|
|
62
|
+
readonly '@prisma/adapter-pg': "7.10.1";
|
|
63
|
+
readonly pg: "8.23.1";
|
|
64
|
+
readonly '@types/pg': "8.23.1";
|
|
65
|
+
};
|
|
17
66
|
/** The zukhruf packages that the root files load. */
|
|
18
67
|
export declare const zukhrufPackages: string[];
|
|
19
68
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../src/generators/versions.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,SAAS,WAAW,CAAC;AAElC,gJAAgJ;AAChJ,eAAO,MAAM,QAAQ,UAMpB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAcnD,CAAC;AAEF,qDAAqD;AACrD,eAAO,MAAM,eAAe,UAI3B,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../src/generators/versions.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,SAAS,WAAW,CAAC;AAElC,gJAAgJ;AAChJ,eAAO,MAAM,QAAQ,UAMpB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAcnD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDY,CAAC;AAE5C,qDAAqD;AACrD,eAAO,MAAM,eAAe,UAI3B,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAyB,CAAC"}
|
|
@@ -16,7 +16,7 @@ export const nxFamily = [
|
|
|
16
16
|
/**
|
|
17
17
|
* The other root tools, at exact versions. A generator adds a missing one and
|
|
18
18
|
* keeps a version that is there. TypeScript 7 compiles and TypeScript 6 gives
|
|
19
|
-
* its API to typescript-eslint and `@nx/js` (monorepo standard
|
|
19
|
+
* its API to typescript-eslint and `@nx/js` (README, monorepo standard). The ESLint
|
|
20
20
|
* packages are the peers of @zukhruf/eslint that the root config loads, with
|
|
21
21
|
* the 2 of `@zukhruf/eslint/modern-node`.
|
|
22
22
|
*/
|
|
@@ -35,6 +35,69 @@ export const rootToolVersions = {
|
|
|
35
35
|
typescript: 'npm:@typescript/typescript6@6.0.2',
|
|
36
36
|
'typescript-eslint': '8.73.0',
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* The packages of the app generators, at exact versions, each the latest on
|
|
40
|
+
* 2026-11-18 (#3338). A generator adds a missing package, and keeps a version
|
|
41
|
+
* that was there before it ran. Each `@nx/*` plugin gets `nxVersion`.
|
|
42
|
+
*/
|
|
43
|
+
export const appPackageVersions = {
|
|
44
|
+
// node-app: the runtime of the backend, and its build tools.
|
|
45
|
+
'@godaddy/terminus': '4.12.1',
|
|
46
|
+
'@hono/node-server': '2.1.9',
|
|
47
|
+
'@sdk-it/cli': '0.46.11',
|
|
48
|
+
'@sdk-it/hono': '0.46.11',
|
|
49
|
+
esbuild: '0.28.2',
|
|
50
|
+
// The Nx generators add these two with a range.
|
|
51
|
+
'@types/node': '26.6.6',
|
|
52
|
+
tslib: '2.9.1',
|
|
53
|
+
evlog: '2.35.1',
|
|
54
|
+
hono: '4.13.19',
|
|
55
|
+
zod: '4.6.7',
|
|
56
|
+
// pair: the generated client imports it. sdk-it writes ^3.0.0 in the client
|
|
57
|
+
// manifest, so the web app takes the latest 3.x, not 4.
|
|
58
|
+
'fast-content-type-parse': '3.0.0',
|
|
59
|
+
// react-app and ui-package: React, Vite, Tailwind and the React lint plugins
|
|
60
|
+
// that @zukhruf/eslint/react loads.
|
|
61
|
+
'@eslint-react/eslint-plugin': '5.30.4',
|
|
62
|
+
'@juristr/nx-tailwind-sync': '0.0.9',
|
|
63
|
+
'@rolldown/plugin-babel': '0.3.1',
|
|
64
|
+
'@tailwindcss/vite': '4.3.5',
|
|
65
|
+
'@types/react': '19.3.0',
|
|
66
|
+
'@types/react-dom': '19.3.0',
|
|
67
|
+
'@vitejs/plugin-react': '6.3.0',
|
|
68
|
+
'babel-plugin-react-compiler': '1.0.0',
|
|
69
|
+
'eslint-plugin-jsx-a11y-x': '0.2.0',
|
|
70
|
+
'eslint-plugin-react-hooks': '7.1.1',
|
|
71
|
+
'eslint-plugin-react-you-might-not-need-an-effect': '1.2.0',
|
|
72
|
+
'prettier-plugin-tailwindcss': '0.8.1',
|
|
73
|
+
react: '19.3.1',
|
|
74
|
+
'react-dom': '19.3.1',
|
|
75
|
+
'react-router': '8.5.1',
|
|
76
|
+
tailwindcss: '4.3.5',
|
|
77
|
+
vite: '8.3.8',
|
|
78
|
+
'vite-plugin-compression2': '2.5.4',
|
|
79
|
+
'vite-plugin-dts': '5.1.2',
|
|
80
|
+
// react-app: component tests.
|
|
81
|
+
'@testing-library/dom': '10.4.2',
|
|
82
|
+
'@testing-library/jest-dom': '7.0.1',
|
|
83
|
+
'@testing-library/react': '16.3.3',
|
|
84
|
+
'@vitest/coverage-v8': '5.1.1',
|
|
85
|
+
'happy-dom': '21.0.4',
|
|
86
|
+
vitest: '5.1.1',
|
|
87
|
+
// ui-package: the component test registers happy-dom's DOM in node:test.
|
|
88
|
+
// It releases with happy-dom.
|
|
89
|
+
'@happy-dom/global-registrator': '21.0.4',
|
|
90
|
+
// prisma: the CLI, the client and its Postgres adapter release together and
|
|
91
|
+
// must have one version. The `latest` tag of `prisma` is a release candidate
|
|
92
|
+
// of 8 (8.0.0-rc.34 on 2026-11-18), so the three are pinned to the last
|
|
93
|
+
// stable version, and a test checks that they are equal (#4604).
|
|
94
|
+
prisma: '7.10.1',
|
|
95
|
+
'@prisma/client': '7.10.1',
|
|
96
|
+
'@prisma/adapter-pg': '7.10.1',
|
|
97
|
+
// The test helper of a db package replays the migrations with pg.
|
|
98
|
+
pg: '8.23.1',
|
|
99
|
+
'@types/pg': '8.23.1',
|
|
100
|
+
};
|
|
38
101
|
/** The zukhruf packages that the root files load. */
|
|
39
102
|
export const zukhrufPackages = [
|
|
40
103
|
'@zukhruf/eslint',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../src/generators/versions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC;AAElC,gJAAgJ;AAChJ,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI;IACJ,YAAY;IACZ,YAAY;IACZ,mBAAmB;IACnB,QAAQ;CACT,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA2B;IACtD,qBAAqB,EAAE,OAAO;IAC9B,YAAY,EAAE,QAAQ;IACtB,uCAAuC,EAAE,OAAO;IAChD,oBAAoB,EAAE,sBAAsB;IAC5C,MAAM,EAAE,SAAS;IACjB,0BAA0B,EAAE,QAAQ;IACpC,wBAAwB,EAAE,QAAQ;IAClC,oCAAoC;IACpC,uBAAuB,EAAE,QAAQ;IACjC,qBAAqB,EAAE,OAAO;IAC9B,QAAQ,EAAE,QAAQ;IAClB,UAAU,EAAE,mCAAmC;IAC/C,mBAAmB,EAAE,QAAQ;CAC9B,CAAC;AAEF,qDAAqD;AACrD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,iBAAiB;IACjB,oBAAoB;IACpB,aAAa;CACd,CAAC;AAEF,MAAM,cAAc,GAAwB,IAAI,CAAC,KAAK,CACpD,YAAY,CAAC,IAAI,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CACtE,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC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-9,6 +9,36 @@
|
|
|
9
9
|
"implementation": "./dist/generators/init/generator.js",
|
|
10
10
|
"schema": "./src/generators/init/schema.json",
|
|
11
11
|
"description": "Add the root files of the monorepo standard. Safe to run again."
|
|
12
|
+
},
|
|
13
|
+
"node-app": {
|
|
14
|
+
"implementation": "./dist/generators/node-app/generator.js",
|
|
15
|
+
"schema": "./src/generators/node-app/schema.json",
|
|
16
|
+
"description": "Add a Hono backend: one ESM esbuild bundle, evlog, a zod env, an sdk-it client and a Dockerfile whose image reports its commit."
|
|
17
|
+
},
|
|
18
|
+
"react-app": {
|
|
19
|
+
"implementation": "./dist/generators/react-app/generator.js",
|
|
20
|
+
"schema": "./src/generators/react-app/schema.json",
|
|
21
|
+
"description": "Add a React Router SPA on Vite, with Tailwind, the React Compiler and Vitest component tests."
|
|
22
|
+
},
|
|
23
|
+
"pair": {
|
|
24
|
+
"implementation": "./dist/generators/pair/generator.js",
|
|
25
|
+
"schema": "./src/generators/pair/schema.json",
|
|
26
|
+
"description": "Pair a react-app with a node-app: the web gets the generated client, and the api serves the web build and puts it in its image."
|
|
27
|
+
},
|
|
28
|
+
"ui-package": {
|
|
29
|
+
"implementation": "./dist/generators/ui-package/generator.js",
|
|
30
|
+
"schema": "./src/generators/ui-package/schema.json",
|
|
31
|
+
"description": "Add a buildable React package with a Vite library build, types and a development export condition."
|
|
32
|
+
},
|
|
33
|
+
"prisma": {
|
|
34
|
+
"implementation": "./dist/generators/prisma/generator.js",
|
|
35
|
+
"schema": "./src/generators/prisma/schema.json",
|
|
36
|
+
"description": "Add a Postgres db package on Prisma 7 and @prisma/adapter-pg, with a migration image and a test helper, and connect a node-app to it."
|
|
37
|
+
},
|
|
38
|
+
"dokploy": {
|
|
39
|
+
"implementation": "./dist/generators/dokploy/generator.js",
|
|
40
|
+
"schema": "./src/generators/dokploy/schema.json",
|
|
41
|
+
"description": "Deliver a node-app to Dokploy by GitOps: an OpenTofu project in infra/ with the compose, optional Postgres and a private registry, and the CI and deploy workflows that call zukhruf's tofu-apply, dokploy-deploy and wait-for-health."
|
|
12
42
|
}
|
|
13
43
|
}
|
|
14
44
|
}
|