Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
Use Typescript project references (experiment).
Browse files Browse the repository at this point in the history
* introduce optional, parallel `tsc --build` based build system

Signed-off-by: Zbigniew Zagorski <ext-zbyszek.zagorski@here.com>
  • Loading branch information
Zbigniew Zagorski committed Oct 11, 2019
1 parent 37a3137 commit 7b1f466
Show file tree
Hide file tree
Showing 52 changed files with 594 additions and 56 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Expand Up @@ -4,6 +4,8 @@ doc/
test-npm-packages-app/
.vscode/
.DS_Store


credentials.js
*.d.ts
*.js
*.js.map
tsconfig-build.tsbuildinfo
5 changes: 5 additions & 0 deletions .mocharc.json
@@ -0,0 +1,5 @@
{
"diff": true,
"spec": ["./test/**/*.js", "./@here/*/test/**/*.js"],
"exclude": ["./@here/harp-mapview/test/resources/testWorker.js"]
}
12 changes: 12 additions & 0 deletions @here/harp-datasource-protocol/test/tsconfig-build.json
@@ -0,0 +1,12 @@
{
"extends": "../../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"references": [
{ "path": "../tsconfig-build.json" },
{ "path": "../../harp-geoutils/tsconfig-build.json" },
{ "path": "../../harp-utils/tsconfig-build.json" }
]
}
12 changes: 12 additions & 0 deletions @here/harp-datasource-protocol/tsconfig-build.json
@@ -0,0 +1,12 @@
{
"extends": "../../tsconfig.settings.json",
"compilerOptions": {
"outDir": ".",
"rootDir": "."
},
"references": [
{ "path": "../harp-geoutils/tsconfig-build.json" },
{ "path": "../harp-utils/tsconfig-build.json" }
],
"exclude": ["test/**/*.ts"]
}
13 changes: 13 additions & 0 deletions @here/harp-debug-datasource/tsconfig-build.json
@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"references": [
{ "path": "../harp-lrucache/tsconfig-build.json" },
{ "path": "../harp-geoutils/tsconfig-build.json" },
{ "path": "../harp-mapview/tsconfig-build.json" }
],
"exclude": ["test/**/*.ts"]
}
3 changes: 2 additions & 1 deletion @here/harp-examples/package.json
Expand Up @@ -54,10 +54,11 @@
"highlight.js": "^9.15.8",
"html-webpack-plugin": "^3.2.0",
"ncp": "^2.0.0",
"source-map-loader": "^0.2.4",
"stats.js": "^0.17.0",
"style-loader": "^0.23.0",
"three": "^0.108.0",
"ts-loader": "^6.0.3",
"ts-loader": "^6.2.0",
"typescript": "^3.6.3",
"webpack": "^4.34.0",
"webpack-cli": "^3.3.4",
Expand Down
31 changes: 31 additions & 0 deletions @here/harp-examples/tsconfig-build.json
@@ -0,0 +1,31 @@
{
"extends": "../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": ".",
"resolveJsonModule": true
},
"references": [
{ "path": "../harp-datasource-protocol/tsconfig-build.json" },
{ "path": "../harp-debug-datasource/tsconfig-build.json" },
{ "path": "../harp-features-datasource/tsconfig-build.json" },
{ "path": "../harp-geojson-datasource/tsconfig-build.json" },
{ "path": "../harp-geoutils/tsconfig-build.json" },
{ "path": "../harp-map-controls/tsconfig-build.json" },
{ "path": "../harp-mapview/tsconfig-build.json" },
{ "path": "../harp-omv-datasource/tsconfig-build.json" },
{ "path": "../harp-text-canvas/tsconfig-build.json" },
{ "path": "../harp-utils/tsconfig-build.json" },
{ "path": "../harp-webtile-datasource/tsconfig-build.json" }
],
"include": [
"./*.ts",
"./src/*.ts",
"./lib/*.ts",
"./resources/*.ts",
"./decoder/*.ts",
"./src/*.tsx",
"./resources/**/*.json"
],
"exclude": ["test/**/*.ts", "dist/**/*.ts"]
}
44 changes: 44 additions & 0 deletions @here/harp-examples/webpack-build.config.js
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2017-2018 HERE Europe B.V.
* Licensed under Apache 2.0, see full license in LICENSE
* SPDX-License-Identifier: Apache-2.0
*/

/**
* This basically downgrades original webpack.config.js to compile
* only JS created by `tsc -b .` (in current folder).
*
* This is much faster in bigger build process as Typescript runs only once.
*
* Usage:
* - Development
* tsc --build tsconfig-build.json --watch --verbose --listEmittedFiles
* webpack-dev-server --config webpack-build.config.js
*
* - CI
* tsc --build tsconfig-build.json
* webpack --config webpack-build.config.js
*/
const configs = require('./webpack.config');

module.exports = configs.map(config => {
config.resolve.extensions = [".webpack.js", ".web.js", ".js"]
config.module.rules = config.module.rules.filter(rule => rule.loader !== "ts-loader")
config.module.rules.push({
rules: [
{
test: /\.js$/,
use: ["source-map-loader"],
enforce: "pre"
}
]
})
for(const entry in config.entries) {
config.entries[entry] = config.entries[entry].replace(/.ts$/, ".js");
}
return config;
})

throw new Foo();
5 changes: 1 addition & 4 deletions @here/harp-examples/webpack.config.js
Expand Up @@ -40,10 +40,7 @@ const commonConfig = {
}
],
resolve: {
extensions: [".webpack.js", ".web.ts", ".ts", ".tsx", ".web.js", ".js"],
alias: {
"react-native": "react-native-web"
}
extensions: [".webpack.js", ".web.ts", ".ts", ".tsx", ".web.js", ".js"]
},
module: {
rules: [
Expand Down
14 changes: 14 additions & 0 deletions @here/harp-features-datasource/tsconfig-build.json
@@ -0,0 +1,14 @@
{
"extends": "../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"references": [
{ "path": "../harp-datasource-protocol/tsconfig-build.json" },
{ "path": "../harp-geojson-datasource/tsconfig-build.json" },
{ "path": "../harp-mapview/tsconfig-build.json" },
{ "path": "../harp-omv-datasource/tsconfig-build.json" }
],
"exclude": ["test/**/*.ts"]
}
8 changes: 8 additions & 0 deletions @here/harp-fetch/test/tsconfig-build.json
@@ -0,0 +1,8 @@
{
"extends": "../../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"references": [{ "path": "../tsconfig-build.json" }]
}
8 changes: 8 additions & 0 deletions @here/harp-fetch/tsconfig-build.json
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"exclude": ["test/**/*.ts"]
}
18 changes: 18 additions & 0 deletions @here/harp-geojson-datasource/tsconfig-build.json
@@ -0,0 +1,18 @@
{
"extends": "../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"references": [
{ "path": "../harp-datasource-protocol/tsconfig-build.json" },
{ "path": "../harp-fetch/tsconfig-build.json" },
{ "path": "../harp-geoutils/tsconfig-build.json" },
{ "path": "../harp-lines/tsconfig-build.json" },
{ "path": "../harp-mapview/tsconfig-build.json" },
{ "path": "../harp-mapview-decoder/tsconfig-build.json" },
{ "path": "../harp-transfer-manager/tsconfig-build.json" },
{ "path": "../harp-utils/tsconfig-build.json" }
],
"exclude": ["test/**/*.ts"]
}
8 changes: 8 additions & 0 deletions @here/harp-geometry/test/tsconfig-build.json
@@ -0,0 +1,8 @@
{
"extends": "../../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"references": [{ "path": "../tsconfig-build.json" }]
}
9 changes: 9 additions & 0 deletions @here/harp-geometry/tsconfig-build.json
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"references": [{ "path": "../harp-geoutils/tsconfig-build.json" }],
"exclude": ["test/**/*.ts"]
}
8 changes: 8 additions & 0 deletions @here/harp-geoutils/test/tsconfig-build.json
@@ -0,0 +1,8 @@
{
"extends": "../../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"references": [{ "path": "../tsconfig-build.json" }]
}
8 changes: 8 additions & 0 deletions @here/harp-geoutils/tsconfig-build.json
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.settings.json",
"compilerOptions": {
"outDir": ".",
"rootDir": "."
},
"include": ["lib/**/*.ts", "index.ts"]
}
8 changes: 8 additions & 0 deletions @here/harp-lines/test/tsconfig-build.json
@@ -0,0 +1,8 @@
{
"extends": "../../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"references": [{ "path": "../tsconfig-build.json" }]
}
12 changes: 12 additions & 0 deletions @here/harp-lines/tsconfig-build.json
@@ -0,0 +1,12 @@
{
"extends": "../../tsconfig.settings.json",
"compilerOptions": {
"outDir": ".",
"rootDir": "."
},
"references": [
{ "path": "../harp-utils/tsconfig-build.json" },
{ "path": "../harp-materials/tsconfig-build.json" }
],
"exclude": ["test/**/*.ts"]
}
11 changes: 11 additions & 0 deletions @here/harp-lrucache/test/tsconfig-build.json
@@ -0,0 +1,11 @@
{
"extends": "../../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"references": [
{ "path": "../tsconfig-build.json" },
{ "path": "../../harp-utils/tsconfig-build.json" }
]
}
9 changes: 9 additions & 0 deletions @here/harp-lrucache/tsconfig-build.json
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.settings.json",
"compilerOptions": {
"outDir": ".",
"rootDir": "."
},
"references": [{ "path": "../harp-utils/tsconfig-build.json" }],
"exclude": ["test/**/*.ts"]
}
11 changes: 11 additions & 0 deletions @here/harp-map-controls/test/tsconfig-build.json
@@ -0,0 +1,11 @@
{
"extends": "../../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"references": [
{ "path": "../tsconfig-build.json" },
{ "path": "../../harp-geoutils/tsconfig-build.json" }
]
}
13 changes: 13 additions & 0 deletions @here/harp-map-controls/tsconfig-build.json
@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"references": [
{ "path": "../harp-geoutils/tsconfig-build.json" },
{ "path": "../harp-mapview/tsconfig-build.json" },
{ "path": "../harp-utils/tsconfig-build.json" }
],
"exclude": ["test/**/*.ts"]
}
11 changes: 11 additions & 0 deletions @here/harp-mapview-decoder/test/tsconfig-build.json
@@ -0,0 +1,11 @@
{
"extends": "../../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"references": [
{ "path": "../tsconfig-build.json" },
{ "path": "../../harp-test-utils/tsconfig-build.json" }
]
}
16 changes: 16 additions & 0 deletions @here/harp-mapview-decoder/tsconfig-build.json
@@ -0,0 +1,16 @@
{
"extends": "../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"references": [
{ "path": "../harp-datasource-protocol/tsconfig-build.json" },
{ "path": "../harp-fetch/tsconfig-build.json" },
{ "path": "../harp-geoutils/tsconfig-build.json" },
{ "path": "../harp-mapview/tsconfig-build.json" },
{ "path": "../harp-utils/tsconfig-build.json" },
{ "path": "../harp-test-utils/tsconfig-build.json" }
],
"exclude": ["test/**/*.ts"]
}
11 changes: 11 additions & 0 deletions @here/harp-mapview/test/tsconfig-build.json
@@ -0,0 +1,11 @@
{
"extends": "../../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"references": [
{ "path": "../tsconfig-build.json" },
{ "path": "../../harp-test-utils/tsconfig-build.json" }
]
}
18 changes: 18 additions & 0 deletions @here/harp-mapview/tsconfig-build.json
@@ -0,0 +1,18 @@
{
"extends": "../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"references": [
{ "path": "../harp-datasource-protocol/tsconfig-build.json" },
{ "path": "../harp-fetch/tsconfig-build.json" },
{ "path": "../harp-geoutils/tsconfig-build.json" },
{ "path": "../harp-lines/tsconfig-build.json" },
{ "path": "../harp-lrucache/tsconfig-build.json" },
{ "path": "../harp-materials/tsconfig-build.json" },
{ "path": "../harp-text-canvas/tsconfig-build.json" },
{ "path": "../harp-utils/tsconfig-build.json" }
],
"exclude": ["test/**/*.ts"]
}
3 changes: 2 additions & 1 deletion @here/harp-materials/lib/MapMeshMaterials.ts
Expand Up @@ -689,7 +689,8 @@ export namespace ExtrusionFeature {
*
* @see [[Tile#addRenderHelper]]
*/
export class ExtrusionFeatureMixin implements ExtrusionFeature {

class ExtrusionFeatureMixin implements ExtrusionFeature {
needsUpdate?: boolean;
uniformsNeedUpdate?: boolean;
private m_extrusion: number = ExtrusionFeature.DEFAULT_RATIO_MAX;
Expand Down
9 changes: 9 additions & 0 deletions @here/harp-materials/tsconfig-build.json
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.settings.json",
"compilerOptions": {
"outDir": ".",
"rootDir": "."
},
"references": [{ "path": "../harp-utils/tsconfig-build.json" }],
"exclude": ["test/**/*.ts"]
}

0 comments on commit 7b1f466

Please sign in to comment.