mirror of
https://github.com/bendtherules/react-fiber-traverse.git
synced 2026-08-18 22:01:49 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4310188a5b | ||
|
|
28d5f6ab1d | ||
|
|
d8bc1fad5f |
@@ -2,3 +2,15 @@
|
|||||||
2. Reduce testcase boilerplate code for similar tests
|
2. Reduce testcase boilerplate code for similar tests
|
||||||
3. Publish to npm
|
3. Publish to npm
|
||||||
4. Build some demo
|
4. Build some demo
|
||||||
|
|
||||||
|
5. Pack separate files
|
||||||
|
|
||||||
|
Affected parts
|
||||||
|
---------------
|
||||||
|
a. Rollup config (input and output) X
|
||||||
|
b. package.json entrypoints X
|
||||||
|
c. root index.js for dynamic prod or dev redirection X
|
||||||
|
d. change unpkg links in readme
|
||||||
|
e. separate folder for types ?? (change tsconfig)
|
||||||
|
|
||||||
|
f. Enable umd build from one index file
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
if (process.env.NODE_ENV === "production") {
|
if (process.env.NODE_ENV === "production") {
|
||||||
module.exports = require("./react-fiber-traverse.cjs.production.js");
|
module.exports = require("./cjs-production/index.js");
|
||||||
} else {
|
} else {
|
||||||
module.exports = require("./react-fiber-traverse.cjs.development.js");
|
module.exports = require("./cjs-development/index.js");
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+20
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-fiber-traverse",
|
"name": "react-fiber-traverse",
|
||||||
"version": "0.0.3",
|
"version": "0.0.4",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -10547,6 +10547,25 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"rollup-plugin-multi-input": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/rollup-plugin-multi-input/-/rollup-plugin-multi-input-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-ktLat6+lrvT3Z3kVrUr/Fy3+5xaj/sIfNpBfDQO2P6sd3lAGPI+yi2Dj+fxxkVubIpRocN0Z4jPkN+c28uJimA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"core-js": "^3.1.3",
|
||||||
|
"fast-glob": "^3.0.0",
|
||||||
|
"lodash": "^4.17.11"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"core-js": {
|
||||||
|
"version": "3.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.1.4.tgz",
|
||||||
|
"integrity": "sha512-YNZN8lt82XIMLnLirj9MhKDFZHalwzzrL9YLt6eb0T5D0EDl4IQ90IGkua8mHbnxNrkj1d8hbdizMc0Qmg1WnQ==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"rollup-plugin-node-resolve": {
|
"rollup-plugin-node-resolve": {
|
||||||
"version": "5.2.0",
|
"version": "5.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz",
|
||||||
|
|||||||
+4
-5
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "react-fiber-traverse",
|
"name": "react-fiber-traverse",
|
||||||
"version": "0.0.3",
|
"version": "0.0.4",
|
||||||
"description": "Traverse and other utils on top of React fiber tree",
|
"description": "Traverse and other utils on top of React fiber tree",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"module": "dist/react-fiber-traverse.esm.js",
|
"module": "dist/esm/index.js",
|
||||||
"jsnext:main": "dist/react-fiber-traverse.esm.js",
|
"jsnext:main": "dist/esm/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
@@ -34,8 +34,6 @@
|
|||||||
"test:es": "jest --config ./scripts/jest/config.es.js",
|
"test:es": "jest --config ./scripts/jest/config.es.js",
|
||||||
"test:src": "jest --config ./scripts/jest/config.src.js",
|
"test:src": "jest --config ./scripts/jest/config.src.js",
|
||||||
"test:src:watch": "npm run test:src -- --watch",
|
"test:src:watch": "npm run test:src -- --watch",
|
||||||
"test:umd": "jest --config ./scripts/jest/config.umd.js",
|
|
||||||
"test:umdprod": "jest --config ./scripts/jest/config.umdprod.js",
|
|
||||||
"test:src:debug": "node --inspect ./node_modules/jest/bin/jest.js --config ./scripts/jest/config.src.js",
|
"test:src:debug": "node --inspect ./node_modules/jest/bin/jest.js --config ./scripts/jest/config.src.js",
|
||||||
"version": "run-s test authors && git add ."
|
"version": "run-s test authors && git add ."
|
||||||
},
|
},
|
||||||
@@ -108,6 +106,7 @@
|
|||||||
"rollup-plugin-babel": "4.3.3",
|
"rollup-plugin-babel": "4.3.3",
|
||||||
"rollup-plugin-commonjs": "10.0.1",
|
"rollup-plugin-commonjs": "10.0.1",
|
||||||
"rollup-plugin-filesize": "6.1.1",
|
"rollup-plugin-filesize": "6.1.1",
|
||||||
|
"rollup-plugin-multi-input": "^1.0.2",
|
||||||
"rollup-plugin-node-resolve": "5.2.0",
|
"rollup-plugin-node-resolve": "5.2.0",
|
||||||
"rollup-plugin-replace": "2.2.0",
|
"rollup-plugin-replace": "2.2.0",
|
||||||
"rollup-plugin-size-snapshot": "0.9.0",
|
"rollup-plugin-size-snapshot": "0.9.0",
|
||||||
|
|||||||
+12
-14
@@ -2,9 +2,10 @@ import babel from "rollup-plugin-babel";
|
|||||||
import commonjs from "rollup-plugin-commonjs";
|
import commonjs from "rollup-plugin-commonjs";
|
||||||
import nodeResolve from "rollup-plugin-node-resolve";
|
import nodeResolve from "rollup-plugin-node-resolve";
|
||||||
import replace from "rollup-plugin-replace";
|
import replace from "rollup-plugin-replace";
|
||||||
import { sizeSnapshot } from "rollup-plugin-size-snapshot";
|
// import { sizeSnapshot } from "rollup-plugin-size-snapshot";
|
||||||
import sourcemaps from "rollup-plugin-sourcemaps";
|
import sourcemaps from "rollup-plugin-sourcemaps";
|
||||||
import { terser } from "rollup-plugin-terser";
|
import { terser } from "rollup-plugin-terser";
|
||||||
|
import multiInput from "rollup-plugin-multi-input";
|
||||||
import pkg from "./package.json";
|
import pkg from "./package.json";
|
||||||
|
|
||||||
const CJS_DEV = "CJS_DEV";
|
const CJS_DEV = "CJS_DEV";
|
||||||
@@ -13,7 +14,7 @@ const ES = "ES";
|
|||||||
const UMD_DEV = "UMD_DEV";
|
const UMD_DEV = "UMD_DEV";
|
||||||
const UMD_PROD = "UMD_PROD";
|
const UMD_PROD = "UMD_PROD";
|
||||||
|
|
||||||
const input = "./compiled/index.js";
|
const input = ["compiled/*.js"];
|
||||||
|
|
||||||
const getGlobals = bundleType => {
|
const getGlobals = bundleType => {
|
||||||
const baseGlobals = {
|
const baseGlobals = {
|
||||||
@@ -124,7 +125,7 @@ const getPlugins = bundleType => [
|
|||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
sourcemaps(),
|
sourcemaps(),
|
||||||
sizeSnapshot(),
|
// sizeSnapshot(),
|
||||||
isProduction(bundleType) &&
|
isProduction(bundleType) &&
|
||||||
terser({
|
terser({
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
@@ -136,16 +137,15 @@ const getPlugins = bundleType => [
|
|||||||
warnings: true,
|
warnings: true,
|
||||||
ecma: 5,
|
ecma: 5,
|
||||||
toplevel: false
|
toplevel: false
|
||||||
})
|
}),
|
||||||
|
multiInput({ relative: "compiled/" })
|
||||||
];
|
];
|
||||||
|
|
||||||
const getCjsConfig = bundleType => ({
|
const getCjsConfig = bundleType => ({
|
||||||
input,
|
input,
|
||||||
external: getExternal(bundleType),
|
external: getExternal(bundleType),
|
||||||
output: {
|
output: {
|
||||||
file: `dist/react-fiber-traverse.cjs.${
|
dir: `dist/cjs-${isProduction(bundleType) ? "production" : "development"}`,
|
||||||
isProduction(bundleType) ? "production" : "development"
|
|
||||||
}.js`,
|
|
||||||
format: "cjs",
|
format: "cjs",
|
||||||
sourcemap: true
|
sourcemap: true
|
||||||
},
|
},
|
||||||
@@ -156,7 +156,7 @@ const getEsConfig = () => ({
|
|||||||
input,
|
input,
|
||||||
external: getExternal(ES),
|
external: getExternal(ES),
|
||||||
output: {
|
output: {
|
||||||
file: pkg.module,
|
dir: `dist/esm`,
|
||||||
format: "es",
|
format: "es",
|
||||||
sourcemap: true
|
sourcemap: true
|
||||||
},
|
},
|
||||||
@@ -167,9 +167,7 @@ const getUmdConfig = bundleType => ({
|
|||||||
input,
|
input,
|
||||||
external: getExternal(bundleType),
|
external: getExternal(bundleType),
|
||||||
output: {
|
output: {
|
||||||
file: `dist/react-fiber-traverse.umd.${
|
dir: `dist/umd-${isProduction(bundleType) ? "production" : "development"}`,
|
||||||
isProduction(bundleType) ? "production" : "development"
|
|
||||||
}.js`,
|
|
||||||
format: "umd",
|
format: "umd",
|
||||||
globals: getGlobals(bundleType),
|
globals: getGlobals(bundleType),
|
||||||
name: "reactFiberTraverse",
|
name: "reactFiberTraverse",
|
||||||
@@ -181,7 +179,7 @@ const getUmdConfig = bundleType => ({
|
|||||||
export default [
|
export default [
|
||||||
getCjsConfig(CJS_DEV),
|
getCjsConfig(CJS_DEV),
|
||||||
getCjsConfig(CJS_PROD),
|
getCjsConfig(CJS_PROD),
|
||||||
getEsConfig(),
|
getEsConfig()
|
||||||
getUmdConfig(UMD_DEV),
|
// getUmdConfig(UMD_DEV),
|
||||||
getUmdConfig(UMD_PROD)
|
// getUmdConfig(UMD_PROD)
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ const srcConfig = require("./config.src");
|
|||||||
module.exports = Object.assign({}, srcConfig, {
|
module.exports = Object.assign({}, srcConfig, {
|
||||||
collectCoverage: false,
|
collectCoverage: false,
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
"^../src$": `<rootDir>/dist/react-fiber-traverse.esm.js`
|
"^../src$": `<rootDir>/dist/esm/index.js`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user