Skip to content

Commit

Permalink
refactor(tsconfig): Use tsconfig paths during development instead of …
Browse files Browse the repository at this point in the history
…build assets for dependencies
  • Loading branch information
carte7000 committed Aug 6, 2019
1 parent f4c441a commit 661407a
Show file tree
Hide file tree
Showing 16 changed files with 77 additions and 19 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
"tsx",
"js"
],
"moduleNameMapper": {
"^@tezos-ts/rpc$": "<rootDir>/packages/tezos-ts-rpc/src/tezos-ts-rpc.ts",
"^@tezos-ts/tezos-ts$": "<rootDir>/packages/tezos-ts/src/tezos-ts.ts"
},
"coveragePathIgnorePatterns": [
"/node_modules/",
"/test/"
Expand Down
6 changes: 5 additions & 1 deletion packages/tezos-ts-react-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
"precommit": "lint-staged",
"prebuild": "rimraf dist",
"build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src",
"build": "tsc --project ./tsconfig.prod.json --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src",
"start": "rollup -c rollup.config.ts -w",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
Expand All @@ -48,6 +48,10 @@
"tsx",
"js"
],
"moduleNameMapper": {
"^@tezos-ts/rpc$": "<rootDir>/../tezos-ts-rpc/src/tezos-ts-rpc.ts",
"^@tezos-ts/tezos-ts$": "<rootDir>/../tezos-ts/src/tezos-ts.ts"
},
"coveragePathIgnorePatterns": [
"/node_modules/",
"/test/"
Expand Down
2 changes: 1 addition & 1 deletion packages/tezos-ts-react-components/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default {
// Allow json resolution
json(),
// Compile TypeScript files
typescript({ useTsconfigDeclarationDir: true }),
typescript({ tsconfig: './tsconfig.prod.json', useTsconfigDeclarationDir: true }),
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
commonjs(),
// Allow node_modules resolution, so you can use 'external' to control
Expand Down
9 changes: 9 additions & 0 deletions packages/tezos-ts-react-components/tsconfig.prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.prod.json",
"compilerOptions": {
"declarationDir": "./dist/types",
"outDir": "./dist/lib",
"typeRoots": ["./node_modules/@types"]
},
"include": ["./src/**/*"]
}
2 changes: 1 addition & 1 deletion packages/tezos-ts-rpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
"precommit": "lint-staged",
"prebuild": "rimraf dist",
"build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src",
"build": "tsc --project ./tsconfig.prod.json --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src",
"start": "rollup -c rollup.config.ts -w"
},
"lint-staged": {
Expand Down
2 changes: 1 addition & 1 deletion packages/tezos-ts-rpc/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default {
// Allow json resolution
json(),
// Compile TypeScript files
typescript({ useTsconfigDeclarationDir: true }),
typescript({ tsconfig: './tsconfig.prod.json', useTsconfigDeclarationDir: true }),
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
commonjs(),
// Allow node_modules resolution, so you can use 'external' to control
Expand Down
1 change: 1 addition & 0 deletions packages/tezos-ts-rpc/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./tezos-ts-rpc";
3 changes: 2 additions & 1 deletion packages/tezos-ts-rpc/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"declarationDir": "dist/types",
"outDir": "dist/lib",
"typeRoots": ["node_modules/@types"]
"typeRoots": ["node_modules/@types"],
"jsx": "react"
},
"include": ["src"]
}
10 changes: 10 additions & 0 deletions packages/tezos-ts-rpc/tsconfig.prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.prod.json",
"compilerOptions": {
"declarationDir": "./dist/types",
"outDir": "./dist/lib",
"typeRoots": ["./node_modules/@types"],
"jsx": "react"
},
"include": ["./src/**/*"]
}
5 changes: 4 additions & 1 deletion packages/tezos-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
"precommit": "lint-staged",
"prebuild": "rimraf dist",
"build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src",
"build": "tsc --project ./tsconfig.prod.json --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src",
"start": "rollup -c rollup.config.ts -w"
},
"lint-staged": {
Expand All @@ -46,6 +46,9 @@
"tsx",
"js"
],
"moduleNameMapper": {
"^@tezos-ts/rpc$": "<rootDir>/../tezos-ts-rpc/src/tezos-ts-rpc.ts"
},
"coveragePathIgnorePatterns": [
"/node_modules/",
"/test/"
Expand Down
2 changes: 1 addition & 1 deletion packages/tezos-ts/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default {
// Allow json resolution
json(),
// Compile TypeScript files
typescript({ useTsconfigDeclarationDir: true }),
typescript({ tsconfig: './tsconfig.prod.json', useTsconfigDeclarationDir: true }),
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
commonjs(),
// Allow node_modules resolution, so you can use 'external' to control
Expand Down
8 changes: 4 additions & 4 deletions packages/tezos-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declarationDir": "dist/types",
"outDir": "dist/lib",
"typeRoots": ["node_modules/@types"]
"declarationDir": "./dist/types",
"outDir": "./dist/lib",
"typeRoots": ["./node_modules/@types"]
},
"include": ["src"]
"include": ["./src/**/*"]
}
9 changes: 9 additions & 0 deletions packages/tezos-ts/tsconfig.prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.prod.json",
"compilerOptions": {
"declarationDir": "./dist/types",
"outDir": "./dist/lib",
"typeRoots": ["./node_modules/@types"]
},
"include": ["./src/**/*"]
}
14 changes: 6 additions & 8 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
"allowSyntheticDefaultImports": true,
"noUnusedParameters": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"paths": {
"@tezos-ts": ["packages/tezos-ts/src/tezos-ts.ts"],
"@tezos-ts/rpc": ["packages/tezos-ts-rpc/src/tezos-ts-rpc.ts"],
"@tezos-ts/react-components": [
"packages/tezos-ts-react-components/src/tezos-ts-react-components.ts"
]
"emitDecoratorMetadata": true,
"baseUrl": "packages",
"paths": {
"@tezos-ts/rpc": ["tezos-ts-rpc/src/tezos-ts-rpc.ts"],
"@tezos-ts/tezos-ts": ["tezos-ts/src/tezos-ts.ts"]
}
}
}
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./tsconfig.base.json"
}
16 changes: 16 additions & 0 deletions tsconfig.prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"moduleResolution": "node",
"target": "es5",
"module": "es2015",
"lib": ["es2015", "es2016", "es2017", "dom"],
"strict": true,
"sourceMap": true,
"declaration": true,
"allowSyntheticDefaultImports": true,
"noUnusedParameters": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"jsx": "react"
}
}

0 comments on commit 661407a

Please sign in to comment.