Skip to content

Commit 4c3330d

Browse files
committed
Fix publishing script
1 parent 944f2b1 commit 4c3330d

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ on:
1111
- 'maintenance/**'
1212
paths:
1313
- '**/package.json'
14-
# Also trigger if the publish workflow itself is changed
14+
# Also trigger if the publish workflow/script itself is changed
1515
- '.github/workflows/publish.yml'
16+
- 'scripts/publish-updated-packages.ts'
1617

1718
jobs:
1819
publish:

scripts/publish-updated-packages.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ async function publishPackage(packagePath: string) {
5151
return;
5252
}
5353
exec('npm publish --provenance --access public', { cwd: packagePath }, (error, stdout, stderr) => {
54-
if (error || stderr) {
55-
reject(error || new Error(stderr));
54+
if (error) {
55+
reject(error);
5656
return;
5757
}
5858
console.log(`Successfully published package at ${packagePath}:`, stdout);
@@ -119,9 +119,9 @@ async function tryPublishExtension(): Promise<boolean> {
119119

120120
async function getVsceVersion(id: string): Promise<string> {
121121
return new Promise((resolve, reject) => {
122-
exec(`npx vsce show ${id} --json`, (error, stdout, stderr) => {
123-
if (error || stderr) {
124-
reject(error || new Error(stderr));
122+
exec(`npx vsce show ${id} --json`, (error, stdout) => {
123+
if (error) {
124+
reject(error);
125125
return;
126126
}
127127
const info = JSON.parse(stdout);
@@ -138,8 +138,8 @@ async function publishVsce(packagePath: string, fileName: string): Promise<void>
138138
return;
139139
}
140140
exec(`npx vsce publish ${fileName} -p ${process.env.VSCE_TOKEN}`, { cwd: packagePath }, (error, stdout, stderr) => {
141-
if (error || stderr) {
142-
reject(error || new Error(stderr));
141+
if (error) {
142+
reject(error);
143143
return;
144144
}
145145
console.log(`Successfully published VSCE extension at ${packagePath}:`, stdout);
@@ -151,8 +151,8 @@ async function publishVsce(packagePath: string, fileName: string): Promise<void>
151151
async function getOvsxVersion(id: string): Promise<string> {
152152
return new Promise((resolve, reject) => {
153153
exec(`npx ovsx get ${id} --metadata`, (error, stdout, stderr) => {
154-
if (error || stderr) {
155-
reject(error || new Error(stderr));
154+
if (error) {
155+
reject(error);
156156
return;
157157
}
158158
const info = JSON.parse(stdout);
@@ -169,8 +169,8 @@ async function publishOvsx(packagePath: string, fileName: string): Promise<void>
169169
return;
170170
}
171171
exec(`npx ovsx publish ${fileName} -p ${process.env.OVSX_TOKEN}`, { cwd: packagePath }, (error, stdout, stderr) => {
172-
if (error || stderr) {
173-
reject(error || new Error(stderr));
172+
if (error) {
173+
reject(error);
174174
return;
175175
}
176176
console.log(`Successfully published OVSX extension at ${packagePath}:`, stdout);

0 commit comments

Comments
 (0)