@eweap/nx-workspace-tools 0.0.2-2 → 0.0.2-5
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/dist/executors/internal-deps/internal-deps.d.ts +28 -0
- package/dist/executors/internal-deps/internal-deps.d.ts.map +1 -0
- package/dist/executors/internal-deps/internal-deps.js +221 -0
- package/dist/executors/internal-deps/schema.d.ts +3 -0
- package/dist/executors/internal-deps/schema.json +15 -0
- package/dist/generators/feature-libs/__snapshots__/ui/.storybook/styles.css +4 -0
- package/dist/generators/feature-libs/__snapshots__/ui/tsconfig.storybook.json +25 -0
- package/dist/generators/feature-libs/feature-libs.d.ts +6 -0
- package/dist/generators/feature-libs/feature-libs.d.ts.map +1 -0
- package/dist/generators/feature-libs/feature-libs.js +31 -0
- package/dist/generators/feature-libs/files/data-access/eslint.config.mjs.template +23 -0
- package/dist/generators/feature-libs/files/data-access/src/index.ts.template +1 -0
- package/dist/generators/feature-libs/files/data-access/tsconfig.spec.json.template +7 -0
- package/dist/generators/feature-libs/files/feature/eslint.config.mjs.template +23 -0
- package/dist/generators/feature-libs/files/feature/src/index.ts.template +4 -0
- package/dist/generators/feature-libs/files/feature/test-setup.ts.template +1 -0
- package/dist/generators/feature-libs/files/feature/tsconfig.spec.json.template +7 -0
- package/dist/generators/feature-libs/files/src/index.ts.template +1 -0
- package/dist/generators/feature-libs/files/types/eslint.config.mjs.template +23 -0
- package/dist/generators/feature-libs/files/types/src/__ressourceNameSingular__.ts.template +1 -0
- package/dist/generators/feature-libs/files/types/src/index.ts.template +1 -0
- package/dist/generators/feature-libs/files/ui/.storybook/main.ts.template +26 -0
- package/dist/generators/feature-libs/files/ui/.storybook/preview.ts.template +13 -0
- package/dist/generators/feature-libs/files/ui/.storybook/styles.css.template +4 -0
- package/dist/generators/feature-libs/files/ui/eslint.config.mjs.template +23 -0
- package/dist/generators/feature-libs/files/ui/src/components/index.ts.template +1 -0
- package/dist/generators/feature-libs/files/ui/src/index.ts.template +1 -0
- package/dist/generators/feature-libs/files/ui/tsconfig.spec.json.template +7 -0
- package/dist/generators/feature-libs/files/ui/tsconfig.storybook.json.template +25 -0
- package/dist/generators/feature-libs/files/util/eslint.config.mjs.template +23 -0
- package/dist/generators/feature-libs/files/util/src/index.ts.template +1 -0
- package/dist/generators/feature-libs/files/util/tsconfig.spec.json.template +7 -0
- package/dist/generators/feature-libs/patches/__snapshots__/eslint-config-mjs.patch.spec.ts.snap +27 -0
- package/dist/generators/feature-libs/patches/__snapshots__/package-json.patch.spec.ts.snap +61 -0
- package/dist/generators/feature-libs/patches/__snapshots__/tsconfig-spec-json.patch.spec.ts.snap +39 -0
- package/dist/generators/feature-libs/patches/__snapshots__/vite-config-mts.patch.spec.ts.snap +58 -0
- package/dist/generators/feature-libs/patches/eslint-config-mjs.patch.d.ts +9 -0
- package/dist/generators/feature-libs/patches/eslint-config-mjs.patch.d.ts.map +1 -0
- package/dist/generators/feature-libs/patches/eslint-config-mjs.patch.js +110 -0
- package/dist/generators/feature-libs/patches/generic.d.ts +4 -0
- package/dist/generators/feature-libs/patches/generic.d.ts.map +1 -0
- package/dist/generators/feature-libs/patches/generic.js +9 -0
- package/dist/generators/feature-libs/patches/package-json.patch.d.ts +8 -0
- package/dist/generators/feature-libs/patches/package-json.patch.d.ts.map +1 -0
- package/dist/generators/feature-libs/patches/package-json.patch.js +23 -0
- package/dist/generators/feature-libs/patches/tsconfig-spec-json.patch.d.ts +8 -0
- package/dist/generators/feature-libs/patches/tsconfig-spec-json.patch.d.ts.map +1 -0
- package/dist/generators/feature-libs/patches/tsconfig-spec-json.patch.js +19 -0
- package/dist/generators/feature-libs/patches/vite-config-mts.patch.d.ts +22 -0
- package/dist/generators/feature-libs/patches/vite-config-mts.patch.d.ts.map +1 -0
- package/dist/generators/feature-libs/patches/vite-config-mts.patch.js +47 -0
- package/dist/generators/feature-libs/schema.d.ts +18 -0
- package/dist/generators/feature-libs/schema.json +62 -0
- package/dist/generators/feature-libs/utils/context.d.ts +13 -0
- package/dist/generators/feature-libs/utils/context.d.ts.map +1 -0
- package/dist/generators/feature-libs/utils/context.js +81 -0
- package/dist/generators/feature-libs/utils/file-helpers.d.ts +4 -0
- package/dist/generators/feature-libs/utils/file-helpers.d.ts.map +1 -0
- package/dist/generators/feature-libs/utils/file-helpers.js +49 -0
- package/dist/generators/feature-libs/utils/install-storybook.d.ts +3 -0
- package/dist/generators/feature-libs/utils/install-storybook.d.ts.map +1 -0
- package/dist/generators/feature-libs/utils/install-storybook.js +12 -0
- package/dist/generators/feature-libs/utils/library-generators.d.ts +8 -0
- package/dist/generators/feature-libs/utils/library-generators.d.ts.map +1 -0
- package/dist/generators/feature-libs/utils/library-generators.js +135 -0
- package/dist/generators/feature-libs/utils/patch-file.d.ts +14 -0
- package/dist/generators/feature-libs/utils/patch-file.d.ts.map +1 -0
- package/dist/generators/feature-libs/utils/patch-file.js +28 -0
- package/dist/generators/feature-libs/utils/string-helpers.d.ts +2 -0
- package/dist/generators/feature-libs/utils/string-helpers.d.ts.map +1 -0
- package/dist/generators/feature-libs/utils/string-helpers.js +7 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/package.json +4 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addInternalDepsToPackageJson = addInternalDepsToPackageJson;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function ensurePackageJson(tree, packageJsonPath, packageName) {
|
|
6
|
+
if (tree.exists(packageJsonPath)) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
tree.write(packageJsonPath, JSON.stringify({
|
|
10
|
+
name: packageName,
|
|
11
|
+
version: '0.0.1',
|
|
12
|
+
exports: {},
|
|
13
|
+
devDependencies: {},
|
|
14
|
+
}, null, 2));
|
|
15
|
+
}
|
|
16
|
+
function addInternalDepsToPackageJson(tree, { projectRoot, projectName, packageName, libTypes, workspacePrefix, }) {
|
|
17
|
+
const packageJsonPath = `${projectRoot}/package.json`;
|
|
18
|
+
ensurePackageJson(tree, packageJsonPath, packageName);
|
|
19
|
+
(0, devkit_1.updateJson)(tree, packageJsonPath, (pkgJson) => {
|
|
20
|
+
pkgJson.devDependencies = {};
|
|
21
|
+
const selectedLibraryTypes = new Set(libTypes);
|
|
22
|
+
if (selectedLibraryTypes.has('feature') &&
|
|
23
|
+
packageName !== `${workspacePrefix}/${projectName}`) {
|
|
24
|
+
pkgJson.devDependencies[`${workspacePrefix}/${projectName}`] =
|
|
25
|
+
'workspace:*';
|
|
26
|
+
}
|
|
27
|
+
if (selectedLibraryTypes.has('data-access') &&
|
|
28
|
+
packageName !== `${workspacePrefix}/${projectName}-data-access`) {
|
|
29
|
+
pkgJson.devDependencies[`${workspacePrefix}/${projectName}-data-access`] =
|
|
30
|
+
'workspace:*';
|
|
31
|
+
}
|
|
32
|
+
if (selectedLibraryTypes.has('ui') &&
|
|
33
|
+
packageName !== `${workspacePrefix}/${projectName}-ui`) {
|
|
34
|
+
pkgJson.devDependencies[`${workspacePrefix}/${projectName}-ui`] =
|
|
35
|
+
'workspace:*';
|
|
36
|
+
}
|
|
37
|
+
if (selectedLibraryTypes.has('types') &&
|
|
38
|
+
packageName !== `${workspacePrefix}/${projectName}-types`) {
|
|
39
|
+
pkgJson.devDependencies[`${workspacePrefix}/${projectName}-types`] =
|
|
40
|
+
'workspace:*';
|
|
41
|
+
}
|
|
42
|
+
if (selectedLibraryTypes.has('util') &&
|
|
43
|
+
packageName !== `${workspacePrefix}/${projectName}-util`) {
|
|
44
|
+
pkgJson.devDependencies[`${workspacePrefix}/${projectName}-util`] =
|
|
45
|
+
'workspace:*';
|
|
46
|
+
}
|
|
47
|
+
return pkgJson;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-storybook.d.ts","sourceRoot":"","sources":["../../../../src/generators/feature-libs/utils/install-storybook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAiB,MAAM,YAAY,CAAC;AAEjD,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,iBAYjE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.installStorybook = installStorybook;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
async function installStorybook(tree, project) {
|
|
6
|
+
const nxVueVersion = require('@nx/vue/package.json').version;
|
|
7
|
+
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/storybook', nxVueVersion);
|
|
8
|
+
await configurationGenerator(tree, {
|
|
9
|
+
addPlugin: true,
|
|
10
|
+
project,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
import { FeatureLibsGeneratorSchema } from '../schema';
|
|
3
|
+
export declare function generateFeatureLib(tree: Tree, options: FeatureLibsGeneratorSchema): Promise<void>;
|
|
4
|
+
export declare function generateDataAccessLib(tree: Tree, options: FeatureLibsGeneratorSchema): Promise<void>;
|
|
5
|
+
export declare function generateTypesLib(tree: Tree, options: FeatureLibsGeneratorSchema): Promise<void>;
|
|
6
|
+
export declare function generateUiLib(tree: Tree, options: FeatureLibsGeneratorSchema): Promise<void>;
|
|
7
|
+
export declare function generateUtilLib(tree: Tree, options: FeatureLibsGeneratorSchema): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=library-generators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library-generators.d.ts","sourceRoot":"","sources":["../../../../src/generators/feature-libs/utils/library-generators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAiB,MAAM,YAAY,CAAC;AASjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAoBvD,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,0BAA0B,iBAgCpC;AAED,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,0BAA0B,iBAwBpC;AAED,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,0BAA0B,iBAsBpC;AAED,wBAAsB,aAAa,CACjC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,0BAA0B,iBA2BpC;AAED,wBAAsB,eAAe,CACnC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,0BAA0B,iBAyBpC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateFeatureLib = generateFeatureLib;
|
|
4
|
+
exports.generateDataAccessLib = generateDataAccessLib;
|
|
5
|
+
exports.generateTypesLib = generateTypesLib;
|
|
6
|
+
exports.generateUiLib = generateUiLib;
|
|
7
|
+
exports.generateUtilLib = generateUtilLib;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const devkit_1 = require("@nx/devkit");
|
|
10
|
+
const js_1 = require("@nx/js");
|
|
11
|
+
const vue_1 = require("@nx/vue");
|
|
12
|
+
const lodash_es_1 = require("lodash-es");
|
|
13
|
+
const path = tslib_1.__importStar(require("path"));
|
|
14
|
+
const generic_1 = require("../patches/generic");
|
|
15
|
+
const tsconfig_spec_json_patch_1 = require("../patches/tsconfig-spec-json.patch");
|
|
16
|
+
const vite_config_mts_patch_1 = require("../patches/vite-config-mts.patch");
|
|
17
|
+
const context_1 = require("./context");
|
|
18
|
+
const file_helpers_1 = require("./file-helpers");
|
|
19
|
+
const install_storybook_1 = require("./install-storybook");
|
|
20
|
+
const string_helpers_1 = require("./string-helpers");
|
|
21
|
+
function applyLibFileTemplates(tree, templateFolder, projectRoot, context) {
|
|
22
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, '..', 'files', templateFolder), projectRoot, context);
|
|
23
|
+
}
|
|
24
|
+
async function generateFeatureLib(tree, options) {
|
|
25
|
+
const context = (0, context_1.createLibraryContext)(options, 'feature');
|
|
26
|
+
await (0, vue_1.libraryGenerator)(tree, {
|
|
27
|
+
directory: context.projectRoot,
|
|
28
|
+
linter: 'eslint',
|
|
29
|
+
name: context.projectName,
|
|
30
|
+
unitTestRunner: 'vitest',
|
|
31
|
+
importPath: context.packageName,
|
|
32
|
+
tags: 'type:feature',
|
|
33
|
+
addPlugin: true,
|
|
34
|
+
useProjectJson: context.useProjectJson,
|
|
35
|
+
});
|
|
36
|
+
await (0, install_storybook_1.installStorybook)(tree, context.projectName);
|
|
37
|
+
// Apply patches
|
|
38
|
+
(0, generic_1.runGenericPatch)(tree, context);
|
|
39
|
+
(0, vite_config_mts_patch_1.patchViteConfig)(tree, context, { hasComponents: true });
|
|
40
|
+
(0, tsconfig_spec_json_patch_1.patchTsConfigSpec)(tree, context);
|
|
41
|
+
// Install internal deps
|
|
42
|
+
(0, file_helpers_1.addInternalDepsToPackageJson)(tree, context);
|
|
43
|
+
// Apply file templates
|
|
44
|
+
applyLibFileTemplates(tree, 'feature', context.projectRoot, {
|
|
45
|
+
...options,
|
|
46
|
+
camelCase: lodash_es_1.camelCase,
|
|
47
|
+
workspacePrefix: context.workspacePrefix,
|
|
48
|
+
libTypes: context.libTypes,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
async function generateDataAccessLib(tree, options) {
|
|
52
|
+
const context = (0, context_1.createLibraryContext)(options, 'data-access');
|
|
53
|
+
await (0, js_1.libraryGenerator)(tree, {
|
|
54
|
+
directory: context.projectRoot,
|
|
55
|
+
linter: 'eslint',
|
|
56
|
+
name: context.projectName,
|
|
57
|
+
unitTestRunner: 'vitest',
|
|
58
|
+
importPath: context.packageName,
|
|
59
|
+
tags: 'type:data-access',
|
|
60
|
+
addPlugin: true,
|
|
61
|
+
useProjectJson: context.useProjectJson,
|
|
62
|
+
});
|
|
63
|
+
// Apply patches
|
|
64
|
+
(0, generic_1.runGenericPatch)(tree, context);
|
|
65
|
+
(0, vite_config_mts_patch_1.patchViteConfig)(tree, context, { hasComponents: false });
|
|
66
|
+
// Apply file templates
|
|
67
|
+
applyLibFileTemplates(tree, 'data-access', context.projectRoot, {
|
|
68
|
+
...options,
|
|
69
|
+
uppercase: string_helpers_1.toUpperSnakeCase,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
async function generateTypesLib(tree, options) {
|
|
73
|
+
const context = (0, context_1.createLibraryContext)(options, 'types');
|
|
74
|
+
await (0, js_1.libraryGenerator)(tree, {
|
|
75
|
+
directory: context.projectRoot,
|
|
76
|
+
linter: 'eslint',
|
|
77
|
+
name: context.projectName,
|
|
78
|
+
unitTestRunner: 'vitest',
|
|
79
|
+
importPath: context.packageName,
|
|
80
|
+
tags: 'type:types',
|
|
81
|
+
addPlugin: true,
|
|
82
|
+
useProjectJson: context.useProjectJson,
|
|
83
|
+
});
|
|
84
|
+
// Apply patches
|
|
85
|
+
(0, generic_1.runGenericPatch)(tree, context);
|
|
86
|
+
// Apply file templates
|
|
87
|
+
applyLibFileTemplates(tree, 'types', context.projectRoot, {
|
|
88
|
+
...options,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
async function generateUiLib(tree, options) {
|
|
92
|
+
const context = (0, context_1.createLibraryContext)(options, 'ui');
|
|
93
|
+
await (0, vue_1.libraryGenerator)(tree, {
|
|
94
|
+
directory: context.projectRoot,
|
|
95
|
+
linter: 'eslint',
|
|
96
|
+
name: context.projectName,
|
|
97
|
+
unitTestRunner: 'vitest',
|
|
98
|
+
importPath: context.packageName,
|
|
99
|
+
tags: 'type:ui',
|
|
100
|
+
addPlugin: true,
|
|
101
|
+
useProjectJson: context.useProjectJson,
|
|
102
|
+
});
|
|
103
|
+
await (0, install_storybook_1.installStorybook)(tree, context.projectName);
|
|
104
|
+
// Apply patches
|
|
105
|
+
(0, generic_1.runGenericPatch)(tree, context);
|
|
106
|
+
(0, vite_config_mts_patch_1.patchViteConfig)(tree, context, { hasComponents: true });
|
|
107
|
+
(0, tsconfig_spec_json_patch_1.patchTsConfigSpec)(tree, context);
|
|
108
|
+
// Apply file templates
|
|
109
|
+
applyLibFileTemplates(tree, 'ui', context.projectRoot, {
|
|
110
|
+
...options,
|
|
111
|
+
camelCase: lodash_es_1.camelCase,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
async function generateUtilLib(tree, options) {
|
|
115
|
+
const context = (0, context_1.createLibraryContext)(options, 'util');
|
|
116
|
+
await (0, js_1.libraryGenerator)(tree, {
|
|
117
|
+
directory: context.projectRoot,
|
|
118
|
+
linter: 'eslint',
|
|
119
|
+
name: context.projectName,
|
|
120
|
+
unitTestRunner: 'vitest',
|
|
121
|
+
importPath: context.packageName,
|
|
122
|
+
tags: 'type:util',
|
|
123
|
+
addPlugin: true,
|
|
124
|
+
useProjectJson: context.useProjectJson,
|
|
125
|
+
});
|
|
126
|
+
// Apply patches
|
|
127
|
+
(0, generic_1.runGenericPatch)(tree, context);
|
|
128
|
+
(0, vite_config_mts_patch_1.patchViteConfig)(tree, context, { hasComponents: false });
|
|
129
|
+
// Apply file templates
|
|
130
|
+
applyLibFileTemplates(tree, 'util', context.projectRoot, {
|
|
131
|
+
...options,
|
|
132
|
+
camelCase: lodash_es_1.camelCase,
|
|
133
|
+
uppercase: string_helpers_1.toUpperSnakeCase,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
type FilePatchInput = {
|
|
3
|
+
tree: Tree;
|
|
4
|
+
path: string;
|
|
5
|
+
content: string;
|
|
6
|
+
};
|
|
7
|
+
export interface FilePatch<TArgs extends readonly unknown[] = readonly unknown[]> {
|
|
8
|
+
patchFn(input: FilePatchInput, ...args: TArgs): string | void;
|
|
9
|
+
patchArgs: TArgs;
|
|
10
|
+
}
|
|
11
|
+
export declare function createFilePatch<TArgs extends readonly unknown[]>(patchFn: (input: FilePatchInput, ...args: TArgs) => string | void, ...args: TArgs): FilePatch<TArgs>;
|
|
12
|
+
export declare function patchFile<const TPatches extends readonly FilePatch[]>(tree: Tree, path: string, filePatches: TPatches): void;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=patch-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch-file.d.ts","sourceRoot":"","sources":["../../../../src/generators/feature-libs/utils/patch-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,SAAS,CACxB,KAAK,SAAS,SAAS,OAAO,EAAE,GAAG,SAAS,OAAO,EAAE;IAErD,OAAO,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC;IAC9D,SAAS,EAAE,KAAK,CAAC;CAClB;AAED,wBAAgB,eAAe,CAAC,KAAK,SAAS,SAAS,OAAO,EAAE,EAC9D,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,KAAK,KAAK,MAAM,GAAG,IAAI,EACjE,GAAG,IAAI,EAAE,KAAK,GACb,SAAS,CAAC,KAAK,CAAC,CAElB;AAED,wBAAgB,SAAS,CAAC,KAAK,CAAC,QAAQ,SAAS,SAAS,SAAS,EAAE,EACnE,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,QAAQ,QA6BtB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFilePatch = createFilePatch;
|
|
4
|
+
exports.patchFile = patchFile;
|
|
5
|
+
function createFilePatch(patchFn, ...args) {
|
|
6
|
+
return { patchFn, patchArgs: args };
|
|
7
|
+
}
|
|
8
|
+
function patchFile(tree, path, filePatches) {
|
|
9
|
+
const fileContent = tree.read(path, 'utf-8');
|
|
10
|
+
if (!fileContent) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
let newFileContent = fileContent;
|
|
14
|
+
filePatches.forEach((filePatch) => {
|
|
15
|
+
const newContent = filePatch.patchFn({
|
|
16
|
+
tree,
|
|
17
|
+
path,
|
|
18
|
+
content: newFileContent,
|
|
19
|
+
}, ...filePatch.patchArgs);
|
|
20
|
+
// Some patches mutate the tree directly instead of returning new content.
|
|
21
|
+
if (newContent) {
|
|
22
|
+
newFileContent = newContent;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
if (newFileContent !== fileContent) {
|
|
26
|
+
tree.write(path, newFileContent);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-helpers.d.ts","sourceRoot":"","sources":["../../../../src/generators/feature-libs/utils/string-helpers.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,UAE7C"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toUpperSnakeCase = toUpperSnakeCase;
|
|
4
|
+
const lodash_es_1 = require("lodash-es");
|
|
5
|
+
function toUpperSnakeCase(value) {
|
|
6
|
+
return (0, lodash_es_1.snakeCase)(value).toUpperCase();
|
|
7
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAuB,MAAM,YAAY,CAAC;AAqCnE,eAAO,MAAM,WAAW,EAAE,WASzB,CAAC;AAEF,eAAO,MAAM,aAAa,aAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createNodesV2 = exports.createNodes = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const internalDepsTargetName = 'internal-deps';
|
|
7
|
+
function getInternalDepsTarget() {
|
|
8
|
+
return {
|
|
9
|
+
executor: '@eweap/nx-workspace-tools:internal-deps',
|
|
10
|
+
options: {
|
|
11
|
+
write: false,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function createInternalDepsTarget(projectRoot) {
|
|
16
|
+
return {
|
|
17
|
+
projects: {
|
|
18
|
+
[projectRoot]: {
|
|
19
|
+
targets: {
|
|
20
|
+
[internalDepsTargetName]: getInternalDepsTarget(),
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
async function createNodesForConfigFile(configFilePath) {
|
|
27
|
+
const projectRoot = (0, node_path_1.dirname)(configFilePath);
|
|
28
|
+
if (projectRoot === '.' || projectRoot.length === 0) {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
return createInternalDepsTarget(projectRoot);
|
|
32
|
+
}
|
|
33
|
+
exports.createNodes = [
|
|
34
|
+
'**/{project,package}.json',
|
|
35
|
+
async (configFilePaths, options, context) => (0, devkit_1.createNodesFromFiles)(createNodesForConfigFile, configFilePaths, options, context),
|
|
36
|
+
];
|
|
37
|
+
exports.createNodesV2 = exports.createNodes;
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eweap/nx-workspace-tools",
|
|
3
|
-
"version": "0.0.2-
|
|
3
|
+
"version": "0.0.2-5",
|
|
4
4
|
"type": "commonjs",
|
|
5
|
+
"repository": {
|
|
6
|
+
"url": "https://github.com/eweap/nx-plugins"
|
|
7
|
+
},
|
|
5
8
|
"main": "./dist/index.js",
|
|
6
9
|
"module": "./dist/index.js",
|
|
7
10
|
"types": "./dist/index.d.ts",
|