Skip to content

Commit fe6ecd5

Browse files
committed
added build files
1 parent f5e10ea commit fe6ecd5

File tree

3 files changed

+61
-3
lines changed

3 files changed

+61
-3
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@ builds/
1212

1313
coverage/
1414

15-
__snapshots__/
15+
__snapshots__/
16+
17+
cjs/
18+
19+
es/

babel.config.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
module.exports = function babelConfig(api) {
2+
api.cache(false);
3+
return {
4+
presets: [
5+
'@babel/preset-env',
6+
'@babel/preset-react',
7+
],
8+
plugins: [
9+
'@babel/plugin-proposal-export-default-from',
10+
'@babel/plugin-proposal-export-namespace-from',
11+
'@babel/plugin-proposal-class-properties',
12+
'@babel/plugin-proposal-object-rest-spread',
13+
'syntax-trailing-function-commas',
14+
'@babel/plugin-transform-runtime',
15+
'styled-components',
16+
],
17+
env: {
18+
cjs: {
19+
presets: [
20+
['@babel/preset-env', {
21+
loose: true,
22+
modules: 'commonjs',
23+
}],
24+
],
25+
},
26+
'react-native': {
27+
presets: [
28+
'expo',
29+
],
30+
plugins: [
31+
'@babel/plugin-transform-react-jsx-source',
32+
],
33+
},
34+
},
35+
};
36+
};

package.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
"description": "fe-theme",
55
"main": "babel.config.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"build": "run-s build:clean && run-p build:es build:cjs",
9+
"build:clean": "rimraf es cjs",
10+
"build:es": "babel js -d es --ignore *.test.js,*.story.js",
11+
"build:cjs": "NODE_ENV=cjs babel js -d cjs --ignore *.test.js,*.story.js",
12+
"build:prepare": "node ./src/scripts/buildPrepare.js"
813
},
914
"repository": {
1015
"type": "git",
@@ -15,5 +20,18 @@
1520
"bugs": {
1621
"url": "https://github.com/hdlion/ui-theme/issues"
1722
},
18-
"homepage": "https://github.com/hdlion/ui-theme#readme"
23+
"homepage": "https://github.com/hdlion/ui-theme#readme",
24+
"dependencies": {
25+
"@babel/cli": "^7.23.4",
26+
"@babel/plugin-proposal-class-properties": "^7.18.6",
27+
"@babel/plugin-proposal-export-default-from": "^7.23.3",
28+
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
29+
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
30+
"@babel/plugin-transform-runtime": "^7.23.4",
31+
"@babel/preset-env": "^7.23.3",
32+
"@babel/preset-react": "^7.23.3",
33+
"babel-plugin-styled-components": "^2.1.4",
34+
"babel-plugin-syntax-trailing-function-commas": "^6.22.0",
35+
"npm-run-all": "^4.1.5"
36+
}
1937
}

0 commit comments

Comments
 (0)