Skip to content

Commit 9a4d090

Browse files
authored
Merge pull request #95 from greydaemon/DOT-4695
[DOT-4685] Add storybook cli changes for adding buildName flag
2 parents e11577a + 8194f94 commit 9a4d090

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

commands/storybook.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const { shortPolling } = require('./utils/polling');
1212
async function storybook(serve, options) {
1313
let type = /^https?:\/\//.test(serve) ? 'url' : 'dir';
1414
let storybookConfig = options.config ? options.config : defaultSmartUIConfig.storybook;
15+
const buildName = options.buildName? options.buildName : "";
1516

1617
if (type === 'url') {
1718
await validateStorybookUrl(serve);
@@ -130,7 +131,8 @@ async function storybook(serve, options) {
130131
commitAuthor: commit.author.name,
131132
commitMessage: commit.subject,
132133
githubURL: process.env.GITHUB_URL || '',
133-
}
134+
},
135+
buildName: buildName
134136
}
135137

136138
// Call static render API

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@ program.command('storybook')
3434
.argument('<url|directory>', 'Storybook url or static build directory')
3535
.option('-c --config <file>', 'Config file path')
3636
.option('--force-rebuild', 'Force a rebuild of an already existing build.', false)
37+
.option('--buildName <string>', 'Specify the build name for the pipeline')
3738
.action(async function(serve, options) {
3839
options.env = program.opts().env || 'prod';
3940

4041
console.log('SmartUI Storybook CLI v' + version);
4142
await checkUpdate(version, options);
4243
console.log('\n');
43-
44+
if (options.buildName === '') {
45+
console.log(`Error: The '--buildName' option cannot be an empty string.`);
46+
process.exit(1);
47+
}
4448
if (options.config) {
4549
options.config = validateConfig(options.config);
4650
}

0 commit comments

Comments
 (0)