@medipass/checkout-sdk 3.3.0-beta.7 → 3.3.0-beta.9
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/scripts/release.mjs +31 -11
package/package.json
CHANGED
package/scripts/release.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/* eslint-disable no-undef */
|
|
3
3
|
|
|
4
|
-
import { execSync } from 'child_process';
|
|
4
|
+
import { execSync, spawnSync } from 'child_process';
|
|
5
5
|
import { readFileSync, writeFileSync } from 'fs';
|
|
6
6
|
import * as readline from 'readline';
|
|
7
7
|
|
|
@@ -24,6 +24,22 @@ const exec = (cmd, options = {}) => {
|
|
|
24
24
|
return execSync(cmd, { stdio: 'inherit', ...options });
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
const execInteractive = (cmd) => {
|
|
28
|
+
if (dryRun) {
|
|
29
|
+
console.log(`\n[DRY RUN] Would execute: ${cmd}`);
|
|
30
|
+
return { status: 0 };
|
|
31
|
+
}
|
|
32
|
+
console.log(`\n> ${cmd}`);
|
|
33
|
+
const result = spawnSync(cmd, {
|
|
34
|
+
stdio: 'inherit',
|
|
35
|
+
shell: true,
|
|
36
|
+
});
|
|
37
|
+
if (result.status !== 0) {
|
|
38
|
+
throw new Error(`Command failed with exit code ${result.status}`);
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
|
|
27
43
|
const execOutput = cmd => execSync(cmd, { encoding: 'utf-8' }).trim();
|
|
28
44
|
|
|
29
45
|
const getCurrentBranch = () => execOutput('git rev-parse --abbrev-ref HEAD');
|
|
@@ -252,16 +268,20 @@ const main = async () => {
|
|
|
252
268
|
console.log(`Created tag: ${tagName}`);
|
|
253
269
|
|
|
254
270
|
console.log('\n--- Publishing to NPM ---');
|
|
255
|
-
|
|
256
|
-
const otpFlag = otp.trim() ? ` --otp=${otp.trim()}` : '';
|
|
271
|
+
rl.close();
|
|
257
272
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
273
|
+
const publishCmd = releaseType === 'pre'
|
|
274
|
+
? 'npm publish --tag next --ignore-scripts --registry https://registry.npmjs.org/'
|
|
275
|
+
: 'npm publish --ignore-scripts --registry https://registry.npmjs.org/';
|
|
276
|
+
execInteractive(publishCmd);
|
|
277
|
+
|
|
278
|
+
const rl2 = readline.createInterface({
|
|
279
|
+
input: process.stdin,
|
|
280
|
+
output: process.stdout,
|
|
281
|
+
});
|
|
282
|
+
const question2 = prompt => new Promise(resolve => rl2.question(prompt, resolve));
|
|
283
|
+
|
|
284
|
+
const pushConfirm = await question2('\nPush commit and tag to remote? (y/n): ');
|
|
265
285
|
if (pushConfirm.toLowerCase() === 'y') {
|
|
266
286
|
exec('git push');
|
|
267
287
|
exec(`git push origin ${tagName}`);
|
|
@@ -275,7 +295,7 @@ const main = async () => {
|
|
|
275
295
|
console.log(` Install with: npm install @medipass/checkout-sdk@next`);
|
|
276
296
|
}
|
|
277
297
|
|
|
278
|
-
|
|
298
|
+
rl2.close();
|
|
279
299
|
};
|
|
280
300
|
|
|
281
301
|
main().catch(err => {
|