monorepo-next 9.4.12 → 10.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monorepo-next",
3
- "version": "9.4.12",
3
+ "version": "10.0.0",
4
4
  "description": "Detach monorepo packages from normal linking",
5
5
  "bin": {
6
6
  "next": "bin/next.js"
@@ -55,7 +55,7 @@
55
55
  },
56
56
  "homepage": "https://github.com/CrowdStrike/monorepo-next#readme",
57
57
  "engines": {
58
- "node": ">=14.15"
58
+ "node": ">=16.13"
59
59
  },
60
60
  "dependencies": {
61
61
  "conventional-changelog": "3.1.25",
@@ -95,7 +95,7 @@
95
95
  "renovate-config-standard": "^2.0.0",
96
96
  "sinon": "^15.0.0",
97
97
  "sinon-chai": "^3.5.0",
98
- "standard-node-template": "3.2.1",
98
+ "standard-node-template": "3.3.0",
99
99
  "yargs-help-output": "^3.0.0"
100
100
  }
101
101
  }
package/src/process.js ADDED
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ const _execa = require('execa');
4
+
5
+ function prettyPrintArgs(args) {
6
+ return args?.map(arg => arg.toString().includes(' ') ? `'${arg}'` : arg);
7
+ }
8
+
9
+ function logArgs(command, args, options) {
10
+ console.log(...[command, prettyPrintArgs(args), options].filter(Boolean));
11
+ }
12
+
13
+ function prepareArgs(command, args, options = {}) {
14
+ if (!Array.isArray(args)) {
15
+ options = args;
16
+ args = null;
17
+ }
18
+
19
+ let {
20
+ silent,
21
+ dryRun,
22
+ ..._options
23
+ } = options;
24
+
25
+ if (!silent) {
26
+ logArgs(command, args, _options);
27
+ }
28
+
29
+ return {
30
+ args: [command, args, _options].filter(Boolean),
31
+ dryRun,
32
+ };
33
+ }
34
+
35
+ function bind(_execa) {
36
+ return function execa() {
37
+ let { args, dryRun } = prepareArgs(...arguments);
38
+
39
+ if (!dryRun) {
40
+ return _execa().apply(this, args);
41
+ }
42
+ };
43
+ }
44
+
45
+ const execa = bind(() => _execa);
46
+ execa.command = bind(() => _execa.command);
47
+
48
+ module.exports = {
49
+ execa,
50
+ };
package/src/release.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const path = require('path');
4
- const execa = require('execa');
4
+ const { execa } = require('./process');
5
5
  const {
6
6
  read: readJson,
7
7
  write: writeJson,
@@ -161,8 +161,10 @@ async function release({
161
161
  async function handleLifecycleScript(lifecycle) {
162
162
  let script = scripts[lifecycle];
163
163
  if (script) {
164
- await exec(execa.command, script, {
164
+ await execa.command(script, {
165
165
  shell: true,
166
+ silent,
167
+ dryRun,
166
168
  });
167
169
  }
168
170
  }
@@ -183,14 +185,14 @@ async function release({
183
185
 
184
186
  let previousCommit = await getCurrentCommit(workspaceCwd);
185
187
 
186
- await exec(execa, 'git', ['commit', '-m', commitMessage], { cwd: workspaceCwd });
188
+ await execa('git', ['commit', '-m', commitMessage], { cwd: workspaceCwd, silent, dryRun });
187
189
 
188
190
  await handleLifecycleScript('postcommit');
189
191
 
190
192
  await handleLifecycleScript('pretag');
191
193
 
192
194
  for (let tag of tags) {
193
- await exec(execa, 'git', ['tag', '-a', tag, '-m', tag], { cwd: workspaceCwd });
195
+ await execa('git', ['tag', '-a', tag, '-m', tag], { cwd: workspaceCwd, silent, dryRun });
194
196
  }
195
197
 
196
198
  await handleLifecycleScript('posttag');
@@ -257,14 +259,6 @@ async function release({
257
259
  }
258
260
  }
259
261
 
260
- function exec(execa, ...args) {
261
- if (dryRun) {
262
- _log(...args);
263
- } else {
264
- return execa.apply(this, args);
265
- }
266
- }
267
-
268
262
  function _log() {
269
263
  if (silent) {
270
264
  return;