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

HARP-6198: Use Typescript project references (experiment). #592

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ test-npm-packages-app/
.vscode/
.DS_Store
.nyc_output/

credentials.js
*.d.ts
*.js
*.js.map
tsconfig-build.tsbuildinfo
5 changes: 5 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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": "^1.0.0",
"three": "^0.110.0",
"ts-loader": "^6.0.3",
"ts-loader": "^6.2.1",
"typescript": "^3.7.2",
"webpack": "^4.34.0",
"webpack-cli": "^3.3.4",
Expand Down
31 changes: 31 additions & 0 deletions @here/harp-examples/tsconfig-build.json
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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();
16 changes: 5 additions & 11 deletions @here/harp-examples/webpack.config.js
Original file line number Diff line number Diff line change
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 All @@ -52,13 +49,9 @@ const commonConfig = {
loader: "ts-loader",
exclude: /node_modules/,
options: {
configFile: path.join(process.cwd(), "tsconfig.json"),
configFile: path.join(__dirname, "tsconfig-build.json"),
onlyCompileBundledFiles: true,
transpileOnly: prepareOnly,
compilerOptions: {
sourceMap: !prepareOnly,
declaration: false
}
projectReferences: true
}
}
]
Expand All @@ -84,12 +77,13 @@ const commonConfig = {
const decoderConfig = merge(commonConfig, {
target: "webworker",
entry: {
decoder: "./decoder/decoder.ts"
decoder: "./decoder/decoder"
}
});

const webpackEntries = glob
.sync(path.join(__dirname, "./src/*.{ts,tsx}"))
.filter(name => !name.includes(".d.ts"))
.reduce((result, entry) => {
const name = path.basename(entry).replace(/.tsx?$/, "");
if (name.startsWith("common")) {
Expand Down
14 changes: 14 additions & 0 deletions @here/harp-features-datasource/tsconfig-build.json
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../../tsconfig.settings.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "."
},
"references": [
{ "path": "../tsconfig-build.json" },
{ "path": "../../harp-test-utils/tsconfig-build.json" }
]
}