Skip to content

Commit

Permalink
build: link packages with tsconfig alias
Browse files Browse the repository at this point in the history
  • Loading branch information
ambar committed Sep 10, 2021
1 parent 7173970 commit 7188da8
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 128 deletions.
3 changes: 0 additions & 3 deletions example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"paths": {
"griffith": ["../packages/griffith/src/index.ts"]
},
"esModuleInterop": true,
"jsx": "react"
}
Expand Down
5 changes: 2 additions & 3 deletions example/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ const packages = [
'griffith',
'griffith-message',
'griffith-utils',
// TODO: ts-migrate
// 'griffith-hls',
// 'griffith-mp4',
'griffith-hls',
'griffith-mp4',
]

const packagesAliases = Object.fromEntries(
Expand Down
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@
"build:watch": "lerna run build --parallel --ignore example --ignore website --ignore griffith-standalone -- --watch",
"release": "yarn build && lerna publish",
"start-server": "yarn workspace example run start",
"start-watch": "lerna run build --parallel --scope griffith-hls --scope griffith-mp4 -- --watch",
"start-on-build": "node scripts/wait-on-build && yarn start-server",
"start": "run-p start-watch start-on-build"
"start": "yarn start-server"
},
"devDependencies": {
"@babel/core": "^7.14.3",
Expand Down Expand Up @@ -83,8 +81,7 @@
"prettier": "^2.3.2",
"rollup": "^2.48.0",
"rollup-plugin-terser": "^7.0.2",
"ts-migrate": "^0.1.22",
"wait-on": "^6.0.0"
"ts-migrate": "^0.1.22"
},
"husky": {
"hooks": {
Expand Down
2 changes: 1 addition & 1 deletion packages/griffith-hls/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"browserslist": ["maintained node versions"],
"scripts": {
"prebuild": "rm -rf dist/**",
"build": "microbundle -f cjs,esm --no-sourcemap --no-compress --jsx React.createElement"
"build": "microbundle --tsconfig ../../tsconfig.build.json -f cjs,esm --no-sourcemap --no-compress --jsx React.createElement"
},
"peerDependencies": {
"react": "^16.8 || ^17",
Expand Down
5 changes: 1 addition & 4 deletions packages/griffith-hls/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"jsx": "react"
}
"extends": "../../tsconfig.json"
}
2 changes: 1 addition & 1 deletion packages/griffith-message/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"browserslist": ["maintained node versions"],
"scripts": {
"prebuild": "rm -rf dist/**",
"build": "microbundle -f cjs,esm --no-sourcemap --no-compress"
"build": "microbundle --tsconfig ../../tsconfig.build.json -f cjs,esm --no-sourcemap --no-compress"
}
}
2 changes: 1 addition & 1 deletion packages/griffith-mp4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"browserslist": ["maintained node versions"],
"scripts": {
"prebuild": "rm -rf dist/**",
"build": "microbundle -f cjs,esm --no-sourcemap --no-compress --jsx React.createElement"
"build": "microbundle --tsconfig ../../tsconfig.build.json -f cjs,esm --no-sourcemap --no-compress --jsx React.createElement"
},
"devDependencies": {
"read-chunk": "^3.0.0"
Expand Down
5 changes: 1 addition & 4 deletions packages/griffith-mp4/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"jsx": "react"
}
"extends": "../../tsconfig.json"
}
2 changes: 1 addition & 1 deletion packages/griffith-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"browserslist": ["maintained node versions"],
"scripts": {
"prebuild": "rm -rf dist/**",
"build": "microbundle -f cjs,esm --no-sourcemap --no-compress"
"build": "microbundle --tsconfig ../../tsconfig.build.json -f cjs,esm --no-sourcemap --no-compress"
}
}
2 changes: 1 addition & 1 deletion packages/griffith/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"browserslist": ["maintained node versions"],
"scripts": {
"prebuild": "rm -rf dist/**",
"build": "microbundle -f cjs,esm --no-sourcemap --no-compress --jsx React.createElement"
"build": "microbundle --tsconfig ../../tsconfig.build.json -f cjs,esm --no-sourcemap --no-compress --jsx React.createElement"
},
"peerDependencies": {
"react": "^16.8 || ^17",
Expand Down
5 changes: 1 addition & 4 deletions packages/griffith/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"jsx": "react"
}
"extends": "../../tsconfig.json"
}
26 changes: 0 additions & 26 deletions scripts/wait-on-build.js

This file was deleted.

7 changes: 7 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
// reset to empty
"paths": {}
}
}
13 changes: 11 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
/* Language and Environment */
"target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
/* Specify what JSX code is generated. */
"jsx": "react",
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
Expand All @@ -28,7 +29,15 @@
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
/* Specify a set of entries that re-map imports to additional lookup locations. */
"paths": {
// link all packages without build step
"griffith-mp4": ["./packages/griffith-mp4/src/index.ts"],
"griffith-hls": ["./packages/griffith-hls/src/index.ts"],
"griffith-utils": ["./packages/griffith-utils/src/index.ts"],
"griffith-message": ["./packages/griffith-message/src/index.ts"],
"griffith": ["./packages/griffith/src/index.ts"]
},
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
Expand Down
74 changes: 2 additions & 72 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1221,18 +1221,6 @@
signedsource "^1.0.0"
yargs "^9.0.0"

"@hapi/hoek@^9.0.0":
version "9.2.0"
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.2.0.tgz#f3933a44e365864f4dad5db94158106d511e8131"
integrity sha512-sqKVVVOe5ivCaXDWivIJYVSaEgdQK9ul7a4Kity5Iw7u9+wBAPbX1RMSnLLmp7O4Vzj0WOWwMAJsTL00xwaNug==

"@hapi/topo@^5.0.0":
version "5.1.0"
resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.1.0.tgz#dc448e332c6c6e37a4dc02fd84ba8d44b9afb012"
integrity sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==
dependencies:
"@hapi/hoek" "^9.0.0"

"@humanwhocodes/config-array@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9"
Expand Down Expand Up @@ -2261,23 +2249,6 @@
dependencies:
any-observable "^0.3.0"

"@sideway/address@^4.1.0":
version "4.1.2"
resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.2.tgz#811b84333a335739d3969cfc434736268170cad1"
integrity sha512-idTz8ibqWFrPU8kMirL0CoPH/A29XOzzAzpyN3zQ4kAWnzmNfFmRaoMNN6VI8ske5M73HZyhIaW4OuSFIdM4oA==
dependencies:
"@hapi/hoek" "^9.0.0"

"@sideway/formula@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.0.tgz#fe158aee32e6bd5de85044be615bc08478a0a13c"
integrity sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==

"@sideway/pinpoint@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df"
integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==

"@sinonjs/commons@^1.7.0":
version "1.8.3"
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.3.tgz#3802ddd21a50a949b6721ddd72da36e67e7f1b2d"
Expand Down Expand Up @@ -3347,13 +3318,6 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f"
integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==

axios@^0.21.1:
version "0.21.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
dependencies:
follow-redirects "^1.10.0"

axobject-query@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.0.2.tgz#ea187abe5b9002b377f925d8bf7d1c561adf38f9"
Expand Down Expand Up @@ -7222,7 +7186,7 @@ fn-name@~2.0.1:
resolved "https://registry.yarnpkg.com/fn-name/-/fn-name-2.0.1.tgz#5214d7537a4d06a4a301c0cc262feb84188002e7"
integrity sha1-UhTXU3pNBqSjAcDMJi/rhBiAAuc=

follow-redirects@^1.0.0, follow-redirects@^1.10.0:
follow-redirects@^1.0.0:
version "1.14.2"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.2.tgz#cecb825047c00f5e66b142f90fed4f515dec789b"
integrity sha512-yLR6WaE2lbF0x4K2qE2p9PEXKLDjUjnR/xmjS3wHAYxtlsI9MLLBJUZirAHKzUZDGLxje7w/cXR49WOUo4rbsA==
Expand Down Expand Up @@ -10091,17 +10055,6 @@ joi@12.x.x:
isemail "3.x.x"
topo "2.x.x"

joi@^17.4.0:
version "17.4.2"
resolved "https://registry.yarnpkg.com/joi/-/joi-17.4.2.tgz#02f4eb5cf88e515e614830239379dcbbe28ce7f7"
integrity sha512-Lm56PP+n0+Z2A2rfRvsfWVDXGEWjXxatPopkQ8qQ5mxCEhwHG+Ettgg5o98FFaxilOxozoa14cFhrE/hOzh/Nw==
dependencies:
"@hapi/hoek" "^9.0.0"
"@hapi/topo" "^5.0.0"
"@sideway/address" "^4.1.0"
"@sideway/formula" "^3.0.0"
"@sideway/pinpoint" "^2.0.0"

"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
Expand Down Expand Up @@ -10799,7 +10752,7 @@ lodash@4.17.11:
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==

lodash@^4.11.1, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.15, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.7.0:
lodash@^4.11.1, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.7.0:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
Expand Down Expand Up @@ -14763,13 +14716,6 @@ rxjs@^6.3.3, rxjs@^6.4.0:
dependencies:
tslib "^1.9.0"

rxjs@^7.1.0:
version "7.3.0"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.3.0.tgz#39fe4f3461dc1e50be1475b2b85a0a88c1e938c6"
integrity sha512-p2yuGIg9S1epc3vrjKf6iVb3RCaAYjYskkO+jHIaV0IjOPlJop4UnodOoFb2xeNwlguqLYvGw1b1McillYb5Gw==
dependencies:
tslib "~2.1.0"

sade@^1.7.4:
version "1.7.4"
resolved "https://registry.yarnpkg.com/sade/-/sade-1.7.4.tgz#ea681e0c65d248d2095c90578c03ca0bb1b54691"
Expand Down Expand Up @@ -16394,11 +16340,6 @@ tslib@^2.0.1, tslib@^2.0.3:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==

tslib@~2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a"
integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==

tsutils@^3.21.0:
version "3.21.0"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"
Expand Down Expand Up @@ -16979,17 +16920,6 @@ w3c-xmlserializer@^2.0.0:
dependencies:
xml-name-validator "^3.0.0"

wait-on@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/wait-on/-/wait-on-6.0.0.tgz#7e9bf8e3d7fe2daecbb7a570ac8ca41e9311c7e7"
integrity sha512-tnUJr9p5r+bEYXPUdRseolmz5XqJTTj98JgOsfBn7Oz2dxfE2g3zw1jE+Mo8lopM3j3et/Mq1yW7kKX6qw7RVw==
dependencies:
axios "^0.21.1"
joi "^17.4.0"
lodash "^4.17.21"
minimist "^1.2.5"
rxjs "^7.1.0"

walker@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb"
Expand Down

0 comments on commit 7188da8

Please sign in to comment.