@html-validate/release-scripts 4.0.0 → 4.1.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/README.md CHANGED
@@ -18,7 +18,7 @@ Various scripts used by release toolchain.
18
18
  ```
19
19
 
20
20
  If the library or CLI tool bundles all dependencies use `release-prepack --bundle`.
21
- Dependencies can also be filtered by marking dependencies as external: `--bundle --external:foo --external:bar`.
21
+ Dependencies can also be filtered by marking dependencies as external using `--bundle --external:foo --external:bar` or listing them in the non-standard `externalDependencies` field `"externalDependencies": ["foo", "bar"]`.
22
22
 
23
23
  ```json
24
24
  {
@@ -31,6 +31,20 @@ Dependencies can also be filtered by marking dependencies as external: `--bundle
31
31
  }
32
32
  ```
33
33
 
34
+ or
35
+
36
+ ```json
37
+ {
38
+ "scripts": {
39
+ "prepack": "release-prepack --bundle --external:foo --external:bar",
40
+ "postpack": "release-postpack",
41
+ "prepublishOnly": "release-prepublish --bundle",
42
+ "postpublish": "release-postpublish"
43
+ },
44
+ "externalDependencies": ["foo", "bar"]
45
+ }
46
+ ```
47
+
34
48
  ### Usage
35
49
 
36
50
  release-prepack [FILENAME] [OPTIONS..]
package/lib/postpack.js CHANGED
@@ -1,10 +1,11 @@
1
- /* eslint-disable no-console, no-process-exit */
1
+ /* eslint-disable no-console -- cli script, expected to print to console */
2
+ /* eslint-disable no-process-exit -- cli script, want it to exit with non-zero status */
2
3
 
3
4
  const path = require("path");
4
5
  const fs = require("fs");
5
6
 
6
7
  /* ensure this script runs via the correct lifecycle event */
7
- const { npm_command: command, npm_lifecycle_event: event } = process.env; // eslint-disable-line camelcase
8
+ const { npm_command: command, npm_lifecycle_event: event } = process.env;
8
9
  if (command === "publish" && event === "postpack") {
9
10
  process.exit(0);
10
11
  }
package/lib/prepack.js CHANGED
@@ -1,4 +1,5 @@
1
- /* eslint-disable no-console, no-process-exit */
1
+ /* eslint-disable no-console -- cli script, expected to print to console */
2
+ /* eslint-disable no-process-exit -- cli script, want it to exit with non-zero status */
2
3
 
3
4
  const path = require("path");
4
5
  const fs = require("fs");
@@ -8,7 +9,7 @@ const { readPackageJson } = require("./read-package-json");
8
9
  const { stripFields } = require("./strip-fields");
9
10
 
10
11
  /* ensure this script runs via the correct lifecycle event */
11
- const { npm_command: command, npm_lifecycle_event: event } = process.env; // eslint-disable-line camelcase
12
+ const { npm_command: command, npm_lifecycle_event: event } = process.env;
12
13
  if (command === "publish" && event === "prepack") {
13
14
  process.exit(0);
14
15
  }
@@ -16,7 +17,7 @@ if (command === "publish" && event === "prepack") {
16
17
  const [flags, positionals] = getArgs(process.argv.slice(2));
17
18
  const bundle = flags.includes("--bundle");
18
19
  const retainScripts = flags.includes("--retain-scripts");
19
- const externals = flags
20
+ const externalArgs = flags
20
21
  .filter((it) => it.startsWith("--external:"))
21
22
  .map((it) => it.slice("--external:".length));
22
23
 
@@ -31,7 +32,11 @@ if (!fs.existsSync(filePath)) {
31
32
  }
32
33
 
33
34
  const pkg = readPackageJson(filePath);
34
- pkg.dependencies = filterDependencies(pkg.dependencies, bundle, externals);
35
+ const externalField = pkg.externalDependencies || [];
36
+ pkg.dependencies = filterDependencies(pkg.dependencies, bundle, [
37
+ ...externalArgs,
38
+ ...externalField,
39
+ ]);
35
40
 
36
41
  const stripped = stripFields(pkg, {
37
42
  retainScripts,
@@ -8,6 +8,7 @@ const strip = [
8
8
  "c8",
9
9
  "commitlint",
10
10
  "devDependencies",
11
+ "externalDependencies",
11
12
  "greenkeeper",
12
13
  "husky",
13
14
  "jest",
@@ -33,7 +34,6 @@ const strip = [
33
34
  function stripFields(pkg, options = {}) {
34
35
  const result = { ...pkg };
35
36
  for (const key of strip) {
36
- /* eslint-disable-next-line security/detect-object-injection */
37
37
  delete result[key];
38
38
  }
39
39
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@html-validate/release-scripts",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "Various script used by release toolchain",
5
5
  "keywords": [
6
6
  "release"
@@ -17,10 +17,10 @@
17
17
  "license": "MIT",
18
18
  "author": "David Sveningsson <ext@sidvind.com>",
19
19
  "bin": {
20
- "release-prepublish": "scripts/prepack",
21
- "release-prepack": "scripts/prepack",
22
20
  "release-postpack": "scripts/postpack",
23
- "release-postpublish": "scripts/postpack"
21
+ "release-postpublish": "scripts/postpack",
22
+ "release-prepack": "scripts/prepack",
23
+ "release-prepublish": "scripts/prepack"
24
24
  },
25
25
  "files": [
26
26
  "lib",
@@ -38,5 +38,5 @@
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "77f9b60d99c80a4ebcdfc5306c3d09465c0dd7bd"
41
+ "gitHead": "cb102c1fbb131e59804ad3ba5b3e315210bdb0c2"
42
42
  }