@storm-software/workspace-tools 1.28.0 → 1.30.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 +14 -0
- package/README.md +48 -2
- package/executors.json +5 -0
- package/generators.json +5 -0
- package/index.js +48 -32
- package/meta.json +1 -1
- package/package.json +1 -1
- package/src/executors/tsup/executor.js +31 -27
- package/src/executors/tsup/get-config.js +14 -13
- package/src/executors/tsup/schema.d.ts +1 -0
- package/src/executors/tsup/schema.json +5 -0
- package/src/executors/tsup-browser/executor.js +117990 -0
- package/src/executors/tsup-browser/schema.d.ts +9 -0
- package/src/executors/tsup-browser/schema.json +11 -0
- package/src/executors/tsup-neutral/executor.js +31 -27
- package/src/executors/tsup-node/executor.js +31 -27
- package/src/generators/browser-library/files/README.md +58 -0
- package/src/generators/browser-library/files/jest.config.ts +3 -0
- package/src/generators/browser-library/files/src/index.ts.template +10 -0
- package/src/generators/browser-library/files/tsconfig.spec.json +13 -0
- package/src/generators/browser-library/generator.js +48471 -0
- package/src/generators/browser-library/schema.d.ts +22 -0
- package/src/generators/browser-library/schema.json +82 -0
- package/src/generators/neutral-library/generator.js +48445 -0
- package/src/generators/node-library/generator.js +17 -5
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "tsup-browser",
|
|
4
|
+
"extends": "../tsup-browser/schema.json",
|
|
5
|
+
"version": 2,
|
|
6
|
+
"title": "Browser TypeScript Builder",
|
|
7
|
+
"description": "Runs a browser platform TypeScript build",
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {},
|
|
10
|
+
"required": []
|
|
11
|
+
}
|
|
@@ -117247,22 +117247,23 @@ function getConfig(workspaceRoot, projectRoot, sourceRoot, {
|
|
|
117247
117247
|
platform,
|
|
117248
117248
|
...rest
|
|
117249
117249
|
}) {
|
|
117250
|
-
const
|
|
117251
|
-
|
|
117252
|
-
|
|
117253
|
-
|
|
117254
|
-
|
|
117255
|
-
|
|
117256
|
-
|
|
117257
|
-
|
|
117258
|
-
|
|
117259
|
-
|
|
117260
|
-
|
|
117261
|
-
|
|
117250
|
+
const entryPoints = [];
|
|
117251
|
+
if (rest.entry) {
|
|
117252
|
+
entryPoints.push(rest.entry);
|
|
117253
|
+
}
|
|
117254
|
+
if (rest.packageAll !== false) {
|
|
117255
|
+
entryPoints.push((0, import_devkit.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
|
|
117256
|
+
}
|
|
117257
|
+
if (additionalEntryPoints) {
|
|
117258
|
+
entryPoints.push(...additionalEntryPoints);
|
|
117259
|
+
}
|
|
117260
|
+
const entry = globSync(entryPoints, {
|
|
117261
|
+
withFileTypes: true
|
|
117262
|
+
}).reduce((ret, filePath) => {
|
|
117262
117263
|
let propertyKey = (0, import_devkit.joinPathFragments)(
|
|
117263
117264
|
filePath.path,
|
|
117264
117265
|
removeExtension(filePath.name)
|
|
117265
|
-
).replaceAll(workspaceRoot, "").replaceAll("\\", "/").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
|
|
117266
|
+
).replaceAll("/", "\\").replaceAll(workspaceRoot, "").replaceAll("\\", "/").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
|
|
117266
117267
|
if (propertyKey) {
|
|
117267
117268
|
while (propertyKey.startsWith("/")) {
|
|
117268
117269
|
propertyKey = propertyKey.substring(1);
|
|
@@ -117405,7 +117406,7 @@ ${Object.keys(options).map(
|
|
|
117405
117406
|
options.external
|
|
117406
117407
|
);
|
|
117407
117408
|
}
|
|
117408
|
-
|
|
117409
|
+
let externalDependencies = options.external.reduce((acc, name) => {
|
|
117409
117410
|
const externalNode = context.projectGraph.externalNodes[`npm:${name}`];
|
|
117410
117411
|
if (externalNode) {
|
|
117411
117412
|
acc.push({
|
|
@@ -117413,22 +117414,20 @@ ${Object.keys(options).map(
|
|
|
117413
117414
|
outputs: [],
|
|
117414
117415
|
node: externalNode
|
|
117415
117416
|
});
|
|
117416
|
-
} else {
|
|
117417
|
-
const workspaceNode = context.projectGraph.nodes[name];
|
|
117418
|
-
if (workspaceNode) {
|
|
117419
|
-
acc.push({
|
|
117420
|
-
name,
|
|
117421
|
-
outputs: [],
|
|
117422
|
-
node: workspaceNode
|
|
117423
|
-
});
|
|
117424
|
-
}
|
|
117425
117417
|
}
|
|
117426
117418
|
return acc;
|
|
117427
117419
|
}, []);
|
|
117428
|
-
|
|
117429
|
-
|
|
117430
|
-
|
|
117431
|
-
|
|
117420
|
+
externalDependencies = implicitDependencies.reduce((acc, name) => {
|
|
117421
|
+
const internalNode = context.projectGraph.nodes[name];
|
|
117422
|
+
if (internalNode) {
|
|
117423
|
+
acc.push({
|
|
117424
|
+
name,
|
|
117425
|
+
outputs: [],
|
|
117426
|
+
node: internalNode
|
|
117427
|
+
});
|
|
117428
|
+
}
|
|
117429
|
+
return acc;
|
|
117430
|
+
}, externalDependencies);
|
|
117432
117431
|
if (options.bundle === false) {
|
|
117433
117432
|
for (const thirdPartyDependency of (0, import_get_extra_dependencies.getExtraDependencies)(
|
|
117434
117433
|
context.projectName,
|
|
@@ -117441,6 +117440,10 @@ ${externalDependencies.map((dep) => {
|
|
|
117441
117440
|
}
|
|
117442
117441
|
}
|
|
117443
117442
|
}
|
|
117443
|
+
console.log(`Building with the following dependencies marked as external:
|
|
117444
|
+
${externalDependencies.map((dep) => {
|
|
117445
|
+
return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
|
|
117446
|
+
}).join("\n")}`);
|
|
117444
117447
|
const prettierOptions = {
|
|
117445
117448
|
plugins: ["prettier-plugin-packagejson"],
|
|
117446
117449
|
trailingComma: "none",
|
|
@@ -117722,6 +117725,7 @@ var applyDefaultOptions = (options) => {
|
|
|
117722
117725
|
options.apiReport ??= true;
|
|
117723
117726
|
options.docModel ??= true;
|
|
117724
117727
|
options.tsdocMetadata ??= true;
|
|
117728
|
+
options.packageAll ??= true;
|
|
117725
117729
|
options.define ??= {};
|
|
117726
117730
|
options.env ??= {};
|
|
117727
117731
|
options.verbose ??= !!process.env.CI;
|
|
@@ -117247,22 +117247,23 @@ function getConfig(workspaceRoot, projectRoot, sourceRoot, {
|
|
|
117247
117247
|
platform,
|
|
117248
117248
|
...rest
|
|
117249
117249
|
}) {
|
|
117250
|
-
const
|
|
117251
|
-
|
|
117252
|
-
|
|
117253
|
-
|
|
117254
|
-
|
|
117255
|
-
|
|
117256
|
-
|
|
117257
|
-
|
|
117258
|
-
|
|
117259
|
-
|
|
117260
|
-
|
|
117261
|
-
|
|
117250
|
+
const entryPoints = [];
|
|
117251
|
+
if (rest.entry) {
|
|
117252
|
+
entryPoints.push(rest.entry);
|
|
117253
|
+
}
|
|
117254
|
+
if (rest.packageAll !== false) {
|
|
117255
|
+
entryPoints.push((0, import_devkit.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
|
|
117256
|
+
}
|
|
117257
|
+
if (additionalEntryPoints) {
|
|
117258
|
+
entryPoints.push(...additionalEntryPoints);
|
|
117259
|
+
}
|
|
117260
|
+
const entry = globSync(entryPoints, {
|
|
117261
|
+
withFileTypes: true
|
|
117262
|
+
}).reduce((ret, filePath) => {
|
|
117262
117263
|
let propertyKey = (0, import_devkit.joinPathFragments)(
|
|
117263
117264
|
filePath.path,
|
|
117264
117265
|
removeExtension(filePath.name)
|
|
117265
|
-
).replaceAll(workspaceRoot, "").replaceAll("\\", "/").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
|
|
117266
|
+
).replaceAll("/", "\\").replaceAll(workspaceRoot, "").replaceAll("\\", "/").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
|
|
117266
117267
|
if (propertyKey) {
|
|
117267
117268
|
while (propertyKey.startsWith("/")) {
|
|
117268
117269
|
propertyKey = propertyKey.substring(1);
|
|
@@ -117405,7 +117406,7 @@ ${Object.keys(options).map(
|
|
|
117405
117406
|
options.external
|
|
117406
117407
|
);
|
|
117407
117408
|
}
|
|
117408
|
-
|
|
117409
|
+
let externalDependencies = options.external.reduce((acc, name) => {
|
|
117409
117410
|
const externalNode = context.projectGraph.externalNodes[`npm:${name}`];
|
|
117410
117411
|
if (externalNode) {
|
|
117411
117412
|
acc.push({
|
|
@@ -117413,22 +117414,20 @@ ${Object.keys(options).map(
|
|
|
117413
117414
|
outputs: [],
|
|
117414
117415
|
node: externalNode
|
|
117415
117416
|
});
|
|
117416
|
-
} else {
|
|
117417
|
-
const workspaceNode = context.projectGraph.nodes[name];
|
|
117418
|
-
if (workspaceNode) {
|
|
117419
|
-
acc.push({
|
|
117420
|
-
name,
|
|
117421
|
-
outputs: [],
|
|
117422
|
-
node: workspaceNode
|
|
117423
|
-
});
|
|
117424
|
-
}
|
|
117425
117417
|
}
|
|
117426
117418
|
return acc;
|
|
117427
117419
|
}, []);
|
|
117428
|
-
|
|
117429
|
-
|
|
117430
|
-
|
|
117431
|
-
|
|
117420
|
+
externalDependencies = implicitDependencies.reduce((acc, name) => {
|
|
117421
|
+
const internalNode = context.projectGraph.nodes[name];
|
|
117422
|
+
if (internalNode) {
|
|
117423
|
+
acc.push({
|
|
117424
|
+
name,
|
|
117425
|
+
outputs: [],
|
|
117426
|
+
node: internalNode
|
|
117427
|
+
});
|
|
117428
|
+
}
|
|
117429
|
+
return acc;
|
|
117430
|
+
}, externalDependencies);
|
|
117432
117431
|
if (options.bundle === false) {
|
|
117433
117432
|
for (const thirdPartyDependency of (0, import_get_extra_dependencies.getExtraDependencies)(
|
|
117434
117433
|
context.projectName,
|
|
@@ -117441,6 +117440,10 @@ ${externalDependencies.map((dep) => {
|
|
|
117441
117440
|
}
|
|
117442
117441
|
}
|
|
117443
117442
|
}
|
|
117443
|
+
console.log(`Building with the following dependencies marked as external:
|
|
117444
|
+
${externalDependencies.map((dep) => {
|
|
117445
|
+
return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
|
|
117446
|
+
}).join("\n")}`);
|
|
117444
117447
|
const prettierOptions = {
|
|
117445
117448
|
plugins: ["prettier-plugin-packagejson"],
|
|
117446
117449
|
trailingComma: "none",
|
|
@@ -117722,6 +117725,7 @@ var applyDefaultOptions = (options) => {
|
|
|
117722
117725
|
options.apiReport ??= true;
|
|
117723
117726
|
options.docModel ??= true;
|
|
117724
117727
|
options.tsdocMetadata ??= true;
|
|
117728
|
+
options.packageAll ??= true;
|
|
117725
117729
|
options.define ??= {};
|
|
117726
117730
|
options.env ??= {};
|
|
117727
117731
|
options.verbose ??= !!process.env.CI;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!-- START header -->
|
|
2
|
+
<!-- END header -->
|
|
3
|
+
|
|
4
|
+
# <%= name %>
|
|
5
|
+
|
|
6
|
+
<%= description %>
|
|
7
|
+
|
|
8
|
+
<!-- START doctoc -->
|
|
9
|
+
<!-- END doctoc -->
|
|
10
|
+
|
|
11
|
+
## Installing
|
|
12
|
+
|
|
13
|
+
Using [pnpm](http://pnpm.io):
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add -D <%= namespace %>/<%= name %>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
<details>
|
|
20
|
+
<summary>Using npm</summary>
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install -D <%= namespace %>/<%= name %>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
</details>
|
|
27
|
+
|
|
28
|
+
<details>
|
|
29
|
+
<summary>Using yarn</summary>
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
yarn add -D <%= namespace %>/<%= name %>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
</details>
|
|
36
|
+
|
|
37
|
+
## Reduced Package Size
|
|
38
|
+
|
|
39
|
+
This project uses [tsup](https://tsup.egoist.dev/) to package the source code due to its ability to remove unused code and ship smaller javascript files thanks to code splitting. This helps to greatly reduce the size of the package and to make it easier to use in other projects.
|
|
40
|
+
|
|
41
|
+
## Development
|
|
42
|
+
|
|
43
|
+
This project is built using [Nx](https://nx.dev). As a result, many of the usual commands are available to assist in development.
|
|
44
|
+
|
|
45
|
+
### Building
|
|
46
|
+
|
|
47
|
+
Run `nx build <%= name %>` to build the library.
|
|
48
|
+
|
|
49
|
+
### Running unit tests
|
|
50
|
+
|
|
51
|
+
Run `nx test <%= name %>` to execute the unit tests via [Jest](https://jestjs.io).
|
|
52
|
+
|
|
53
|
+
### Linting
|
|
54
|
+
|
|
55
|
+
Run `nx lint <%= name %>` to run [ESLint](https://eslint.org/) on the package.
|
|
56
|
+
|
|
57
|
+
<!-- START footer -->
|
|
58
|
+
<!-- END footer -->
|