@storm-software/workspace-tools 1.42.4 → 1.43.1
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 +14 -0
- package/README.md +1 -1
- package/index.js +382 -285
- package/meta.json +1 -1
- package/package.json +1 -1
- package/src/base/index.js +362 -265
- package/src/executors/design-tokens/executor.js +235 -131
- package/src/executors/tsup/executor.js +234 -129
- package/src/executors/tsup-browser/executor.js +233 -128
- package/src/executors/tsup-neutral/executor.js +233 -128
- package/src/executors/tsup-node/executor.js +233 -128
- package/src/generators/browser-library/generator.js +251 -149
- package/src/generators/config-schema/generator.js +221 -109
- package/src/generators/neutral-library/generator.js +251 -149
- package/src/generators/node-library/generator.js +251 -149
- package/src/generators/preset/generator.js +220 -108
|
@@ -16158,14 +16158,14 @@ var require_share = __commonJS({
|
|
|
16158
16158
|
resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe();
|
|
16159
16159
|
resetConnection = void 0;
|
|
16160
16160
|
};
|
|
16161
|
-
var
|
|
16161
|
+
var reset2 = function() {
|
|
16162
16162
|
cancelReset();
|
|
16163
16163
|
connection = subject = void 0;
|
|
16164
16164
|
hasCompleted = hasErrored = false;
|
|
16165
16165
|
};
|
|
16166
16166
|
var resetAndUnsubscribe = function() {
|
|
16167
16167
|
var conn = connection;
|
|
16168
|
-
|
|
16168
|
+
reset2();
|
|
16169
16169
|
conn === null || conn === void 0 ? void 0 : conn.unsubscribe();
|
|
16170
16170
|
};
|
|
16171
16171
|
return lift_1.operate(function(source, subscriber) {
|
|
@@ -16189,13 +16189,13 @@ var require_share = __commonJS({
|
|
|
16189
16189
|
error: function(err) {
|
|
16190
16190
|
hasErrored = true;
|
|
16191
16191
|
cancelReset();
|
|
16192
|
-
resetConnection = handleReset(
|
|
16192
|
+
resetConnection = handleReset(reset2, resetOnError, err);
|
|
16193
16193
|
dest.error(err);
|
|
16194
16194
|
},
|
|
16195
16195
|
complete: function() {
|
|
16196
16196
|
hasCompleted = true;
|
|
16197
16197
|
cancelReset();
|
|
16198
|
-
resetConnection = handleReset(
|
|
16198
|
+
resetConnection = handleReset(reset2, resetOnComplete);
|
|
16199
16199
|
dest.complete();
|
|
16200
16200
|
}
|
|
16201
16201
|
});
|
|
@@ -16205,13 +16205,13 @@ var require_share = __commonJS({
|
|
|
16205
16205
|
};
|
|
16206
16206
|
}
|
|
16207
16207
|
exports.share = share;
|
|
16208
|
-
function handleReset(
|
|
16208
|
+
function handleReset(reset2, on) {
|
|
16209
16209
|
var args = [];
|
|
16210
16210
|
for (var _i = 2; _i < arguments.length; _i++) {
|
|
16211
16211
|
args[_i - 2] = arguments[_i];
|
|
16212
16212
|
}
|
|
16213
16213
|
if (on === true) {
|
|
16214
|
-
|
|
16214
|
+
reset2();
|
|
16215
16215
|
return;
|
|
16216
16216
|
}
|
|
16217
16217
|
if (on === false) {
|
|
@@ -16220,7 +16220,7 @@ var require_share = __commonJS({
|
|
|
16220
16220
|
var onSubscriber = new Subscriber_1.SafeSubscriber({
|
|
16221
16221
|
next: function() {
|
|
16222
16222
|
onSubscriber.unsubscribe();
|
|
16223
|
-
|
|
16223
|
+
reset2();
|
|
16224
16224
|
}
|
|
16225
16225
|
});
|
|
16226
16226
|
return innerFrom_1.innerFrom(on.apply(void 0, __spreadArray2([], __read2(args)))).subscribe(onSubscriber);
|
|
@@ -28102,7 +28102,7 @@ var require_array = __commonJS({
|
|
|
28102
28102
|
parent.enabled = choices.every((ch) => ch.enabled === true);
|
|
28103
28103
|
parent = parent.parent;
|
|
28104
28104
|
}
|
|
28105
|
-
|
|
28105
|
+
reset2(this, this.choices);
|
|
28106
28106
|
this.emit("toggle", choice, this);
|
|
28107
28107
|
return choice;
|
|
28108
28108
|
}
|
|
@@ -28400,7 +28400,7 @@ var require_array = __commonJS({
|
|
|
28400
28400
|
}
|
|
28401
28401
|
}
|
|
28402
28402
|
get choices() {
|
|
28403
|
-
return
|
|
28403
|
+
return reset2(this, this.state.choices || []);
|
|
28404
28404
|
}
|
|
28405
28405
|
set visible(visible) {
|
|
28406
28406
|
this.state.visible = visible;
|
|
@@ -28448,7 +28448,7 @@ var require_array = __commonJS({
|
|
|
28448
28448
|
return this.multiple ? this.enabled : this.focused;
|
|
28449
28449
|
}
|
|
28450
28450
|
};
|
|
28451
|
-
function
|
|
28451
|
+
function reset2(prompt, choices) {
|
|
28452
28452
|
if (choices instanceof Promise)
|
|
28453
28453
|
return choices;
|
|
28454
28454
|
if (typeof choices === "function") {
|
|
@@ -43521,6 +43521,7 @@ var LogLevel = {
|
|
|
43521
43521
|
ERROR: 20,
|
|
43522
43522
|
WARN: 30,
|
|
43523
43523
|
INFO: 40,
|
|
43524
|
+
SUCCESS: 45,
|
|
43524
43525
|
DEBUG: 60,
|
|
43525
43526
|
TRACE: 70,
|
|
43526
43527
|
ALL: 100
|
|
@@ -47318,6 +47319,8 @@ var getDefaultConfig = (config = {}, root) => {
|
|
|
47318
47319
|
// packages/config-tools/src/utilities/get-log-level.ts
|
|
47319
47320
|
var getLogLevel = (label) => {
|
|
47320
47321
|
switch (label) {
|
|
47322
|
+
case "all":
|
|
47323
|
+
return LogLevel.ALL;
|
|
47321
47324
|
case "trace":
|
|
47322
47325
|
return LogLevel.TRACE;
|
|
47323
47326
|
case "debug":
|
|
@@ -47337,6 +47340,9 @@ var getLogLevel = (label) => {
|
|
|
47337
47340
|
}
|
|
47338
47341
|
};
|
|
47339
47342
|
var getLogLevelLabel = (logLevel) => {
|
|
47343
|
+
if (logLevel >= LogLevel.ALL) {
|
|
47344
|
+
return LogLevelLabel.ALL;
|
|
47345
|
+
}
|
|
47340
47346
|
if (logLevel >= LogLevel.TRACE) {
|
|
47341
47347
|
return LogLevelLabel.TRACE;
|
|
47342
47348
|
}
|
|
@@ -47361,71 +47367,100 @@ var getLogLevelLabel = (logLevel) => {
|
|
|
47361
47367
|
return LogLevelLabel.INFO;
|
|
47362
47368
|
};
|
|
47363
47369
|
|
|
47364
|
-
// packages/config-tools/src/
|
|
47365
|
-
var
|
|
47366
|
-
|
|
47367
|
-
|
|
47368
|
-
|
|
47369
|
-
if (name) {
|
|
47370
|
-
ret[name] = process.env[key];
|
|
47371
|
-
}
|
|
47372
|
-
return ret;
|
|
47373
|
-
}, {});
|
|
47374
|
-
};
|
|
47375
|
-
var getConfigEnv = () => {
|
|
47376
|
-
const prefix = "STORM_";
|
|
47377
|
-
let config = {
|
|
47378
|
-
name: process.env[`${prefix}NAME`],
|
|
47379
|
-
namespace: process.env[`${prefix}NAMESPACE`],
|
|
47380
|
-
owner: process.env[`${prefix}OWNER`],
|
|
47381
|
-
worker: process.env[`${prefix}WORKER`],
|
|
47382
|
-
organization: process.env[`${prefix}ORGANIZATION`],
|
|
47383
|
-
packageManager: process.env[`${prefix}PACKAGE_MANAGER`],
|
|
47384
|
-
license: process.env[`${prefix}LICENSE`],
|
|
47385
|
-
homepage: process.env[`${prefix}HOMEPAGE`],
|
|
47386
|
-
timezone: process.env[`${prefix}TIMEZONE`] ?? process.env.TZ,
|
|
47387
|
-
locale: process.env[`${prefix}LOCALE`] ?? process.env.LOCALE,
|
|
47388
|
-
configFile: process.env[`${prefix}CONFIG_FILE`],
|
|
47389
|
-
workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`],
|
|
47390
|
-
packageDirectory: process.env[`${prefix}PACKAGE_DIRECTORY`],
|
|
47391
|
-
buildDirectory: process.env[`${prefix}BUILD_DIRECTORY`],
|
|
47392
|
-
runtimeVersion: process.env[`${prefix}RUNTIME_VERSION`],
|
|
47393
|
-
runtimeDirectory: process.env[`${prefix}RUNTIME_DIRECTORY`],
|
|
47394
|
-
env: process.env[`${prefix}ENV`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT,
|
|
47395
|
-
ci: Boolean(process.env[`${prefix}CI`] ?? process.env.CI ?? process.env.CONTINUOUS_INTEGRATION),
|
|
47396
|
-
colors: {
|
|
47397
|
-
primary: process.env[`${prefix}COLOR_PRIMARY`],
|
|
47398
|
-
background: process.env[`${prefix}COLOR_BACKGROUND`],
|
|
47399
|
-
success: process.env[`${prefix}COLOR_SUCCESS`],
|
|
47400
|
-
info: process.env[`${prefix}COLOR_INFO`],
|
|
47401
|
-
warning: process.env[`${prefix}COLOR_WARNING`],
|
|
47402
|
-
error: process.env[`${prefix}COLOR_ERROR`],
|
|
47403
|
-
fatal: process.env[`${prefix}COLOR_FATAL`]
|
|
47404
|
-
},
|
|
47405
|
-
repository: process.env[`${prefix}REPOSITORY`],
|
|
47406
|
-
branch: process.env[`${prefix}BRANCH`],
|
|
47407
|
-
preMajor: Boolean(process.env[`${prefix}PRE_MAJOR`]),
|
|
47408
|
-
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? Number.isSafeInteger(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) ? getLogLevelLabel(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : LogLevelLabel.INFO,
|
|
47409
|
-
extensions: {}
|
|
47410
|
-
};
|
|
47411
|
-
const serializedConfig = process.env[`${prefix}CONFIG`];
|
|
47412
|
-
if (serializedConfig) {
|
|
47413
|
-
const parsed = JSON.parse(serializedConfig);
|
|
47414
|
-
config = {
|
|
47415
|
-
...config,
|
|
47416
|
-
...parsed,
|
|
47417
|
-
colors: { ...config.colors, ...parsed.colors },
|
|
47418
|
-
extensions: { ...config.extensions, ...parsed.extensions }
|
|
47370
|
+
// packages/config-tools/src/utilities/logger.ts
|
|
47371
|
+
var chalk = __toESM(require_source(), 1);
|
|
47372
|
+
var getLogFn = (config = {}, logLevel = LogLevel.INFO) => {
|
|
47373
|
+
if (typeof logLevel === "number" && (logLevel >= getLogLevel(config.logLevel ?? process.env?.STORM_LOG_LEVEL) || logLevel <= LogLevel.SILENT) || typeof logLevel === "string" && getLogLevel(logLevel) >= getLogLevel(config.logLevel ?? process.env?.STORM_LOG_LEVEL)) {
|
|
47374
|
+
return (_) => {
|
|
47419
47375
|
};
|
|
47420
47376
|
}
|
|
47421
|
-
|
|
47422
|
-
|
|
47423
|
-
|
|
47424
|
-
|
|
47425
|
-
|
|
47426
|
-
|
|
47427
|
-
|
|
47428
|
-
|
|
47377
|
+
if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel || typeof logLevel === "string" && LogLevel.FATAL >= getLogLevel(logLevel)) {
|
|
47378
|
+
return (message) => {
|
|
47379
|
+
console.error(
|
|
47380
|
+
` ${chalk.bold.bgHex(config?.colors?.fatal ? config.colors.fatal : "#1fb2a6").inverse("\n\n \u{1F480} Fatal ")} ${chalk.reset.hex(
|
|
47381
|
+
config?.colors?.fatal ? config.colors.fatal : "#1fb2a6"
|
|
47382
|
+
)(message)}
|
|
47383
|
+
`
|
|
47384
|
+
);
|
|
47385
|
+
};
|
|
47386
|
+
}
|
|
47387
|
+
if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel || typeof logLevel === "string" && LogLevel.ERROR >= getLogLevel(logLevel)) {
|
|
47388
|
+
return (message) => {
|
|
47389
|
+
console.error(
|
|
47390
|
+
` ${chalk.bold.bgHex(config?.colors?.error ? config.colors.error : "#7d1a1a").inverse("\n\n \u{1F6D1} Error ")} ${chalk.reset.hex(
|
|
47391
|
+
config?.colors?.error ? config.colors.error : "#7d1a1a"
|
|
47392
|
+
)(message)}
|
|
47393
|
+
`
|
|
47394
|
+
);
|
|
47395
|
+
};
|
|
47396
|
+
}
|
|
47397
|
+
if (typeof logLevel === "number" && LogLevel.WARN >= logLevel || typeof logLevel === "string" && LogLevel.WARN >= getLogLevel(logLevel)) {
|
|
47398
|
+
return (message) => {
|
|
47399
|
+
console.warn(
|
|
47400
|
+
` ${chalk.bold.bgHex(config?.colors?.warning ? config.colors.warning : "#fcc419").inverse("\n\n \u26A0\uFE0F Warn ")} ${chalk.reset.hex(
|
|
47401
|
+
config?.colors?.warning ? config.colors.warning : "#fcc419"
|
|
47402
|
+
)(message)}
|
|
47403
|
+
`
|
|
47404
|
+
);
|
|
47405
|
+
};
|
|
47406
|
+
}
|
|
47407
|
+
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel || typeof logLevel === "string" && LogLevel.INFO >= getLogLevel(logLevel)) {
|
|
47408
|
+
return (message) => {
|
|
47409
|
+
console.info(
|
|
47410
|
+
` ${chalk.bold.bgHex(config?.colors?.info ? config.colors.info : "#0ea5e9").inverse("\n\n \u{1F4EC} Info ")} ${chalk.reset.hex(
|
|
47411
|
+
config?.colors?.info ? config.colors.info : "#0ea5e9"
|
|
47412
|
+
)(message)}
|
|
47413
|
+
`
|
|
47414
|
+
);
|
|
47415
|
+
};
|
|
47416
|
+
}
|
|
47417
|
+
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel || typeof logLevel === "string" && LogLevel.INFO >= getLogLevel(logLevel)) {
|
|
47418
|
+
return (message) => {
|
|
47419
|
+
console.info(
|
|
47420
|
+
` ${chalk.bold.bgHex(config?.colors?.success ? config.colors.success : "#087f5b").inverse("\n\n \u{1F389} Success ")} ${chalk.reset.hex(
|
|
47421
|
+
config?.colors?.success ? config.colors.success : "#087f5b"
|
|
47422
|
+
)(message)}
|
|
47423
|
+
`
|
|
47424
|
+
);
|
|
47425
|
+
};
|
|
47426
|
+
}
|
|
47427
|
+
if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel || typeof logLevel === "string" && LogLevel.DEBUG >= getLogLevel(logLevel)) {
|
|
47428
|
+
return (message) => {
|
|
47429
|
+
console.debug(
|
|
47430
|
+
` ${chalk.bold.bgHex(config?.colors?.primary ? config.colors.primary : "#1fb2a6").inverse("\n\n \u{1F9EA} Debug ")} ${chalk.reset.hex(
|
|
47431
|
+
config?.colors?.primary ? config.colors.primary : "#1fb2a6"
|
|
47432
|
+
)(message)}
|
|
47433
|
+
`
|
|
47434
|
+
);
|
|
47435
|
+
};
|
|
47436
|
+
}
|
|
47437
|
+
return (message) => {
|
|
47438
|
+
console.log(
|
|
47439
|
+
` ${chalk.bold.bgHex(config?.colors?.primary ? config.colors.primary : "#1fb2a6").inverse("\n\n \u{1F4E2} System ")} ${chalk.bold.hex(
|
|
47440
|
+
config?.colors?.primary ? config.colors.primary : "#1fb2a6"
|
|
47441
|
+
)(message)}
|
|
47442
|
+
`
|
|
47443
|
+
);
|
|
47444
|
+
};
|
|
47445
|
+
};
|
|
47446
|
+
var writeFatal = (config, message) => getLogFn(config, LogLevel.FATAL)(message);
|
|
47447
|
+
var writeError = (config, message) => getLogFn(config, LogLevel.ERROR)(message);
|
|
47448
|
+
var writeInfo = (config, message) => getLogFn(config, LogLevel.INFO)(message);
|
|
47449
|
+
var writeSuccess = (config, message) => getLogFn(config, LogLevel.SUCCESS)(message);
|
|
47450
|
+
var writeDebug = (config, message) => getLogFn(config, LogLevel.DEBUG)(message);
|
|
47451
|
+
var writeTrace = (config, message) => getLogFn(config, LogLevel.TRACE)(message);
|
|
47452
|
+
var getStopwatch = (name) => {
|
|
47453
|
+
const start = process.hrtime();
|
|
47454
|
+
return () => {
|
|
47455
|
+
const end = process.hrtime(start);
|
|
47456
|
+
console.info(
|
|
47457
|
+
chalk.dim(
|
|
47458
|
+
`\u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(
|
|
47459
|
+
end[0] * 1e3 + end[1] / 1e6
|
|
47460
|
+
)}ms to complete`
|
|
47461
|
+
)
|
|
47462
|
+
);
|
|
47463
|
+
};
|
|
47429
47464
|
};
|
|
47430
47465
|
|
|
47431
47466
|
// packages/config-tools/src/env/set-env.ts
|
|
@@ -47562,8 +47597,82 @@ var setConfigEnv = (config) => {
|
|
|
47562
47597
|
}
|
|
47563
47598
|
};
|
|
47564
47599
|
|
|
47565
|
-
// packages/
|
|
47566
|
-
var
|
|
47600
|
+
// packages/config-tools/src/utilities/prepare-workspace.ts
|
|
47601
|
+
var prepareWorkspace = async () => {
|
|
47602
|
+
const _STORM_CONFIG = getDefaultConfig({
|
|
47603
|
+
...await getConfigFile(),
|
|
47604
|
+
...getConfigEnv()
|
|
47605
|
+
});
|
|
47606
|
+
setConfigEnv(_STORM_CONFIG);
|
|
47607
|
+
return _STORM_CONFIG;
|
|
47608
|
+
};
|
|
47609
|
+
|
|
47610
|
+
// packages/config-tools/src/env/get-env.ts
|
|
47611
|
+
var getExtensionEnv = (extensionName) => {
|
|
47612
|
+
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
47613
|
+
return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
|
|
47614
|
+
const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
|
|
47615
|
+
if (name) {
|
|
47616
|
+
ret[name] = process.env[key];
|
|
47617
|
+
}
|
|
47618
|
+
return ret;
|
|
47619
|
+
}, {});
|
|
47620
|
+
};
|
|
47621
|
+
var getConfigEnv = () => {
|
|
47622
|
+
const prefix = "STORM_";
|
|
47623
|
+
let config = {
|
|
47624
|
+
name: process.env[`${prefix}NAME`],
|
|
47625
|
+
namespace: process.env[`${prefix}NAMESPACE`],
|
|
47626
|
+
owner: process.env[`${prefix}OWNER`],
|
|
47627
|
+
worker: process.env[`${prefix}WORKER`],
|
|
47628
|
+
organization: process.env[`${prefix}ORGANIZATION`],
|
|
47629
|
+
packageManager: process.env[`${prefix}PACKAGE_MANAGER`],
|
|
47630
|
+
license: process.env[`${prefix}LICENSE`],
|
|
47631
|
+
homepage: process.env[`${prefix}HOMEPAGE`],
|
|
47632
|
+
timezone: process.env[`${prefix}TIMEZONE`] ?? process.env.TZ,
|
|
47633
|
+
locale: process.env[`${prefix}LOCALE`] ?? process.env.LOCALE,
|
|
47634
|
+
configFile: process.env[`${prefix}CONFIG_FILE`],
|
|
47635
|
+
workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`],
|
|
47636
|
+
packageDirectory: process.env[`${prefix}PACKAGE_DIRECTORY`],
|
|
47637
|
+
buildDirectory: process.env[`${prefix}BUILD_DIRECTORY`],
|
|
47638
|
+
runtimeVersion: process.env[`${prefix}RUNTIME_VERSION`],
|
|
47639
|
+
runtimeDirectory: process.env[`${prefix}RUNTIME_DIRECTORY`],
|
|
47640
|
+
env: process.env[`${prefix}ENV`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT,
|
|
47641
|
+
ci: Boolean(process.env[`${prefix}CI`] ?? process.env.CI ?? process.env.CONTINUOUS_INTEGRATION),
|
|
47642
|
+
colors: {
|
|
47643
|
+
primary: process.env[`${prefix}COLOR_PRIMARY`],
|
|
47644
|
+
background: process.env[`${prefix}COLOR_BACKGROUND`],
|
|
47645
|
+
success: process.env[`${prefix}COLOR_SUCCESS`],
|
|
47646
|
+
info: process.env[`${prefix}COLOR_INFO`],
|
|
47647
|
+
warning: process.env[`${prefix}COLOR_WARNING`],
|
|
47648
|
+
error: process.env[`${prefix}COLOR_ERROR`],
|
|
47649
|
+
fatal: process.env[`${prefix}COLOR_FATAL`]
|
|
47650
|
+
},
|
|
47651
|
+
repository: process.env[`${prefix}REPOSITORY`],
|
|
47652
|
+
branch: process.env[`${prefix}BRANCH`],
|
|
47653
|
+
preMajor: Boolean(process.env[`${prefix}PRE_MAJOR`]),
|
|
47654
|
+
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? Number.isSafeInteger(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) ? getLogLevelLabel(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : LogLevelLabel.INFO,
|
|
47655
|
+
extensions: {}
|
|
47656
|
+
};
|
|
47657
|
+
const serializedConfig = process.env[`${prefix}CONFIG`];
|
|
47658
|
+
if (serializedConfig) {
|
|
47659
|
+
const parsed = JSON.parse(serializedConfig);
|
|
47660
|
+
config = {
|
|
47661
|
+
...config,
|
|
47662
|
+
...parsed,
|
|
47663
|
+
colors: { ...config.colors, ...parsed.colors },
|
|
47664
|
+
extensions: { ...config.extensions, ...parsed.extensions }
|
|
47665
|
+
};
|
|
47666
|
+
}
|
|
47667
|
+
const extensionPrefix = `${prefix}EXTENSION_`;
|
|
47668
|
+
return Object.keys(process.env).filter((key) => key.startsWith(extensionPrefix)).reduce((ret, key) => {
|
|
47669
|
+
const extensionName = key.substring(prefix.length, key.indexOf("_", prefix.length)).split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
|
|
47670
|
+
if (extensionName) {
|
|
47671
|
+
ret.extensions[extensionName] = getExtensionEnv(extensionName);
|
|
47672
|
+
}
|
|
47673
|
+
return ret;
|
|
47674
|
+
}, config);
|
|
47675
|
+
};
|
|
47567
47676
|
|
|
47568
47677
|
// packages/workspace-tools/src/utils/get-workspace-root.ts
|
|
47569
47678
|
var import_find_workspace_root2 = require("nx/src/utils/find-workspace-root.js");
|
|
@@ -47631,43 +47740,48 @@ var applyWorkspaceTokens = (options, config, tokenizerFn) => {
|
|
|
47631
47740
|
var withRunGenerator = (name, generatorFn, generatorOptions = {
|
|
47632
47741
|
skipReadingConfig: false
|
|
47633
47742
|
}) => async (tree, _options) => {
|
|
47634
|
-
const
|
|
47743
|
+
const stopwatch = getStopwatch(name);
|
|
47635
47744
|
let options = _options;
|
|
47745
|
+
let config;
|
|
47636
47746
|
try {
|
|
47637
|
-
|
|
47747
|
+
writeInfo(config, `\u26A1 Running the ${name} generator...
|
|
47638
47748
|
|
|
47639
|
-
`)
|
|
47640
|
-
|
|
47749
|
+
`);
|
|
47750
|
+
const workspaceRoot = getWorkspaceRoot();
|
|
47641
47751
|
if (!generatorOptions.skipReadingConfig) {
|
|
47642
|
-
|
|
47643
|
-
|
|
47644
|
-
...
|
|
47645
|
-
|
|
47646
|
-
|
|
47647
|
-
|
|
47648
|
-
|
|
47649
|
-
|
|
47650
|
-
|
|
47651
|
-
|
|
47752
|
+
writeDebug(
|
|
47753
|
+
config,
|
|
47754
|
+
`Loading the Storm Config from environment variables and storm.config.js file...
|
|
47755
|
+
- workspaceRoot: ${workspaceRoot}`
|
|
47756
|
+
);
|
|
47757
|
+
config = await prepareWorkspace();
|
|
47758
|
+
writeTrace(
|
|
47759
|
+
config,
|
|
47760
|
+
`Loaded Storm config into env:
|
|
47761
|
+
${Object.keys(process.env).map((key) => ` - ${key}=${JSON.stringify(process.env[key])}`).join("\n")}`
|
|
47652
47762
|
);
|
|
47653
47763
|
}
|
|
47654
47764
|
if (generatorOptions?.hooks?.applyDefaultOptions) {
|
|
47655
|
-
|
|
47765
|
+
writeDebug(config, "Running the applyDefaultOptions hook...");
|
|
47656
47766
|
options = await Promise.resolve(
|
|
47657
47767
|
generatorOptions.hooks.applyDefaultOptions(options, config)
|
|
47658
47768
|
);
|
|
47659
|
-
|
|
47769
|
+
writeDebug(config, "Completed the applyDefaultOptions hook");
|
|
47660
47770
|
}
|
|
47661
|
-
|
|
47771
|
+
writeTrace(
|
|
47772
|
+
config,
|
|
47773
|
+
`Generator schema options \u2699\uFE0F
|
|
47774
|
+
${Object.keys(options).map((key) => ` - ${key}=${JSON.stringify(options[key])}`).join("\n")}`
|
|
47775
|
+
);
|
|
47662
47776
|
const tokenized = applyWorkspaceTokens(
|
|
47663
47777
|
options,
|
|
47664
47778
|
{ workspaceRoot: tree.root, config },
|
|
47665
47779
|
applyWorkspaceGeneratorTokens
|
|
47666
47780
|
);
|
|
47667
47781
|
if (generatorOptions?.hooks?.preProcess) {
|
|
47668
|
-
|
|
47669
|
-
await Promise.resolve(generatorOptions.hooks.preProcess(
|
|
47670
|
-
|
|
47782
|
+
writeDebug(config, "Running the preProcess hook...");
|
|
47783
|
+
await Promise.resolve(generatorOptions.hooks.preProcess(tokenized, config));
|
|
47784
|
+
writeDebug(config, "Completed the preProcess hook");
|
|
47671
47785
|
}
|
|
47672
47786
|
const result = await Promise.resolve(generatorFn(tree, tokenized, config));
|
|
47673
47787
|
if (result && (!result.success || result.error && result?.error?.message && typeof result?.error?.message === "string" && result?.error?.name && typeof result?.error?.name === "string")) {
|
|
@@ -47676,33 +47790,31 @@ ${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\
|
|
|
47676
47790
|
});
|
|
47677
47791
|
}
|
|
47678
47792
|
if (generatorOptions?.hooks?.postProcess) {
|
|
47679
|
-
|
|
47793
|
+
writeDebug(config, "Running the postProcess hook...");
|
|
47680
47794
|
await Promise.resolve(generatorOptions.hooks.postProcess(config));
|
|
47681
|
-
|
|
47795
|
+
writeDebug(config, "Completed the postProcess hook");
|
|
47682
47796
|
}
|
|
47683
|
-
|
|
47684
|
-
|
|
47685
|
-
|
|
47686
|
-
\u{1F389} Successfully completed running the ${name} generator!`)
|
|
47687
|
-
);
|
|
47797
|
+
writeSuccess(config, `Completed running the ${name} task executor!
|
|
47798
|
+
`);
|
|
47688
47799
|
return {
|
|
47689
47800
|
success: true
|
|
47690
47801
|
};
|
|
47691
47802
|
} catch (error) {
|
|
47692
|
-
|
|
47693
|
-
|
|
47694
|
-
error
|
|
47803
|
+
writeFatal(
|
|
47804
|
+
config,
|
|
47805
|
+
"A fatal error occurred while running the generator - the process was forced to terminate"
|
|
47806
|
+
);
|
|
47807
|
+
writeError(
|
|
47808
|
+
config,
|
|
47809
|
+
`An exception was thrown in the generator's process
|
|
47810
|
+
- Details: ${error.message}
|
|
47811
|
+
- Stacktrace: ${error.stack}`
|
|
47695
47812
|
);
|
|
47696
|
-
console.error(error);
|
|
47697
47813
|
return {
|
|
47698
47814
|
success: false
|
|
47699
47815
|
};
|
|
47700
47816
|
} finally {
|
|
47701
|
-
|
|
47702
|
-
chalk.hex("#0ea5e9").italic(
|
|
47703
|
-
`\u23F1\uFE0F The${name ? ` ${name}` : ""} generator took ${Date.now() - startTime}ms to complete`
|
|
47704
|
-
)
|
|
47705
|
-
);
|
|
47817
|
+
stopwatch();
|
|
47706
47818
|
}
|
|
47707
47819
|
};
|
|
47708
47820
|
|
|
@@ -47757,14 +47869,14 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
47757
47869
|
defaultConfiguration: "production",
|
|
47758
47870
|
assets: [
|
|
47759
47871
|
{
|
|
47760
|
-
|
|
47761
|
-
|
|
47762
|
-
|
|
47872
|
+
input: options.projectRoot,
|
|
47873
|
+
glob: "*.md",
|
|
47874
|
+
output: "/"
|
|
47763
47875
|
},
|
|
47764
47876
|
{
|
|
47765
|
-
|
|
47766
|
-
|
|
47767
|
-
|
|
47877
|
+
input: "",
|
|
47878
|
+
glob: "LICENSE",
|
|
47879
|
+
output: "/"
|
|
47768
47880
|
}
|
|
47769
47881
|
]
|
|
47770
47882
|
},
|
|
@@ -47783,7 +47895,9 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
47783
47895
|
test: {}
|
|
47784
47896
|
}
|
|
47785
47897
|
};
|
|
47786
|
-
|
|
47898
|
+
if (schema.platform) {
|
|
47899
|
+
projectConfig.targets.build.options.platform = schema.platform;
|
|
47900
|
+
}
|
|
47787
47901
|
createProjectTsConfigJson(tree, options);
|
|
47788
47902
|
(0, import_devkit.addProjectConfiguration)(tree, options.name, projectConfig);
|
|
47789
47903
|
let repository = {
|
|
@@ -47793,19 +47907,20 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
47793
47907
|
let description = schema.description ?? "\u26A1 A Storm package used to create modern, scalable web applications.";
|
|
47794
47908
|
if (tree.exists("package.json")) {
|
|
47795
47909
|
const packageJson = (0, import_devkit.readJson)(tree, "package.json");
|
|
47796
|
-
|
|
47797
|
-
|
|
47910
|
+
if (packageJson?.repository) {
|
|
47911
|
+
repository = packageJson.repository;
|
|
47912
|
+
}
|
|
47913
|
+
if (packageJson?.description) {
|
|
47914
|
+
description = packageJson.description;
|
|
47915
|
+
}
|
|
47798
47916
|
}
|
|
47799
|
-
const packageJsonPath = (0, import_devkit.joinPathFragments)(
|
|
47800
|
-
options.projectRoot,
|
|
47801
|
-
"package.json"
|
|
47802
|
-
);
|
|
47917
|
+
const packageJsonPath = (0, import_devkit.joinPathFragments)(options.projectRoot, "package.json");
|
|
47803
47918
|
if (tree.exists(packageJsonPath)) {
|
|
47804
47919
|
(0, import_devkit.updateJson)(tree, packageJsonPath, (json) => {
|
|
47805
47920
|
json.name = options.importPath;
|
|
47806
47921
|
json.version = "0.0.1";
|
|
47807
47922
|
if (json.private && (options.publishable || options.rootProject)) {
|
|
47808
|
-
|
|
47923
|
+
json.private = void 0;
|
|
47809
47924
|
}
|
|
47810
47925
|
return {
|
|
47811
47926
|
...json,
|
|
@@ -47853,19 +47968,19 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
47853
47968
|
}));
|
|
47854
47969
|
}
|
|
47855
47970
|
(0, import_js.addTsConfigPath)(tree, options.importPath, [
|
|
47856
|
-
(0, import_devkit.joinPathFragments)(
|
|
47857
|
-
options.projectRoot,
|
|
47858
|
-
"./src",
|
|
47859
|
-
"index." + (options.js ? "js" : "ts")
|
|
47860
|
-
)
|
|
47971
|
+
(0, import_devkit.joinPathFragments)(options.projectRoot, "./src", `index.${options.js ? "js" : "ts"}`)
|
|
47861
47972
|
]);
|
|
47862
47973
|
(0, import_js.addTsConfigPath)(tree, (0, import_devkit.joinPathFragments)(options.importPath, "/*"), [
|
|
47863
47974
|
(0, import_devkit.joinPathFragments)(options.projectRoot, "./src", "/*")
|
|
47864
47975
|
]);
|
|
47865
47976
|
if (tree.exists("package.json")) {
|
|
47866
47977
|
const packageJson = (0, import_devkit.readJson)(tree, "package.json");
|
|
47867
|
-
|
|
47868
|
-
|
|
47978
|
+
if (packageJson?.repository) {
|
|
47979
|
+
repository = packageJson.repository;
|
|
47980
|
+
}
|
|
47981
|
+
if (packageJson?.description) {
|
|
47982
|
+
description = packageJson.description;
|
|
47983
|
+
}
|
|
47869
47984
|
}
|
|
47870
47985
|
const tsconfigPath = (0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json");
|
|
47871
47986
|
if (tree.exists(tsconfigPath)) {
|
|
@@ -47904,11 +48019,7 @@ async function addLint(tree, options) {
|
|
|
47904
48019
|
tsConfigPaths: [(0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json")],
|
|
47905
48020
|
unitTestRunner: options.unitTestRunner,
|
|
47906
48021
|
eslintFilePatterns: [
|
|
47907
|
-
mapLintPattern(
|
|
47908
|
-
options.projectRoot,
|
|
47909
|
-
options.js ? "js" : "ts",
|
|
47910
|
-
options.rootProject
|
|
47911
|
-
)
|
|
48022
|
+
mapLintPattern(options.projectRoot, options.js ? "js" : "ts", options.rootProject)
|
|
47912
48023
|
],
|
|
47913
48024
|
setParserOptionsProject: options.setParserOptionsProject,
|
|
47914
48025
|
rootProject: options.rootProject
|
|
@@ -47954,9 +48065,7 @@ async function addLint(tree, options) {
|
|
|
47954
48065
|
ruleOptions = {};
|
|
47955
48066
|
}
|
|
47956
48067
|
if (options.bundler === "esbuild") {
|
|
47957
|
-
ruleOptions.ignoredFiles = [
|
|
47958
|
-
"{projectRoot}/esbuild.config.{js,ts,mjs,mts}"
|
|
47959
|
-
];
|
|
48068
|
+
ruleOptions.ignoredFiles = ["{projectRoot}/esbuild.config.{js,ts,mjs,mts}"];
|
|
47960
48069
|
o.rules["@nx/dependency-checks"] = [ruleSeverity, ruleOptions];
|
|
47961
48070
|
}
|
|
47962
48071
|
return o;
|
|
@@ -47980,10 +48089,7 @@ function createProjectTsConfigJson(tree, options) {
|
|
|
47980
48089
|
...options?.tsConfigOptions ?? {},
|
|
47981
48090
|
compilerOptions: {
|
|
47982
48091
|
...options.rootProject ? import_js.tsConfigBaseOptions : {},
|
|
47983
|
-
outDir: (0, import_devkit.joinPathFragments)(
|
|
47984
|
-
(0, import_devkit.offsetFromRoot)(options.projectRoot),
|
|
47985
|
-
"dist/out-tsc"
|
|
47986
|
-
),
|
|
48092
|
+
outDir: (0, import_devkit.joinPathFragments)((0, import_devkit.offsetFromRoot)(options.projectRoot), "dist/out-tsc"),
|
|
47987
48093
|
noEmit: true,
|
|
47988
48094
|
...options?.tsConfigOptions?.compilerOptions ?? {}
|
|
47989
48095
|
},
|
|
@@ -48001,11 +48107,7 @@ function createProjectTsConfigJson(tree, options) {
|
|
|
48001
48107
|
"src/**/*.test.ts"
|
|
48002
48108
|
]
|
|
48003
48109
|
};
|
|
48004
|
-
(0, import_devkit.writeJson)(
|
|
48005
|
-
tree,
|
|
48006
|
-
(0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json"),
|
|
48007
|
-
tsconfig
|
|
48008
|
-
);
|
|
48110
|
+
(0, import_devkit.writeJson)(tree, (0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json"), tsconfig);
|
|
48009
48111
|
}
|
|
48010
48112
|
async function normalizeOptions(tree, options) {
|
|
48011
48113
|
if (options.publishable) {
|