mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-04 23:11:23 +08:00
Merge pull request #18838 from storybookjs/rename-example-to-sandbox
Rename `example` => `sandbox`
This commit is contained in:
commit
5dd97a77b7
2
.gitignore
vendored
2
.gitignore
vendored
@ -8,6 +8,7 @@ dist
|
||||
.cache
|
||||
junit.xml
|
||||
/repros
|
||||
/sandbox
|
||||
|
||||
# Yarn stuff
|
||||
/**/.yarn/*
|
||||
@ -17,4 +18,3 @@ junit.xml
|
||||
!/**/.yarn/versions
|
||||
/**/.pnp.*
|
||||
/yarn.lock
|
||||
./examples/
|
@ -62,7 +62,6 @@
|
||||
"clean:dist": "del **/dist",
|
||||
"coverage": "codecov",
|
||||
"danger": "danger",
|
||||
"example": "ts-node ../scripts/example.ts",
|
||||
"generate-repros": "zx ../scripts/repros-generator/index.mjs",
|
||||
"github-release": "github-release-from-changelog",
|
||||
"linear-export": "ts-node --project=../scripts/tsconfig.json ../scripts/linear-export.ts",
|
||||
@ -80,6 +79,7 @@
|
||||
"publish:latest": "lerna publish --exact --concurrency 1 --force-publish",
|
||||
"publish:next": "npm run publish:latest -- --npm-tag=next",
|
||||
"run-chromatics": "node -r esm ../scripts/run-chromatics.js",
|
||||
"sandbox": "ts-node ../scripts/sandbox.ts",
|
||||
"serve-storybooks": "http-server ./built-storybooks -p 8001",
|
||||
"smoketest-storybooks": "cross-env STORYBOOK_DISPLAY_WARNING=true DISPLAY_WARNING=true node -r esm ../scripts/smoketest-storybooks.js",
|
||||
"start": "yarn workspace official-storybook storybook --no-manager-cache",
|
||||
|
@ -10,4 +10,4 @@ export const Button = ({ onClick, children }) => (
|
||||
Button.propTypes = {
|
||||
onClick: PropTypes.func.isRequired,
|
||||
children: PropTypes.node.isRequired,
|
||||
}
|
||||
};
|
||||
|
@ -25,14 +25,14 @@ const defaultAddons = [
|
||||
'toolbars',
|
||||
'viewport',
|
||||
];
|
||||
const examplesDir = path.resolve(__dirname, '../examples');
|
||||
const sandboxDir = path.resolve(__dirname, '../sandbox');
|
||||
const codeDir = path.resolve(__dirname, '../code');
|
||||
|
||||
// TODO -- how to encode this information
|
||||
const renderersMap = { react: 'react', angular: 'angular' };
|
||||
|
||||
async function getOptions() {
|
||||
return getOptionsOrPrompt('yarn example', {
|
||||
return getOptionsOrPrompt('yarn sandbox', {
|
||||
framework: {
|
||||
description: 'Which framework would you like to use?',
|
||||
values: frameworks,
|
||||
@ -48,14 +48,14 @@ async function getOptions() {
|
||||
promptType: (_, { framework }) => framework === 'react',
|
||||
},
|
||||
create: {
|
||||
description: 'Create the example from scratch (rather than degitting it)?',
|
||||
description: 'Create the template from scratch (rather than degitting it)?',
|
||||
},
|
||||
forceDelete: {
|
||||
description: 'Always delete an existing example, even if it has the same configuration?',
|
||||
description: 'Always delete an existing sandbox, even if it has the same configuration?',
|
||||
promptType: false,
|
||||
},
|
||||
forceReuse: {
|
||||
description: 'Always reuse an existing example, even if it has a different configuration?',
|
||||
description: 'Always reuse an existing sandbox, even if it has a different configuration?',
|
||||
promptType: false,
|
||||
},
|
||||
link: {
|
||||
@ -63,14 +63,14 @@ async function getOptions() {
|
||||
inverse: true,
|
||||
},
|
||||
start: {
|
||||
description: 'Start the example Storybook?',
|
||||
description: 'Start the Storybook?',
|
||||
inverse: true,
|
||||
},
|
||||
build: {
|
||||
description: 'Build the example Storybook?',
|
||||
description: 'Build the Storybook?',
|
||||
},
|
||||
watch: {
|
||||
description: 'Start building used packages in watch mode as well as the example Storybook?',
|
||||
description: 'Start building used packages in watch mode as well as the Storybook?',
|
||||
},
|
||||
dryRun: {
|
||||
description: "Don't execute commands, just list them (dry run)?",
|
||||
@ -81,7 +81,7 @@ async function getOptions() {
|
||||
const steps = {
|
||||
repro: {
|
||||
command: 'repro',
|
||||
description: 'Bootstrapping example',
|
||||
description: 'Bootstrapping Template',
|
||||
icon: '👷',
|
||||
hasArgument: true,
|
||||
options: {
|
||||
@ -105,13 +105,13 @@ const steps = {
|
||||
},
|
||||
build: {
|
||||
command: 'build',
|
||||
description: 'Building example',
|
||||
description: 'Building Storybook',
|
||||
icon: '🔨',
|
||||
options: {},
|
||||
},
|
||||
dev: {
|
||||
command: 'dev',
|
||||
description: 'Starting example',
|
||||
description: 'Starting Storybook',
|
||||
icon: '🖥 ',
|
||||
options: {},
|
||||
},
|
||||
@ -191,7 +191,7 @@ async function main() {
|
||||
const optionValues = await getOptions();
|
||||
|
||||
const { framework, forceDelete, forceReuse, link, dryRun } = optionValues;
|
||||
const cwd = path.join(examplesDir, framework);
|
||||
const cwd = path.join(sandboxDir, framework);
|
||||
|
||||
const exists = await pathExists(cwd);
|
||||
let shouldDelete = exists && !forceReuse;
|
||||
@ -213,7 +213,7 @@ async function main() {
|
||||
await executeCLIStep(steps.repro, {
|
||||
argument: cwd,
|
||||
optionValues: { template: framework },
|
||||
cwd: examplesDir,
|
||||
cwd: sandboxDir,
|
||||
dryRun,
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user