@storm-software/workspace-tools 1.19.3 → 1.20.0
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/CHANGELOG.md +7 -0
- package/index.js +159 -67
- package/meta.json +1 -1
- package/package.json +1 -1
- package/src/base/index.js +83 -19
- package/src/executors/tsup/executor.js +6827 -103
- package/src/executors/tsup/schema.d.ts +3 -3
- package/src/executors/tsup-neutral/executor.js +111 -57
- package/src/executors/tsup-neutral/schema.d.ts +2 -1
- package/src/executors/tsup-node/executor.js +112 -59
- package/src/executors/tsup-node/schema.d.ts +4 -1
- package/src/generators/config-schema/generator.js +60 -15
- package/src/generators/node-library/generator.js +60 -3
- package/src/generators/preset/generator.js +60 -3
- package/src/utils/index.js +46 -6
|
@@ -29593,12 +29593,67 @@ var setConfigEnv = (config) => {
|
|
|
29593
29593
|
});
|
|
29594
29594
|
};
|
|
29595
29595
|
|
|
29596
|
+
// packages/workspace-tools/src/utils/get-workspace-root.ts
|
|
29597
|
+
var import_find_workspace_root2 = require("nx/src/utils/find-workspace-root.js");
|
|
29598
|
+
var getWorkspaceRoot2 = () => {
|
|
29599
|
+
const root = (0, import_find_workspace_root2.findWorkspaceRoot)(process.cwd());
|
|
29600
|
+
process.env.STORM_REPO_ROOT ??= root?.dir;
|
|
29601
|
+
process.env.NX_WORKSPACE_ROOT_PATH ??= root?.dir;
|
|
29602
|
+
return root?.dir;
|
|
29603
|
+
};
|
|
29604
|
+
|
|
29605
|
+
// packages/workspace-tools/src/utils/apply-workspace-tokens.ts
|
|
29606
|
+
var applyWorkspaceGeneratorTokens = (option, config) => {
|
|
29607
|
+
let result = option;
|
|
29608
|
+
if (!result) {
|
|
29609
|
+
return result;
|
|
29610
|
+
}
|
|
29611
|
+
if (result.includes("{workspaceRoot}")) {
|
|
29612
|
+
result = result.replaceAll(
|
|
29613
|
+
"{workspaceRoot}",
|
|
29614
|
+
config.workspaceRoot ?? getWorkspaceRoot2()
|
|
29615
|
+
);
|
|
29616
|
+
}
|
|
29617
|
+
return result;
|
|
29618
|
+
};
|
|
29619
|
+
var applyWorkspaceTokens = (options, config, tokenizerFn) => {
|
|
29620
|
+
let result = options;
|
|
29621
|
+
if (!result) {
|
|
29622
|
+
return {};
|
|
29623
|
+
}
|
|
29624
|
+
return Object.keys(options).reduce(
|
|
29625
|
+
(ret, option) => {
|
|
29626
|
+
if (options[option] === void 0 || options[option] === null || typeof options[option] === "number" || typeof options[option] === "boolean" || typeof options[option] === "string") {
|
|
29627
|
+
ret[option] = tokenizerFn(option, config);
|
|
29628
|
+
} else if (Array.isArray(options[option])) {
|
|
29629
|
+
ret[option] = options[option].map(
|
|
29630
|
+
(item) => tokenizerFn(item, config)
|
|
29631
|
+
);
|
|
29632
|
+
} else if (typeof options[option] === "object") {
|
|
29633
|
+
ret[option] = tokenizerFn(options[option], config);
|
|
29634
|
+
}
|
|
29635
|
+
return ret;
|
|
29636
|
+
},
|
|
29637
|
+
{}
|
|
29638
|
+
);
|
|
29639
|
+
};
|
|
29640
|
+
|
|
29596
29641
|
// packages/workspace-tools/src/base/base-generator.ts
|
|
29597
|
-
var withRunGenerator = (name, generatorFn, generatorOptions = {
|
|
29642
|
+
var withRunGenerator = (name, generatorFn, generatorOptions = {
|
|
29643
|
+
skipReadingConfig: false
|
|
29644
|
+
}) => async (tree, options) => {
|
|
29598
29645
|
const startTime = Date.now();
|
|
29599
29646
|
try {
|
|
29600
29647
|
console.info(`\u26A1 Running the ${name} generator...`);
|
|
29601
|
-
|
|
29648
|
+
if (generatorOptions?.applyDefaultFn) {
|
|
29649
|
+
options = generatorOptions.applyDefaultFn(options);
|
|
29650
|
+
}
|
|
29651
|
+
console.debug("\u2699\uFE0F Generator schema options: \n", options);
|
|
29652
|
+
const tokenized = applyWorkspaceTokens(
|
|
29653
|
+
options,
|
|
29654
|
+
{ workspaceRoot: tree.root },
|
|
29655
|
+
applyWorkspaceGeneratorTokens
|
|
29656
|
+
);
|
|
29602
29657
|
let config;
|
|
29603
29658
|
if (!generatorOptions.skipReadingConfig) {
|
|
29604
29659
|
const configFile = await getConfigFile();
|
|
@@ -29611,7 +29666,9 @@ var withRunGenerator = (name, generatorFn, generatorOptions = { skipReadingConfi
|
|
|
29611
29666
|
console.debug(`Loaded Storm config into env:
|
|
29612
29667
|
${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\n")}`);
|
|
29613
29668
|
}
|
|
29614
|
-
const result = await Promise.resolve(
|
|
29669
|
+
const result = await Promise.resolve(
|
|
29670
|
+
generatorFn(tree, tokenized, config)
|
|
29671
|
+
);
|
|
29615
29672
|
if (result && (!result.success || result.error && result?.error?.message && typeof result?.error?.message === "string" && result?.error?.name && typeof result?.error?.name === "string")) {
|
|
29616
29673
|
throw new Error(`The ${name} generator failed to run`, {
|
|
29617
29674
|
cause: result.error
|
|
@@ -29636,24 +29693,12 @@ ${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\
|
|
|
29636
29693
|
|
|
29637
29694
|
// packages/workspace-tools/src/utils/get-project-configurations.ts
|
|
29638
29695
|
var import_retrieve_workspace_files = require("nx/src/project-graph/utils/retrieve-workspace-files");
|
|
29639
|
-
|
|
29640
|
-
// packages/workspace-tools/src/utils/get-workspace-root.ts
|
|
29641
|
-
var import_find_workspace_root2 = require("nx/src/utils/find-workspace-root.js");
|
|
29642
|
-
var getWorkspaceRoot2 = () => {
|
|
29643
|
-
const root = (0, import_find_workspace_root2.findWorkspaceRoot)(process.cwd());
|
|
29644
|
-
process.env.STORM_REPO_ROOT ??= root?.dir;
|
|
29645
|
-
process.env.NX_WORKSPACE_ROOT_PATH ??= root?.dir;
|
|
29646
|
-
return root?.dir;
|
|
29647
|
-
};
|
|
29648
|
-
|
|
29649
|
-
// packages/workspace-tools/src/utils/get-project-configurations.ts
|
|
29650
29696
|
var getProjectConfigurations = () => (0, import_retrieve_workspace_files.retrieveProjectConfigurationsWithoutPluginInference)(
|
|
29651
29697
|
getWorkspaceRoot2()
|
|
29652
29698
|
);
|
|
29653
29699
|
|
|
29654
29700
|
// packages/workspace-tools/src/generators/config-schema/generator.ts
|
|
29655
29701
|
async function configSchemaGeneratorFn(tree, options) {
|
|
29656
|
-
const schema = {};
|
|
29657
29702
|
const projectConfigurations = getProjectConfigurations();
|
|
29658
29703
|
const workspaceRoot = getWorkspaceRoot2();
|
|
29659
29704
|
const modules = await Promise.all(
|
|
@@ -43925,12 +43925,67 @@ var setConfigEnv = (config) => {
|
|
|
43925
43925
|
});
|
|
43926
43926
|
};
|
|
43927
43927
|
|
|
43928
|
+
// packages/workspace-tools/src/utils/get-workspace-root.ts
|
|
43929
|
+
var import_find_workspace_root2 = require("nx/src/utils/find-workspace-root.js");
|
|
43930
|
+
var getWorkspaceRoot2 = () => {
|
|
43931
|
+
const root = (0, import_find_workspace_root2.findWorkspaceRoot)(process.cwd());
|
|
43932
|
+
process.env.STORM_REPO_ROOT ??= root?.dir;
|
|
43933
|
+
process.env.NX_WORKSPACE_ROOT_PATH ??= root?.dir;
|
|
43934
|
+
return root?.dir;
|
|
43935
|
+
};
|
|
43936
|
+
|
|
43937
|
+
// packages/workspace-tools/src/utils/apply-workspace-tokens.ts
|
|
43938
|
+
var applyWorkspaceGeneratorTokens = (option, config) => {
|
|
43939
|
+
let result = option;
|
|
43940
|
+
if (!result) {
|
|
43941
|
+
return result;
|
|
43942
|
+
}
|
|
43943
|
+
if (result.includes("{workspaceRoot}")) {
|
|
43944
|
+
result = result.replaceAll(
|
|
43945
|
+
"{workspaceRoot}",
|
|
43946
|
+
config.workspaceRoot ?? getWorkspaceRoot2()
|
|
43947
|
+
);
|
|
43948
|
+
}
|
|
43949
|
+
return result;
|
|
43950
|
+
};
|
|
43951
|
+
var applyWorkspaceTokens = (options, config, tokenizerFn) => {
|
|
43952
|
+
let result = options;
|
|
43953
|
+
if (!result) {
|
|
43954
|
+
return {};
|
|
43955
|
+
}
|
|
43956
|
+
return Object.keys(options).reduce(
|
|
43957
|
+
(ret, option) => {
|
|
43958
|
+
if (options[option] === void 0 || options[option] === null || typeof options[option] === "number" || typeof options[option] === "boolean" || typeof options[option] === "string") {
|
|
43959
|
+
ret[option] = tokenizerFn(option, config);
|
|
43960
|
+
} else if (Array.isArray(options[option])) {
|
|
43961
|
+
ret[option] = options[option].map(
|
|
43962
|
+
(item) => tokenizerFn(item, config)
|
|
43963
|
+
);
|
|
43964
|
+
} else if (typeof options[option] === "object") {
|
|
43965
|
+
ret[option] = tokenizerFn(options[option], config);
|
|
43966
|
+
}
|
|
43967
|
+
return ret;
|
|
43968
|
+
},
|
|
43969
|
+
{}
|
|
43970
|
+
);
|
|
43971
|
+
};
|
|
43972
|
+
|
|
43928
43973
|
// packages/workspace-tools/src/base/base-generator.ts
|
|
43929
|
-
var withRunGenerator = (name, generatorFn, generatorOptions = {
|
|
43974
|
+
var withRunGenerator = (name, generatorFn, generatorOptions = {
|
|
43975
|
+
skipReadingConfig: false
|
|
43976
|
+
}) => async (tree, options) => {
|
|
43930
43977
|
const startTime = Date.now();
|
|
43931
43978
|
try {
|
|
43932
43979
|
console.info(`\u26A1 Running the ${name} generator...`);
|
|
43933
|
-
|
|
43980
|
+
if (generatorOptions?.applyDefaultFn) {
|
|
43981
|
+
options = generatorOptions.applyDefaultFn(options);
|
|
43982
|
+
}
|
|
43983
|
+
console.debug("\u2699\uFE0F Generator schema options: \n", options);
|
|
43984
|
+
const tokenized = applyWorkspaceTokens(
|
|
43985
|
+
options,
|
|
43986
|
+
{ workspaceRoot: tree.root },
|
|
43987
|
+
applyWorkspaceGeneratorTokens
|
|
43988
|
+
);
|
|
43934
43989
|
let config;
|
|
43935
43990
|
if (!generatorOptions.skipReadingConfig) {
|
|
43936
43991
|
const configFile = await getConfigFile();
|
|
@@ -43943,7 +43998,9 @@ var withRunGenerator = (name, generatorFn, generatorOptions = { skipReadingConfi
|
|
|
43943
43998
|
console.debug(`Loaded Storm config into env:
|
|
43944
43999
|
${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\n")}`);
|
|
43945
44000
|
}
|
|
43946
|
-
const result = await Promise.resolve(
|
|
44001
|
+
const result = await Promise.resolve(
|
|
44002
|
+
generatorFn(tree, tokenized, config)
|
|
44003
|
+
);
|
|
43947
44004
|
if (result && (!result.success || result.error && result?.error?.message && typeof result?.error?.message === "string" && result?.error?.name && typeof result?.error?.name === "string")) {
|
|
43948
44005
|
throw new Error(`The ${name} generator failed to run`, {
|
|
43949
44006
|
cause: result.error
|
|
@@ -24950,12 +24950,67 @@ var setConfigEnv = (config) => {
|
|
|
24950
24950
|
});
|
|
24951
24951
|
};
|
|
24952
24952
|
|
|
24953
|
+
// packages/workspace-tools/src/utils/get-workspace-root.ts
|
|
24954
|
+
var import_find_workspace_root2 = require("nx/src/utils/find-workspace-root.js");
|
|
24955
|
+
var getWorkspaceRoot2 = () => {
|
|
24956
|
+
const root = (0, import_find_workspace_root2.findWorkspaceRoot)(process.cwd());
|
|
24957
|
+
process.env.STORM_REPO_ROOT ??= root?.dir;
|
|
24958
|
+
process.env.NX_WORKSPACE_ROOT_PATH ??= root?.dir;
|
|
24959
|
+
return root?.dir;
|
|
24960
|
+
};
|
|
24961
|
+
|
|
24962
|
+
// packages/workspace-tools/src/utils/apply-workspace-tokens.ts
|
|
24963
|
+
var applyWorkspaceGeneratorTokens = (option, config) => {
|
|
24964
|
+
let result = option;
|
|
24965
|
+
if (!result) {
|
|
24966
|
+
return result;
|
|
24967
|
+
}
|
|
24968
|
+
if (result.includes("{workspaceRoot}")) {
|
|
24969
|
+
result = result.replaceAll(
|
|
24970
|
+
"{workspaceRoot}",
|
|
24971
|
+
config.workspaceRoot ?? getWorkspaceRoot2()
|
|
24972
|
+
);
|
|
24973
|
+
}
|
|
24974
|
+
return result;
|
|
24975
|
+
};
|
|
24976
|
+
var applyWorkspaceTokens = (options, config, tokenizerFn) => {
|
|
24977
|
+
let result = options;
|
|
24978
|
+
if (!result) {
|
|
24979
|
+
return {};
|
|
24980
|
+
}
|
|
24981
|
+
return Object.keys(options).reduce(
|
|
24982
|
+
(ret, option) => {
|
|
24983
|
+
if (options[option] === void 0 || options[option] === null || typeof options[option] === "number" || typeof options[option] === "boolean" || typeof options[option] === "string") {
|
|
24984
|
+
ret[option] = tokenizerFn(option, config);
|
|
24985
|
+
} else if (Array.isArray(options[option])) {
|
|
24986
|
+
ret[option] = options[option].map(
|
|
24987
|
+
(item) => tokenizerFn(item, config)
|
|
24988
|
+
);
|
|
24989
|
+
} else if (typeof options[option] === "object") {
|
|
24990
|
+
ret[option] = tokenizerFn(options[option], config);
|
|
24991
|
+
}
|
|
24992
|
+
return ret;
|
|
24993
|
+
},
|
|
24994
|
+
{}
|
|
24995
|
+
);
|
|
24996
|
+
};
|
|
24997
|
+
|
|
24953
24998
|
// packages/workspace-tools/src/base/base-generator.ts
|
|
24954
|
-
var withRunGenerator = (name, generatorFn, generatorOptions = {
|
|
24999
|
+
var withRunGenerator = (name, generatorFn, generatorOptions = {
|
|
25000
|
+
skipReadingConfig: false
|
|
25001
|
+
}) => async (tree, options) => {
|
|
24955
25002
|
const startTime = Date.now();
|
|
24956
25003
|
try {
|
|
24957
25004
|
console.info(`\u26A1 Running the ${name} generator...`);
|
|
24958
|
-
|
|
25005
|
+
if (generatorOptions?.applyDefaultFn) {
|
|
25006
|
+
options = generatorOptions.applyDefaultFn(options);
|
|
25007
|
+
}
|
|
25008
|
+
console.debug("\u2699\uFE0F Generator schema options: \n", options);
|
|
25009
|
+
const tokenized = applyWorkspaceTokens(
|
|
25010
|
+
options,
|
|
25011
|
+
{ workspaceRoot: tree.root },
|
|
25012
|
+
applyWorkspaceGeneratorTokens
|
|
25013
|
+
);
|
|
24959
25014
|
let config;
|
|
24960
25015
|
if (!generatorOptions.skipReadingConfig) {
|
|
24961
25016
|
const configFile = await getConfigFile();
|
|
@@ -24968,7 +25023,9 @@ var withRunGenerator = (name, generatorFn, generatorOptions = { skipReadingConfi
|
|
|
24968
25023
|
console.debug(`Loaded Storm config into env:
|
|
24969
25024
|
${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\n")}`);
|
|
24970
25025
|
}
|
|
24971
|
-
const result = await Promise.resolve(
|
|
25026
|
+
const result = await Promise.resolve(
|
|
25027
|
+
generatorFn(tree, tokenized, config)
|
|
25028
|
+
);
|
|
24972
25029
|
if (result && (!result.success || result.error && result?.error?.message && typeof result?.error?.message === "string" && result?.error?.name && typeof result?.error?.name === "string")) {
|
|
24973
25030
|
throw new Error(`The ${name} generator failed to run`, {
|
|
24974
25031
|
cause: result.error
|
package/src/utils/index.js
CHANGED
|
@@ -20,6 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
var utils_exports = {};
|
|
21
21
|
__export(utils_exports, {
|
|
22
22
|
WorkspaceStorage: () => WorkspaceStorage,
|
|
23
|
+
applyWorkspaceExecutorTokens: () => applyWorkspaceExecutorTokens,
|
|
24
|
+
applyWorkspaceGeneratorTokens: () => applyWorkspaceGeneratorTokens,
|
|
23
25
|
applyWorkspaceTokens: () => applyWorkspaceTokens,
|
|
24
26
|
eslintVersion: () => eslintVersion,
|
|
25
27
|
findCacheDirectory: () => findCacheDirectory,
|
|
@@ -58,20 +60,19 @@ var getWorkspaceRoot = () => {
|
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
// packages/workspace-tools/src/utils/apply-workspace-tokens.ts
|
|
61
|
-
var
|
|
63
|
+
var applyWorkspaceExecutorTokens = (option, config) => {
|
|
62
64
|
let result = option;
|
|
63
65
|
if (!result) {
|
|
64
66
|
return result;
|
|
65
67
|
}
|
|
66
|
-
const workspaceRoot = getWorkspaceRoot();
|
|
67
68
|
let projectName;
|
|
68
69
|
let projectRoot;
|
|
69
70
|
let sourceRoot;
|
|
70
|
-
if (config?.
|
|
71
|
+
if (config?.projectName) {
|
|
71
72
|
const context = config;
|
|
72
73
|
projectName = context.projectName;
|
|
73
|
-
projectRoot = context.
|
|
74
|
-
sourceRoot = context.
|
|
74
|
+
projectRoot = context.root;
|
|
75
|
+
sourceRoot = context.sourceRoot;
|
|
75
76
|
} else {
|
|
76
77
|
const projectConfig = config;
|
|
77
78
|
projectName = projectConfig.name;
|
|
@@ -88,10 +89,47 @@ var applyWorkspaceTokens = (option, config) => {
|
|
|
88
89
|
result = result.replaceAll("{sourceRoot}", sourceRoot);
|
|
89
90
|
}
|
|
90
91
|
if (result.includes("{workspaceRoot}")) {
|
|
91
|
-
result = result.replaceAll(
|
|
92
|
+
result = result.replaceAll(
|
|
93
|
+
"{workspaceRoot}",
|
|
94
|
+
config.workspaceRoot ?? getWorkspaceRoot()
|
|
95
|
+
);
|
|
92
96
|
}
|
|
93
97
|
return result;
|
|
94
98
|
};
|
|
99
|
+
var applyWorkspaceGeneratorTokens = (option, config) => {
|
|
100
|
+
let result = option;
|
|
101
|
+
if (!result) {
|
|
102
|
+
return result;
|
|
103
|
+
}
|
|
104
|
+
if (result.includes("{workspaceRoot}")) {
|
|
105
|
+
result = result.replaceAll(
|
|
106
|
+
"{workspaceRoot}",
|
|
107
|
+
config.workspaceRoot ?? getWorkspaceRoot()
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
111
|
+
};
|
|
112
|
+
var applyWorkspaceTokens = (options, config, tokenizerFn) => {
|
|
113
|
+
let result = options;
|
|
114
|
+
if (!result) {
|
|
115
|
+
return {};
|
|
116
|
+
}
|
|
117
|
+
return Object.keys(options).reduce(
|
|
118
|
+
(ret, option) => {
|
|
119
|
+
if (options[option] === void 0 || options[option] === null || typeof options[option] === "number" || typeof options[option] === "boolean" || typeof options[option] === "string") {
|
|
120
|
+
ret[option] = tokenizerFn(option, config);
|
|
121
|
+
} else if (Array.isArray(options[option])) {
|
|
122
|
+
ret[option] = options[option].map(
|
|
123
|
+
(item) => tokenizerFn(item, config)
|
|
124
|
+
);
|
|
125
|
+
} else if (typeof options[option] === "object") {
|
|
126
|
+
ret[option] = tokenizerFn(options[option], config);
|
|
127
|
+
}
|
|
128
|
+
return ret;
|
|
129
|
+
},
|
|
130
|
+
{}
|
|
131
|
+
);
|
|
132
|
+
};
|
|
95
133
|
|
|
96
134
|
// packages/workspace-tools/src/utils/file-path-utils.ts
|
|
97
135
|
var import_node_path = require("node:path");
|
|
@@ -283,6 +321,8 @@ var WorkspaceStorage = class {
|
|
|
283
321
|
// Annotate the CommonJS export names for ESM import in node:
|
|
284
322
|
0 && (module.exports = {
|
|
285
323
|
WorkspaceStorage,
|
|
324
|
+
applyWorkspaceExecutorTokens,
|
|
325
|
+
applyWorkspaceGeneratorTokens,
|
|
286
326
|
applyWorkspaceTokens,
|
|
287
327
|
eslintVersion,
|
|
288
328
|
findCacheDirectory,
|