Skip to content

Commit 3fa5e14

Browse files
authored
Use @pika/pack to build and publish the package (#29)
1 parent 439163d commit 3fa5e14

File tree

4 files changed

+49
-25
lines changed

4 files changed

+49
-25
lines changed

.babelrc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
2-
"presets": [["env", { "loose": true }], "react"],
3-
"plugins": ["transform-object-rest-spread"],
4-
"ignore": ["node_modules", "stories.js"]
2+
"presets": ["@babel/preset-env", "@babel/preset-react"],
3+
"plugins": ["@babel/plugin-proposal-object-rest-spread"],
4+
"ignore": ["node_modules", "stories.js"],
5+
"env": {
6+
"test": {
7+
"plugins": ["@babel/plugin-transform-runtime"]
8+
}
9+
}
510
}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
lib/
1+
pkg/
22
node_modules/
33
coverage/
44
package-lock.json

package.json

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"react",
77
"async",
88
"promise",
9-
"loader"
9+
"fetch",
10+
"hook"
1011
],
1112
"author": "Gert Hengeveld <[email protected]>",
1213
"license": "ISC",
@@ -18,23 +19,17 @@
1819
"publishConfig": {
1920
"registry": "https://registry.npmjs.org/"
2021
},
21-
"main": "lib/index.js",
22-
"typings": "typings/index.d.ts",
23-
"files": [
24-
"lib",
25-
"src",
26-
"typings"
27-
],
2822
"scripts": {
29-
"build": "rimraf lib && babel src -d lib --ignore '**/*spec.js'",
3023
"lint": "eslint src",
31-
"test": "jest src/Async.spec.js --collectCoverageFrom=src/Async.js",
24+
"test": "jest src/Async.spec.js --collectCoverageFrom=src/Async.js",
3225
"test:hook": "jest src/useAsync.spec.js --collectCoverageFrom=src/useAsync.js",
3326
"test:watch": "npm run test -- --watch",
3427
"test:compat": "npm run test:backwards && npm run test:forwards && npm run test:latest",
3528
"test:backwards": "npm i [email protected] [email protected] --no-save && npm test",
3629
"test:forwards": "npm i react@next react-dom@next --no-save && npm test && npm run test:hook",
3730
"test:latest": "npm i react@latest react-dom@latest --no-save && npm test && npm run test:hook",
31+
"build": "pack build",
32+
"publish": "pack publish",
3833
"prepublishOnly": "npm run lint && npm run test:compat && npm run build"
3934
},
4035
"dependencies": {},
@@ -45,29 +40,53 @@
4540
"prop-types": ">=15.5.7"
4641
},
4742
"devDependencies": {
48-
"babel-cli": "6.26.0",
49-
"babel-core": "6.26.3",
43+
"@babel/plugin-proposal-object-rest-spread": "7.3.4",
44+
"@babel/plugin-transform-runtime": "7.2.0",
45+
"@babel/preset-env": "7.3.1",
46+
"@babel/preset-react": "7.0.0",
47+
"@pika/plugin-build-node": "0.3.12",
48+
"@pika/plugin-build-types": "0.3.12",
49+
"@pika/plugin-build-web": "0.3.12",
50+
"@pika/plugin-standard-pkg": "0.3.12",
5051
"babel-eslint": "10.0.1",
51-
"babel-plugin-transform-object-rest-spread": "6.26.0",
52-
"babel-preset-env": "1.7.0",
53-
"babel-preset-react": "6.24.1",
52+
"babel-jest": "24.1.0",
5453
"eslint": "5.11.1",
5554
"eslint-config-prettier": "3.3.0",
5655
"eslint-plugin-jest": "22.1.2",
5756
"eslint-plugin-prettier": "3.0.1",
5857
"eslint-plugin-promise": "4.0.1",
5958
"eslint-plugin-react": "7.12.0",
6059
"eslint-plugin-react-hooks": "1.0.1",
61-
"jest": "23.6.0",
62-
"jest-dom": "2.1.0",
60+
"jest": "24.1.0",
61+
"jest-dom": "3.1.2",
6362
"prettier": "1.15.3",
6463
"react": "16.8.1",
6564
"react-dom": "16.8.1",
66-
"react-testing-library": "5.5.3",
67-
"rimraf": "2.6.2"
65+
"react-testing-library": "5.5.3"
6866
},
6967
"jest": {
70-
"coverageDirectory": "./coverage/",
71-
"collectCoverage": true
68+
"collectCoverage": true,
69+
"coverageDirectory": "./coverage/"
70+
},
71+
"@pika/pack": {
72+
"pipeline": [
73+
[
74+
"@pika/plugin-standard-pkg",
75+
{
76+
"exclude": [
77+
"*.spec.js"
78+
]
79+
}
80+
],
81+
[
82+
"@pika/plugin-build-node"
83+
],
84+
[
85+
"@pika/plugin-build-web"
86+
],
87+
[
88+
"@pika/plugin-build-types"
89+
]
90+
]
7291
}
7392
}
File renamed without changes.

0 commit comments

Comments
 (0)