@storm-software/workspace-tools 1.202.1 → 1.204.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 +15 -0
- package/declarations.d.ts +18 -2
- package/index.js +115 -101
- package/meta.json +221 -176
- package/package.json +1 -1
- package/src/base/base-executor.js +10 -12
- package/src/base/base-generator.js +10 -12
- package/src/base/index.js +79 -19
- package/src/base/typescript-library-generator.d.ts +2 -1
- package/src/base/typescript-library-generator.js +69 -7
- package/src/executors/cargo-build/executor.js +10 -12
- package/src/executors/cargo-check/executor.js +10 -12
- package/src/executors/cargo-clippy/executor.js +10 -12
- package/src/executors/cargo-doc/executor.js +10 -12
- package/src/executors/cargo-format/executor.js +10 -12
- package/src/executors/clean-package/executor.js +10 -12
- package/src/executors/rolldown/executor.js +10 -12
- package/src/executors/rollup/executor.js +10 -12
- package/src/executors/size-limit/executor.js +10 -12
- package/src/executors/tsup/executor.js +10 -12
- package/src/executors/tsup-browser/executor.js +10 -12
- package/src/executors/tsup-neutral/executor.js +10 -12
- package/src/executors/tsup-node/executor.js +10 -12
- package/src/executors/typia/executor.js +10 -12
- package/src/executors/unbuild/executor.js +10 -12
- package/src/executors/unbuild/schema.json +7 -1
- package/src/generators/browser-library/generator.d.ts +2 -1
- package/src/generators/browser-library/generator.js +81 -21
- package/src/generators/config-schema/generator.js +10 -12
- package/src/generators/neutral-library/generator.d.ts +2 -1
- package/src/generators/neutral-library/generator.js +81 -21
- package/src/generators/node-library/generator.d.ts +2 -1
- package/src/generators/node-library/generator.js +81 -21
- package/src/generators/preset/generator.js +10 -12
- package/src/generators/release-version/generator.js +10 -12
- package/src/plugins/rust/index.js +13 -0
- package/src/plugins/typescript/index.js +13 -0
- package/src/utils/index.js +23 -12
- package/src/utils/project-tags.d.ts +8 -1
- package/src/utils/project-tags.js +13 -0
|
@@ -27,6 +27,12 @@
|
|
|
27
27
|
"x-priority": "important",
|
|
28
28
|
"default": "{projectRoot}/tsconfig.json"
|
|
29
29
|
},
|
|
30
|
+
"platform": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "Platform target for outputs.",
|
|
33
|
+
"enum": ["neutral", "browser", "node", "worker"],
|
|
34
|
+
"default": "neutral"
|
|
35
|
+
},
|
|
30
36
|
"additionalEntryPoints": {
|
|
31
37
|
"type": "array",
|
|
32
38
|
"description": "List of additional entry points.",
|
|
@@ -96,7 +102,7 @@
|
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
104
|
},
|
|
99
|
-
"required": ["tsConfig"],
|
|
105
|
+
"required": ["tsConfig", "platform"],
|
|
100
106
|
"definitions": {
|
|
101
107
|
"assetPattern": {
|
|
102
108
|
"oneOf": [
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Tree } from "@nx/devkit";
|
|
2
|
+
import { StormConfig } from "@storm-software/config";
|
|
2
3
|
import type { BrowserLibraryGeneratorSchema } from "./schema";
|
|
3
|
-
export declare function browserLibraryGeneratorFn(tree: Tree, schema: BrowserLibraryGeneratorSchema): Promise<null>;
|
|
4
|
+
export declare function browserLibraryGeneratorFn(tree: Tree, schema: BrowserLibraryGeneratorSchema, config?: StormConfig): Promise<null>;
|
|
4
5
|
declare const _default: (tree: Tree, _options: BrowserLibraryGeneratorSchema) => Promise<import("@nx/devkit").GeneratorCallback | import("../../../declarations.d").BaseGeneratorResult>;
|
|
5
6
|
export default _default;
|
|
@@ -66405,7 +66405,7 @@ var init_schema = __esm({
|
|
|
66405
66405
|
worker: z3.string().trim().default("Stormie-Bot").describe(
|
|
66406
66406
|
"The worker of the package (this is the bot that will be used to perform various tasks)"
|
|
66407
66407
|
),
|
|
66408
|
-
|
|
66408
|
+
envName: z3.enum(["development", "staging", "production"]).default("production").describe("The current runtime environment name for the package"),
|
|
66409
66409
|
workspaceRoot: z3.string().trim().default("").describe("The root directory of the workspace"),
|
|
66410
66410
|
packageDirectory: z3.string().trim().optional().describe("The root directory of the package"),
|
|
66411
66411
|
externalPackagePatterns: z3.array(z3.string()).default([]).describe(
|
|
@@ -66527,19 +66527,17 @@ var init_get_default_config = __esm({
|
|
|
66527
66527
|
}
|
|
66528
66528
|
};
|
|
66529
66529
|
DEFAULT_STORM_CONFIG = {
|
|
66530
|
-
name: "storm",
|
|
66531
66530
|
namespace: "storm-software",
|
|
66532
|
-
license: "Apache
|
|
66531
|
+
license: "Apache-2.0",
|
|
66533
66532
|
homepage: "https://stormsoftware.com",
|
|
66534
|
-
owner: "@storm-software/
|
|
66533
|
+
owner: "@storm-software/admin",
|
|
66535
66534
|
worker: "stormie-bot",
|
|
66536
66535
|
runtimeDirectory: "node_modules/.storm",
|
|
66537
|
-
cacheDirectory: "node_modules/.cache/storm",
|
|
66538
66536
|
skipCache: false,
|
|
66539
|
-
packageManager: "
|
|
66537
|
+
packageManager: "pnpm",
|
|
66540
66538
|
timezone: "America/New_York",
|
|
66541
66539
|
locale: "en-US",
|
|
66542
|
-
|
|
66540
|
+
envName: "production",
|
|
66543
66541
|
branch: "main",
|
|
66544
66542
|
organization: "storm-software",
|
|
66545
66543
|
configFile: null,
|
|
@@ -67039,7 +67037,7 @@ var init_get_env = __esm({
|
|
|
67039
67037
|
cacheDirectory: correctPaths(process.env[`${prefix}CACHE_DIRECTORY`]),
|
|
67040
67038
|
runtimeVersion: process.env[`${prefix}RUNTIME_VERSION`],
|
|
67041
67039
|
outputDirectory: correctPaths(process.env[`${prefix}OUTPUT_DIRECTORY`]),
|
|
67042
|
-
|
|
67040
|
+
envName: process.env[`${prefix}ENV_NAME`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT,
|
|
67043
67041
|
// ci:
|
|
67044
67042
|
// process.env[`${prefix}CI`] !== undefined
|
|
67045
67043
|
// ? Boolean(
|
|
@@ -67268,10 +67266,10 @@ var init_set_env = __esm({
|
|
|
67268
67266
|
config.outputDirectory
|
|
67269
67267
|
);
|
|
67270
67268
|
}
|
|
67271
|
-
if (config.
|
|
67272
|
-
process.env[`${prefix}
|
|
67273
|
-
process.env.NODE_ENV = config.
|
|
67274
|
-
process.env.ENVIRONMENT = config.
|
|
67269
|
+
if (config.envName) {
|
|
67270
|
+
process.env[`${prefix}ENV_NAME`] = config.envName;
|
|
67271
|
+
process.env.NODE_ENV = config.envName;
|
|
67272
|
+
process.env.ENVIRONMENT = config.envName;
|
|
67275
67273
|
}
|
|
67276
67274
|
if (config.colors?.base?.light || config.colors?.base?.dark) {
|
|
67277
67275
|
for (const key of Object.keys(config.colors)) {
|
|
@@ -67720,11 +67718,68 @@ var import_js = require("@nx/js");
|
|
|
67720
67718
|
var import_init = __toESM(require("@nx/js/src/generators/init/init"));
|
|
67721
67719
|
var import_generator = __toESM(require("@nx/js/src/generators/setup-verdaccio/generator"));
|
|
67722
67720
|
|
|
67721
|
+
// packages/workspace-tools/src/utils/project-tags.ts
|
|
67722
|
+
var ProjectTagConstants = {
|
|
67723
|
+
Language: {
|
|
67724
|
+
TAG_ID: "language",
|
|
67725
|
+
TYPESCRIPT: "typescript",
|
|
67726
|
+
RUST: "rust"
|
|
67727
|
+
},
|
|
67728
|
+
ProjectType: {
|
|
67729
|
+
TAG_ID: "type",
|
|
67730
|
+
LIBRARY: "library",
|
|
67731
|
+
APPLICATION: "application"
|
|
67732
|
+
},
|
|
67733
|
+
DistStyle: {
|
|
67734
|
+
TAG_ID: "dist-style",
|
|
67735
|
+
NORMAL: "normal",
|
|
67736
|
+
CLEAN: "clean"
|
|
67737
|
+
},
|
|
67738
|
+
Provider: {
|
|
67739
|
+
TAG_ID: "provider"
|
|
67740
|
+
},
|
|
67741
|
+
Platform: {
|
|
67742
|
+
TAG_ID: "platform",
|
|
67743
|
+
NODE: "node",
|
|
67744
|
+
BROWSER: "browser",
|
|
67745
|
+
NEUTRAL: "neutral",
|
|
67746
|
+
WORKER: "worker"
|
|
67747
|
+
},
|
|
67748
|
+
Registry: {
|
|
67749
|
+
TAG_ID: "registry",
|
|
67750
|
+
CARGO: "cargo",
|
|
67751
|
+
NPM: "npm",
|
|
67752
|
+
CONTAINER: "container",
|
|
67753
|
+
CYCLONE: "cyclone"
|
|
67754
|
+
}
|
|
67755
|
+
};
|
|
67756
|
+
var formatProjectTag = (variant, value2) => {
|
|
67757
|
+
return `${variant}:${value2}`;
|
|
67758
|
+
};
|
|
67759
|
+
var hasProjectTag = (project, variant) => {
|
|
67760
|
+
project.tags = project.tags ?? [];
|
|
67761
|
+
const prefix = formatProjectTag(variant, "");
|
|
67762
|
+
return project.tags.some(
|
|
67763
|
+
(tag) => tag.startsWith(prefix) && tag.length > prefix.length
|
|
67764
|
+
);
|
|
67765
|
+
};
|
|
67766
|
+
var addProjectTag = (project, variant, value2, options = {
|
|
67767
|
+
overwrite: false
|
|
67768
|
+
}) => {
|
|
67769
|
+
project.tags = project.tags ?? [];
|
|
67770
|
+
if (options.overwrite || !hasProjectTag(project, variant)) {
|
|
67771
|
+
project.tags = project.tags.filter(
|
|
67772
|
+
(tag) => !tag.startsWith(formatProjectTag(variant, ""))
|
|
67773
|
+
);
|
|
67774
|
+
project.tags.push(formatProjectTag(variant, value2));
|
|
67775
|
+
}
|
|
67776
|
+
};
|
|
67777
|
+
|
|
67723
67778
|
// packages/workspace-tools/src/utils/versions.ts
|
|
67724
67779
|
var nxVersion = "^18.0.4";
|
|
67725
67780
|
|
|
67726
67781
|
// packages/workspace-tools/src/base/typescript-library-generator.ts
|
|
67727
|
-
async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
67782
|
+
async function typeScriptLibraryGeneratorFn(tree, schema, config) {
|
|
67728
67783
|
const options = await normalizeOptions(tree, { ...schema });
|
|
67729
67784
|
const tasks = [];
|
|
67730
67785
|
tasks.push(
|
|
@@ -67761,6 +67816,7 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
67761
67816
|
tsConfig: (0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json"),
|
|
67762
67817
|
project: (0, import_devkit.joinPathFragments)(options.projectRoot, "package.json"),
|
|
67763
67818
|
defaultConfiguration: "production",
|
|
67819
|
+
platform: "neutral",
|
|
67764
67820
|
assets: [
|
|
67765
67821
|
{
|
|
67766
67822
|
input: options.projectRoot,
|
|
@@ -67784,21 +67840,25 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
67784
67840
|
verbose: true
|
|
67785
67841
|
}
|
|
67786
67842
|
}
|
|
67787
|
-
}
|
|
67788
|
-
lint: {},
|
|
67789
|
-
test: {}
|
|
67843
|
+
}
|
|
67790
67844
|
}
|
|
67791
67845
|
};
|
|
67792
|
-
if (schema.platform
|
|
67846
|
+
if (schema.platform) {
|
|
67793
67847
|
projectConfig.targets.build.options.platform = schema.platform;
|
|
67794
67848
|
}
|
|
67849
|
+
addProjectTag(
|
|
67850
|
+
projectConfig,
|
|
67851
|
+
ProjectTagConstants.Platform.TAG_ID,
|
|
67852
|
+
projectConfig.targets.build.options.platform === "node" ? ProjectTagConstants.Platform.NODE : projectConfig.targets.build.options.platform === "worker" ? ProjectTagConstants.Platform.WORKER : projectConfig.targets.build.options.platform === "browser" ? ProjectTagConstants.Platform.BROWSER : ProjectTagConstants.Platform.NEUTRAL,
|
|
67853
|
+
{ overwrite: false }
|
|
67854
|
+
);
|
|
67795
67855
|
createProjectTsConfigJson(tree, options);
|
|
67796
67856
|
(0, import_devkit.addProjectConfiguration)(tree, options.name, projectConfig);
|
|
67797
67857
|
let repository = {
|
|
67798
67858
|
type: "github",
|
|
67799
|
-
url:
|
|
67859
|
+
url: config?.repository || `https://github.com/${config?.organization || "storm-software"}/${config?.namespace || config?.name || "repository"}.git`
|
|
67800
67860
|
};
|
|
67801
|
-
let description = schema.description
|
|
67861
|
+
let description = schema.description || "A package developed by Storm Software used to create modern, scalable web applications.";
|
|
67802
67862
|
if (tree.exists("package.json")) {
|
|
67803
67863
|
const packageJson = (0, import_devkit.readJson)(tree, "package.json");
|
|
67804
67864
|
if (packageJson?.repository) {
|
|
@@ -68005,7 +68065,7 @@ async function normalizeOptions(tree, options) {
|
|
|
68005
68065
|
}
|
|
68006
68066
|
|
|
68007
68067
|
// packages/workspace-tools/src/generators/browser-library/generator.ts
|
|
68008
|
-
async function browserLibraryGeneratorFn(tree, schema) {
|
|
68068
|
+
async function browserLibraryGeneratorFn(tree, schema, config) {
|
|
68009
68069
|
const filesDir = (0, import_devkit2.joinPathFragments)(__dirname, "./files");
|
|
68010
68070
|
const tsLibraryGeneratorOptions = {
|
|
68011
68071
|
...schema,
|
|
@@ -68059,7 +68119,7 @@ async function browserLibraryGeneratorFn(tree, schema) {
|
|
|
68059
68119
|
}
|
|
68060
68120
|
}
|
|
68061
68121
|
});
|
|
68062
|
-
await typeScriptLibraryGeneratorFn(tree, tsLibraryGeneratorOptions);
|
|
68122
|
+
await typeScriptLibraryGeneratorFn(tree, tsLibraryGeneratorOptions, config);
|
|
68063
68123
|
await (0, import_devkit2.formatFiles)(tree);
|
|
68064
68124
|
return null;
|
|
68065
68125
|
}
|
|
@@ -4075,7 +4075,7 @@ var init_schema = __esm({
|
|
|
4075
4075
|
worker: z.string().trim().default("Stormie-Bot").describe(
|
|
4076
4076
|
"The worker of the package (this is the bot that will be used to perform various tasks)"
|
|
4077
4077
|
),
|
|
4078
|
-
|
|
4078
|
+
envName: z.enum(["development", "staging", "production"]).default("production").describe("The current runtime environment name for the package"),
|
|
4079
4079
|
workspaceRoot: z.string().trim().default("").describe("The root directory of the workspace"),
|
|
4080
4080
|
packageDirectory: z.string().trim().optional().describe("The root directory of the package"),
|
|
4081
4081
|
externalPackagePatterns: z.array(z.string()).default([]).describe(
|
|
@@ -66527,19 +66527,17 @@ var init_get_default_config = __esm({
|
|
|
66527
66527
|
}
|
|
66528
66528
|
};
|
|
66529
66529
|
DEFAULT_STORM_CONFIG = {
|
|
66530
|
-
name: "storm",
|
|
66531
66530
|
namespace: "storm-software",
|
|
66532
|
-
license: "Apache
|
|
66531
|
+
license: "Apache-2.0",
|
|
66533
66532
|
homepage: "https://stormsoftware.com",
|
|
66534
|
-
owner: "@storm-software/
|
|
66533
|
+
owner: "@storm-software/admin",
|
|
66535
66534
|
worker: "stormie-bot",
|
|
66536
66535
|
runtimeDirectory: "node_modules/.storm",
|
|
66537
|
-
cacheDirectory: "node_modules/.cache/storm",
|
|
66538
66536
|
skipCache: false,
|
|
66539
|
-
packageManager: "
|
|
66537
|
+
packageManager: "pnpm",
|
|
66540
66538
|
timezone: "America/New_York",
|
|
66541
66539
|
locale: "en-US",
|
|
66542
|
-
|
|
66540
|
+
envName: "production",
|
|
66543
66541
|
branch: "main",
|
|
66544
66542
|
organization: "storm-software",
|
|
66545
66543
|
configFile: null,
|
|
@@ -67039,7 +67037,7 @@ var init_get_env = __esm({
|
|
|
67039
67037
|
cacheDirectory: correctPaths(process.env[`${prefix}CACHE_DIRECTORY`]),
|
|
67040
67038
|
runtimeVersion: process.env[`${prefix}RUNTIME_VERSION`],
|
|
67041
67039
|
outputDirectory: correctPaths(process.env[`${prefix}OUTPUT_DIRECTORY`]),
|
|
67042
|
-
|
|
67040
|
+
envName: process.env[`${prefix}ENV_NAME`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT,
|
|
67043
67041
|
// ci:
|
|
67044
67042
|
// process.env[`${prefix}CI`] !== undefined
|
|
67045
67043
|
// ? Boolean(
|
|
@@ -67268,10 +67266,10 @@ var init_set_env = __esm({
|
|
|
67268
67266
|
config.outputDirectory
|
|
67269
67267
|
);
|
|
67270
67268
|
}
|
|
67271
|
-
if (config.
|
|
67272
|
-
process.env[`${prefix}
|
|
67273
|
-
process.env.NODE_ENV = config.
|
|
67274
|
-
process.env.ENVIRONMENT = config.
|
|
67269
|
+
if (config.envName) {
|
|
67270
|
+
process.env[`${prefix}ENV_NAME`] = config.envName;
|
|
67271
|
+
process.env.NODE_ENV = config.envName;
|
|
67272
|
+
process.env.ENVIRONMENT = config.envName;
|
|
67275
67273
|
}
|
|
67276
67274
|
if (config.colors?.base?.light || config.colors?.base?.dark) {
|
|
67277
67275
|
for (const key of Object.keys(config.colors)) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Tree } from "@nx/devkit";
|
|
2
|
+
import { StormConfig } from "@storm-software/config";
|
|
2
3
|
import { NeutralLibraryGeneratorSchema } from "./schema";
|
|
3
|
-
export declare function neutralLibraryGeneratorFn(tree: Tree, schema: NeutralLibraryGeneratorSchema): Promise<null>;
|
|
4
|
+
export declare function neutralLibraryGeneratorFn(tree: Tree, schema: NeutralLibraryGeneratorSchema, config?: StormConfig): Promise<null>;
|
|
4
5
|
declare const _default: (tree: Tree, _options: NeutralLibraryGeneratorSchema) => Promise<import("@nx/devkit").GeneratorCallback | import("../../../declarations.d").BaseGeneratorResult>;
|
|
5
6
|
export default _default;
|
|
@@ -66405,7 +66405,7 @@ var init_schema = __esm({
|
|
|
66405
66405
|
worker: z3.string().trim().default("Stormie-Bot").describe(
|
|
66406
66406
|
"The worker of the package (this is the bot that will be used to perform various tasks)"
|
|
66407
66407
|
),
|
|
66408
|
-
|
|
66408
|
+
envName: z3.enum(["development", "staging", "production"]).default("production").describe("The current runtime environment name for the package"),
|
|
66409
66409
|
workspaceRoot: z3.string().trim().default("").describe("The root directory of the workspace"),
|
|
66410
66410
|
packageDirectory: z3.string().trim().optional().describe("The root directory of the package"),
|
|
66411
66411
|
externalPackagePatterns: z3.array(z3.string()).default([]).describe(
|
|
@@ -66527,19 +66527,17 @@ var init_get_default_config = __esm({
|
|
|
66527
66527
|
}
|
|
66528
66528
|
};
|
|
66529
66529
|
DEFAULT_STORM_CONFIG = {
|
|
66530
|
-
name: "storm",
|
|
66531
66530
|
namespace: "storm-software",
|
|
66532
|
-
license: "Apache
|
|
66531
|
+
license: "Apache-2.0",
|
|
66533
66532
|
homepage: "https://stormsoftware.com",
|
|
66534
|
-
owner: "@storm-software/
|
|
66533
|
+
owner: "@storm-software/admin",
|
|
66535
66534
|
worker: "stormie-bot",
|
|
66536
66535
|
runtimeDirectory: "node_modules/.storm",
|
|
66537
|
-
cacheDirectory: "node_modules/.cache/storm",
|
|
66538
66536
|
skipCache: false,
|
|
66539
|
-
packageManager: "
|
|
66537
|
+
packageManager: "pnpm",
|
|
66540
66538
|
timezone: "America/New_York",
|
|
66541
66539
|
locale: "en-US",
|
|
66542
|
-
|
|
66540
|
+
envName: "production",
|
|
66543
66541
|
branch: "main",
|
|
66544
66542
|
organization: "storm-software",
|
|
66545
66543
|
configFile: null,
|
|
@@ -67039,7 +67037,7 @@ var init_get_env = __esm({
|
|
|
67039
67037
|
cacheDirectory: correctPaths(process.env[`${prefix}CACHE_DIRECTORY`]),
|
|
67040
67038
|
runtimeVersion: process.env[`${prefix}RUNTIME_VERSION`],
|
|
67041
67039
|
outputDirectory: correctPaths(process.env[`${prefix}OUTPUT_DIRECTORY`]),
|
|
67042
|
-
|
|
67040
|
+
envName: process.env[`${prefix}ENV_NAME`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT,
|
|
67043
67041
|
// ci:
|
|
67044
67042
|
// process.env[`${prefix}CI`] !== undefined
|
|
67045
67043
|
// ? Boolean(
|
|
@@ -67268,10 +67266,10 @@ var init_set_env = __esm({
|
|
|
67268
67266
|
config.outputDirectory
|
|
67269
67267
|
);
|
|
67270
67268
|
}
|
|
67271
|
-
if (config.
|
|
67272
|
-
process.env[`${prefix}
|
|
67273
|
-
process.env.NODE_ENV = config.
|
|
67274
|
-
process.env.ENVIRONMENT = config.
|
|
67269
|
+
if (config.envName) {
|
|
67270
|
+
process.env[`${prefix}ENV_NAME`] = config.envName;
|
|
67271
|
+
process.env.NODE_ENV = config.envName;
|
|
67272
|
+
process.env.ENVIRONMENT = config.envName;
|
|
67275
67273
|
}
|
|
67276
67274
|
if (config.colors?.base?.light || config.colors?.base?.dark) {
|
|
67277
67275
|
for (const key of Object.keys(config.colors)) {
|
|
@@ -67720,11 +67718,68 @@ var import_js = require("@nx/js");
|
|
|
67720
67718
|
var import_init = __toESM(require("@nx/js/src/generators/init/init"));
|
|
67721
67719
|
var import_generator = __toESM(require("@nx/js/src/generators/setup-verdaccio/generator"));
|
|
67722
67720
|
|
|
67721
|
+
// packages/workspace-tools/src/utils/project-tags.ts
|
|
67722
|
+
var ProjectTagConstants = {
|
|
67723
|
+
Language: {
|
|
67724
|
+
TAG_ID: "language",
|
|
67725
|
+
TYPESCRIPT: "typescript",
|
|
67726
|
+
RUST: "rust"
|
|
67727
|
+
},
|
|
67728
|
+
ProjectType: {
|
|
67729
|
+
TAG_ID: "type",
|
|
67730
|
+
LIBRARY: "library",
|
|
67731
|
+
APPLICATION: "application"
|
|
67732
|
+
},
|
|
67733
|
+
DistStyle: {
|
|
67734
|
+
TAG_ID: "dist-style",
|
|
67735
|
+
NORMAL: "normal",
|
|
67736
|
+
CLEAN: "clean"
|
|
67737
|
+
},
|
|
67738
|
+
Provider: {
|
|
67739
|
+
TAG_ID: "provider"
|
|
67740
|
+
},
|
|
67741
|
+
Platform: {
|
|
67742
|
+
TAG_ID: "platform",
|
|
67743
|
+
NODE: "node",
|
|
67744
|
+
BROWSER: "browser",
|
|
67745
|
+
NEUTRAL: "neutral",
|
|
67746
|
+
WORKER: "worker"
|
|
67747
|
+
},
|
|
67748
|
+
Registry: {
|
|
67749
|
+
TAG_ID: "registry",
|
|
67750
|
+
CARGO: "cargo",
|
|
67751
|
+
NPM: "npm",
|
|
67752
|
+
CONTAINER: "container",
|
|
67753
|
+
CYCLONE: "cyclone"
|
|
67754
|
+
}
|
|
67755
|
+
};
|
|
67756
|
+
var formatProjectTag = (variant, value2) => {
|
|
67757
|
+
return `${variant}:${value2}`;
|
|
67758
|
+
};
|
|
67759
|
+
var hasProjectTag = (project, variant) => {
|
|
67760
|
+
project.tags = project.tags ?? [];
|
|
67761
|
+
const prefix = formatProjectTag(variant, "");
|
|
67762
|
+
return project.tags.some(
|
|
67763
|
+
(tag) => tag.startsWith(prefix) && tag.length > prefix.length
|
|
67764
|
+
);
|
|
67765
|
+
};
|
|
67766
|
+
var addProjectTag = (project, variant, value2, options = {
|
|
67767
|
+
overwrite: false
|
|
67768
|
+
}) => {
|
|
67769
|
+
project.tags = project.tags ?? [];
|
|
67770
|
+
if (options.overwrite || !hasProjectTag(project, variant)) {
|
|
67771
|
+
project.tags = project.tags.filter(
|
|
67772
|
+
(tag) => !tag.startsWith(formatProjectTag(variant, ""))
|
|
67773
|
+
);
|
|
67774
|
+
project.tags.push(formatProjectTag(variant, value2));
|
|
67775
|
+
}
|
|
67776
|
+
};
|
|
67777
|
+
|
|
67723
67778
|
// packages/workspace-tools/src/utils/versions.ts
|
|
67724
67779
|
var nxVersion = "^18.0.4";
|
|
67725
67780
|
|
|
67726
67781
|
// packages/workspace-tools/src/base/typescript-library-generator.ts
|
|
67727
|
-
async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
67782
|
+
async function typeScriptLibraryGeneratorFn(tree, schema, config) {
|
|
67728
67783
|
const options = await normalizeOptions(tree, { ...schema });
|
|
67729
67784
|
const tasks = [];
|
|
67730
67785
|
tasks.push(
|
|
@@ -67761,6 +67816,7 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
67761
67816
|
tsConfig: (0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json"),
|
|
67762
67817
|
project: (0, import_devkit.joinPathFragments)(options.projectRoot, "package.json"),
|
|
67763
67818
|
defaultConfiguration: "production",
|
|
67819
|
+
platform: "neutral",
|
|
67764
67820
|
assets: [
|
|
67765
67821
|
{
|
|
67766
67822
|
input: options.projectRoot,
|
|
@@ -67784,21 +67840,25 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
67784
67840
|
verbose: true
|
|
67785
67841
|
}
|
|
67786
67842
|
}
|
|
67787
|
-
}
|
|
67788
|
-
lint: {},
|
|
67789
|
-
test: {}
|
|
67843
|
+
}
|
|
67790
67844
|
}
|
|
67791
67845
|
};
|
|
67792
|
-
if (schema.platform
|
|
67846
|
+
if (schema.platform) {
|
|
67793
67847
|
projectConfig.targets.build.options.platform = schema.platform;
|
|
67794
67848
|
}
|
|
67849
|
+
addProjectTag(
|
|
67850
|
+
projectConfig,
|
|
67851
|
+
ProjectTagConstants.Platform.TAG_ID,
|
|
67852
|
+
projectConfig.targets.build.options.platform === "node" ? ProjectTagConstants.Platform.NODE : projectConfig.targets.build.options.platform === "worker" ? ProjectTagConstants.Platform.WORKER : projectConfig.targets.build.options.platform === "browser" ? ProjectTagConstants.Platform.BROWSER : ProjectTagConstants.Platform.NEUTRAL,
|
|
67853
|
+
{ overwrite: false }
|
|
67854
|
+
);
|
|
67795
67855
|
createProjectTsConfigJson(tree, options);
|
|
67796
67856
|
(0, import_devkit.addProjectConfiguration)(tree, options.name, projectConfig);
|
|
67797
67857
|
let repository = {
|
|
67798
67858
|
type: "github",
|
|
67799
|
-
url:
|
|
67859
|
+
url: config?.repository || `https://github.com/${config?.organization || "storm-software"}/${config?.namespace || config?.name || "repository"}.git`
|
|
67800
67860
|
};
|
|
67801
|
-
let description = schema.description
|
|
67861
|
+
let description = schema.description || "A package developed by Storm Software used to create modern, scalable web applications.";
|
|
67802
67862
|
if (tree.exists("package.json")) {
|
|
67803
67863
|
const packageJson = (0, import_devkit.readJson)(tree, "package.json");
|
|
67804
67864
|
if (packageJson?.repository) {
|
|
@@ -68005,7 +68065,7 @@ async function normalizeOptions(tree, options) {
|
|
|
68005
68065
|
}
|
|
68006
68066
|
|
|
68007
68067
|
// packages/workspace-tools/src/generators/neutral-library/generator.ts
|
|
68008
|
-
async function neutralLibraryGeneratorFn(tree, schema) {
|
|
68068
|
+
async function neutralLibraryGeneratorFn(tree, schema, config) {
|
|
68009
68069
|
const filesDir = (0, import_devkit2.joinPathFragments)(__dirname, "./files");
|
|
68010
68070
|
const tsLibraryGeneratorOptions = {
|
|
68011
68071
|
...schema,
|
|
@@ -68033,7 +68093,7 @@ async function neutralLibraryGeneratorFn(tree, schema) {
|
|
|
68033
68093
|
buildable: options.bundler && options.bundler !== "none",
|
|
68034
68094
|
hasUnitTestRunner: options.unitTestRunner !== "none"
|
|
68035
68095
|
});
|
|
68036
|
-
await typeScriptLibraryGeneratorFn(tree, tsLibraryGeneratorOptions);
|
|
68096
|
+
await typeScriptLibraryGeneratorFn(tree, tsLibraryGeneratorOptions, config);
|
|
68037
68097
|
await (0, import_devkit2.formatFiles)(tree);
|
|
68038
68098
|
return null;
|
|
68039
68099
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Tree } from "@nx/devkit";
|
|
2
|
+
import { StormConfig } from "@storm-software/config";
|
|
2
3
|
import type { NodeLibraryGeneratorSchema } from "./schema";
|
|
3
|
-
export declare function nodeLibraryGeneratorFn(tree: Tree, schema: NodeLibraryGeneratorSchema): Promise<null>;
|
|
4
|
+
export declare function nodeLibraryGeneratorFn(tree: Tree, schema: NodeLibraryGeneratorSchema, config?: StormConfig): Promise<null>;
|
|
4
5
|
declare const _default: (tree: Tree, _options: NodeLibraryGeneratorSchema) => Promise<import("@nx/devkit").GeneratorCallback | import("../../../declarations.d").BaseGeneratorResult>;
|
|
5
6
|
export default _default;
|
|
@@ -66405,7 +66405,7 @@ var init_schema = __esm({
|
|
|
66405
66405
|
worker: z3.string().trim().default("Stormie-Bot").describe(
|
|
66406
66406
|
"The worker of the package (this is the bot that will be used to perform various tasks)"
|
|
66407
66407
|
),
|
|
66408
|
-
|
|
66408
|
+
envName: z3.enum(["development", "staging", "production"]).default("production").describe("The current runtime environment name for the package"),
|
|
66409
66409
|
workspaceRoot: z3.string().trim().default("").describe("The root directory of the workspace"),
|
|
66410
66410
|
packageDirectory: z3.string().trim().optional().describe("The root directory of the package"),
|
|
66411
66411
|
externalPackagePatterns: z3.array(z3.string()).default([]).describe(
|
|
@@ -66527,19 +66527,17 @@ var init_get_default_config = __esm({
|
|
|
66527
66527
|
}
|
|
66528
66528
|
};
|
|
66529
66529
|
DEFAULT_STORM_CONFIG = {
|
|
66530
|
-
name: "storm",
|
|
66531
66530
|
namespace: "storm-software",
|
|
66532
|
-
license: "Apache
|
|
66531
|
+
license: "Apache-2.0",
|
|
66533
66532
|
homepage: "https://stormsoftware.com",
|
|
66534
|
-
owner: "@storm-software/
|
|
66533
|
+
owner: "@storm-software/admin",
|
|
66535
66534
|
worker: "stormie-bot",
|
|
66536
66535
|
runtimeDirectory: "node_modules/.storm",
|
|
66537
|
-
cacheDirectory: "node_modules/.cache/storm",
|
|
66538
66536
|
skipCache: false,
|
|
66539
|
-
packageManager: "
|
|
66537
|
+
packageManager: "pnpm",
|
|
66540
66538
|
timezone: "America/New_York",
|
|
66541
66539
|
locale: "en-US",
|
|
66542
|
-
|
|
66540
|
+
envName: "production",
|
|
66543
66541
|
branch: "main",
|
|
66544
66542
|
organization: "storm-software",
|
|
66545
66543
|
configFile: null,
|
|
@@ -67039,7 +67037,7 @@ var init_get_env = __esm({
|
|
|
67039
67037
|
cacheDirectory: correctPaths(process.env[`${prefix}CACHE_DIRECTORY`]),
|
|
67040
67038
|
runtimeVersion: process.env[`${prefix}RUNTIME_VERSION`],
|
|
67041
67039
|
outputDirectory: correctPaths(process.env[`${prefix}OUTPUT_DIRECTORY`]),
|
|
67042
|
-
|
|
67040
|
+
envName: process.env[`${prefix}ENV_NAME`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT,
|
|
67043
67041
|
// ci:
|
|
67044
67042
|
// process.env[`${prefix}CI`] !== undefined
|
|
67045
67043
|
// ? Boolean(
|
|
@@ -67268,10 +67266,10 @@ var init_set_env = __esm({
|
|
|
67268
67266
|
config.outputDirectory
|
|
67269
67267
|
);
|
|
67270
67268
|
}
|
|
67271
|
-
if (config.
|
|
67272
|
-
process.env[`${prefix}
|
|
67273
|
-
process.env.NODE_ENV = config.
|
|
67274
|
-
process.env.ENVIRONMENT = config.
|
|
67269
|
+
if (config.envName) {
|
|
67270
|
+
process.env[`${prefix}ENV_NAME`] = config.envName;
|
|
67271
|
+
process.env.NODE_ENV = config.envName;
|
|
67272
|
+
process.env.ENVIRONMENT = config.envName;
|
|
67275
67273
|
}
|
|
67276
67274
|
if (config.colors?.base?.light || config.colors?.base?.dark) {
|
|
67277
67275
|
for (const key of Object.keys(config.colors)) {
|
|
@@ -67720,12 +67718,69 @@ var import_js = require("@nx/js");
|
|
|
67720
67718
|
var import_init = __toESM(require("@nx/js/src/generators/init/init"));
|
|
67721
67719
|
var import_generator = __toESM(require("@nx/js/src/generators/setup-verdaccio/generator"));
|
|
67722
67720
|
|
|
67721
|
+
// packages/workspace-tools/src/utils/project-tags.ts
|
|
67722
|
+
var ProjectTagConstants = {
|
|
67723
|
+
Language: {
|
|
67724
|
+
TAG_ID: "language",
|
|
67725
|
+
TYPESCRIPT: "typescript",
|
|
67726
|
+
RUST: "rust"
|
|
67727
|
+
},
|
|
67728
|
+
ProjectType: {
|
|
67729
|
+
TAG_ID: "type",
|
|
67730
|
+
LIBRARY: "library",
|
|
67731
|
+
APPLICATION: "application"
|
|
67732
|
+
},
|
|
67733
|
+
DistStyle: {
|
|
67734
|
+
TAG_ID: "dist-style",
|
|
67735
|
+
NORMAL: "normal",
|
|
67736
|
+
CLEAN: "clean"
|
|
67737
|
+
},
|
|
67738
|
+
Provider: {
|
|
67739
|
+
TAG_ID: "provider"
|
|
67740
|
+
},
|
|
67741
|
+
Platform: {
|
|
67742
|
+
TAG_ID: "platform",
|
|
67743
|
+
NODE: "node",
|
|
67744
|
+
BROWSER: "browser",
|
|
67745
|
+
NEUTRAL: "neutral",
|
|
67746
|
+
WORKER: "worker"
|
|
67747
|
+
},
|
|
67748
|
+
Registry: {
|
|
67749
|
+
TAG_ID: "registry",
|
|
67750
|
+
CARGO: "cargo",
|
|
67751
|
+
NPM: "npm",
|
|
67752
|
+
CONTAINER: "container",
|
|
67753
|
+
CYCLONE: "cyclone"
|
|
67754
|
+
}
|
|
67755
|
+
};
|
|
67756
|
+
var formatProjectTag = (variant, value2) => {
|
|
67757
|
+
return `${variant}:${value2}`;
|
|
67758
|
+
};
|
|
67759
|
+
var hasProjectTag = (project, variant) => {
|
|
67760
|
+
project.tags = project.tags ?? [];
|
|
67761
|
+
const prefix = formatProjectTag(variant, "");
|
|
67762
|
+
return project.tags.some(
|
|
67763
|
+
(tag) => tag.startsWith(prefix) && tag.length > prefix.length
|
|
67764
|
+
);
|
|
67765
|
+
};
|
|
67766
|
+
var addProjectTag = (project, variant, value2, options = {
|
|
67767
|
+
overwrite: false
|
|
67768
|
+
}) => {
|
|
67769
|
+
project.tags = project.tags ?? [];
|
|
67770
|
+
if (options.overwrite || !hasProjectTag(project, variant)) {
|
|
67771
|
+
project.tags = project.tags.filter(
|
|
67772
|
+
(tag) => !tag.startsWith(formatProjectTag(variant, ""))
|
|
67773
|
+
);
|
|
67774
|
+
project.tags.push(formatProjectTag(variant, value2));
|
|
67775
|
+
}
|
|
67776
|
+
};
|
|
67777
|
+
|
|
67723
67778
|
// packages/workspace-tools/src/utils/versions.ts
|
|
67724
67779
|
var typesNodeVersion = "20.9.0";
|
|
67725
67780
|
var nxVersion = "^18.0.4";
|
|
67726
67781
|
|
|
67727
67782
|
// packages/workspace-tools/src/base/typescript-library-generator.ts
|
|
67728
|
-
async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
67783
|
+
async function typeScriptLibraryGeneratorFn(tree, schema, config) {
|
|
67729
67784
|
const options = await normalizeOptions(tree, { ...schema });
|
|
67730
67785
|
const tasks = [];
|
|
67731
67786
|
tasks.push(
|
|
@@ -67762,6 +67817,7 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
67762
67817
|
tsConfig: (0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json"),
|
|
67763
67818
|
project: (0, import_devkit.joinPathFragments)(options.projectRoot, "package.json"),
|
|
67764
67819
|
defaultConfiguration: "production",
|
|
67820
|
+
platform: "neutral",
|
|
67765
67821
|
assets: [
|
|
67766
67822
|
{
|
|
67767
67823
|
input: options.projectRoot,
|
|
@@ -67785,21 +67841,25 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
67785
67841
|
verbose: true
|
|
67786
67842
|
}
|
|
67787
67843
|
}
|
|
67788
|
-
}
|
|
67789
|
-
lint: {},
|
|
67790
|
-
test: {}
|
|
67844
|
+
}
|
|
67791
67845
|
}
|
|
67792
67846
|
};
|
|
67793
|
-
if (schema.platform
|
|
67847
|
+
if (schema.platform) {
|
|
67794
67848
|
projectConfig.targets.build.options.platform = schema.platform;
|
|
67795
67849
|
}
|
|
67850
|
+
addProjectTag(
|
|
67851
|
+
projectConfig,
|
|
67852
|
+
ProjectTagConstants.Platform.TAG_ID,
|
|
67853
|
+
projectConfig.targets.build.options.platform === "node" ? ProjectTagConstants.Platform.NODE : projectConfig.targets.build.options.platform === "worker" ? ProjectTagConstants.Platform.WORKER : projectConfig.targets.build.options.platform === "browser" ? ProjectTagConstants.Platform.BROWSER : ProjectTagConstants.Platform.NEUTRAL,
|
|
67854
|
+
{ overwrite: false }
|
|
67855
|
+
);
|
|
67796
67856
|
createProjectTsConfigJson(tree, options);
|
|
67797
67857
|
(0, import_devkit.addProjectConfiguration)(tree, options.name, projectConfig);
|
|
67798
67858
|
let repository = {
|
|
67799
67859
|
type: "github",
|
|
67800
|
-
url:
|
|
67860
|
+
url: config?.repository || `https://github.com/${config?.organization || "storm-software"}/${config?.namespace || config?.name || "repository"}.git`
|
|
67801
67861
|
};
|
|
67802
|
-
let description = schema.description
|
|
67862
|
+
let description = schema.description || "A package developed by Storm Software used to create modern, scalable web applications.";
|
|
67803
67863
|
if (tree.exists("package.json")) {
|
|
67804
67864
|
const packageJson = (0, import_devkit.readJson)(tree, "package.json");
|
|
67805
67865
|
if (packageJson?.repository) {
|
|
@@ -68006,7 +68066,7 @@ async function normalizeOptions(tree, options) {
|
|
|
68006
68066
|
}
|
|
68007
68067
|
|
|
68008
68068
|
// packages/workspace-tools/src/generators/node-library/generator.ts
|
|
68009
|
-
async function nodeLibraryGeneratorFn(tree, schema) {
|
|
68069
|
+
async function nodeLibraryGeneratorFn(tree, schema, config) {
|
|
68010
68070
|
const filesDir = (0, import_devkit2.joinPathFragments)(__dirname, "./files");
|
|
68011
68071
|
const tsLibraryGeneratorOptions = {
|
|
68012
68072
|
...schema,
|
|
@@ -68036,7 +68096,7 @@ async function nodeLibraryGeneratorFn(tree, schema) {
|
|
|
68036
68096
|
buildable: options.bundler && options.bundler !== "none",
|
|
68037
68097
|
hasUnitTestRunner: options.unitTestRunner !== "none"
|
|
68038
68098
|
});
|
|
68039
|
-
await typeScriptLibraryGeneratorFn(tree, tsLibraryGeneratorOptions);
|
|
68099
|
+
await typeScriptLibraryGeneratorFn(tree, tsLibraryGeneratorOptions, config);
|
|
68040
68100
|
await (0, import_devkit2.formatFiles)(tree);
|
|
68041
68101
|
return null;
|
|
68042
68102
|
}
|