Skip to content

Commit

Permalink
Merge pull request #30 from TheComputerM/main
Browse files Browse the repository at this point in the history
Add ESM support
  • Loading branch information
shilman authored Jun 10, 2021
2 parents fdac2e5 + 660a852 commit 9b7a7fd
Show file tree
Hide file tree
Showing 5 changed files with 560 additions and 517 deletions.
12 changes: 12 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
module.exports = {
presets: ['@babel/preset-env', '@babel/preset-typescript'],
env: {
esm: {
presets: [
[
'@babel/env',
{
modules: false,
},
],
],
},
},
};
46 changes: 25 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,27 @@
"url": "https://github.com/storybookjs/addon-svelte-csf"
},
"license": "MIT",
"main": "dist/preset",
"browser": "dist/index.js",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"browser": "dist/cjs/index.js",
"files": [
"dist/**/*",
"README.md",
"*.js"
"*.js",
"*.d.ts"
],
"scripts": {
"clean": "rimraf ./dist",
"build": "babel ./src --out-dir ./dist --extensions .ts --extensions .js --copy-files",
"prepublish": "npm run clean && npm run build",
"build": "concurrently \"yarn build:cjs\" \"yarn build:esm\"",
"build:cjs": "babel ./src -d ./dist/cjs --extensions \".js,.ts\" --copy-files",
"build:esm": "babel ./src -d ./dist/esm --env-name esm --extensions \".js,.ts\" --copy-files",
"prepublish": "yarn clean && yarn build",
"test": "jest",
"lint": "eslint --cache --cache-location=.cache/eslint --ext .js,.jsx,.json,.html,.ts,.tsx,.mjs --report-unused-disable-directives",
"storybook": "start-storybook -p 6006",
"start": "concurrently \"npm run storybook -- --no-manager-cache --quiet\" \"npm run build -- --watch\"",
"start": "concurrently \"yarn storybook -- --no-manager-cache --quiet\" \"yarn build -- --watch\"",
"build-storybook": "build-storybook",
"release": "npm run build && auto shipit --base-branch=main"
"release": "yarn && auto shipit --base-branch=main"
},
"dependencies": {
"ts-dedent": "^2.0.0"
Expand All @@ -38,16 +42,16 @@
"@babel/preset-env": "^7.12.1",
"@babel/preset-react": "^7.12.5",
"@babel/preset-typescript": "^7.12.5",
"@storybook/addon-essentials": "^6.2.1",
"@storybook/addon-knobs": "^6.2.1",
"@storybook/addon-storyshots": "^6.2.1",
"@storybook/eslint-config-storybook": "^2.4.0",
"@storybook/svelte": "^6.2.1",
"@storybook/addon-essentials": "^6.2.9",
"@storybook/addon-knobs": "^6.2.9",
"@storybook/addon-storyshots": "^6.2.9",
"@storybook/eslint-config-storybook": "^3.0.0",
"@storybook/svelte": "^6.2.9",
"auto": "^10.3.0",
"babel-jest": "^26.6.3",
"babel-loader": "^8.1.0",
"chromatic": "^5.6.1",
"concurrently": "^5.3.0",
"concurrently": "^6.2.0",
"eslint": "^7.17.0",
"jest": "^26.6.3",
"jest-environment-jsdom-thirteen": "^1.0.1",
Expand All @@ -61,14 +65,14 @@
"typescript": "^3.3.3333"
},
"peerDependencies": {
"@storybook/addons": "^6.2.1",
"@storybook/api": "^6.2.1",
"@storybook/client-api": "^6.2.1",
"@storybook/client-logger": "^6.2.1",
"@storybook/components": "^6.2.1",
"@storybook/core-events": "^6.2.1",
"@storybook/svelte": "^6.2.1",
"@storybook/theming": "^6.2.1",
"@storybook/addons": "^6.2.9",
"@storybook/api": "^6.2.9",
"@storybook/client-api": "^6.2.9",
"@storybook/client-logger": "^6.2.9",
"@storybook/components": "^6.2.9",
"@storybook/core-events": "^6.2.9",
"@storybook/svelte": "^6.2.9",
"@storybook/theming": "^6.2.9",
"react": "^16.8.0 || ^17.0.0",
"react-dom": "^16.8.0 || ^17.0.0",
"svelte": "^3.35.0",
Expand Down
2 changes: 1 addition & 1 deletion preset.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./dist/preset');
module.exports = require('./dist/cjs/preset');
7 changes: 7 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
export { default as Meta } from './components/Meta.svelte';
export { default as Story } from './components/Story.svelte';
export { default as Template } from './components/Template.svelte';

if (module && module.hot && module.hot.decline) {
module.hot.decline();
}

// make it work with --isolatedModules
export default {};
Loading

0 comments on commit 9b7a7fd

Please sign in to comment.