Fix nightly release job (#28824)
Sebastian Silbermann committed
Apr 11, 2024 at 18:08 UTC
a2582074b84e95f8e9be6d9f51c80f09dd620ad7
1 file changed
+5
-3
scripts/release/publish-commands/publish-to-npm.js
+5
-3
@@ -2,10 +2,11 @@
2
3
'use strict';
4
5
+const {spawnSync} = require('child_process');
6
const {exec} = require('child-process-promise');
7
const {readJsonSync} = require('fs-extra');
8
const {join} = require('path');
8
-const {confirm, execRead} = require('../utils');
9
+const {confirm} = require('../utils');
10
const theme = require('../theme');
11
12
const run = async ({cwd, dry, tags, ci}, packageName, otp) => {
@@ -16,8 +17,9 @@ const run = async ({cwd, dry, tags, ci}, packageName, otp) => {
17
// If so we might be resuming from a previous run.
18
// We could infer this by comparing the build-info.json,
19
// But for now the easiest way is just to ask if this is expected.
19
- const info = await execRead(`npm view ${packageName}@${version}`);
20
- if (info) {
20
+ const {status} = spawnSync('npm', ['view', `${packageName}@${version}`]);
21
+ const packageExists = status === 0;
22
+ if (!packageExists) {
23
console.log(
24
theme`{package ${packageName}} {version ${version}} has already been published.`
25
);