monorepo-next 12.2.1 → 12.4.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/package.json +1 -1
- package/src/fs.js +18 -0
- package/src/release.js +14 -0
- package/src/version.js +7 -1
package/package.json
CHANGED
package/src/fs.js
CHANGED
@@ -63,10 +63,28 @@ async function ensureWriteFile(path, data) {
|
|
63
63
|
await fs.writeFile(path, data);
|
64
64
|
}
|
65
65
|
|
66
|
+
/**
|
67
|
+
* @param {string} path
|
68
|
+
*/
|
69
|
+
async function exists(path) {
|
70
|
+
try {
|
71
|
+
await fs.access(path, fs.constants.F_OK);
|
72
|
+
|
73
|
+
return true;
|
74
|
+
} catch (err) {
|
75
|
+
if (err.code !== 'ENOENT') {
|
76
|
+
throw err;
|
77
|
+
}
|
78
|
+
|
79
|
+
return false;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
66
83
|
module.exports = {
|
67
84
|
replaceFile,
|
68
85
|
replaceJsonFile,
|
69
86
|
safeReadFile,
|
70
87
|
ensureDir,
|
71
88
|
ensureWriteFile,
|
89
|
+
exists,
|
72
90
|
};
|
package/src/release.js
CHANGED
@@ -19,6 +19,9 @@ const semver = require('semver');
|
|
19
19
|
const { builder } = require('../bin/commands/release');
|
20
20
|
const debug = require('./debug');
|
21
21
|
const { createAsyncLogger } = require('./log');
|
22
|
+
const {
|
23
|
+
exists: fsExists,
|
24
|
+
} = require('./fs');
|
22
25
|
|
23
26
|
async function release({
|
24
27
|
cwd = process.cwd(),
|
@@ -179,6 +182,10 @@ async function release({
|
|
179
182
|
|
180
183
|
let commitMessage = `chore(release): ${tags.join()}`;
|
181
184
|
|
185
|
+
if (await fsExists(path.join(workspaceCwd, 'pnpm-lock.yaml'))) {
|
186
|
+
await module.exports.updatePnpmLockfile({ cwd: workspaceCwd, silent, dryRun });
|
187
|
+
}
|
188
|
+
|
182
189
|
if (!dryRun) {
|
183
190
|
await execa('git', ['add', '-A'], { cwd: workspaceCwd, silent: true });
|
184
191
|
}
|
@@ -305,4 +312,11 @@ async function publish({ cwd, silent, distTag, dryRun }) {
|
|
305
312
|
await execa('npm', ['publish', '--tag', distTag, ...dryRunArgs], { cwd, silent });
|
306
313
|
}
|
307
314
|
|
315
|
+
async function updatePnpmLockfile({ cwd, silent, dryRun }) {
|
316
|
+
await execa('pnpm', ['install', '--lockfile-only'], { cwd, silent, dryRun });
|
317
|
+
}
|
318
|
+
|
308
319
|
module.exports = release;
|
320
|
+
module.exports = Object.assign(release, {
|
321
|
+
updatePnpmLockfile,
|
322
|
+
});
|
package/src/version.js
CHANGED
@@ -18,8 +18,14 @@ function trackNewVersion({
|
|
18
18
|
// https://github.com/npm/node-semver/commit/bcab95a966413b978dc1e7bdbcb8f495b63303cd
|
19
19
|
range.set[0][0].operator
|
20
20
|
) {
|
21
|
+
let hint = range.raw[0];
|
22
|
+
|
23
|
+
if (hint !== '^' && hint !== '~') {
|
24
|
+
hint = '~';
|
25
|
+
}
|
26
|
+
|
21
27
|
// This behaviour can probably be removed in the next major.
|
22
|
-
newRange =
|
28
|
+
newRange = `${hint}${newVersion}`;
|
23
29
|
} else if (
|
24
30
|
// NOTE: wildcard range is empty string
|
25
31
|
// SEE: https://github.com/npm/node-semver/blob/bcab95a966413b978dc1e7bdbcb8f495b63303cd/test/ranges/to-comparators.js#L10-L12
|