Skip to content

Commit

Permalink
feat(storybook): addressed comments from yann
Browse files Browse the repository at this point in the history
  • Loading branch information
katerina committed Jun 22, 2021
1 parent 9446ba1 commit fd82068
Show file tree
Hide file tree
Showing 14 changed files with 805 additions and 57 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@
"@rollup/plugin-node-resolve": "7.1.1",
"@schematics/angular": "^12.0.0",
"@storybook/addon-controls": "^6.2.9",
"@storybook/addon-knobs": "^6.2.7",
"@storybook/angular": "^6.2.7",
"@storybook/addon-essentials": "^6.2.9",
"@storybook/addon-knobs": "^6.2.9",
"@storybook/angular": "^6.2.9",
"@storybook/core": "^6.0.21",
"@storybook/react": "^6.2.7",
"@storybook/react": "^6.2.9",
"@svgr/webpack": "^5.4.0",
"@tailwindcss/typography": "^0.4.0",
"@testing-library/react": "11.2.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ export default {
imports: [],
})
],
} as Meta;
} as Meta<<%=componentName%>>;

const Template: Story<<%=componentName%>> = (args: <%=componentName%>) => ({
component: <%=componentName%>,
props: args,
});


export const primary = Template.bind({});
primary.args = {<% for (let prop of props) { %>
export const Primary = Template.bind({});
Primary.args = {<% for (let prop of props) { %>
<%= prop.name %>: <%- prop.defaultValue %>,<% } %>
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {

const Template: Story<<%= propsTypeName %>> = (args) => <<%= componentName %> {...args} />;

export const primary = Template.bind({})
primary.args = {<% for (let prop of props) { %>
export const Primary = Template.bind({})
Primary.args = {<% for (let prop of props) { %>
<%= prop.name %>: <%- prop.defaultValue %>,<% } %>
}
4 changes: 2 additions & 2 deletions packages/storybook/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"update-11-6-0": {
"version": "11.6.4",
"cli": "nx",
"description": "Update storybook if installed and above 6 but below 6.2.7",
"description": "Update storybook if installed and above 6 but below 6.2.9",
"factory": "./src/migrations/update-11-6-0/update-storybook"
},
"update-12-1-0": {
Expand All @@ -46,7 +46,7 @@
"update-12-3-0": {
"version": "12.3.0-rc.1",
"cli": "nx",
"description": "Update storybook if installed and above 6 but below 6.2.7",
"description": "Update storybook if installed and above 6 but below 6.2.9",
"factory": "./src/migrations/update-11-6-0/update-storybook"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ describe('Build storybook', () => {
beforeEach(async () => {
jest.spyOn(fileUtils, 'readPackageJson').mockReturnValue({
devDependencies: {
'@storybook/addon-essentials': '^6.2.7',
'@storybook/angular': '^6.2.7',
'@storybook/addon-essentials': '^6.2.9',
'@storybook/angular': '^6.2.9',
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ describe('@nrwl/storybook:storybook', () => {
beforeEach(() => {
jest.spyOn(fileUtils, 'readPackageJson').mockReturnValue({
devDependencies: {
'@storybook/addon-essentials': '^6.2.7',
'@storybook/angular': '^6.2.7',
'@storybook/addon-essentials': '^6.2.9',
'@storybook/angular': '^6.2.9',
},
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
stories: [],
addons: ['@storybook/addon-controls'],
addons: ['@storybook/addon-essentials'],
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Object {
},
"devDependencies": Object {
"@angular/forms": "*",
"@nrwl/storybook": "^6.2.7",
"@storybook/addon-knobs": "^6.2.7",
"@storybook/angular": "^6.2.7",
"@storybook/builder-webpack5": "^6.2.7",
"@nrwl/storybook": "^6.2.9",
"@storybook/addon-knobs": "^6.2.9",
"@storybook/angular": "^6.2.9",
"@storybook/builder-webpack5": "^6.2.9",
"existing": "1.0.0",
},
"name": "test-name",
Expand Down
6 changes: 3 additions & 3 deletions packages/storybook/src/generators/init/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ function checkDependenciesInstalled(host: Tree, schema: Schema) {
*/

if (
!packageJson.dependencies['@storybook/addon-controls'] &&
!packageJson.devDependencies['@storybook/addon-controls']
!packageJson.dependencies['@storybook/addon-essentials'] &&
!packageJson.devDependencies['@storybook/addon-essentials']
) {
devDependencies['@storybook/addon-controls'] = storybookVersion;
devDependencies['@storybook/addon-essentials'] = storybookVersion;
}

if (isFramework('angular', schema)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('Update 11-6-0/12-3-0', () => {
tree = createTree();
});

it('should update storybook versions if storybook is already above 6 but below 6.2.7', async () => {
it('should update storybook versions if storybook is already above 6 but below 6.2.9', async () => {
writeJson(tree, 'package.json', {
devDependencies: {
'@storybook/angular': '^6.0.0',
Expand All @@ -21,10 +21,10 @@ describe('Update 11-6-0/12-3-0', () => {
await updateStorybook(tree);
expect(
readJson(tree, 'package.json').devDependencies['@storybook/angular']
).toBe('^6.2.7');
).toBe('^6.2.9');
});

it('should not update storybook versions if storybook is already above 6.2.7', async () => {
it('should not update storybook versions if storybook is already above 6.2.9', async () => {
writeJson(tree, 'package.json', {
devDependencies: {
'@storybook/angular': '6.2.8',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function maybeUpdateVersion(tree: Tree) {
storybookPackageName,
json.dependencies[storybookPackageName]
);
if (gte(version, '6.0.0') && lt(version, '6.2.7')) {
json.dependencies[storybookPackageName] = '^6.2.7';
if (gte(version, '6.0.0') && lt(version, '6.2.9')) {
json.dependencies[storybookPackageName] = '^6.2.9';
needsInstall = true;
}
}
Expand All @@ -36,8 +36,8 @@ function maybeUpdateVersion(tree: Tree) {
storybookPackageName,
json.devDependencies[storybookPackageName]
);
if (gte(version, '6.0.0') && lt(version, '6.2.7')) {
json.devDependencies[storybookPackageName] = '^6.2.7';
if (gte(version, '6.0.0') && lt(version, '6.2.9')) {
json.devDependencies[storybookPackageName] = '^6.2.9';
needsInstall = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/storybook/src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const nxVersion = '*';
export const storybookVersion = '^6.2.7';
export const storybookVersion = '^6.2.9';
export const babelCoreVersion = '7.12.13';
export const babelLoaderVersion = '8.1.0';
export const babelPresetTypescriptVersion = '7.12.13';
Expand Down
2 changes: 1 addition & 1 deletion scripts/depcheck/missing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const IGNORE_MATCHES = {
'@angular-devkit/core',
'@angular-devkit/schematics',
'@storybook/addon-knobs',
'@storybook/addon-controls',
'@storybook/addon-essentials',
'@storybook/core',
'rxjs',
],
Expand Down

0 comments on commit fd82068

Please sign in to comment.