@ethima/semantic-release-configuration 7.0.0-rc.1 → 7.0.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
@@ -20,9 +20,10 @@ configuration supporting a range of languages and platforms supported by the
20
20
  - Maintains a `CHANGELOG.md` from the generated release notes using
21
21
  [`@semantic-release/changelog`][semantic-release-changelog-plugin-url] and
22
22
  [`@semantic-release/git`][semantic-release-git-plugin-url].
23
- - (Conditionally) maintains NPM package files, i.e. `package.json` and
24
- publishes using [`@semantic-release/npm`][semantic-release-npm-plugin-url]
25
- and [`@semantic-release/git`][semantic-release-git-plugin-url].
23
+ - (Conditionally) maintains NPM package files, i.e. `package.json`,
24
+ `package-lock.json` (if committed), and publishes using
25
+ [`@semantic-release/npm`][semantic-release-npm-plugin-url] and
26
+ [`@semantic-release/git`][semantic-release-git-plugin-url].
26
27
  - (Conditionally) maintains Julia package files, i.e. `version` fields in
27
28
  `Project.toml` files, using
28
29
  [`semantic-release-replace-plugin`][semantic-release-replace-plugin-url] and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethima/semantic-release-configuration",
3
- "version": "7.0.0-rc.1",
3
+ "version": "7.0.0",
4
4
  "description": "A shareable semantic release configuration supporting a range of languages and platforms supported by the Ethima organization.",
5
5
  "main": "./src/index.js",
6
6
  "repository": {
@@ -28,6 +28,7 @@
28
28
  "@semantic-release/gitlab": "13.0.0",
29
29
  "conventional-changelog-conventionalcommits": "7.0.2",
30
30
  "cosmiconfig": "8.3.6",
31
+ "execa": "8.0.1",
31
32
  "semantic-release-replace-plugin": "1.2.7"
32
33
  },
33
34
  "devDependencies": {
package/src/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { accessSync } from "node:fs";
2
2
  import { env } from "node:process";
3
+ import { execa } from "execa";
3
4
 
4
5
  import { BranchesConfiguration } from "./branches.js";
5
6
  import { CONFIGURATION } from "./configuration.js";
@@ -10,6 +11,19 @@ const GIT_ASSETS = [
10
11
  ...CONFIGURATION.files_with_versioned_templates,
11
12
  ];
12
13
 
14
+ /**
15
+ * Checks whether a file is being tracked by Git.
16
+ *
17
+ * @param {string} path The path to the file to verify for whether it's being
18
+ * tracked by Git.
19
+ *
20
+ * @return bool Whether the file is being tracked by Git.
21
+ */
22
+ async function isFileTrackedByGit(path) {
23
+ const { stdout } = await execa("git", ["ls-files", path]);
24
+ return stdout.includes(path);
25
+ }
26
+
13
27
  /*
14
28
  * Determines whether the provided plugin should be added to the semantic
15
29
  * release configuration based on the presence of select environment variables.
@@ -32,6 +46,10 @@ try {
32
46
  accessSync("package.json");
33
47
  GIT_ASSETS.push("package.json");
34
48
  NPM_PLUGIN.push("@semantic-release/npm");
49
+
50
+ if (isFileTrackedByGit("package-lock.json")) {
51
+ GIT_ASSETS.push("package-lock.json");
52
+ }
35
53
  } catch {}
36
54
 
37
55
  const JULIA_PROJECT_TOML_PLUGIN = [];