Skip to content

Commit

Permalink
fix: package build system
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo1v committed Feb 12, 2021
1 parent 60be36c commit 5c4de9f
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 38 deletions.
3 changes: 2 additions & 1 deletion build/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"exclude": ["node_modules", "dist", "typings", "__tests__"],
"compilerOptions": {
"baseUrl": "../",
"allowJs": true
"allowJs": true,
"sourceMap": true
}
}
1 change: 1 addition & 0 deletions build/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"module": "CommonJS",
"outDir": "../dist/cjs"
}
}
1 change: 1 addition & 0 deletions build/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"module": "ES6",
"outDir": "../dist/es"
}
}
10 changes: 10 additions & 0 deletions build/tsconfig.types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"outDir": "../typings",
"declarationDir": "../typings",
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true
}
}
32 changes: 20 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,29 @@
"module": "dist/es/index.js",
"types": "typings/index.d.ts",
"scripts": {
"clean": "rimraf dist typings",
"prepublishOnly": "yarn build",
"fix": "yarn lint:fix && yarn prettier:fix",
"clean": "rimraf dist typings",
"release": "yarn node-env-run --exec \"semantic-release\"",
"prepublishOnly": "yarn build",
"test": "jest --passWithNoTests",
"test:watch": "yarn test --watchAll",
"build": "tsc --project build/tsconfig.cjs.json && tsc --project build/tsconfig.esm.json",
"prebuild": "yarn clean",
"postbuild": "tscpaths -p build/tsconfig.cjs.json -s ./src -o ./dist/cjs && tscpaths -p build/tsconfig.esm.json -s ./src -o ./dist/es",
"build:watch": "tsc-watch --project build/tsconfig.esm.json --onSuccess \"tscpaths -p build/tsconfig.esm.json -s ./src -o ./dist/es\"",
"prebuild:watch": "yarn clean",
"lint": "eslint ./ --ext js,jsx,ts,tsx",
"lint:fix": "eslint ./ --ext js,jsx,ts,tsx --fix",
"prettier": "prettier --check ./**/*.{js,jsx,ts,tsx}",
"prettier:fix": "prettier --write ./**/*.{js,jsx,ts,tsx}"
"prettier:fix": "prettier --write ./**/*.{js,jsx,ts,tsx}",
"build": "yarn build:cjs && yarn build:esm && yarn build:types",
"prebuild": "yarn clean",
"postbuild": "yarn compile-paths:cjs && yarn compile-paths:esm && yarn compile-paths:types",
"build:watch": "yarn build:watch:cjs & build:watch:esm",
"prebuild:watch": "yarn clean",
"build:cjs": "tsc -p build/tsconfig.cjs.json",
"build:esm": "tsc -p build/tsconfig.esm.json",
"build:types": "tsc -p build/tsconfig.types.json",
"build:watch:cjs": "tsc-watch -p build/tsconfig.cjs.json --onSuccess \"yarn compile-paths:cjs --silent\"",
"build:watch:esm": "tsc-watch -p build/tsconfig.esm.json --onSuccess \"yarn compile-paths:esm --silent\"",
"compile-paths:cjs": "tscpaths -p build/tsconfig.cjs.json -s ./src -o ./dist/cjs",
"compile-paths:esm": "tscpaths -p build/tsconfig.esm.json -s ./src -o ./dist/es",
"compile-paths:types": "tscpaths -p build/tsconfig.types.json -s ./src -o ./typings"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -48,7 +56,8 @@
"abortcontroller-polyfill": "^1.7.1"
},
"devDependencies": {
"@hitechline/eslint-config-web": "1.1.4",
"@herbcaudill/tscpaths": "^0.0.17",
"@hitechline/eslint-config-web": "1.1.0",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/commit-analyzer": "^8.0.1",
"@semantic-release/git": "^9.0.0",
Expand All @@ -59,7 +68,7 @@
"@testing-library/react": "11.2.5",
"@testing-library/react-hooks": "5.0.3",
"@types/jest": "26.0.20",
"@types/react": "17.0.2",
"@types/react": "17.0.1",
"@types/react-dom": "17.0.0",
"eslint": "7.19.0",
"eslint-plugin-testing-library": "3.10.1",
Expand All @@ -71,9 +80,8 @@
"react-test-renderer": "17.0.1",
"rimraf": "3.0.2",
"semantic-release": "17.3.8",
"ts-jest": "26.5.1",
"ts-jest": "26.4.4",
"tsc-watch": "4.2.9",
"tscpaths": "0.0.9",
"typescript": "4.1.5"
}
}
3 changes: 0 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
"jsx": "react",
"target": "ES6",
"baseUrl": ".",
"module": "CommonJS",
"moduleResolution": "Node",
"declarationDir": "typings",
"strict": true,
"allowJs": false,
"declaration": true,
"skipLibCheck": true,
"noImplicitAny": true,
"noUnusedLocals": true,
Expand Down
49 changes: 27 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,18 @@
minimatch "^3.0.4"
strip-json-comments "^3.1.1"

"@hitechline/[email protected]":
version "1.1.4"
resolved "https://registry.yarnpkg.com/@hitechline/eslint-config-web/-/eslint-config-web-1.1.4.tgz#797b16c88f68792281077edc628b5b014009fe89"
integrity sha512-BSeBzKUeL3uc++x3Q0QusYm9xvul/KUn02xgblk7bgIa0HShZH0EJ/9mQT/aGFjqjcwYQ7bSs0sMYLEpTxDlpw==
"@herbcaudill/tscpaths@^0.0.17":
version "0.0.17"
resolved "https://registry.yarnpkg.com/@herbcaudill/tscpaths/-/tscpaths-0.0.17.tgz#c29370fdc2d9d187548a6d92e388968f4c79e8bd"
integrity sha512-yBKz3S9RwDUq1LAr9lrHUDBwtsaFuX+6WLgnUq9tkTlu5wsoofxCYfhbwFeNXVRVFeCMLpBp+lhMFQ5/11w3Cw==
dependencies:
commander "^2.20.0"
globby "^9.2.0"

"@hitechline/[email protected]":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@hitechline/eslint-config-web/-/eslint-config-web-1.1.0.tgz#747f8d906bff6dc28e5e41c7230134ed8fd69fcb"
integrity sha512-trSIf1i0kFqe66f1tK54TPe88X4toF7MJeu4uBcGyZY9n9Q/awWEJM4Xp/ckDIEWFZx8cDmSM5HlVpM/G1dzJA==
dependencies:
"@typescript-eslint/eslint-plugin" "^4.0.0"
"@typescript-eslint/parser" "^4.0.0"
Expand Down Expand Up @@ -987,10 +995,10 @@
"@types/prop-types" "*"
csstype "^3.0.2"

"@types/[email protected].2":
version "17.0.2"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.2.tgz#3de24c4efef902dd9795a49c75f760cbe4f7a5a8"
integrity sha512-Xt40xQsrkdvjn1EyWe1Bc0dJLcil/9x2vAuW7ya+PuQip4UYUaXyhzWmAbwRsdMgwOFHpfp7/FFZebDU6Y8VHA==
"@types/[email protected].1":
version "17.0.1"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.1.tgz#eb1f1407dea8da3bc741879c1192aa703ab9975b"
integrity sha512-w8t9f53B2ei4jeOqf/gxtc2Sswnc3LBK5s0DyJcg5xd10tMHXts2N31cKjWfH9IC/JvEPa/YF1U4YeP1t4R6HQ==
dependencies:
"@types/prop-types" "*"
csstype "^3.0.2"
Expand Down Expand Up @@ -5148,6 +5156,11 @@ lodash.isstring@^4.0.1:
resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451"
integrity sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=

[email protected]:
version "4.1.2"
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=

lodash.sortby@^4.7.0:
version "4.7.0"
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
Expand Down Expand Up @@ -5178,7 +5191,7 @@ lodash.without@~4.4.0:
resolved "https://registry.yarnpkg.com/lodash.without/-/lodash.without-4.4.0.tgz#3cd4574a00b67bae373a94b748772640507b7aac"
integrity sha1-PNRXSgC2e643OpS3SHcmQFB7eqw=

lodash@4.x, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.4:
lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.4:
version "4.17.20"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
Expand Down Expand Up @@ -7889,18 +7902,18 @@ trim-off-newlines@^1.0.0:
resolved "https://registry.yarnpkg.com/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz#9f9ba9d9efa8764c387698bcbfeb2c848f11adb3"
integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM=

ts-jest@26.5.1:
version "26.5.1"
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.1.tgz#4d53ee4481552f57c1624f0bd3425c8b17996150"
integrity sha512-G7Rmo3OJMvlqE79amJX8VJKDiRcd7/r61wh9fnvvG8cAjhA9edklGw/dCxRSQmfZ/z8NDums5srSVgwZos1qfg==
ts-jest@26.4.4:
version "26.4.4"
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.4.4.tgz#61f13fb21ab400853c532270e52cc0ed7e502c49"
integrity sha512-3lFWKbLxJm34QxyVNNCgXX1u4o/RV0myvA2y2Bxm46iGIjKlaY0own9gIckbjZJPn+WaJEnfPPJ20HHGpoq4yg==
dependencies:
"@types/jest" "26.x"
bs-logger "0.x"
buffer-from "1.x"
fast-json-stable-stringify "2.x"
jest-util "^26.1.0"
json5 "2.x"
lodash "4.x"
lodash.memoize "4.x"
make-error "1.x"
mkdirp "1.x"
semver "7.x"
Expand All @@ -7927,14 +7940,6 @@ tsconfig-paths@^3.9.0:
minimist "^1.2.0"
strip-bom "^3.0.0"

[email protected]:
version "0.0.9"
resolved "https://registry.yarnpkg.com/tscpaths/-/tscpaths-0.0.9.tgz#c77abfde6820920f10c64f83c27753b9505814ab"
integrity sha512-tz4qimSJTCjYtHVsoY7pvxLcxhmhgmwzm7fyMEiL3/kPFFVyUuZOwuwcWwjkAsIrSUKJK22A7fNuJUwxzQ+H+w==
dependencies:
commander "^2.20.0"
globby "^9.2.0"

tslib@^1.8.1:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
Expand Down

0 comments on commit 5c4de9f

Please sign in to comment.