Skip to content

Commit

Permalink
Adopt babel7 and add video and source tag
Browse files Browse the repository at this point in the history
  • Loading branch information
HillLiu committed Feb 20, 2019
1 parent 1367691 commit 8bd3f3b
Show file tree
Hide file tree
Showing 50 changed files with 1,878 additions and 1,170 deletions.
10 changes: 0 additions & 10 deletions .babelrc

This file was deleted.

65 changes: 65 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
module.exports = function(api) {
api.cache(true);
return {
env: {
build: {
presets: [
[
'@babel/preset-env',
{
targets: ['last 2 versions', 'ie >= 8'],
},
],
'@babel/preset-react',
],
plugins: [
'add-module-exports',
'dynamic-import-node',
'transform-react-pure-class-to-function',
['transform-react-remove-prop-types', {mode: 'wrap'}],
[
'reshow-transform-runtime',
{
regenerator: false,
},
],
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-react-constant-elements',
'@babel/plugin-transform-object-assign',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-class-properties',
],
},
es: {
presets: [
[
'@babel/preset-env',
{
modules: false,
targets: ['last 2 versions', 'ie >= 8'],
},
],
'@babel/preset-react',
],
plugins: [
'transform-react-pure-class-to-function',
['transform-react-remove-prop-types', {mode: 'wrap'}],
[
'reshow-transform-runtime',
{
regenerator: false,
useESModules: true,
},
],
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-object-assign',
'@babel/plugin-transform-react-constant-elements',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-class-properties',
],
},
},
};
};
36 changes: 26 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
{
"name": "react-atomic-atom",
"version": "1.0.18",
"version": "2.0.0",
"description": "Atomic design in React (atoms)",
"main": "./build/src/index.js",
"main": "./build/cjs/src/index.js",
"module": "./build/es/src/index.js",
"repository": "react-atomic/react-atomic-atom",
"keywords": [
"reactjs"
],
"author": "Hill <hill@kimo.com>",
"license": "MIT",
"dependencies": {
"reshow-runtime": "*"
},
"devDependencies": {
"babel-cli": "^6.x",
"babel-core": "^6.x",
"babel-plugin-add-module-exports": "^0.1.2",
"babel-preset-env": "*",
"babel-preset-react": "^6.x",
"babel-preset-stage-0": "^6.x",
"@babel/cli": "^7.x",
"@babel/core": "^7.x",
"@babel/plugin-proposal-class-properties": "*",
"@babel/plugin-proposal-export-default-from": "*",
"@babel/plugin-proposal-object-rest-spread": "*",
"@babel/plugin-syntax-dynamic-import": "*",
"@babel/plugin-transform-object-assign": "*",
"@babel/plugin-transform-react-constant-elements": "*",
"@babel/preset-env": "*",
"@babel/preset-react": "*",
"babel-plugin-add-module-exports": "*",
"babel-plugin-dynamic-import-node": "*",
"babel-plugin-reshow-transform-runtime": "*",
"babel-plugin-transform-react-pure-class-to-function": "*",
"babel-plugin-transform-react-remove-prop-types": "*",
"react": "^16.x"
},
"scripts": {
"build": "rm -rf build && babel ui --out-dir build/ui && babel src --out-dir build/src",
"prepublish": "npm run build"
"clean": "find ./build -name '*.*' | xargs rm -rf",
"build:cjs": "BABEL_ENV=build babel src -d build/cjs/src && BABEL_ENV=build babel ui -d build/cjs/ui",
"build:es": "BABEL_ENV=es babel src -d build/es/src && BABEL_ENV=es babel ui -d build/es/ui",
"build": "npm run clean && npm run build:cjs && npm run build:es",
"prepublishOnly": "npm run build"
},
"files": [
"build",
Expand Down
18 changes: 8 additions & 10 deletions src/base.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
'use strict';

import React from 'react';

const Base = (name) => {
const Atom = ({refCb, ...others}) => {
if (refCb) {
others.ref = refCb;
}
return React.createElement(name, others);
const Base = name => {
const Atom = ({refCb, ...others}) => {
if (refCb) {
others.ref = refCb;
}
return Atom;
}
return React.createElement(name, others);
};
return Atom;
};

export default Base;
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export {default as Polygon} from '../ui/atoms/polygon'
export {default as Rect} from '../ui/atoms/rect'
export {default as Section} from '../ui/atoms/section'
export {default as Select} from '../ui/atoms/select'
export {default as Source} from '../ui/atoms/source'
export {default as Span} from '../ui/atoms/span'
export {default as Svg} from '../ui/atoms/svg'
export {default as Table} from '../ui/atoms/table'
Expand All @@ -40,4 +41,5 @@ export {default as Th} from '../ui/atoms/th'
export {default as Tr} from '../ui/atoms/tr'
export {default as Tspan} from '../ui/atoms/tspan'
export {default as Ul} from '../ui/atoms/ul'
export {default as Video} from '../ui/atoms/video'

4 changes: 2 additions & 2 deletions ui/atoms/a.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base')
module.exports = base('a')
import base from '../../src/base';
export default base('a');
4 changes: 2 additions & 2 deletions ui/atoms/article.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base')
module.exports = base('article')
import base from '../../src/base';
export default base('article');
4 changes: 2 additions & 2 deletions ui/atoms/button.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base')
module.exports = base('button')
import base from '../../src/base';
export default base('button');
4 changes: 2 additions & 2 deletions ui/atoms/circle.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base')
module.exports = base('circle')
import base from '../../src/base';
export default base('circle');
4 changes: 2 additions & 2 deletions ui/atoms/div.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('div');
import base from '../../src/base';
export default base('div');
4 changes: 2 additions & 2 deletions ui/atoms/dl.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('dl');
import base from '../../src/base';
export default base('dl');
4 changes: 2 additions & 2 deletions ui/atoms/footer.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base')
module.exports = base('footer')
import base from '../../src/base';
export default base('footer');
4 changes: 2 additions & 2 deletions ui/atoms/form.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('form');
import base from '../../src/base';
export default base('form');
4 changes: 2 additions & 2 deletions ui/atoms/g.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('g');
import base from '../../src/base';
export default base('g');
4 changes: 2 additions & 2 deletions ui/atoms/h1.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('h1');
import base from '../../src/base';
export default base('h1');
4 changes: 2 additions & 2 deletions ui/atoms/h2.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('h2');
import base from '../../src/base';
export default base('h2');
4 changes: 2 additions & 2 deletions ui/atoms/h3.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('h3');
import base from '../../src/base';
export default base('h3');
4 changes: 2 additions & 2 deletions ui/atoms/h4.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('h4');
import base from '../../src/base';
export default base('h4');
4 changes: 2 additions & 2 deletions ui/atoms/h5.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('h5');
import base from '../../src/base';
export default base('h5');
4 changes: 2 additions & 2 deletions ui/atoms/h6.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('h6');
import base from '../../src/base';
export default base('h6');
4 changes: 2 additions & 2 deletions ui/atoms/header.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('header');
import base from '../../src/base';
export default base('header');
4 changes: 2 additions & 2 deletions ui/atoms/i.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('i');
import base from '../../src/base';
export default base('i');
4 changes: 2 additions & 2 deletions ui/atoms/iframe.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('iframe');
import base from '../../src/base';
export default base('iframe');
4 changes: 2 additions & 2 deletions ui/atoms/img.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('img');
import base from '../../src/base';
export default base('img');
4 changes: 2 additions & 2 deletions ui/atoms/input.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('input');
import base from '../../src/base';
export default base('input');
4 changes: 2 additions & 2 deletions ui/atoms/label.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('label');
import base from '../../src/base';
export default base('label');
4 changes: 2 additions & 2 deletions ui/atoms/li.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('li');
import base from '../../src/base';
export default base('li');
4 changes: 2 additions & 2 deletions ui/atoms/line.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('line');
import base from '../../src/base';
export default base('line');
4 changes: 2 additions & 2 deletions ui/atoms/main.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base')
module.exports = base('main')
import base from '../../src/base';
export default base('main');
4 changes: 2 additions & 2 deletions ui/atoms/nav.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('nav');
import base from '../../src/base';
export default base('nav');
4 changes: 2 additions & 2 deletions ui/atoms/ol.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('ol');
import base from '../../src/base';
export default base('ol');
4 changes: 2 additions & 2 deletions ui/atoms/p.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('p');
import base from '../../src/base';
export default base('p');
4 changes: 2 additions & 2 deletions ui/atoms/path.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('path');
import base from '../../src/base';
export default base('path');
4 changes: 2 additions & 2 deletions ui/atoms/polygon.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('polygon');
import base from '../../src/base';
export default base('polygon');
4 changes: 2 additions & 2 deletions ui/atoms/rect.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('rect');
import base from '../../src/base';
export default base('rect');
4 changes: 2 additions & 2 deletions ui/atoms/section.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('section');
import base from '../../src/base';
export default base('section');
4 changes: 2 additions & 2 deletions ui/atoms/select.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('select');
import base from '../../src/base';
export default base('select');
2 changes: 2 additions & 0 deletions ui/atoms/source.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import base from '../../src/base';
export default base('source');
4 changes: 2 additions & 2 deletions ui/atoms/span.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('span');
import base from '../../src/base';
export default base('span');
4 changes: 2 additions & 2 deletions ui/atoms/svg.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('svg');
import base from '../../src/base';
export default base('svg');
4 changes: 2 additions & 2 deletions ui/atoms/table.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('table');
import base from '../../src/base';
export default base('table');
4 changes: 2 additions & 2 deletions ui/atoms/td.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('td');
import base from '../../src/base';
export default base('td');
4 changes: 2 additions & 2 deletions ui/atoms/text.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('text');
import base from '../../src/base';
export default base('text');
4 changes: 2 additions & 2 deletions ui/atoms/textarea.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('textarea');
import base from '../../src/base';
export default base('textarea');
4 changes: 2 additions & 2 deletions ui/atoms/th.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('th');
import base from '../../src/base';
export default base('th');
4 changes: 2 additions & 2 deletions ui/atoms/tr.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('tr');
import base from '../../src/base';
export default base('tr');
4 changes: 2 additions & 2 deletions ui/atoms/tspan.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('tspan');
import base from '../../src/base';
export default base('tspan');
4 changes: 2 additions & 2 deletions ui/atoms/ul.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const base = require('../../src/base');
module.exports = base('ul');
import base from '../../src/base';
export default base('ul');
2 changes: 2 additions & 0 deletions ui/atoms/video.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import base from '../../src/base';
export default base('video');
Loading

0 comments on commit 8bd3f3b

Please sign in to comment.