@storm-software/workspace-tools 1.21.18 → 1.22.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 +17 -0
- package/generators.json +6 -1
- package/index.js +156 -128
- package/meta.json +1 -1
- package/package.json +1 -1
- package/src/base/index.js +2 -2
- package/src/executors/tsup/executor.js +2 -2
- package/src/executors/tsup/schema.d.ts +6 -6
- package/src/executors/tsup-neutral/executor.js +2 -2
- package/src/executors/tsup-node/executor.js +2 -2
- package/src/generators/config-schema/generator.js +2 -2
- package/src/generators/neutral-library/files/README.md +58 -0
- package/src/generators/neutral-library/files/jest.config.ts +3 -0
- package/src/generators/neutral-library/files/src/index.ts.template +10 -0
- package/src/generators/neutral-library/files/tsconfig.spec.json +13 -0
- package/src/generators/neutral-library/schema.d.ts +6 -0
- package/src/generators/neutral-library/schema.json +82 -0
- package/src/generators/node-library/files/README.md +3 -3
- package/src/generators/node-library/generator.js +23197 -23167
- package/src/generators/node-library/schema.json +1 -1
- package/src/generators/preset/files/.env.template +2 -2
- package/src/generators/preset/files/.github/workflows/build-release.yml.template +6 -6
- package/src/generators/preset/generator.js +2 -2
- package/src/utils/index.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## [1.21.19](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.21.18...workspace-tools-v1.21.19) (2023-12-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **git-tools:** Resolved issue in `semantic-release` patch with module directory ([a04aa3a](https://github.com/storm-software/storm-ops/commit/a04aa3add212abc781392d1227122a790b2f004e))
|
|
7
|
+
* **git-tools:** Resolved issue with patched semantic-release bundled path ([93b4e43](https://github.com/storm-software/storm-ops/commit/93b4e439bf19a888db1b35554b32b9aec3cc3acd))
|
|
8
|
+
* **git-tools:** Update the env used by packages to match new config updates ([d3b7dac](https://github.com/storm-software/storm-ops/commit/d3b7dac057a04aff9e0170d89cedc4cb47c584e5))
|
|
9
|
+
* **git-tools:** Updated `semantic-release` patch to properly check for plugins ([4e3db96](https://github.com/storm-software/storm-ops/commit/4e3db96814e8abb5cb22d9bfb5c747f042c43157))
|
|
10
|
+
|
|
11
|
+
## [1.21.18](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.21.17...workspace-tools-v1.21.18) (2023-12-05)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **config-tools:** Update generic type used in `createStormConfig` function ([fe72f6d](https://github.com/storm-software/storm-ops/commit/fe72f6d52ca0ea02e15f07679ba5f0e824a228be))
|
|
17
|
+
|
|
1
18
|
## [1.21.17](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.21.16...workspace-tools-v1.21.17) (2023-12-05)
|
|
2
19
|
|
|
3
20
|
|
package/generators.json
CHANGED
|
@@ -18,12 +18,17 @@
|
|
|
18
18
|
"schema": "./src/generators/node-library/schema.json",
|
|
19
19
|
"aliases": ["node-lib"],
|
|
20
20
|
"x-type": "library",
|
|
21
|
-
"description": "
|
|
21
|
+
"description": "Create a new NodeJs TypeScript library package in the Storm workspace"
|
|
22
22
|
},
|
|
23
23
|
"config-schema": {
|
|
24
24
|
"factory": "./src/generators/config-schema/generator",
|
|
25
25
|
"schema": "./src/generators/config-schema/schema.json",
|
|
26
26
|
"description": "Create a Storm JSON schema based on the workspaces project configurations"
|
|
27
|
+
},
|
|
28
|
+
"neutral-library": {
|
|
29
|
+
"factory": "./src/generators/neutral-library/generator",
|
|
30
|
+
"schema": "./src/generators/neutral-library/schema.json",
|
|
31
|
+
"description": "Create a new Neutral TypeScript library package in the Storm workspace"
|
|
27
32
|
}
|
|
28
33
|
}
|
|
29
34
|
}
|
package/index.js
CHANGED
|
@@ -8862,7 +8862,7 @@ var require_format_files = __commonJS({
|
|
|
8862
8862
|
var nx_1 = require_nx();
|
|
8863
8863
|
var { updateJson: updateJson3, readJson: readJson2, sortObjectByKeys } = (0, nx_1.requireNx)();
|
|
8864
8864
|
sortObjectByKeys = sortObjectByKeys ?? require("nx/src/utils/object-sort").sortObjectByKeys;
|
|
8865
|
-
async function
|
|
8865
|
+
async function formatFiles6(tree) {
|
|
8866
8866
|
let prettier;
|
|
8867
8867
|
try {
|
|
8868
8868
|
prettier = await Promise.resolve().then(() => require("prettier"));
|
|
@@ -8901,7 +8901,7 @@ var require_format_files = __commonJS({
|
|
|
8901
8901
|
}
|
|
8902
8902
|
}));
|
|
8903
8903
|
}
|
|
8904
|
-
exports.formatFiles =
|
|
8904
|
+
exports.formatFiles = formatFiles6;
|
|
8905
8905
|
function sortTsConfig(tree) {
|
|
8906
8906
|
try {
|
|
8907
8907
|
const tsConfigPath = getRootTsConfigPath(tree);
|
|
@@ -12458,12 +12458,12 @@ var require_install_packages_task = __commonJS({
|
|
|
12458
12458
|
var child_process_1 = require("child_process");
|
|
12459
12459
|
var path_1 = require("path");
|
|
12460
12460
|
var nx_1 = require_nx();
|
|
12461
|
-
var { detectPackageManager, getPackageManagerCommand, joinPathFragments:
|
|
12461
|
+
var { detectPackageManager, getPackageManagerCommand, joinPathFragments: joinPathFragments5 } = (0, nx_1.requireNx)();
|
|
12462
12462
|
function installPackagesTask(tree, alwaysRun = false, cwd = "", packageManager = detectPackageManager(cwd)) {
|
|
12463
|
-
if (!tree.listChanges().find((f) => f.path ===
|
|
12463
|
+
if (!tree.listChanges().find((f) => f.path === joinPathFragments5(cwd, "package.json")) && !alwaysRun) {
|
|
12464
12464
|
return;
|
|
12465
12465
|
}
|
|
12466
|
-
const packageJsonValue = tree.read(
|
|
12466
|
+
const packageJsonValue = tree.read(joinPathFragments5(cwd, "package.json"), "utf-8");
|
|
12467
12467
|
let storedPackageJsonValue = global["__packageJsonInstallCache__"];
|
|
12468
12468
|
if (storedPackageJsonValue != packageJsonValue || alwaysRun) {
|
|
12469
12469
|
global["__packageJsonInstallCache__"] = packageJsonValue;
|
|
@@ -15658,7 +15658,7 @@ var require_package_json = __commonJS({
|
|
|
15658
15658
|
return needsDepsUpdate || needsDevDepsUpdate;
|
|
15659
15659
|
}
|
|
15660
15660
|
var packageMapCache = /* @__PURE__ */ new Map();
|
|
15661
|
-
function
|
|
15661
|
+
function ensurePackage2(pkgOrTree, requiredVersionOrPackage, maybeRequiredVersion, _) {
|
|
15662
15662
|
let pkg;
|
|
15663
15663
|
let requiredVersion;
|
|
15664
15664
|
if (typeof pkgOrTree === "string") {
|
|
@@ -15722,7 +15722,7 @@ var require_package_json = __commonJS({
|
|
|
15722
15722
|
throw e;
|
|
15723
15723
|
}
|
|
15724
15724
|
}
|
|
15725
|
-
exports.ensurePackage =
|
|
15725
|
+
exports.ensurePackage = ensurePackage2;
|
|
15726
15726
|
function generatePackageManagerFiles(root, packageManager = detectPackageManager()) {
|
|
15727
15727
|
const [pmMajor] = getPackageManagerVersion(packageManager).split(".");
|
|
15728
15728
|
switch (packageManager) {
|
|
@@ -16496,7 +16496,7 @@ var require_offset_from_root = __commonJS({
|
|
|
16496
16496
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16497
16497
|
exports.offsetFromRoot = void 0;
|
|
16498
16498
|
var path_1 = require("path");
|
|
16499
|
-
function
|
|
16499
|
+
function offsetFromRoot3(fullPathToDir) {
|
|
16500
16500
|
if (fullPathToDir === ".")
|
|
16501
16501
|
return "./";
|
|
16502
16502
|
const parts = (0, path_1.normalize)(fullPathToDir).split(path_1.sep);
|
|
@@ -16508,7 +16508,7 @@ var require_offset_from_root = __commonJS({
|
|
|
16508
16508
|
}
|
|
16509
16509
|
return offset;
|
|
16510
16510
|
}
|
|
16511
|
-
exports.offsetFromRoot =
|
|
16511
|
+
exports.offsetFromRoot = offsetFromRoot3;
|
|
16512
16512
|
}
|
|
16513
16513
|
});
|
|
16514
16514
|
|
|
@@ -41606,7 +41606,7 @@ var require_project_name_and_root_utils = __commonJS({
|
|
|
41606
41606
|
var nx_1 = require_nx();
|
|
41607
41607
|
var get_workspace_layout_1 = require_get_workspace_layout();
|
|
41608
41608
|
var names_1 = require_names();
|
|
41609
|
-
var { joinPathFragments:
|
|
41609
|
+
var { joinPathFragments: joinPathFragments5, normalizePath, logger, readJson: readJson2, stripIndents, workspaceRoot } = (0, nx_1.requireNx)();
|
|
41610
41610
|
var deprecationWarning = stripIndents`
|
|
41611
41611
|
In Nx 18, generating projects will no longer derive the name and root.
|
|
41612
41612
|
Please provide the exact project name and root in the future.`;
|
|
@@ -41682,14 +41682,14 @@ var require_project_name_and_root_utils = __commonJS({
|
|
|
41682
41682
|
if (directory === relativeCwd || directory.startsWith(`${relativeCwd}/`)) {
|
|
41683
41683
|
asProvidedProjectDirectory = directory;
|
|
41684
41684
|
} else {
|
|
41685
|
-
asProvidedProjectDirectory =
|
|
41685
|
+
asProvidedProjectDirectory = joinPathFragments5(relativeCwd, directory);
|
|
41686
41686
|
}
|
|
41687
41687
|
} else if (options.rootProject) {
|
|
41688
41688
|
asProvidedProjectDirectory = ".";
|
|
41689
41689
|
} else {
|
|
41690
41690
|
asProvidedProjectDirectory = relativeCwd;
|
|
41691
41691
|
if (!relativeCwd.endsWith(asProvidedProjectName) && !relativeCwd.endsWith(options.name)) {
|
|
41692
|
-
asProvidedProjectDirectory =
|
|
41692
|
+
asProvidedProjectDirectory = joinPathFragments5(relativeCwd, asProvidedProjectName);
|
|
41693
41693
|
}
|
|
41694
41694
|
}
|
|
41695
41695
|
if (asProvidedProjectName.startsWith("@")) {
|
|
@@ -41722,7 +41722,7 @@ var require_project_name_and_root_utils = __commonJS({
|
|
|
41722
41722
|
const derivedSimpleProjectName = name;
|
|
41723
41723
|
let derivedProjectDirectory = derivedProjectDirectoryWithoutLayout;
|
|
41724
41724
|
if (derivedProjectDirectoryWithoutLayout !== ".") {
|
|
41725
|
-
derivedProjectDirectory =
|
|
41725
|
+
derivedProjectDirectory = joinPathFragments5(layoutDirectory, derivedProjectDirectory);
|
|
41726
41726
|
}
|
|
41727
41727
|
let derivedImportPath;
|
|
41728
41728
|
if (options.projectType === "library") {
|
|
@@ -108756,7 +108756,7 @@ var getDefaultConfig = (config = {}) => {
|
|
|
108756
108756
|
};
|
|
108757
108757
|
var getWorkspaceRoot = () => {
|
|
108758
108758
|
const root = (0, import_find_workspace_root.findWorkspaceRoot)(process.cwd());
|
|
108759
|
-
process.env.
|
|
108759
|
+
process.env.STORM_WORKSPACE_ROOT ??= root?.dir;
|
|
108760
108760
|
process.env.NX_WORKSPACE_ROOT_PATH ??= root?.dir;
|
|
108761
108761
|
return root?.dir;
|
|
108762
108762
|
};
|
|
@@ -108947,7 +108947,7 @@ var chalk = __toESM(require_source());
|
|
|
108947
108947
|
var import_find_workspace_root2 = require("nx/src/utils/find-workspace-root.js");
|
|
108948
108948
|
var getWorkspaceRoot2 = () => {
|
|
108949
108949
|
const root = (0, import_find_workspace_root2.findWorkspaceRoot)(process.cwd());
|
|
108950
|
-
process.env.
|
|
108950
|
+
process.env.STORM_WORKSPACE_ROOT ??= root?.dir;
|
|
108951
108951
|
process.env.NX_WORKSPACE_ROOT_PATH ??= root?.dir;
|
|
108952
108952
|
return root?.dir;
|
|
108953
108953
|
};
|
|
@@ -117387,70 +117387,14 @@ async function stormInitGenerator(tree, schema) {
|
|
|
117387
117387
|
|
|
117388
117388
|
// packages/workspace-tools/src/generators/node-library/generator.ts
|
|
117389
117389
|
var import_devkit5 = __toESM(require_devkit());
|
|
117390
|
-
var import_js2 = __toESM(require_src2());
|
|
117391
|
-
var import_init = __toESM(require_init());
|
|
117392
|
-
var import_generator = __toESM(require_generator());
|
|
117393
117390
|
|
|
117394
|
-
// packages/workspace-tools/src/
|
|
117391
|
+
// packages/workspace-tools/src/base/typescript-library-generator.ts
|
|
117395
117392
|
var import_devkit4 = __toESM(require_devkit());
|
|
117396
117393
|
var import_project_name_and_root_utils = __toESM(require_project_name_and_root_utils());
|
|
117397
|
-
|
|
117398
|
-
|
|
117399
|
-
|
|
117400
|
-
|
|
117401
|
-
`For publishable libs you have to provide a proper "--importPath" which needs to be a valid npm package name (e.g. my-awesome-lib or @myorg/my-lib)`
|
|
117402
|
-
);
|
|
117403
|
-
}
|
|
117404
|
-
}
|
|
117405
|
-
let bundler = "tsc";
|
|
117406
|
-
if (options.publishable === false && options.buildable === false) {
|
|
117407
|
-
bundler = "none";
|
|
117408
|
-
}
|
|
117409
|
-
const { Linter } = (0, import_devkit4.ensurePackage)("@nx/eslint", nxVersion);
|
|
117410
|
-
const {
|
|
117411
|
-
projectName,
|
|
117412
|
-
names: projectNames,
|
|
117413
|
-
projectRoot,
|
|
117414
|
-
importPath
|
|
117415
|
-
} = await (0, import_project_name_and_root_utils.determineProjectNameAndRootOptions)(tree, {
|
|
117416
|
-
name: options.name,
|
|
117417
|
-
projectType: "library",
|
|
117418
|
-
directory: options.directory,
|
|
117419
|
-
importPath: options.importPath,
|
|
117420
|
-
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
117421
|
-
rootProject: options.rootProject,
|
|
117422
|
-
callingGenerator: "@nx/js:library"
|
|
117423
|
-
});
|
|
117424
|
-
options.rootProject = projectRoot === ".";
|
|
117425
|
-
const normalized = (0, import_devkit4.names)(projectNames.projectFileName);
|
|
117426
|
-
const fileName = normalized.fileName;
|
|
117427
|
-
return {
|
|
117428
|
-
js: false,
|
|
117429
|
-
pascalCaseFiles: false,
|
|
117430
|
-
skipFormat: false,
|
|
117431
|
-
skipTsConfig: false,
|
|
117432
|
-
includeBabelRc: false,
|
|
117433
|
-
unitTestRunner: "jest",
|
|
117434
|
-
linter: Linter.EsLint,
|
|
117435
|
-
testEnvironment: "node",
|
|
117436
|
-
config: "project",
|
|
117437
|
-
compiler: "tsc",
|
|
117438
|
-
bundler,
|
|
117439
|
-
skipTypeCheck: false,
|
|
117440
|
-
minimal: false,
|
|
117441
|
-
...options,
|
|
117442
|
-
fileName,
|
|
117443
|
-
name: projectName,
|
|
117444
|
-
projectNames,
|
|
117445
|
-
projectRoot,
|
|
117446
|
-
parsedTags: options.tags ? options.tags.split(",").map((s) => s.trim()) : [],
|
|
117447
|
-
importPath
|
|
117448
|
-
};
|
|
117449
|
-
}
|
|
117450
|
-
|
|
117451
|
-
// packages/workspace-tools/src/generators/node-library/generator.ts
|
|
117452
|
-
async function nodeLibraryGeneratorFn(tree, schema) {
|
|
117453
|
-
const filesDir = (0, import_devkit5.joinPathFragments)(__dirname, "./files");
|
|
117394
|
+
var import_js2 = __toESM(require_src2());
|
|
117395
|
+
var import_init = __toESM(require_init());
|
|
117396
|
+
var import_generator = __toESM(require_generator());
|
|
117397
|
+
async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
117454
117398
|
const options = await normalizeOptions2(tree, { ...schema });
|
|
117455
117399
|
const tasks = [];
|
|
117456
117400
|
tasks.push(
|
|
@@ -117460,37 +117404,45 @@ async function nodeLibraryGeneratorFn(tree, schema) {
|
|
|
117460
117404
|
})
|
|
117461
117405
|
);
|
|
117462
117406
|
tasks.push(
|
|
117463
|
-
(0,
|
|
117407
|
+
(0, import_devkit4.addDependenciesToPackageJson)(
|
|
117464
117408
|
tree,
|
|
117465
117409
|
{},
|
|
117466
117410
|
{
|
|
117467
117411
|
"@storm-software/workspace-tools": "latest",
|
|
117468
117412
|
"@storm-software/testing-tools": "latest",
|
|
117469
|
-
|
|
117413
|
+
...schema.devDependencies ?? {}
|
|
117470
117414
|
}
|
|
117471
117415
|
)
|
|
117472
117416
|
);
|
|
117473
117417
|
if (options.publishable) {
|
|
117474
117418
|
tasks.push(await (0, import_generator.default)(tree, { ...options, skipFormat: true }));
|
|
117475
117419
|
}
|
|
117476
|
-
const
|
|
117477
|
-
options.projectNames.projectFileName
|
|
117478
|
-
);
|
|
117479
|
-
createProjectTsConfigJson(tree, options);
|
|
117480
|
-
(0, import_devkit5.addProjectConfiguration)(tree, options.name, {
|
|
117420
|
+
const projectConfig = {
|
|
117481
117421
|
root: options.directory,
|
|
117482
117422
|
projectType: "library",
|
|
117483
|
-
sourceRoot: (0,
|
|
117423
|
+
sourceRoot: (0, import_devkit4.joinPathFragments)(options.directory, "src"),
|
|
117484
117424
|
targets: {
|
|
117485
117425
|
build: {
|
|
117486
|
-
executor:
|
|
117426
|
+
executor: schema.buildExecutor,
|
|
117487
117427
|
outputs: ["{options.outputPath}"],
|
|
117488
117428
|
options: {
|
|
117429
|
+
entry: (0, import_devkit4.joinPathFragments)(options.projectRoot, "src", "index.ts"),
|
|
117489
117430
|
outputPath: getOutputPath(options),
|
|
117490
|
-
tsConfig: (0,
|
|
117491
|
-
project: (0,
|
|
117431
|
+
tsConfig: (0, import_devkit4.joinPathFragments)(options.projectRoot, "tsconfig.json"),
|
|
117432
|
+
project: (0, import_devkit4.joinPathFragments)(options.projectRoot, "package.json"),
|
|
117492
117433
|
defaultConfiguration: "production",
|
|
117493
|
-
|
|
117434
|
+
assets: [
|
|
117435
|
+
{
|
|
117436
|
+
"input": options.projectRoot,
|
|
117437
|
+
"glob": "*.md",
|
|
117438
|
+
"output": "/"
|
|
117439
|
+
},
|
|
117440
|
+
{
|
|
117441
|
+
"input": "",
|
|
117442
|
+
"glob": "LICENSE",
|
|
117443
|
+
"output": "/"
|
|
117444
|
+
}
|
|
117445
|
+
]
|
|
117494
117446
|
},
|
|
117495
117447
|
configurations: {
|
|
117496
117448
|
production: {
|
|
@@ -117506,39 +117458,26 @@ async function nodeLibraryGeneratorFn(tree, schema) {
|
|
|
117506
117458
|
lint: {},
|
|
117507
117459
|
test: {}
|
|
117508
117460
|
}
|
|
117509
|
-
}
|
|
117510
|
-
|
|
117511
|
-
|
|
117512
|
-
|
|
117513
|
-
className,
|
|
117514
|
-
name,
|
|
117515
|
-
namespace: process.env.STORM_NAMESPACE ?? "storm-software",
|
|
117516
|
-
description: schema.description ?? "",
|
|
117517
|
-
propertyName,
|
|
117518
|
-
js: !!options.js,
|
|
117519
|
-
cliCommand: "nx",
|
|
117520
|
-
strict: void 0,
|
|
117521
|
-
tmpl: "",
|
|
117522
|
-
offsetFromRoot: (0, import_devkit5.offsetFromRoot)(options.projectRoot),
|
|
117523
|
-
buildable: options.bundler && options.bundler !== "none",
|
|
117524
|
-
hasUnitTestRunner: options.unitTestRunner !== "none"
|
|
117525
|
-
});
|
|
117461
|
+
};
|
|
117462
|
+
schema.platform && (projectConfig.targets.build.options.platform = schema.platform);
|
|
117463
|
+
createProjectTsConfigJson(tree, options);
|
|
117464
|
+
(0, import_devkit4.addProjectConfiguration)(tree, options.name, projectConfig);
|
|
117526
117465
|
let repository = {
|
|
117527
117466
|
type: "github",
|
|
117528
117467
|
url: "https://github.com/storm-software/storm-stack.git"
|
|
117529
117468
|
};
|
|
117530
117469
|
let description = schema.description ?? "\u26A1 A Storm package used to create modern, scalable web applications.";
|
|
117531
117470
|
if (tree.exists("package.json")) {
|
|
117532
|
-
const packageJson = (0,
|
|
117471
|
+
const packageJson = (0, import_devkit4.readJson)(tree, "package.json");
|
|
117533
117472
|
packageJson?.repository && (repository = packageJson.repository);
|
|
117534
117473
|
packageJson?.description && (description = packageJson.description);
|
|
117535
117474
|
}
|
|
117536
|
-
const packageJsonPath = (0,
|
|
117475
|
+
const packageJsonPath = (0, import_devkit4.joinPathFragments)(
|
|
117537
117476
|
options.projectRoot,
|
|
117538
117477
|
"package.json"
|
|
117539
117478
|
);
|
|
117540
117479
|
if (tree.exists(packageJsonPath)) {
|
|
117541
|
-
(0,
|
|
117480
|
+
(0, import_devkit4.updateJson)(tree, packageJsonPath, (json) => {
|
|
117542
117481
|
json.name = options.importPath;
|
|
117543
117482
|
json.version = "0.0.1";
|
|
117544
117483
|
if (json.private && (options.publishable || options.rootProject)) {
|
|
@@ -117562,7 +117501,7 @@ async function nodeLibraryGeneratorFn(tree, schema) {
|
|
|
117562
117501
|
};
|
|
117563
117502
|
});
|
|
117564
117503
|
} else {
|
|
117565
|
-
(0,
|
|
117504
|
+
(0, import_devkit4.writeJson)(tree, packageJsonPath, {
|
|
117566
117505
|
name: options.importPath,
|
|
117567
117506
|
version: "0.0.1",
|
|
117568
117507
|
description,
|
|
@@ -117578,7 +117517,7 @@ async function nodeLibraryGeneratorFn(tree, schema) {
|
|
|
117578
117517
|
});
|
|
117579
117518
|
}
|
|
117580
117519
|
if (tree.exists("package.json")) {
|
|
117581
|
-
(0,
|
|
117520
|
+
(0, import_devkit4.updateJson)(tree, "package.json", (json) => ({
|
|
117582
117521
|
...json,
|
|
117583
117522
|
pnpm: {
|
|
117584
117523
|
...json?.pnpm,
|
|
@@ -117590,32 +117529,32 @@ async function nodeLibraryGeneratorFn(tree, schema) {
|
|
|
117590
117529
|
}));
|
|
117591
117530
|
}
|
|
117592
117531
|
(0, import_js2.addTsConfigPath)(tree, options.importPath, [
|
|
117593
|
-
(0,
|
|
117532
|
+
(0, import_devkit4.joinPathFragments)(
|
|
117594
117533
|
options.projectRoot,
|
|
117595
117534
|
"./src",
|
|
117596
117535
|
"index." + (options.js ? "js" : "ts")
|
|
117597
117536
|
)
|
|
117598
117537
|
]);
|
|
117599
|
-
(0, import_js2.addTsConfigPath)(tree, (0,
|
|
117600
|
-
(0,
|
|
117538
|
+
(0, import_js2.addTsConfigPath)(tree, (0, import_devkit4.joinPathFragments)(options.importPath, "/*"), [
|
|
117539
|
+
(0, import_devkit4.joinPathFragments)(options.projectRoot, "./src", "/*")
|
|
117601
117540
|
]);
|
|
117602
117541
|
if (tree.exists("package.json")) {
|
|
117603
|
-
const packageJson = (0,
|
|
117542
|
+
const packageJson = (0, import_devkit4.readJson)(tree, "package.json");
|
|
117604
117543
|
packageJson?.repository && (repository = packageJson.repository);
|
|
117605
117544
|
packageJson?.description && (description = packageJson.description);
|
|
117606
117545
|
}
|
|
117607
|
-
const tsconfigPath = (0,
|
|
117546
|
+
const tsconfigPath = (0, import_devkit4.joinPathFragments)(options.projectRoot, "tsconfig.json");
|
|
117608
117547
|
if (tree.exists(tsconfigPath)) {
|
|
117609
|
-
(0,
|
|
117548
|
+
(0, import_devkit4.updateJson)(tree, tsconfigPath, (json) => {
|
|
117610
117549
|
json.composite ??= true;
|
|
117611
117550
|
return json;
|
|
117612
117551
|
});
|
|
117613
117552
|
} else {
|
|
117614
|
-
(0,
|
|
117615
|
-
extends: `${(0,
|
|
117553
|
+
(0, import_devkit4.writeJson)(tree, tsconfigPath, {
|
|
117554
|
+
extends: `${(0, import_devkit4.offsetFromRoot)(options.projectRoot)}tsconfig.base.json`,
|
|
117616
117555
|
composite: true,
|
|
117617
117556
|
compilerOptions: {
|
|
117618
|
-
outDir: `${(0,
|
|
117557
|
+
outDir: `${(0, import_devkit4.offsetFromRoot)(options.projectRoot)}dist/out-tsc`
|
|
117619
117558
|
},
|
|
117620
117559
|
files: [],
|
|
117621
117560
|
include: ["src/**/*.ts", "src/**/*.js"],
|
|
@@ -117624,21 +117563,21 @@ async function nodeLibraryGeneratorFn(tree, schema) {
|
|
|
117624
117563
|
}
|
|
117625
117564
|
const lintCallback = await addLint(tree, options);
|
|
117626
117565
|
tasks.push(lintCallback);
|
|
117627
|
-
await (0,
|
|
117566
|
+
await (0, import_devkit4.formatFiles)(tree);
|
|
117628
117567
|
return null;
|
|
117629
117568
|
}
|
|
117630
117569
|
async function addLint(tree, options) {
|
|
117631
|
-
const { lintProjectGenerator } = (0,
|
|
117570
|
+
const { lintProjectGenerator } = (0, import_devkit4.ensurePackage)("@nx/eslint", nxVersion);
|
|
117632
117571
|
const { mapLintPattern } = (
|
|
117633
117572
|
// nx-ignore-next-line
|
|
117634
117573
|
require_lint_project()
|
|
117635
117574
|
);
|
|
117636
|
-
const projectConfiguration = (0,
|
|
117575
|
+
const projectConfiguration = (0, import_devkit4.readProjectConfiguration)(tree, options.name);
|
|
117637
117576
|
const task = lintProjectGenerator(tree, {
|
|
117638
117577
|
project: options.name,
|
|
117639
117578
|
linter: options.linter,
|
|
117640
117579
|
skipFormat: true,
|
|
117641
|
-
tsConfigPaths: [(0,
|
|
117580
|
+
tsConfigPaths: [(0, import_devkit4.joinPathFragments)(options.projectRoot, "tsconfig.json")],
|
|
117642
117581
|
unitTestRunner: options.unitTestRunner,
|
|
117643
117582
|
eslintFilePatterns: [
|
|
117644
117583
|
mapLintPattern(
|
|
@@ -117709,15 +117648,15 @@ function getOutputPath(options) {
|
|
|
117709
117648
|
} else {
|
|
117710
117649
|
parts.push(options.projectRoot);
|
|
117711
117650
|
}
|
|
117712
|
-
return (0,
|
|
117651
|
+
return (0, import_devkit4.joinPathFragments)(...parts);
|
|
117713
117652
|
}
|
|
117714
117653
|
function createProjectTsConfigJson(tree, options) {
|
|
117715
117654
|
const tsconfig = {
|
|
117716
117655
|
extends: options.rootProject ? void 0 : (0, import_js2.getRelativePathToRootTsConfig)(tree, options.projectRoot),
|
|
117717
117656
|
compilerOptions: {
|
|
117718
117657
|
...options.rootProject ? import_js2.tsConfigBaseOptions : {},
|
|
117719
|
-
outDir: (0,
|
|
117720
|
-
(0,
|
|
117658
|
+
outDir: (0, import_devkit4.joinPathFragments)(
|
|
117659
|
+
(0, import_devkit4.offsetFromRoot)(options.projectRoot),
|
|
117721
117660
|
"dist/out-tsc"
|
|
117722
117661
|
),
|
|
117723
117662
|
noEmit: true
|
|
@@ -117726,12 +117665,101 @@ function createProjectTsConfigJson(tree, options) {
|
|
|
117726
117665
|
include: ["src/**/*.ts", "src/**/*.js", "bin/**/*"],
|
|
117727
117666
|
exclude: ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
|
|
117728
117667
|
};
|
|
117729
|
-
(0,
|
|
117668
|
+
(0, import_devkit4.writeJson)(
|
|
117730
117669
|
tree,
|
|
117731
|
-
(0,
|
|
117670
|
+
(0, import_devkit4.joinPathFragments)(options.projectRoot, "tsconfig.json"),
|
|
117732
117671
|
tsconfig
|
|
117733
117672
|
);
|
|
117734
117673
|
}
|
|
117674
|
+
async function normalizeOptions2(tree, options) {
|
|
117675
|
+
if (options.publishable) {
|
|
117676
|
+
if (!options.importPath) {
|
|
117677
|
+
throw new Error(
|
|
117678
|
+
`For publishable libs you have to provide a proper "--importPath" which needs to be a valid npm package name (e.g. my-awesome-lib or @myorg/my-lib)`
|
|
117679
|
+
);
|
|
117680
|
+
}
|
|
117681
|
+
}
|
|
117682
|
+
let bundler = "tsc";
|
|
117683
|
+
if (options.publishable === false && options.buildable === false) {
|
|
117684
|
+
bundler = "none";
|
|
117685
|
+
}
|
|
117686
|
+
const { Linter } = (0, import_devkit4.ensurePackage)("@nx/eslint", nxVersion);
|
|
117687
|
+
const {
|
|
117688
|
+
projectName,
|
|
117689
|
+
names: projectNames,
|
|
117690
|
+
projectRoot,
|
|
117691
|
+
importPath
|
|
117692
|
+
} = await (0, import_project_name_and_root_utils.determineProjectNameAndRootOptions)(tree, {
|
|
117693
|
+
name: options.name,
|
|
117694
|
+
projectType: "library",
|
|
117695
|
+
directory: options.directory,
|
|
117696
|
+
importPath: options.importPath,
|
|
117697
|
+
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
117698
|
+
rootProject: options.rootProject,
|
|
117699
|
+
callingGenerator: "@nx/js:library"
|
|
117700
|
+
});
|
|
117701
|
+
options.rootProject = projectRoot === ".";
|
|
117702
|
+
const normalized = (0, import_devkit4.names)(projectNames.projectFileName);
|
|
117703
|
+
const fileName = normalized.fileName;
|
|
117704
|
+
return {
|
|
117705
|
+
js: false,
|
|
117706
|
+
pascalCaseFiles: false,
|
|
117707
|
+
skipFormat: false,
|
|
117708
|
+
skipTsConfig: false,
|
|
117709
|
+
includeBabelRc: false,
|
|
117710
|
+
unitTestRunner: "jest",
|
|
117711
|
+
linter: Linter.EsLint,
|
|
117712
|
+
testEnvironment: "node",
|
|
117713
|
+
config: "project",
|
|
117714
|
+
compiler: "tsc",
|
|
117715
|
+
bundler,
|
|
117716
|
+
skipTypeCheck: false,
|
|
117717
|
+
minimal: false,
|
|
117718
|
+
...options,
|
|
117719
|
+
fileName,
|
|
117720
|
+
name: projectName,
|
|
117721
|
+
projectNames,
|
|
117722
|
+
projectRoot,
|
|
117723
|
+
parsedTags: options.tags ? options.tags.split(",").map((s) => s.trim()) : [],
|
|
117724
|
+
importPath
|
|
117725
|
+
};
|
|
117726
|
+
}
|
|
117727
|
+
|
|
117728
|
+
// packages/workspace-tools/src/generators/node-library/generator.ts
|
|
117729
|
+
async function nodeLibraryGeneratorFn(tree, schema) {
|
|
117730
|
+
const filesDir = (0, import_devkit5.joinPathFragments)(__dirname, "./files");
|
|
117731
|
+
const tsLibraryGeneratorOptions = {
|
|
117732
|
+
...schema,
|
|
117733
|
+
platform: "node",
|
|
117734
|
+
devDependencies: {
|
|
117735
|
+
"@types/node": typesNodeVersion
|
|
117736
|
+
},
|
|
117737
|
+
buildExecutor: "@storm-software/workspace-tools:tsup-node"
|
|
117738
|
+
};
|
|
117739
|
+
const options = await normalizeOptions2(tree, tsLibraryGeneratorOptions);
|
|
117740
|
+
const { className, name, propertyName } = (0, import_devkit5.names)(
|
|
117741
|
+
options.projectNames.projectFileName
|
|
117742
|
+
);
|
|
117743
|
+
(0, import_devkit5.generateFiles)(tree, filesDir, options.projectRoot, {
|
|
117744
|
+
...schema,
|
|
117745
|
+
dot: ".",
|
|
117746
|
+
className,
|
|
117747
|
+
name,
|
|
117748
|
+
namespace: process.env.STORM_NAMESPACE ?? "storm-software",
|
|
117749
|
+
description: schema.description ?? "",
|
|
117750
|
+
propertyName,
|
|
117751
|
+
js: !!options.js,
|
|
117752
|
+
cliCommand: "nx",
|
|
117753
|
+
strict: void 0,
|
|
117754
|
+
tmpl: "",
|
|
117755
|
+
offsetFromRoot: (0, import_devkit5.offsetFromRoot)(options.projectRoot),
|
|
117756
|
+
buildable: options.bundler && options.bundler !== "none",
|
|
117757
|
+
hasUnitTestRunner: options.unitTestRunner !== "none"
|
|
117758
|
+
});
|
|
117759
|
+
await typeScriptLibraryGeneratorFn(tree, tsLibraryGeneratorOptions);
|
|
117760
|
+
await (0, import_devkit5.formatFiles)(tree);
|
|
117761
|
+
return null;
|
|
117762
|
+
}
|
|
117735
117763
|
var generator_default2 = withRunGenerator(
|
|
117736
117764
|
"TypeScript Build (NodeJs Platform)",
|
|
117737
117765
|
nodeLibraryGeneratorFn
|