Skip to content

Commit

Permalink
feat(esm): include ESM and CommonJS builds (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbardini authored May 15, 2021
1 parent ef03e9d commit 653dd06
Show file tree
Hide file tree
Showing 18 changed files with 11,627 additions and 2,572 deletions.
14 changes: 0 additions & 14 deletions .babelrc

This file was deleted.

33 changes: 33 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const presetEnvOptions = {
bugfixes: true,
corejs: '3',
modules: false,
shippedProposals: true,
targets: 'defaults',
useBuiltIns: 'usage',
};

module.exports = {
assumptions: {
noDocumentAll: true,
privateFieldsAsProperties: true,
setClassMethods: true,
setComputedProperties: true,
setPublicClassFields: true,
setSpreadProperties: true,
},
env: {
cjs: {
presets: [
['@babel/preset-env', { ...presetEnvOptions, modules: 'cjs' }],
'@babel/preset-typescript',
'@babel/preset-react',
],
},
},
presets: [
['@babel/preset-env', presetEnvOptions],
'@babel/preset-typescript',
'@babel/preset-react',
],
};
12 changes: 9 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"airbnb",
"prettier",
"prettier/react"
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand All @@ -24,8 +24,14 @@
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-use-before-define": "error",
"import/extensions": ["error", "ignorePackages", { "tsx": "never" }],
"import/extensions": [
"error",
"ignorePackages",
{ "js": "never", "tsx": "never" }
],
"import/prefer-default-export": "off",
"no-undef": "off",
"no-unused-vars": "off",
"no-use-before-define": "off",
"react/jsx-filename-extension": [
"error",
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: 12
node-version: 14

- name: Install
run: npm ci
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
.vscode
dist
node_modules
Expand Down
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no lint-staged
5 changes: 0 additions & 5 deletions .huskyrc

This file was deleted.

12 changes: 6 additions & 6 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
"storybook": "start-storybook -s public -p 6006"
},
"dependencies": {
"react": "^17.0.0",
"react-dom": "^17.0.0"
"react": "^16.8.0",
"react-dom": "^16.8.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@storybook/addon-storysource": "^6.0.0",
"@storybook/addons": "^6.0.0",
"@storybook/react": "^6.0.0",
"@storybook/theming": "^6.0.0",
"@storybook/addon-storysource": "^6.2.0",
"@storybook/addons": "^6.2.0",
"@storybook/react": "^6.2.0",
"@storybook/theming": "^6.2.0",
"babel-loader": "^8.0.0",
"storybook-addon-paddings": "file:../"
}
Expand Down
2 changes: 1 addition & 1 deletion example/src/Card.stories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Card from './Card.js';
import Card from './Card';

export default {
title: 'Example',
Expand Down
Loading

0 comments on commit 653dd06

Please sign in to comment.