Skip to content

Commit

Permalink
Package all files into a single dist folder (#537)
Browse files Browse the repository at this point in the history
* refactor: change config to resolve to single folder

* trigger build

* ci: nextjs sandbox

* remove `module` field

* Update tsconfig.json

* revert missed out change for tsconfig from rollup
  • Loading branch information
barelyhuman committed Aug 17, 2021
1 parent e47ea03 commit 720a740
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .codesandbox/ci.json
Expand Up @@ -5,7 +5,8 @@
"react-typescript-react-ts",
"simple-react-browserify-x9yni",
"simple-snowpack-react-o1gmx",
"react-parcel-onewf"
"react-parcel-onewf",
"next-js-uo1h0"
],
"node": "12"
}
25 changes: 25 additions & 0 deletions .size-snapshot.json
@@ -1,5 +1,10 @@
{
"index.js": {
"bundled": 4684,
"minified": 1888,
"gzipped": 846
},
"index.mjs": {
"bundled": 3993,
"minified": 1614,
"gzipped": 786,
Expand All @@ -14,6 +19,11 @@
}
},
"vanilla.js": {
"bundled": 1800,
"minified": 631,
"gzipped": 350
},
"vanilla.mjs": {
"bundled": 1352,
"minified": 444,
"gzipped": 288,
Expand All @@ -28,6 +38,11 @@
}
},
"middleware.js": {
"bundled": 8221,
"minified": 3675,
"gzipped": 1508
},
"middleware.mjs": {
"bundled": 6679,
"minified": 3385,
"gzipped": 1483,
Expand All @@ -42,6 +57,11 @@
}
},
"shallow.js": {
"bundled": 622,
"minified": 401,
"gzipped": 251
},
"shallow.mjs": {
"bundled": 541,
"minified": 338,
"gzipped": 217,
Expand All @@ -56,6 +76,11 @@
}
},
"context.js": {
"bundled": 1857,
"minified": 935,
"gzipped": 466
},
"context.mjs": {
"bundled": 1516,
"minified": 840,
"gzipped": 418,
Expand Down
23 changes: 11 additions & 12 deletions package.json
Expand Up @@ -4,7 +4,6 @@
"version": "3.5.8",
"description": "🐻 Bear necessities for state management in React",
"main": "./index.js",
"module": "./esm/index.js",
"types": "./index.d.ts",
"files": [
"**"
Expand All @@ -13,32 +12,32 @@
"./package.json": "./package.json",
".": {
"types": "./index.d.ts",
"module": "./esm/index.js",
"import": "./esm/index.js",
"module": "./index.mjs",
"import": "./index.mjs",
"default": "./index.js"
},
"./vanilla": {
"types": "./vanilla.d.ts",
"module": "./esm/vanilla.js",
"import": "./esm/vanilla.js",
"module": "./vanilla.mjs",
"import": "./vanilla.mjs",
"default": "./vanilla.js"
},
"./middleware": {
"types": "./middleware.d.ts",
"module": "./esm/middleware.js",
"import": "./esm/middleware.js",
"module": "./middleware.mjs",
"import": "./middleware.mjs",
"default": "./middleware.js"
},
"./shallow": {
"types": "./shallow.d.ts",
"module": "./esm/shallow.js",
"import": "./esm/shallow.js",
"module": "./shallow.mjs",
"import": "./shallow.mjs",
"default": "./shallow.js"
},
"./context": {
"types": "./context.d.ts",
"module": "./esm/context.js",
"import": "./esm/context.js",
"module": "./context.mjs",
"import": "./context.mjs",
"default": "./context.js"
}
},
Expand All @@ -60,7 +59,7 @@
"test": "jest",
"test:dev": "jest --watch --no-coverage",
"test:coverage:watch": "jest --watch",
"copy": "shx cp -r dist/src/* dist/esm && shx mv dist/src/* dist && shx rm -rf dist/{src,tests} && shx cp package.json readme.md LICENSE dist && json -I -f dist/package.json -e \"this.private=false; this.devDependencies=undefined; this.optionalDependencies=undefined; this.scripts=undefined; this.prettier=undefined; this.jest=undefined; this['lint-staged']=undefined;\" && shx cp package.json dist/esm && shx echo '{\"type\":\"module\"}' > dist/esm/package.json && json -I -f dist/esm/package.json"
"copy": "shx mv dist/src/* dist && shx rm -rf dist/{src,tests} && shx cp package.json readme.md LICENSE dist && json -I -f dist/package.json -e \"this.private=false; this.devDependencies=undefined; this.optionalDependencies=undefined; this.scripts=undefined; this.prettier=undefined; this.jest=undefined; this['lint-staged']=undefined;\""
},
"prettier": {
"semi": false,
Expand Down
12 changes: 9 additions & 3 deletions rollup.config.js
Expand Up @@ -37,7 +37,13 @@ function createDeclarationConfig(input, output) {
dir: output,
},
external,
plugins: [typescript({ declaration: true, outDir: output })],
plugins: [
typescript({
declaration: true,
emitDeclarationOnly: true,
outDir: output,
}),
],
}
}

Expand Down Expand Up @@ -69,12 +75,12 @@ export default function (args) {
c = c.slice('config-'.length)
return [
createCommonJSConfig(`src/${c}.ts`, `dist/${c}.js`),
createESMConfig(`src/${c}.ts`, `dist/esm/${c}.js`),
createESMConfig(`src/${c}.ts`, `dist/${c}.mjs`),
]
}
return [
createDeclarationConfig('src/index.ts', 'dist'),
createCommonJSConfig('src/index.ts', 'dist/index.js'),
createESMConfig('src/index.ts', 'dist/esm/index.js'),
createESMConfig('src/index.ts', 'dist/index.mjs'),
]
}
2 changes: 1 addition & 1 deletion tsconfig.json
Expand Up @@ -21,4 +21,4 @@
"node_modules",
"dist"
]
}
}

0 comments on commit 720a740

Please sign in to comment.