@open-pioneer/build-package-cli 2.0.3 → 2.1.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,5 +1,43 @@
1
1
  # Changelog @open-pioneer/build-package-cli
2
2
 
3
+ ## 2.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [2526935]
8
+ - Updated dependencies [7668cd9]
9
+ - Updated dependencies [7668cd9]
10
+ - @open-pioneer/build-package@3.1.0
11
+
12
+ ## 2.1.0
13
+
14
+ ### Minor Changes
15
+
16
+ - e4ae880: Switch to `type: module`
17
+ - e4ae880: Implement additional validations when importing modules from other packages.
18
+
19
+ - When importing modules from normal node packages, `build-package` will now check that the imported module actually exists.
20
+ - When importing modules from another trails package in the same repository, `build-package` now verifies that the imported module is an actual entry point of that package (declared in the `build.config.mjs`).
21
+
22
+ These validations are designed to errors where a package would run locally (in Vite's development mode)
23
+ but end up broken when published (see also https://github.com/open-pioneer/trails-core-packages/issues/42).
24
+
25
+ - e4ae880: Introduce an option to configure the root directory (`-r` for the CLI, `rootDirectory` for the JavaScript API).
26
+
27
+ The root directory is used to detect which packages are local to the project.
28
+ The option defaults to the root of the current workspace (e.g. the PNPM workspace root), or, if that doesn't work, to the root of the current git repository.
29
+ However, it can also be configured manually.
30
+
31
+ ### Patch Changes
32
+
33
+ - 3550ca8: Update dependencies
34
+ - Updated dependencies [e4ae880]
35
+ - Updated dependencies [e4ae880]
36
+ - Updated dependencies [3550ca8]
37
+ - Updated dependencies [e4ae880]
38
+ - Updated dependencies [e4ae880]
39
+ - @open-pioneer/build-package@3.0.0
40
+
3
41
  ## 2.0.3
4
42
 
5
43
  ### Patch Changes
package/README.md CHANGED
@@ -16,6 +16,7 @@ Builds an Open Pioneer Trails package for publishing.
16
16
 
17
17
  Options:
18
18
  -p, --package <path> package directory (defaults to current directory)
19
+ -r, --root <path> the root directory (optional, defaults to the workspace root)
19
20
  -q, --silent disable logging
20
21
  -d, --debug show exception stack traces
21
22
  -V, --version output the version number
package/dist/index.js CHANGED
@@ -1,62 +1,40 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
-
25
1
  // src/index.ts
26
- var import_commander = require("commander");
27
- var import_node_process = require("node:process");
2
+ import { Command } from "commander";
3
+ import { cwd, exit } from "node:process";
28
4
 
29
5
  // package.json
30
- var version = "2.0.3";
6
+ var version = "2.1.1";
31
7
 
32
8
  // src/index.ts
33
- var import_build_package = require("@open-pioneer/build-package");
34
- var program = new import_commander.Command();
35
- program.name("build-pioneer-package").description("Builds an Open Pioneer Trails package for publishing.").option("-p, --package <path>", "package directory (defaults to current directory)").option("-q, --silent", "disable logging").option("-d, --debug", "show exception stack traces").version(version);
9
+ import { build } from "@open-pioneer/build-package";
10
+ var program = new Command();
11
+ program.name("build-pioneer-package").description("Builds an Open Pioneer Trails package for publishing.").option("-p, --package <path>", "package directory (defaults to current directory)").option("-r, --root <path>", "the root directory (optional, defaults to the workspace root)").option("-q, --silent", "disable logging").option("-d, --debug", "show exception stack traces").version(version);
36
12
  program.parse();
37
13
  async function main() {
38
14
  const chalk = (await import("chalk")).default;
39
15
  const opts = program.opts();
40
16
  const debug = opts.debug ?? false;
41
17
  const silent = opts.silent ?? false;
42
- const packagePath = opts.package ?? (0, import_node_process.cwd)();
18
+ const packagePath = opts.package ?? cwd();
19
+ const rootDirectory = opts.root;
43
20
  try {
44
- await (0, import_build_package.build)({
21
+ await build({
45
22
  packageDirectory: packagePath,
23
+ rootDirectory,
46
24
  logger: silent ? null : console
47
25
  });
48
- (0, import_node_process.exit)(0);
26
+ exit(0);
49
27
  } catch (e) {
50
28
  if (debug) {
51
29
  console.error(e);
52
30
  } else {
53
31
  console.error(chalk.red(e.message ?? String(e)));
54
32
  }
55
- (0, import_node_process.exit)(1);
33
+ exit(1);
56
34
  }
57
35
  }
58
36
  main().catch((e) => {
59
37
  console.error("Fatal error", e);
60
- (0, import_node_process.exit)(1);
38
+ exit(1);
61
39
  });
62
40
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts", "../package.json"],
4
- "sourcesContent": ["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Command } from \"commander\";\nimport { cwd, exit } from \"node:process\";\nimport { version } from \"../package.json\";\nimport { build } from \"@open-pioneer/build-package\";\n\nconst program = new Command();\nprogram\n .name(\"build-pioneer-package\")\n .description(\"Builds an Open Pioneer Trails package for publishing.\")\n .option(\"-p, --package <path>\", \"package directory (defaults to current directory)\")\n .option(\"-q, --silent\", \"disable logging\")\n .option(\"-d, --debug\", \"show exception stack traces\")\n .version(version);\nprogram.parse();\n\nasync function main() {\n const chalk = (await import(\"chalk\")).default;\n const opts = program.opts();\n const debug = opts.debug ?? false;\n const silent = opts.silent ?? false;\n const packagePath = opts.package ?? cwd();\n try {\n await build({\n packageDirectory: packagePath,\n logger: silent ? null : console\n });\n exit(0);\n } catch (e) {\n if (debug) {\n console.error(e);\n } else {\n console.error(chalk.red((e as Error).message ?? String(e)));\n }\n exit(1);\n }\n}\n\nmain().catch((e) => {\n console.error(\"Fatal error\", e);\n exit(1);\n});\n", "{\n \"name\": \"@open-pioneer/build-package-cli\",\n \"description\": \"Provides a CLI tool to compile Open Pioneer Trails packages.\",\n \"version\": \"2.0.3\",\n \"type\": \"commonjs\",\n \"license\": \"Apache-2.0\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/open-pioneer/trails-build-tools.git\",\n \"directory\": \"packages/build-package-cli\"\n },\n \"homepage\": \"https://github.com/open-pioneer\",\n \"keywords\": [\n \"open-pioneer-trails\"\n ],\n \"bin\": {\n \"build-pioneer-package\": \"./dist/index.js\"\n },\n \"scripts\": {\n \"clean\": \"rimraf dist\",\n \"build\": \"node build.mjs build\",\n \"build-dev\": \"node build.mjs buildDev\",\n \"dev\": \"node build.mjs watch\"\n },\n \"files\": [\n \"dist/**/*.js\",\n \"dist/**/*.js.map\",\n \"CHANGELOG.md\",\n \"README.md\",\n \"LICENSE\"\n ],\n \"dependencies\": {\n \"@open-pioneer/build-package\": \"workspace:^\",\n \"chalk\": \"^5.3.0\",\n \"commander\": \"^12.0.0\"\n },\n \"devDependencies\": {\n \"build-tools\": \"workspace:*\"\n },\n \"engines\": {\n \"node\": \">= 18\"\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAEA,uBAAwB;AACxB,0BAA0B;;;ACAtB,cAAW;;;ADEf,2BAAsB;AAEtB,IAAM,UAAU,IAAI,yBAAQ;AAC5B,QACK,KAAK,uBAAuB,EAC5B,YAAY,uDAAuD,EACnE,OAAO,wBAAwB,mDAAmD,EAClF,OAAO,gBAAgB,iBAAiB,EACxC,OAAO,eAAe,6BAA6B,EACnD,QAAQ,OAAO;AACpB,QAAQ,MAAM;AAEd,eAAe,OAAO;AAClB,QAAM,SAAS,MAAM,OAAO,OAAO,GAAG;AACtC,QAAM,OAAO,QAAQ,KAAK;AAC1B,QAAM,QAAQ,KAAK,SAAS;AAC5B,QAAM,SAAS,KAAK,UAAU;AAC9B,QAAM,cAAc,KAAK,eAAW,yBAAI;AACxC,MAAI;AACA,cAAM,4BAAM;AAAA,MACR,kBAAkB;AAAA,MAClB,QAAQ,SAAS,OAAO;AAAA,IAC5B,CAAC;AACD,kCAAK,CAAC;AAAA,EACV,SAAS,GAAG;AACR,QAAI,OAAO;AACP,cAAQ,MAAM,CAAC;AAAA,IACnB,OAAO;AACH,cAAQ,MAAM,MAAM,IAAK,EAAY,WAAW,OAAO,CAAC,CAAC,CAAC;AAAA,IAC9D;AACA,kCAAK,CAAC;AAAA,EACV;AACJ;AAEA,KAAK,EAAE,MAAM,CAAC,MAAM;AAChB,UAAQ,MAAM,eAAe,CAAC;AAC9B,gCAAK,CAAC;AACV,CAAC;",
4
+ "sourcesContent": ["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Command } from \"commander\";\nimport { cwd, exit } from \"node:process\";\nimport { version } from \"../package.json\";\nimport { build } from \"@open-pioneer/build-package\";\n\nconst program = new Command();\nprogram\n .name(\"build-pioneer-package\")\n .description(\"Builds an Open Pioneer Trails package for publishing.\")\n .option(\"-p, --package <path>\", \"package directory (defaults to current directory)\")\n .option(\"-r, --root <path>\", \"the root directory (optional, defaults to the workspace root)\")\n .option(\"-q, --silent\", \"disable logging\")\n .option(\"-d, --debug\", \"show exception stack traces\")\n .version(version);\nprogram.parse();\n\nasync function main() {\n const chalk = (await import(\"chalk\")).default;\n const opts = program.opts();\n const debug = opts.debug ?? false;\n const silent = opts.silent ?? false;\n const packagePath = opts.package ?? cwd();\n const rootDirectory = opts.root;\n try {\n await build({\n packageDirectory: packagePath,\n rootDirectory,\n logger: silent ? null : console\n });\n exit(0);\n } catch (e) {\n if (debug) {\n console.error(e);\n } else {\n console.error(chalk.red((e as Error).message ?? String(e)));\n }\n exit(1);\n }\n}\n\nmain().catch((e) => {\n console.error(\"Fatal error\", e);\n exit(1);\n});\n", "{\n \"name\": \"@open-pioneer/build-package-cli\",\n \"description\": \"Provides a CLI tool to compile Open Pioneer Trails packages.\",\n \"version\": \"2.1.1\",\n \"type\": \"module\",\n \"license\": \"Apache-2.0\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/open-pioneer/trails-build-tools.git\",\n \"directory\": \"packages/build-package-cli\"\n },\n \"homepage\": \"https://github.com/open-pioneer\",\n \"keywords\": [\n \"open-pioneer-trails\"\n ],\n \"bin\": {\n \"build-pioneer-package\": \"./dist/index.js\"\n },\n \"scripts\": {\n \"clean\": \"rimraf dist\",\n \"build\": \"node build.mjs build\",\n \"build-dev\": \"node build.mjs buildDev\",\n \"dev\": \"node build.mjs watch\"\n },\n \"files\": [\n \"dist/**/*.js\",\n \"dist/**/*.js.map\",\n \"CHANGELOG.md\",\n \"README.md\",\n \"LICENSE\"\n ],\n \"dependencies\": {\n \"@open-pioneer/build-package\": \"workspace:^\",\n \"chalk\": \"^5.3.0\",\n \"commander\": \"^12.1.0\"\n },\n \"devDependencies\": {\n \"build-tools\": \"workspace:*\"\n },\n \"engines\": {\n \"node\": \">= 18\"\n }\n}\n"],
5
+ "mappings": ";AAEA,SAAS,eAAe;AACxB,SAAS,KAAK,YAAY;;;ACAtB,cAAW;;;ADEf,SAAS,aAAa;AAEtB,IAAM,UAAU,IAAI,QAAQ;AAC5B,QACK,KAAK,uBAAuB,EAC5B,YAAY,uDAAuD,EACnE,OAAO,wBAAwB,mDAAmD,EAClF,OAAO,qBAAqB,+DAA+D,EAC3F,OAAO,gBAAgB,iBAAiB,EACxC,OAAO,eAAe,6BAA6B,EACnD,QAAQ,OAAO;AACpB,QAAQ,MAAM;AAEd,eAAe,OAAO;AAClB,QAAM,SAAS,MAAM,OAAO,OAAO,GAAG;AACtC,QAAM,OAAO,QAAQ,KAAK;AAC1B,QAAM,QAAQ,KAAK,SAAS;AAC5B,QAAM,SAAS,KAAK,UAAU;AAC9B,QAAM,cAAc,KAAK,WAAW,IAAI;AACxC,QAAM,gBAAgB,KAAK;AAC3B,MAAI;AACA,UAAM,MAAM;AAAA,MACR,kBAAkB;AAAA,MAClB;AAAA,MACA,QAAQ,SAAS,OAAO;AAAA,IAC5B,CAAC;AACD,SAAK,CAAC;AAAA,EACV,SAAS,GAAG;AACR,QAAI,OAAO;AACP,cAAQ,MAAM,CAAC;AAAA,IACnB,OAAO;AACH,cAAQ,MAAM,MAAM,IAAK,EAAY,WAAW,OAAO,CAAC,CAAC,CAAC;AAAA,IAC9D;AACA,SAAK,CAAC;AAAA,EACV;AACJ;AAEA,KAAK,EAAE,MAAM,CAAC,MAAM;AAChB,UAAQ,MAAM,eAAe,CAAC;AAC9B,OAAK,CAAC;AACV,CAAC;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@open-pioneer/build-package-cli",
3
3
  "description": "Provides a CLI tool to compile Open Pioneer Trails packages.",
4
- "version": "2.0.3",
5
- "type": "commonjs",
4
+ "version": "2.1.1",
5
+ "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
@@ -25,8 +25,8 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "chalk": "^5.3.0",
28
- "commander": "^12.0.0",
29
- "@open-pioneer/build-package": "^2.0.3"
28
+ "commander": "^12.1.0",
29
+ "@open-pioneer/build-package": "^3.1.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "build-tools": "0.0.1"