mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 18:31:46 +08:00
Server CSF compiler generates double quote vs single quote strings
This commit is contained in:
parent
fe8c1e3f92
commit
17987f7b9f
@ -3,10 +3,10 @@
|
|||||||
exports[`json-to-csf-compiler a11y.json 1`] = `
|
exports[`json-to-csf-compiler a11y.json 1`] = `
|
||||||
"
|
"
|
||||||
export default {
|
export default {
|
||||||
title: 'Addons/a11y',
|
title: \\"Addons/a11y\\",
|
||||||
parameters: {
|
parameters: {
|
||||||
options: {
|
options: {
|
||||||
selectedPanel: 'storybook/a11y/panel'
|
selectedPanel: \\"storybook/a11y/panel\\"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -15,7 +15,7 @@ export const Label = (args) => {};
|
|||||||
Label.storyName = 'Label';
|
Label.storyName = 'Label';
|
||||||
Label.parameters = {
|
Label.parameters = {
|
||||||
server: {
|
server: {
|
||||||
id: 'addons/a11y/label'
|
id: \\"addons/a11y/label\\"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
"
|
"
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
exports[`json-to-csf-compiler actions.json 1`] = `
|
exports[`json-to-csf-compiler actions.json 1`] = `
|
||||||
"
|
"
|
||||||
export default {
|
export default {
|
||||||
title: 'Addons/Actions',
|
title: \\"Addons/Actions\\",
|
||||||
parameters: {
|
parameters: {
|
||||||
options: {
|
options: {
|
||||||
selectedPanel: 'storybook/actions/panel'
|
selectedPanel: \\"storybook/actions/panel\\"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -15,14 +15,14 @@ export const Multiple_actions_config = (args) => {};
|
|||||||
Multiple_actions_config.storyName = 'Multiple actions + config';
|
Multiple_actions_config.storyName = 'Multiple actions + config';
|
||||||
Multiple_actions_config.parameters = {
|
Multiple_actions_config.parameters = {
|
||||||
actions: [
|
actions: [
|
||||||
'click',
|
\\"click\\",
|
||||||
'contextmenu',
|
\\"contextmenu\\",
|
||||||
{
|
{
|
||||||
clearOnStoryChange: false
|
clearOnStoryChange: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
server: {
|
server: {
|
||||||
id: 'addons/actions/story3'
|
id: \\"addons/actions/story3\\"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
"
|
"
|
||||||
|
@ -3,16 +3,16 @@
|
|||||||
exports[`json-to-csf-compiler backgrounds.json 1`] = `
|
exports[`json-to-csf-compiler backgrounds.json 1`] = `
|
||||||
"
|
"
|
||||||
export default {
|
export default {
|
||||||
title: 'Addons/Backgrounds',
|
title: \\"Addons/Backgrounds\\",
|
||||||
parameters: {
|
parameters: {
|
||||||
backgrounds: [
|
backgrounds: [
|
||||||
{
|
{
|
||||||
name: 'light',
|
name: \\"light\\",
|
||||||
value: '#eeeeee'
|
value: \\"#eeeeee\\"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'dark',
|
name: \\"dark\\",
|
||||||
value: '#222222',
|
value: \\"#222222\\",
|
||||||
default: true
|
default: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -23,7 +23,7 @@ export const Story_1 = (args) => {};
|
|||||||
Story_1.storyName = 'Story 1';
|
Story_1.storyName = 'Story 1';
|
||||||
Story_1.parameters = {
|
Story_1.parameters = {
|
||||||
server: {
|
server: {
|
||||||
id: 'addons/backgrounds/story1'
|
id: \\"addons/backgrounds/story1\\"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
"
|
"
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
exports[`json-to-csf-compiler controls.json 1`] = `
|
exports[`json-to-csf-compiler controls.json 1`] = `
|
||||||
"
|
"
|
||||||
export default {
|
export default {
|
||||||
title: 'Addons/Controls',
|
title: \\"Addons/Controls\\",
|
||||||
parameters: {
|
parameters: {
|
||||||
options: {
|
options: {
|
||||||
selectedPanel: 'storybook/controls/panel'
|
selectedPanel: \\"storybook/controls/panel\\"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -15,44 +15,44 @@ export const Simple = (args) => {};
|
|||||||
Simple.storyName = 'Simple';
|
Simple.storyName = 'Simple';
|
||||||
Simple.parameters = {
|
Simple.parameters = {
|
||||||
server: {
|
server: {
|
||||||
id: 'addons/controls/simple'
|
id: \\"addons/controls/simple\\"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Simple.args = {
|
Simple.args = {
|
||||||
name: 'John Doe',
|
name: \\"John Doe\\",
|
||||||
birthday: '1960-12-25T00:42:03.600Z',
|
birthday: \\"1960-12-25T00:42:03.600Z\\",
|
||||||
favorite_color: 'red',
|
favorite_color: \\"red\\",
|
||||||
active: true,
|
active: true,
|
||||||
pets: 2,
|
pets: 2,
|
||||||
sports: [
|
sports: [
|
||||||
'football',
|
\\"football\\",
|
||||||
'baseball'
|
\\"baseball\\"
|
||||||
],
|
],
|
||||||
favorite_food: 'Ice Cream',
|
favorite_food: \\"Ice Cream\\",
|
||||||
other_things: {
|
other_things: {
|
||||||
hair: 'Brown',
|
hair: \\"Brown\\",
|
||||||
eyes: 'Blue'
|
eyes: \\"Blue\\"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Simple.argTypes = {
|
Simple.argTypes = {
|
||||||
birthday: {
|
birthday: {
|
||||||
control: {
|
control: {
|
||||||
type: 'date'
|
type: \\"date\\"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
favorite_color: {
|
favorite_color: {
|
||||||
control: {
|
control: {
|
||||||
type: 'color'
|
type: \\"color\\"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
favorite_food: {
|
favorite_food: {
|
||||||
control: {
|
control: {
|
||||||
type: 'select',
|
type: \\"select\\",
|
||||||
options: {
|
options: {
|
||||||
hot_dog: 'Hot Dog',
|
hot_dog: \\"Hot Dog\\",
|
||||||
pizza: 'Pizza',
|
pizza: \\"Pizza\\",
|
||||||
burgers: 'Burgers',
|
burgers: \\"Burgers\\",
|
||||||
ice_cream: 'Ice Cream'
|
ice_cream: \\"Ice Cream\\"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,25 +3,25 @@
|
|||||||
exports[`json-to-csf-compiler kitchen_sink.json 1`] = `
|
exports[`json-to-csf-compiler kitchen_sink.json 1`] = `
|
||||||
"
|
"
|
||||||
export default {
|
export default {
|
||||||
title: 'Kitchen Sink',
|
title: \\"Kitchen Sink\\",
|
||||||
parameters: {
|
parameters: {
|
||||||
backgrounds: [
|
backgrounds: [
|
||||||
{
|
{
|
||||||
name: 'light',
|
name: \\"light\\",
|
||||||
value: '#eeeeee'
|
value: \\"#eeeeee\\"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'dark',
|
name: \\"dark\\",
|
||||||
value: '#222222',
|
value: \\"#222222\\",
|
||||||
default: true
|
default: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
options: {
|
options: {
|
||||||
selectedPanel: 'storybook/a11y/panel'
|
selectedPanel: \\"storybook/a11y/panel\\"
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
params: {
|
params: {
|
||||||
color: 'red'
|
color: \\"red\\"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,21 +31,21 @@ export const Heading = (args) => {};
|
|||||||
Heading.storyName = 'Heading';
|
Heading.storyName = 'Heading';
|
||||||
Heading.parameters = {
|
Heading.parameters = {
|
||||||
actions: [
|
actions: [
|
||||||
'click',
|
\\"click\\",
|
||||||
'contextmenu',
|
\\"contextmenu\\",
|
||||||
{
|
{
|
||||||
clearOnStoryChange: false
|
clearOnStoryChange: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
server: {
|
server: {
|
||||||
id: 'demo/heading',
|
id: \\"demo/heading\\",
|
||||||
params: {
|
params: {
|
||||||
color: 'orange'
|
color: \\"orange\\"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Heading.args = {
|
Heading.args = {
|
||||||
name: 'John Doe',
|
name: \\"John Doe\\",
|
||||||
age: 44
|
age: 44
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ export const Button = (args) => {};
|
|||||||
Button.storyName = 'Button';
|
Button.storyName = 'Button';
|
||||||
Button.parameters = {
|
Button.parameters = {
|
||||||
server: {
|
server: {
|
||||||
id: 'demo/button'
|
id: \\"demo/button\\"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
"
|
"
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
exports[`json-to-csf-compiler links.json 1`] = `
|
exports[`json-to-csf-compiler links.json 1`] = `
|
||||||
"
|
"
|
||||||
export default {
|
export default {
|
||||||
title: 'Welcome',
|
title: \\"Welcome\\",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Welcome = (args) => {};
|
export const Welcome = (args) => {};
|
||||||
Welcome.storyName = 'Welcome';
|
Welcome.storyName = 'Welcome';
|
||||||
Welcome.parameters = {
|
Welcome.parameters = {
|
||||||
server: {
|
server: {
|
||||||
id: 'welcome/welcome'
|
id: \\"welcome/welcome\\"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
"
|
"
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
exports[`json-to-csf-compiler multiple_stories.json 1`] = `
|
exports[`json-to-csf-compiler multiple_stories.json 1`] = `
|
||||||
"
|
"
|
||||||
export default {
|
export default {
|
||||||
title: 'Demo',
|
title: \\"Demo\\",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Heading = (args) => {};
|
export const Heading = (args) => {};
|
||||||
Heading.storyName = 'Heading';
|
Heading.storyName = 'Heading';
|
||||||
Heading.parameters = {
|
Heading.parameters = {
|
||||||
server: {
|
server: {
|
||||||
id: 'demo/heading'
|
id: \\"demo/heading\\"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ export const Headings = (args) => {};
|
|||||||
Headings.storyName = 'Headings';
|
Headings.storyName = 'Headings';
|
||||||
Headings.parameters = {
|
Headings.parameters = {
|
||||||
server: {
|
server: {
|
||||||
id: 'demo/headings'
|
id: \\"demo/headings\\"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ export const Button = (args) => {};
|
|||||||
Button.storyName = 'Button';
|
Button.storyName = 'Button';
|
||||||
Button.parameters = {
|
Button.parameters = {
|
||||||
server: {
|
server: {
|
||||||
id: 'demo/button'
|
id: \\"demo/button\\"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
"
|
"
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
exports[`json-to-csf-compiler params.json 1`] = `
|
exports[`json-to-csf-compiler params.json 1`] = `
|
||||||
"
|
"
|
||||||
export default {
|
export default {
|
||||||
title: 'Params',
|
title: \\"Params\\",
|
||||||
parameters: {
|
parameters: {
|
||||||
server: {
|
server: {
|
||||||
params: {
|
params: {
|
||||||
color: 'red'
|
color: \\"red\\"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -17,9 +17,9 @@ export const Story = (args) => {};
|
|||||||
Story.storyName = 'Story';
|
Story.storyName = 'Story';
|
||||||
Story.parameters = {
|
Story.parameters = {
|
||||||
server: {
|
server: {
|
||||||
id: 'params/story',
|
id: \\"params/story\\",
|
||||||
params: {
|
params: {
|
||||||
message: 'Hello World'
|
message: \\"Hello World\\"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
exports[`json-to-csf-compiler params_override.json 1`] = `
|
exports[`json-to-csf-compiler params_override.json 1`] = `
|
||||||
"
|
"
|
||||||
export default {
|
export default {
|
||||||
title: 'Params',
|
title: \\"Params\\",
|
||||||
parameters: {
|
parameters: {
|
||||||
server: {
|
server: {
|
||||||
params: {
|
params: {
|
||||||
color: 'red'
|
color: \\"red\\"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -17,10 +17,10 @@ export const Override = (args) => {};
|
|||||||
Override.storyName = 'Override';
|
Override.storyName = 'Override';
|
||||||
Override.parameters = {
|
Override.parameters = {
|
||||||
server: {
|
server: {
|
||||||
id: 'params/override',
|
id: \\"params/override\\",
|
||||||
params: {
|
params: {
|
||||||
message: 'Hello World',
|
message: \\"Hello World\\",
|
||||||
color: 'green'
|
color: \\"green\\"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,7 @@ const { identifier } = require('safe-identifier');
|
|||||||
|
|
||||||
export function stringifyObject(object: any, level = 0, excludeOuterParams = false): string {
|
export function stringifyObject(object: any, level = 0, excludeOuterParams = false): string {
|
||||||
if (typeof object === 'string') {
|
if (typeof object === 'string') {
|
||||||
return `'${object}'`;
|
return `"${object}"`;
|
||||||
}
|
}
|
||||||
const indent = ' '.repeat(level);
|
const indent = ' '.repeat(level);
|
||||||
if (Array.isArray(object)) {
|
if (Array.isArray(object)) {
|
||||||
@ -53,7 +53,7 @@ export function stringifyDefault(section: StorybookSection): string {
|
|||||||
|
|
||||||
return dedent`
|
return dedent`
|
||||||
export default {
|
export default {
|
||||||
title: '${title}',${decoratorsString}${optionsString}
|
title: "${title}",${decoratorsString}${optionsString}
|
||||||
};
|
};
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user