@dhis2/cli-utils 5.2.0 → 5.2.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cmds/release.js +15 -10
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "engines": {
7
7
  "node": ">=12"
8
8
  },
9
- "version": "5.2.0",
9
+ "version": "5.2.1",
10
10
  "main": "src/index.js",
11
11
  "author": "Viktor Varland <viktor@dhis2.org>",
12
12
  "contributors": [
@@ -41,8 +41,10 @@ function publisher(target = '', packages) {
41
41
 
42
42
  const handler = async ({ publish }) => {
43
43
  // set up the plugins and filter out any undefined elements
44
-
45
44
  const rootPackageFile = path.join(process.cwd(), 'package.json')
45
+ const isPnpm = existsSync(path.join(process.cwd(), 'pnpm-lock.yaml'))
46
+ const lockFile = isPnpm ? 'pnpm-lock.yaml' : 'yarn.lock'
47
+
46
48
  const packages = [
47
49
  rootPackageFile,
48
50
  ...(await getWorkspacePackages(rootPackageFile)),
@@ -76,7 +78,7 @@ const handler = async ({ publish }) => {
76
78
  ),
77
79
  packages
78
80
  .map((pkgJsonPath) =>
79
- path.join(path.dirname(pkgJsonPath), 'pnpm-lock.yaml')
81
+ path.join(path.dirname(pkgJsonPath), lockFile)
80
82
  )
81
83
  .filter(existsSync)
82
84
  .map((pkgJsonPath) =>
@@ -88,13 +90,16 @@ const handler = async ({ publish }) => {
88
90
  },
89
91
  ]
90
92
 
91
- const updateLockFile = [
92
- '@semantic-release/exec',
93
- {
94
- publishCmd:
95
- 'pnpm install --lockfile-only && git commit -am "chore: bump pnpm-lock.yml ${nextRelease.version} [skip ci]" && git push',
96
- },
97
- ]
93
+ const updateLockFile = isPnpm
94
+ ? [
95
+ '@semantic-release/exec',
96
+ {
97
+ publishCmd:
98
+ 'pnpm install --lockfile-only && git commit -am "chore: bump pnpm-lock.yml ${nextRelease.version} [skip ci]" && git push',
99
+ },
100
+ ]
101
+ : undefined
102
+
98
103
  const deferPlugin = require('../support/semantic-release-defer-release')
99
104
 
100
105
  // Order matters here!
@@ -111,7 +116,7 @@ const handler = async ({ publish }) => {
111
116
  [
112
117
  '@semantic-release/git',
113
118
  {
114
- assets: ['pnpm-lock.yaml'],
119
+ assets: [lockFile],
115
120
  message:
116
121
  'chore: bump pnpm-lock.yml ${nextRelease.version} [skip ci]',
117
122
  },