Compare commits

..
3 Commits
Author SHA1 Message Date
bendtherules 4310188a5b 0.0.4 2019-08-08 18:40:03 +05:30
bendtherules 28d5f6ab1d Fix jest and other test configs from build 2019-08-08 18:30:51 +05:30
bendtherules d8bc1fad5f Setup multi-dist build with cjs, esm 2019-08-08 18:21:17 +05:30
6 changed files with 52 additions and 24 deletions
+13 -1
View File
@@ -1,4 +1,16 @@
1. Write docs and examples
2. Reduce testcase boilerplate code for similar tests
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
+2 -2
View File
@@ -1,7 +1,7 @@
"use strict";
if (process.env.NODE_ENV === "production") {
module.exports = require("./react-fiber-traverse.cjs.production.js");
module.exports = require("./cjs-production/index.js");
} else {
module.exports = require("./react-fiber-traverse.cjs.development.js");
module.exports = require("./cjs-development/index.js");
}
+20 -1
View File
@@ -1,6 +1,6 @@
{
"name": "react-fiber-traverse",
"version": "0.0.3",
"version": "0.0.4",
"lockfileVersion": 1,
"requires": true,
"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": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz",
+4 -5
View File
@@ -1,10 +1,10 @@
{
"name": "react-fiber-traverse",
"version": "0.0.3",
"version": "0.0.4",
"description": "Traverse and other utils on top of React fiber tree",
"main": "dist/index.js",
"module": "dist/react-fiber-traverse.esm.js",
"jsnext:main": "dist/react-fiber-traverse.esm.js",
"module": "dist/esm/index.js",
"jsnext:main": "dist/esm/index.js",
"typings": "dist/index.d.ts",
"files": [
"dist"
@@ -34,8 +34,6 @@
"test:es": "jest --config ./scripts/jest/config.es.js",
"test:src": "jest --config ./scripts/jest/config.src.js",
"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",
"version": "run-s test authors && git add ."
},
@@ -108,6 +106,7 @@
"rollup-plugin-babel": "4.3.3",
"rollup-plugin-commonjs": "10.0.1",
"rollup-plugin-filesize": "6.1.1",
"rollup-plugin-multi-input": "^1.0.2",
"rollup-plugin-node-resolve": "5.2.0",
"rollup-plugin-replace": "2.2.0",
"rollup-plugin-size-snapshot": "0.9.0",
+12 -14
View File
@@ -2,9 +2,10 @@ import babel from "rollup-plugin-babel";
import commonjs from "rollup-plugin-commonjs";
import nodeResolve from "rollup-plugin-node-resolve";
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 { terser } from "rollup-plugin-terser";
import multiInput from "rollup-plugin-multi-input";
import pkg from "./package.json";
const CJS_DEV = "CJS_DEV";
@@ -13,7 +14,7 @@ const ES = "ES";
const UMD_DEV = "UMD_DEV";
const UMD_PROD = "UMD_PROD";
const input = "./compiled/index.js";
const input = ["compiled/*.js"];
const getGlobals = bundleType => {
const baseGlobals = {
@@ -124,7 +125,7 @@ const getPlugins = bundleType => [
)
}),
sourcemaps(),
sizeSnapshot(),
// sizeSnapshot(),
isProduction(bundleType) &&
terser({
sourcemap: true,
@@ -136,16 +137,15 @@ const getPlugins = bundleType => [
warnings: true,
ecma: 5,
toplevel: false
})
}),
multiInput({ relative: "compiled/" })
];
const getCjsConfig = bundleType => ({
input,
external: getExternal(bundleType),
output: {
file: `dist/react-fiber-traverse.cjs.${
isProduction(bundleType) ? "production" : "development"
}.js`,
dir: `dist/cjs-${isProduction(bundleType) ? "production" : "development"}`,
format: "cjs",
sourcemap: true
},
@@ -156,7 +156,7 @@ const getEsConfig = () => ({
input,
external: getExternal(ES),
output: {
file: pkg.module,
dir: `dist/esm`,
format: "es",
sourcemap: true
},
@@ -167,9 +167,7 @@ const getUmdConfig = bundleType => ({
input,
external: getExternal(bundleType),
output: {
file: `dist/react-fiber-traverse.umd.${
isProduction(bundleType) ? "production" : "development"
}.js`,
dir: `dist/umd-${isProduction(bundleType) ? "production" : "development"}`,
format: "umd",
globals: getGlobals(bundleType),
name: "reactFiberTraverse",
@@ -181,7 +179,7 @@ const getUmdConfig = bundleType => ({
export default [
getCjsConfig(CJS_DEV),
getCjsConfig(CJS_PROD),
getEsConfig(),
getUmdConfig(UMD_DEV),
getUmdConfig(UMD_PROD)
getEsConfig()
// getUmdConfig(UMD_DEV),
// getUmdConfig(UMD_PROD)
];
+1 -1
View File
@@ -3,6 +3,6 @@ const srcConfig = require("./config.src");
module.exports = Object.assign({}, srcConfig, {
collectCoverage: false,
moduleNameMapper: {
"^../src$": `<rootDir>/dist/react-fiber-traverse.esm.js`
"^../src$": `<rootDir>/dist/esm/index.js`
}
});