Skip to content

Commit

Permalink
make builds work again
Browse files Browse the repository at this point in the history
  • Loading branch information
Swatinem committed Jun 3, 2019
1 parent 6ec64da commit 7ea4a02
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 91 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
coverage
dist
node_modules
.build
68 changes: 6 additions & 62 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
"dist"
],
"scripts": {
"build": "rimraf dist && rollup -c",
"clean": "rimraf dist",
"prebuild": "npm run clean",
"build": "tsc --project tsconfig.build.json && rollup -c",
"prepublishOnly": "npm run test && npm run build",
"test": "jest --runInBand"
},
Expand Down Expand Up @@ -60,20 +62,17 @@
"@types/jest": "^24.0.13",
"@types/node": "^12.0.4",
"@types/react": "^16.8.19",
"esm": "^3.2.25",
"fs-extra": "^8.0.1",
"jest": "^24.8.0",
"prettier": "^1.17.1",
"react": "^16.8.6",
"rollup": "^1.13.1",
"rollup-plugin-json": "^4.0.0",
"ts-jest": "^24.0.2",
"ts-node": "^8.2.0",
"tslib": "^1.9.3",
"typescript": "3.5.1"
},
"peerDependencies": {
"rollup": "^1.13.1",
"tslib": "*",
"typescript": "^3.5.1"
},
"optionalDependencies": {
Expand Down
29 changes: 7 additions & 22 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
// @ts-ignore
import json from "rollup-plugin-json";
import pkg from "./package.json";

require("ts-node").register({ transpileOnly: true });
const { ts, dts } = require("./src");
// @ts-ignore
require = require("esm")(module);
const { default: dts } = require("./.build");

const external = ["fs", "path", "typescript", "rollup-pluginutils", "rollup", "@babel/code-frame"];
const external = ["typescript", "rollup", "@babel/code-frame"];

/** @type {Array<import("rollup").RollupWatchOptions>} */
const config = [
{
input: "./src/index.ts",
output: [
{
exports: "named",
file: pkg.main,
format: "cjs",
},
{ file: pkg.module, format: "es" },
],
input: "./.build/index.js",
output: [{ exports: "named", file: pkg.main, format: "cjs" }, { file: pkg.module, format: "es" }],

external,
plugins: [
json({
preferConst: true,
indent: " ",
}),
ts(),
],
},
{
input: "./src/index.ts",
input: "./.build/index.d.ts",
output: [{ file: pkg.types, format: "es" }],

external,
Expand Down
21 changes: 21 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"allowJs": false,
"checkJs": false,

"incremental": true,
"tsBuildInfoFile": ".build/tsconfig.build.tsbuildinfo",

"declaration": true,
// "declarationMap": true,
// "sourceMap": true,
"module": "esnext",

"noEmit": false,

"outDir": ".build",
"rootDir": "src"
},
"include": ["src"]
}
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"compilerOptions": {
"noEmitOnError": true,
"noEmitOnError": false,
"diagnostics": true,
"lib": ["es2018", "esnext"],

"target": "es2017",

"resolveJsonModule": true,
"moduleResolution": "node",
"module": "commonjs",
"module": "esnext",
"esModuleInterop": true,

"jsx": "react",
Expand Down

0 comments on commit 7ea4a02

Please sign in to comment.