Skip to content

Commit

Permalink
Move all templates out of cli into renderers
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperpeulen committed Oct 30, 2022
1 parent 44abd49 commit d236c89
Show file tree
Hide file tree
Showing 165 changed files with 341 additions and 787 deletions.
7 changes: 7 additions & 0 deletions code/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,12 @@ module.exports = {
'no-undef': 'off', // ignore "window" undef errors
},
},
{
// Because those templates reference css files in other directory.
files: ['**/template/cli/**/*'],
rules: {
'import/no-unresolved': 'off',
},
},
],
};
14 changes: 8 additions & 6 deletions code/frameworks/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
"url": "https://opencollective.com/storybook"
},
"license": "MIT",
"main": "dist/types/index.js",
"module": "dist/types/index.js",
"types": "dist/types/index.d.ts",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist/**/*",
"template/**/*",
"README.md",
"*.js",
"*.d.ts"
],
"scripts": {
"check": "../../../scripts/node_modules/.bin/tsc --noEmit",
"prep": "node ../../../scripts/prepare.js"
"check": "../../../scripts/node_modules/.bin/tsc",
"prep": "rimraf dist && ../../../scripts/node_modules/.bin/tsc --project tsconfig.build.json && echo \"Preventing passing flags to tsc\""
},
"dependencies": {
"@storybook/addons": "7.0.0-alpha.46",
Expand Down Expand Up @@ -77,11 +77,13 @@
"@angular/platform-browser": "^13.3.6",
"@angular/platform-browser-dynamic": "^13.3.6",
"@nrwl/workspace": "14.6.1",
"@types/rimraf": "^3.0.2",
"@types/tmp": "^0.2.3",
"cross-spawn": "^7.0.3",
"jest": "^27.5.1",
"jest-preset-angular": "^12.0.0",
"jest-specific-snapshot": "^5.0.0",
"rimraf": "^3.0.2",
"tmp": "^0.2.1",
"typescript": "~4.6.3",
"webpack": "5",
Expand Down Expand Up @@ -119,6 +121,6 @@
"publishConfig": {
"access": "public"
},
"builders": "dist/types/builders/builders.json",
"builders": "dist/builders/builders.json",
"gitHead": "c64b5be851ed2affac56e1daaac3f453fbe6f230"
}
2 changes: 1 addition & 1 deletion code/frameworks/angular/preset.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./dist/types/preset');
module.exports = require('./dist/preset');
2 changes: 1 addition & 1 deletion code/frameworks/angular/renderer.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './dist/types/renderer.d';
export * from './dist/renderer.d';
2 changes: 1 addition & 1 deletion code/frameworks/angular/renderer.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./dist/types/renderer');
module.exports = require('./dist/renderer');
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { hasDocsOrControls } from '@storybook/docs-tools';

export const previewAnnotations: StorybookConfig['previewAnnotations'] = (entry = [], options) => {
if (!hasDocsOrControls(options)) return entry;
return [...entry, path.join(__dirname, '../../../dist/types/client/docs/config')];
return [...entry, path.join(__dirname, '../../dist/client/docs/config')];
};
5 changes: 5 additions & 0 deletions code/frameworks/angular/template/cli/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/consistent-type-imports": ["error", { "disallowTypeAnnotations": false }]
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class DocButtonComponent<T> {

/** Test null default value. */
@Input()
public aNullValue = null;
public aNullValue: string | null = null;

/** Test null default value. */
@Input()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class DocInjectableService {
/**
* Get posts from Backend.
*/
getPosts() {
getPosts(): unknown[] {
return [];
}
}
21 changes: 21 additions & 0 deletions code/frameworks/angular/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": "../../tsconfig.json",
"compileOnSave": false,
"compilerOptions": {
"target": "ES2020",
"module": "CommonJS",
"lib": ["es2020", "dom"],
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"declaration": true,
"outDir": "dist",
"types": ["node"],
"skipLibCheck": true,
"resolveJsonModule": true,
"allowJs": true,
"pretty": true,
"noErrorTruncation": true,
"listEmittedFiles": false
},
"include": ["src/**/*", "src/**/*.json"]
}
16 changes: 3 additions & 13 deletions code/frameworks/angular/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
{
"extends": "../../tsconfig.json",
"compileOnSave": false,
"extends": "./tsconfig.build.json",
"compilerOptions": {
"target": "ES2020",
"module": "CommonJS",
"lib": ["es2020", "dom"],
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"outDir": "dist",
"types": ["node"],
"skipLibCheck": true,
"resolveJsonModule": true,
"allowJs": true
"noEmit": true
},
"include": ["src/**/*", "src/**/*.json"]
"include": ["src/**/*", "src/**/*.json", "template/**/*"]
}
1 change: 1 addition & 0 deletions code/frameworks/ember/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"types": "dist/types/index.d.ts",
"files": [
"dist/**/*",
"template/**/*",
"README.md",
"*.js",
"*.d.ts"
Expand Down
1 change: 1 addition & 0 deletions code/frameworks/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"types": "dist/index.d.ts",
"files": [
"dist/**/*",
"template/**/*",
"types/**/*",
"README.md",
"*.js",
Expand Down
7 changes: 7 additions & 0 deletions code/frameworks/nextjs/template/cli/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"rules": {
"import/no-extraneous-dependencies": "off",
"import/extensions": "off",
"react/no-unknown-property": "off"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ export const Header = ({ user, onLogin, onLogout, onCreateAccount }) => (
);

Header.propTypes = {
user: PropTypes.shape({}),
user: PropTypes.shape({
name: PropTypes.string.isRequired,
}),
onLogin: PropTypes.func.isRequired,
onLogout: PropTypes.func.isRequired,
onCreateAccount: PropTypes.func.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ export const Page = () => {
</ul>
<p>
Get a guided tutorial on component-driven development at{' '}
<a href="https://storybook.js.org/tutorials/" target="_blank" rel="noopener noreferrer">
<a
href="code/frameworks/nextjs/template/cli/js/Page"
target="_blank"
rel="noopener noreferrer"
>
Storybook tutorials
</a>
. Read more in the{' '}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import { Button } from './Button';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ export const Page: React.VFC = () => {
</ul>
<p>
Get a guided tutorial on component-driven development at{' '}
<a href="https://storybook.js.org/tutorials/" target="_blank" rel="noopener noreferrer">
<a
href="frameworks/nextjs/template/cli/ts/Page"
target="_blank"
rel="noopener noreferrer"
>
Storybook tutorials
</a>
. Read more in the{' '}
Expand Down
2 changes: 1 addition & 1 deletion code/frameworks/nextjs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"resolveJsonModule": true,
"skipLibCheck": true
},
"include": ["src/**/*"],
"include": ["src/**/*", "template/**/*"],
"exclude": ["src/**/*.test.*", "src/**/__testfixtures__/**"]
}
49 changes: 0 additions & 49 deletions code/lib/cli/rendererAssets/aurelia/1-Button.stories.ts

This file was deleted.

28 changes: 0 additions & 28 deletions code/lib/cli/rendererAssets/aurelia/button.ts

This file was deleted.

20 changes: 0 additions & 20 deletions code/lib/cli/rendererAssets/marionette/index.stories.js

This file was deleted.

24 changes: 0 additions & 24 deletions code/lib/cli/rendererAssets/marko/1-Button.stories.js

This file was deleted.

13 changes: 0 additions & 13 deletions code/lib/cli/rendererAssets/marko/Button.marko

This file was deleted.

22 changes: 0 additions & 22 deletions code/lib/cli/rendererAssets/mithril/Button.js

This file was deleted.

Loading

0 comments on commit d236c89

Please sign in to comment.