Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 898591d

Browse files
author
David Dooling
committed
Make npm scripts optional
[changelog:changed]
1 parent 77272a8 commit 898591d

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

lib/configuration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
export interface Configuration {
1818
publish: string;
19-
scripts: string[];
19+
scripts?: string[];
2020
version?: string;
2121
access?: string;
2222
tag?: string[];

lib/events.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,17 @@ const PrepareStep: NpmStep = {
143143
}
144144

145145
// raise the check
146+
const body =
147+
ctx.configuration?.parameters?.scripts?.length > 0
148+
? `Running \`npm run --if-present ${ctx.configuration?.parameters?.scripts?.join(
149+
" ",
150+
)}\``
151+
: `Running npm Build`;
146152
params.check = await github.createCheck(ctx, params.project.id, {
147153
sha: commit.sha,
148154
title: "npm run",
149155
name: `${ctx.skill.name}/${ctx.configuration?.name}/run`,
150-
body: `Running \`npm run --if-present ${ctx.configuration?.parameters?.scripts.join(
151-
" ",
152-
)}\``,
156+
body,
153157
});
154158

155159
return status.success();
@@ -277,7 +281,7 @@ const NpmScriptsStep: NpmStep = {
277281
?.after ||
278282
(ctx.data as subscription.types.OnTagSubscription).Tag?.[0]?.commit;
279283
const cfg = ctx.configuration?.parameters;
280-
const scripts = cfg.scripts;
284+
const scripts = cfg.scripts || [];
281285

282286
// Run scripts
283287
for (const script of scripts) {

skill.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export const Skill = skill<
6969
type: ParameterType.StringArray,
7070
displayName: "npm scripts",
7171
description: "Provide name of npm scripts to run in order",
72-
required: true,
72+
required: false,
7373
},
7474
version: {
7575
type: ParameterType.String,

0 commit comments

Comments
 (0)