Skip to content

Commit

Permalink
Merge pull request #24208 from storybookjs/norbert/filter-angular-pre…
Browse files Browse the repository at this point in the history
…release

Build: Filter `angular-cli/prerelease` in sandbox generation
(cherry picked from commit f49c9a2)
  • Loading branch information
ndelangen authored and storybook-bot committed Sep 19, 2023
1 parent b548171 commit 846c0b4
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/generate-sandboxes-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
run: yarn wait-on http://localhost:6001
working-directory: ./code
- name: Generate
run: yarn generate-sandboxes --local-registry
run: yarn generate-sandboxes --local-registry --exclude=angular-cli/prerelease
working-directory: ./code
- name: Publish
run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT}}@github.com/storybookjs/sandboxes.git --push --branch=main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-sandboxes-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
run: yarn wait-on http://localhost:6001
working-directory: ./code
- name: Generate
run: yarn generate-sandboxes --local-registry
run: yarn generate-sandboxes --local-registry --exclude=angular-cli/prerelease
working-directory: ./code
- name: Publish
run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT}}@github.com/storybookjs/sandboxes.git --push --branch=next
Expand Down
5 changes: 3 additions & 2 deletions code/lib/cli/src/sandbox-templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ const baseTemplates = {
builder: '@storybook/builder-webpack5',
},
skipTasks: ['e2e-tests-dev', 'bench'],
// TODO: Can be enabled once we re-revert this PR: https://github.com/storybookjs/storybook/pull/24033
// TODO: Should be removed after we merge this PR: https://github.com/storybookjs/storybook/pull/24188
inDevelopment: true,
},
'angular-cli/default-ts': {
Expand Down Expand Up @@ -575,7 +575,8 @@ export const merged: TemplateKey[] = [
];
export const daily: TemplateKey[] = [
...merged,
'angular-cli/prerelease',
// TODO: Should be re-added after we merge this PR: https://github.com/storybookjs/storybook/pull/24188
// 'angular-cli/prerelease',
'cra/default-js',
'react-vite/default-js',
'vue3-vite/default-js',
Expand Down
28 changes: 19 additions & 9 deletions scripts/sandbox/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,16 @@ const runGenerators = async (
};

export const options = createOptions({
template: {
type: 'string',
description: 'Which template would you like to create?',
templates: {
type: 'string[]',
description: 'Which templates would you like to create?',
values: Object.keys(sandboxTemplates),
},
exclude: {
type: 'string[]',
description: 'Space-delimited list of templates to exclude. Takes precedence over --templates',
promptType: false,
},
localRegistry: {
type: 'boolean',
description: 'Generate reproduction from local registry?',
Expand All @@ -220,7 +225,8 @@ export const options = createOptions({
});

export const generate = async ({
template,
templates,
exclude,
localRegistry,
debug,
}: OptionValues<typeof options>) => {
Expand All @@ -230,11 +236,11 @@ export const generate = async ({
...configuration,
}))
.filter(({ dirName }) => {
if (template) {
return dirName === template;
let include = Array.isArray(templates) ? templates.includes(dirName) : true;
if (Array.isArray(exclude) && include) {
include = !exclude.includes(dirName);
}

return true;
return include;
});

await runGenerators(generatorConfigs, localRegistry, debug);
Expand All @@ -243,7 +249,11 @@ export const generate = async ({
if (require.main === module) {
program
.description('Generate sandboxes from a set of possible templates')
.option('--template <template>', 'Create a single template')
.option('--templates [templates...]', 'Space-delimited list of templates to include')
.option(
'--exclude [templates...]',
'Space-delimited list of templates to exclude. Takes precedence over --templates'
)
.option('--debug', 'Print all the logs to the console')
.option('--local-registry', 'Use local registry', false)
.action((optionValues) => {
Expand Down
3 changes: 2 additions & 1 deletion scripts/tasks/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export const generate: Task = {
const { generate: generateRepro } = await import('../sandbox/generate');

await generateRepro({
template: details.key,
templates: [details.key],
exclude: [],
localRegistry: true,
debug: options.debug,
});
Expand Down

0 comments on commit 846c0b4

Please sign in to comment.