@storm-software/workspace-tools 1.29.0 → 1.30.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 CHANGED
@@ -1,3 +1,17 @@
1
+ # [1.30.0](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.29.0...workspace-tools-v1.30.0) (2023-12-12)
2
+
3
+
4
+ ### Features
5
+
6
+ * **workspace-tools:** Added the `packageAll` option to build nested package files ([cf18588](https://github.com/storm-software/storm-ops/commit/cf18588e55e491f984affecd040c95298f0cf273))
7
+
8
+ # [1.29.0](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.28.0...workspace-tools-v1.29.0) (2023-12-12)
9
+
10
+
11
+ ### Features
12
+
13
+ * **workspace-tools:** Added compiled child directories to build package ([367ac43](https://github.com/storm-software/storm-ops/commit/367ac4312ed4b81badbce62676d3d9341431018a))
14
+
1
15
  # [1.28.0](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.27.0...workspace-tools-v1.28.0) (2023-12-12)
2
16
 
3
17
 
package/README.md CHANGED
@@ -16,7 +16,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
16
16
 
17
17
  <h3 align="center">💻 Visit <a href="https://stormsoftware.org" target="_blank">stormsoftware.org</a> to stay up to date with this developer</h3><br />
18
18
 
19
- [![Version](https://img.shields.io/badge/version-1.24.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;
19
+ [![Version](https://img.shields.io/badge/version-1.29.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;
20
20
  [![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with docusaurus](https://img.shields.io/badge/documented_with-docusaurus-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://docusaurus.io/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
21
21
 
22
22
  <h3 align="center" bold="true">⚠️ <b>Attention</b> ⚠️ This repository, and the apps, libraries, and tools contained within, is still in it's initial development phase. As a result, bugs and issues are expected with it's usage. When the main development phase completes, a proper release will be performed, the packages will be availible through NPM (and other distributions), and this message will be removed. However, in the meantime, please feel free to report any issues you may come across.</h3><br />
@@ -102,13 +102,16 @@ The following executor options are available:
102
102
  | watch | `boolean` | Enable re-building when files change. | |
103
103
  | assets | `array` | List of static assets. | `[]` |
104
104
  | clean | `boolean` | Remove previous output before build. | `true` |
105
- | includeSrc | `boolean` | Should the source files be added to the distribution folder in an \`src\` directory. | `true` |
105
+ | includeSrc | `boolean` | Should the source files be added to the distribution folder in an \`src\` directory. | |
106
+ | packageAll | `boolean` | Should the build run for each file contained in the package individually. | `true` |
107
+ | generatePackageJson | `boolean` | Should a package.json file be generated in the output folder or should the existing one be copied in. | `true` |
106
108
  | splitting | `boolean` | Should the build process preform \*code-splitting\*? | `true` |
107
109
  | treeshake | `boolean` | Should the build process \*tree-shake\* to remove unused code? | `true` |
108
110
  | debug | `boolean` | Should output be unminified with source mappings. | |
109
111
  | **platform \*** | "browser" \| "neutral" \| "node" \| "worker" | Platform target for outputs. | "neutral" |
110
112
  | **banner \*** | `string` | A short heading added to the top of each typescript file added in the output folder's \`src\` directory. | "This code was developed by Storm Software (<https://stormsoftware.org>) and is licensed under the Apache License 2.0." |
111
113
  | verbose | `boolean` | Should write extra log outputs with details from the executor. | |
114
+ | shims | `boolean` | Should the build process add shims for node.js modules that are not available in the browser? | |
112
115
  | define | `object` | Define global constants that can be used in the source code. The value will be converted into a stringified JSON. | |
113
116
  | env | `object` | Define environment variables that can be used in the source code. The value will be converted into a stringified JSON. | |
114
117
  | apiReport | `boolean` | Should API Extractor generate an API Report file. | `true` |
@@ -163,6 +166,22 @@ nx run my-project:tsup-node
163
166
 
164
167
 
165
168
 
169
+ ## Browser TypeScript Builder
170
+
171
+ Runs a browser platform TypeScript build
172
+
173
+ ### Example
174
+
175
+ This executor can be used by executing the following in a command line utility:
176
+
177
+ ```cmd
178
+ nx run my-project:tsup-browser
179
+ ```
180
+
181
+ **Please note:** _The tsup-browser executor should be included in the desired projects's `project.json` file._
182
+
183
+
184
+
166
185
  <!-- markdownlint-restore -->
167
186
  <!-- prettier-ignore-end -->
168
187
 
@@ -326,6 +345,33 @@ The following executor options are available:
326
345
 
327
346
 
328
347
 
348
+ ## Add browser Library
349
+
350
+ Create a new browser TypeScript library package in the Storm workspace
351
+
352
+ ### Options
353
+
354
+ The following executor options are available:
355
+
356
+ | Option | Type | Description | Default |
357
+ | --------- | ------ | ------------- | --------- |
358
+ | **name \*** | `string` | A name for the library. | |
359
+ | description | `string` | The library used by Storm Software for building TypeScript applications. | |
360
+ | **directory \*** | `string` | A directory where the lib is placed. | |
361
+ | **projectNameAndRootFormat \*** | "as-provided" \| "derived" | Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`). | |
362
+ | tags | `string` | Add tags to the library (used for linting). | |
363
+ | strict | `boolean` | Whether to enable tsconfig strict mode or not. | `true` |
364
+ | **publishable \*** | `boolean` | Generate a publishable library. | |
365
+ | **importPath \*** | `string` | The library name used to import it, like @storm-software/my-awesome-lib. Required for publishable library. | |
366
+ | **buildable \*** | `boolean` | Generate a buildable library. | `true` |
367
+ | setParserOptionsProject | `boolean` | Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons. | |
368
+ | rootProject | `boolean` | Is the current project the root project in the workspace. | |
369
+
370
+
371
+ **Please note:** _Option names followed by \* above are required, and must be provided to run the executor._
372
+
373
+
374
+
329
375
  <!-- markdownlint-restore -->
330
376
  <!-- prettier-ignore-end -->
331
377
 
package/index.js CHANGED
@@ -117409,22 +117409,23 @@ function getConfig(workspaceRoot, projectRoot, sourceRoot, {
117409
117409
  platform,
117410
117410
  ...rest
117411
117411
  }) {
117412
- const entry = globSync(
117413
- [
117414
- rest.entry ? rest.entry : (0, import_devkit.joinPathFragments)(
117415
- sourceRoot.includes(workspaceRoot) ? sourceRoot : (0, import_devkit.joinPathFragments)(workspaceRoot, sourceRoot),
117416
- "**/*.{ts,tsx}"
117417
- ),
117418
- ...additionalEntryPoints ?? []
117419
- ],
117420
- {
117421
- withFileTypes: true
117422
- }
117423
- ).reduce((ret, filePath) => {
117412
+ const entryPoints = [];
117413
+ if (rest.entry) {
117414
+ entryPoints.push(rest.entry);
117415
+ }
117416
+ if (rest.packageAll !== false) {
117417
+ entryPoints.push((0, import_devkit.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
117418
+ }
117419
+ if (additionalEntryPoints) {
117420
+ entryPoints.push(...additionalEntryPoints);
117421
+ }
117422
+ const entry = globSync(entryPoints, {
117423
+ withFileTypes: true
117424
+ }).reduce((ret, filePath) => {
117424
117425
  let propertyKey = (0, import_devkit.joinPathFragments)(
117425
117426
  filePath.path,
117426
117427
  removeExtension(filePath.name)
117427
- ).replaceAll(workspaceRoot, "").replaceAll("\\", "/").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
117428
+ ).replaceAll("\\", "/").replaceAll(workspaceRoot.substring(1).replaceAll("\\", "/"), "").replaceAll(sourceRoot.replaceAll("\\", "/"), "").replaceAll(projectRoot.replaceAll("\\", "/"), "");
117428
117429
  if (propertyKey) {
117429
117430
  while (propertyKey.startsWith("/")) {
117430
117431
  propertyKey = propertyKey.substring(1);
@@ -117550,16 +117551,17 @@ ${Object.keys(options).map(
117550
117551
  if (implicitDependencies && implicitDependencies.length > 0) {
117551
117552
  options.external = implicitDependencies.reduce(
117552
117553
  (ret, key) => {
117553
- if (context.projectsConfigurations.projects[key].root) {
117554
- const packageJson = (0, import_devkit2.readJsonFile)(
117555
- (0, import_path3.join)(
117556
- context.root,
117557
- context.projectsConfigurations.projects[key].root,
117558
- "package.json"
117559
- )
117560
- );
117561
- if (packageJson.name && !options.external.includes(packageJson.name)) {
117562
- ret.push(packageJson.name);
117554
+ if (Object.keys(context.projectsConfigurations.projects[key]?.targets).length > 0) {
117555
+ const buildTargetName = Object.keys(
117556
+ context.projectsConfigurations.projects[key].targets
117557
+ ).find((name) => name.toLowerCase() === "build");
117558
+ if (buildTargetName && context.projectsConfigurations.projects[key].targets[buildTargetName]?.options?.project) {
117559
+ const packageJson = (0, import_devkit2.readJsonFile)(
117560
+ context.projectsConfigurations.projects[key].targets[buildTargetName].options.project
117561
+ );
117562
+ if (packageJson?.name && !options.external.includes(packageJson.name)) {
117563
+ ret.push(packageJson.name);
117564
+ }
117563
117565
  }
117564
117566
  }
117565
117567
  return ret;
@@ -117567,7 +117569,7 @@ ${Object.keys(options).map(
117567
117569
  options.external
117568
117570
  );
117569
117571
  }
117570
- const externalDependencies = options.external.reduce((acc, name) => {
117572
+ let externalDependencies = options.external.reduce((acc, name) => {
117571
117573
  const externalNode = context.projectGraph.externalNodes[`npm:${name}`];
117572
117574
  if (externalNode) {
117573
117575
  acc.push({
@@ -117575,22 +117577,20 @@ ${Object.keys(options).map(
117575
117577
  outputs: [],
117576
117578
  node: externalNode
117577
117579
  });
117578
- } else {
117579
- const workspaceNode = context.projectGraph.nodes[name];
117580
- if (workspaceNode) {
117581
- acc.push({
117582
- name,
117583
- outputs: [],
117584
- node: workspaceNode
117585
- });
117586
- }
117587
117580
  }
117588
117581
  return acc;
117589
117582
  }, []);
117590
- options.verbose && console.log(`Added the following external dependencies:
117591
- ${externalDependencies.map((dep) => {
117592
- return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
117593
- }).join("\n")}`);
117583
+ externalDependencies = implicitDependencies.reduce((acc, name) => {
117584
+ const internalNode = context.projectGraph.nodes[name];
117585
+ if (internalNode) {
117586
+ acc.push({
117587
+ name,
117588
+ outputs: [],
117589
+ node: internalNode
117590
+ });
117591
+ }
117592
+ return acc;
117593
+ }, externalDependencies);
117594
117594
  if (options.bundle === false) {
117595
117595
  for (const thirdPartyDependency of (0, import_get_extra_dependencies.getExtraDependencies)(
117596
117596
  context.projectName,
@@ -117603,6 +117603,10 @@ ${externalDependencies.map((dep) => {
117603
117603
  }
117604
117604
  }
117605
117605
  }
117606
+ console.log(`Building with the following dependencies marked as external:
117607
+ ${externalDependencies.map((dep) => {
117608
+ return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
117609
+ }).join("\n")}`);
117606
117610
  const prettierOptions = {
117607
117611
  plugins: ["prettier-plugin-packagejson"],
117608
117612
  trailingComma: "none",
@@ -117645,20 +117649,20 @@ ${externalDependencies.map((dep) => {
117645
117649
  default: "./dist/modern/index.cjs"
117646
117650
  },
117647
117651
  default: {
117648
- types: "./dist/modern/**/*.d.ts",
117649
- default: "./dist/modern/**/*.js"
117652
+ types: "./dist/modern/index.d.ts",
117653
+ default: "./dist/modern/index.js"
117650
117654
  },
117651
117655
  "./*": {
117652
117656
  "import": {
117653
- types: "./dist/modern/**/*.d.ts",
117657
+ types: "./dist/modern/index.d.ts",
117654
117658
  default: "./dist/modern/**/*.js"
117655
117659
  },
117656
117660
  require: {
117657
- types: "./dist/modern/**/*.d.cts",
117661
+ types: "./dist/modern/index.d.cts",
117658
117662
  default: "./dist/modern/**/*.cjs"
117659
117663
  },
117660
117664
  "default": {
117661
- types: "./dist/modern/**/*.d.ts",
117665
+ types: "./dist/modern/index.d.ts",
117662
117666
  default: "./dist/modern/**/*.js"
117663
117667
  }
117664
117668
  },
@@ -117884,6 +117888,7 @@ var applyDefaultOptions = (options) => {
117884
117888
  options.apiReport ??= true;
117885
117889
  options.docModel ??= true;
117886
117890
  options.tsdocMetadata ??= true;
117891
+ options.packageAll ??= true;
117887
117892
  options.define ??= {};
117888
117893
  options.env ??= {};
117889
117894
  options.verbose ??= !!process.env.CI;