Skip to content

Commit

Permalink
Merge pull request #21 from kickstartDS/feature/upgrade-to-storybook7
Browse files Browse the repository at this point in the history
Upgrade addon to Storybook 7
  • Loading branch information
lmestel authored Sep 29, 2023
2 parents e0e5935 + ab560ea commit d7131ed
Show file tree
Hide file tree
Showing 26 changed files with 5,405 additions and 9,114 deletions.
19 changes: 0 additions & 19 deletions .babelrc.js

This file was deleted.

17 changes: 7 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,19 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Prepare repository
run: git fetch --unshallow --tags

- name: Use Node.js 14.x
uses: actions/setup-node@v1
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: "18.12"
cache: "yarn"

- name: Install dependencies
uses: bahmutov/npm-install@v1
run: yarn

- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
yarn release
run: yarn release
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.12
1 change: 0 additions & 1 deletion .prettierrc

This file was deleted.

7 changes: 0 additions & 7 deletions .storybook/main.js

This file was deleted.

15 changes: 15 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
stories: [
"../stories/**/*.mdx",
"../stories/**/*.stories.@(js|jsx|ts|tsx)",
],
addons: ["@storybook/addon-essentials", "../manager.js"],
framework: {
name: '@storybook/react-vite',
options: {}
},
};

export default config;
21 changes: 0 additions & 21 deletions .storybook/preview.js

This file was deleted.

20 changes: 20 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Preview } from '@storybook/react';
import { unpackDecorator } from "@kickstartds/core/lib/storybook";

import "@kickstartds/core/lib/design-tokens/tokens.css";
import "@kickstartds/base/lib/global/base.js";
import "@kickstartds/base/lib/global/base.css";

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
decorators: [unpackDecorator],
}

export default preview;
30 changes: 30 additions & 0 deletions bundle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const esbuild = require("esbuild");
const { nodeExternalsPlugin } = require("esbuild-node-externals");

/** @type import("esbuild").BuildOptions */
const sharedConfig = {
entryPoints: ["src/index.ts", "src/manager.ts"],
bundle: true,
platform: "browser",
minify: true,
plugins: [
nodeExternalsPlugin({
dependencies: true,
devDependencies: false,
peerDependencies: true,
}),
],
logLevel: "info",
};

esbuild.build({
...sharedConfig,
format: "esm",
outdir: "dist/esm",
splitting: true,
});
esbuild.build({
...sharedConfig,
format: "cjs",
outdir: "dist/cjs",
});
1 change: 1 addition & 0 deletions manager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./dist/esm/manager";
119 changes: 55 additions & 64 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,68 +13,72 @@
"type": "git",
"url": "https://github.com/kickstartDS/storybook-addon-jsonschema"
},
"author": "Jonas Ulrich | ruhmesmeile GmbH",
"license": "MIT",
"author": "Jonas Ulrich | ruhmesmeile GmbH",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/ts/index.d.ts",
"files": [
"dist/**/*",
"README.md",
"*.js",
"*.d.ts"
"dist",
"manager.js"
],
"scripts": {
"clean": "rimraf ./dist",
"buildBabel": "concurrently \"yarn buildBabel:cjs\" \"yarn buildBabel:esm\"",
"buildBabel:cjs": "babel ./src -d ./dist/cjs --extensions \".js,.jsx,.ts,.tsx\"",
"buildBabel:esm": "babel ./src -d ./dist/esm --env-name esm --extensions \".js,.jsx,.ts,.tsx\"",
"buildTsc": "tsc --declaration --emitDeclarationOnly --outDir ./dist/ts",
"prebuild": "yarn clean",
"prepare": "cp node_modules/@kickstartds/core/lib/storybook/helpers.js src/helpers.js",
"build": "concurrently \"yarn buildBabel\" \"yarn buildTsc\"",
"build:watch": "concurrently \"yarn buildBabel:esm -- --watch\" \"yarn buildTsc -- --watch\"",
"test": "echo \"Error: no test specified\" && exit 1",
"storybook": "start-storybook -p 6006",
"start": "concurrently \"yarn build:watch\" \"yarn storybook -- --no-manager-cache --quiet\"",
"build-storybook": "build-storybook",
"prerelease": "zx scripts/prepublish-checks.mjs",
"build": "yarn buildJs && yarn buildTsc",
"build-storybook": "storybook build",
"buildJs": "node bundle.js",
"buildTsc": "tsc --declaration --emitDeclarationOnly --outDir ./dist/ts",
"clean": "rimraf ./dist",
"prepare": "patch-package",
"release": "yarn build && auto shipit",
"eject-ts": "zx scripts/eject-typescript.mjs"
"start": "yarn build && yarn storybook",
"storybook": "storybook dev -p 6007",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {},
"devDependencies": {
"@babel/cli": "^7.12.1",
"@babel/core": "^7.12.3",
"@babel/preset-env": "^7.12.1",
"@babel/preset-react": "^7.12.5",
"@babel/preset-typescript": "^7.13.0",
"@kickstartds/base": "^1.6.0-next.0",
"@kickstartds/content": "^1.6.0-next.0",
"@kickstartds/core": "^1.6.0-next.0",
"@storybook/addon-essentials": "^6.4.19",
"@storybook/react": "^6.4.19",
"@types/styled-components": "^5.1.15",
"auto": "^10.3.0",
"babel-loader": "^8.1.0",
"boxen": "^5.0.1",
"concurrently": "^6.2.0",
"dedent": "^0.7.0",
"prettier": "^2.3.1",
"prop-types": "^15.7.2",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"rimraf": "^3.0.2",
"typescript": "^4.2.4",
"zx": "^1.14.1"
"@kickstartds/base": "^2.2.0",
"@kickstartds/content": "^2.1.0",
"@kickstartds/core": "^2.2.0",
"@kickstartds/json-schema-viewer": "^2.0.0",
"@monaco-editor/react": "^4.5.1",
"@storybook/addon-essentials": "^7.4.0",
"@storybook/builder-vite": "^7.4.0",
"@storybook/components": "^7.4.0",
"@storybook/manager-api": "^7.4.0",
"@storybook/react": "^7.4.0",
"@storybook/react-vite": "^7.4.0",
"@types/decomment": "^0.9.3",
"@types/json-schema": "^7.0.13",
"@types/react-dom": "^18.2.8",
"@types/react-router-dom": "^5.3.3",
"@types/styled-components": "^3.0.6",
"@vitejs/plugin-react": "^4.1.0",
"auto": "^11.0.4",
"decomment": "^0.9.5",
"esbuild": "^0.19.3",
"esbuild-node-externals": "^1.9.0",
"patch-package": "^8.0.0",
"prettier": "^3.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"rimraf": "^5.0.5",
"storybook": "^7.4.0",
"styled-components": "^3.2.6",
"typescript": "^5.2.2",
"vite": "^4.4.9"
},
"peerDependencies": {
"@storybook/addons": "^6.3.6",
"@storybook/api": "^6.3.6",
"@storybook/components": "^6.3.6",
"@storybook/core-events": "^6.3.6",
"@storybook/theming": "^6.3.6",
"react": "^16.8.0 || ^17.0.0",
"react-dom": "^16.8.0 || ^17.0.0"
"@storybook/api": "^7.0.0",
"@storybook/components": "^7.0.0",
"@storybook/core-events": "^7.0.0",
"@storybook/manager-api": "^7.0.0",
"@storybook/preview-api": "^7.0.0",
"@storybook/theming": "^7.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.2.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.2.0"
},
"peerDependenciesMeta": {
"react": {
Expand All @@ -85,7 +89,8 @@
}
},
"publishConfig": {
"access": "public"
"access": "public",
"registry": "https://registry.npmjs.org"
},
"storybook": {
"displayName": "JSON Schema",
Expand All @@ -95,19 +100,5 @@
"angular"
],
"icon": "https://opencollective-production.s3.us-west-1.amazonaws.com/1e445ca0-fca9-11e9-a830-c36c137aded5.png"
},
"dependencies": {
"@kickstartds/json-schema-viewer": "^1.1.0",
"@monaco-editor/react": "^4.3.1",
"@types/decomment": "^0.9.2",
"@types/js-yaml": "^4.0.3",
"@types/json-schema": "^7.0.9",
"@types/react-copy-to-clipboard": "^5.0.1",
"@types/react-dom": "^17.0.9",
"@types/react-router-dom": "^5.3.1",
"decomment": "^0.9.4",
"react-router": "^5.2.1",
"react-router-dom": "^5.3.0",
"styled-components": "^5.3.1"
}
}
26 changes: 26 additions & 0 deletions patches/decomment+0.9.5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/node_modules/decomment/lib/utils.js b/node_modules/decomment/lib/utils.js
index bca12da..b9daf81 100644
--- a/node_modules/decomment/lib/utils.js
+++ b/node_modules/decomment/lib/utils.js
@@ -1,7 +1,7 @@
'use strict';

const esprima = require('esprima');
-const os = require('os');
+// const os = require('os');

////////////////////////////////////////////////////
// Automatically calculates and returns End of Line,
@@ -20,9 +20,9 @@ function getEOL(text) {
}
idx++;
}
- if (unix === windows) {
- return os.EOL;
- }
+ // if (unix === windows) {
+ // return os.EOL;
+ // }
return unix > windows ? '\n' : '\r\n';
}

12 changes: 0 additions & 12 deletions preset.js

This file was deleted.

30 changes: 0 additions & 30 deletions scripts/eject-typescript.mjs

This file was deleted.

Loading

0 comments on commit d7131ed

Please sign in to comment.