Skip to content

Commit

Permalink
fix(build-main): move ng dependencies to ROOT of Stark. Fix issue in …
Browse files Browse the repository at this point in the history
…build process. Rename tsconfig

Move ng dependencies and rxjs dep into the ROOT to avoid install of those shared in multiple
packages.
Rename tsconfig inside packages to tsconfig-build and remove root tsconfig.json file to
make IntelliJ working correctly

ISSUES CLOSED: #361, #362
  • Loading branch information
ageorges-nbb committed May 8, 2018
1 parent 08a5383 commit 98d294c
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 37 deletions.
23 changes: 12 additions & 11 deletions build-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -250,19 +250,20 @@ compilePackage() {
logDebug "Compiling package [$3] located in: $1" 1

if containsElement "${3}" "${4:-}"; then
logTrace "[$3]: Compiling: $TSC -p $1/tsconfig.json" 2
$TSC -p ${1}/tsconfig.json
logTrace "[$3]: Compiling: $TSC -p $1/tsconfig-build.json" 2
$TSC -p ${1}/tsconfig-build.json
else
logTrace "[$3]: Compiling: $NGC -p $1/tsconfig.json" 2
logTrace "[$3]: Compiling: $NGC -p $1/tsconfig-build.json" 2
local package_name=$(basename "${2}")
$NGC -p ${1}/tsconfig.json
$NGC -p ${1}/tsconfig-build.json
logTrace "[$3]: Create ${package_name}.d.ts re-export file for tsickle" 2

# this is not a typo!
N="
"

echo "$(cat ${LICENSE_BANNER}) ${N} export * from \"./src/${package_name}\"" > ${2}/${package_name}.d.ts
# Generate the package's d.ts file at the root of dist/packages (e.g., dist/packages/stark-core.d.ts)
echo "$(cat ${LICENSE_BANNER}) ${N} export * from './${package_name}/${package_name}'" > ${2}/../${package_name}.d.ts
echo "{\"__symbolic\":\"module\",\"version\":3,\"metadata\":{},\"exports\":[{\"from\":\"./${package_name}/${package_name}\"}],\"flatModuleIndexRedirect\":true}" > ${2}/../${package_name}.metadata.json
fi

Expand All @@ -271,7 +272,7 @@ N="
[ -d "${DIR}" ] || continue
BASE_DIR=$(basename "${DIR}")
# Skip over directories that are not nested entry points
[[ -e ${DIR}/tsconfig.json && "${BASE_DIR}" != "integrationtest" ]] || continue
[[ -e ${DIR}/tsconfig-build.json && "${BASE_DIR}" != "integrationtest" ]] || continue
compilePackage ${DIR} ${2}/${BASE_DIR} ${3} ${4}
done
}
Expand All @@ -291,21 +292,21 @@ compilePackageES5() {
logDebug "Compiling package located in : $1 to ES5" 1

if containsElement "${3}" "${4:-}"; then
logTrace "${FUNCNAME[0]}: [${3}]: Compiling: ${TSC} -p ${1}/tsconfig.json --target es5 -d false --outDir ${2} --importHelpers true --sourceMap" 2
logTrace "${FUNCNAME[0]}: [${3}]: Compiling: ${TSC} -p ${1}/tsconfig-build.json --target es5 -d false --outDir ${2} --importHelpers true --sourceMap" 2
local package_name=$(basename "${2}")
$TSC -p ${1}/tsconfig.json --target es5 -d false --outDir ${2} --importHelpers true --sourceMap
$TSC -p ${1}/tsconfig-build.json --target es5 -d false --outDir ${2} --importHelpers true --sourceMap
else
logTrace "${FUNCNAME[0]}: [${3}]: Compiling: ${NGC} -p ${1}/tsconfig.json --target es5 -d false --outDir ${2} --importHelpers true --sourceMap" 2
logTrace "${FUNCNAME[0]}: [${3}]: Compiling: ${NGC} -p ${1}/tsconfig-build.json --target es5 -d false --outDir ${2} --importHelpers true --sourceMap" 2
local package_name=$(basename "${2}")
$NGC -p ${1}/tsconfig.json --target es5 -d false --outDir ${2} --importHelpers true --sourceMap
$NGC -p ${1}/tsconfig-build.json --target es5 -d false --outDir ${2} --importHelpers true --sourceMap
fi

logTrace "Building sub-packages" 2
for DIR in ${1}/* ; do
[ -d "${DIR}" ] || continue
BASE_DIR=$(basename "${DIR}")
# Skip over directories that are not nested entry points
[[ -e ${DIR}/tsconfig.json && "${BASE_DIR}" != "integrationtest" ]] || continue
[[ -e ${DIR}/tsconfig-build.json && "${BASE_DIR}" != "integrationtest" ]] || continue
compilePackageES5 ${DIR} ${2} ${3}
done
}
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@
"npm": ">=5.3.0"
},
"devDependencies": {
"@angular/common": "5.2.10",
"@angular/compiler": "5.2.10",
"@angular/compiler-cli": "5.2.10",
"@angular/core": "5.2.10",
"@angular/router": "5.2.10",
"@angular/platform-browser": "5.2.10",
"@angular/platform-browser-dynamic": "5.2.10",
"@commitlint/cli": "6.1.3",
"@commitlint/config-conventional": "6.1.3",
"@ngtools/json-schema": "1.1.0",
Expand All @@ -37,6 +41,7 @@
"rollup-plugin-commonjs": "9.1.0",
"rollup-plugin-node-resolve": "3.3.0",
"rollup-plugin-sourcemaps": "0.4.2",
"rxjs": "5.6.0-forward-compat.4",
"stylelint": "9.2.0",
"stylelint-config-prettier": "3.2.0",
"tslint": "5.9.1",
Expand Down
11 changes: 2 additions & 9 deletions packages/stark-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,11 @@
"deep-freeze-strict": "1.1.1",
"ibantools": "2.0.0",
"moment": "2.22.1",
"rxjs": "5.6.0-forward-compat.4",
"typescript": "2.6.2",
"uuid": "3.2.1",
"zone.js": "0.8.26"
},
"devDependencies": {
"@angular/common": "5.2.10",
"@angular/compiler": "5.2.10",
"@angular/compiler-cli": "5.2.10",
"@angular/core": "5.2.10",
"@angular/router": "5.2.10",
"@angular/platform-browser": "5.2.10",
"@angular/platform-browser-dynamic": "5.2.10",
"@nationalbankbelgium/stark-testing": "../stark-testing",
"tslint": "5.9.1"
},
Expand All @@ -64,7 +56,8 @@
"@angular/compiler-cli": "5.x",
"@angular/core": "5.x",
"@angular/platform-browser": "5.x",
"@angular/platform-browser-dynamic": "5.x"
"@angular/platform-browser-dynamic": "5.x",
"rxjs": "5.x"
},
"scripts": {
"clean": "npx rimraf dist",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"extends": "../../tsconfig.json",

"extends": "../stark-build/tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"rootDir": ".",
"typeRoots": ["./node_modules/@types", "./node_modules/@nationalbankbelgium/stark-testing/node_modules/@types"],
"lib": ["dom", "dom.iterable", "es2017"],
"paths": {
"rxjs/*": ["../../node_modules/rxjs/*"],
"@angular/*": ["node_modules/@angular/*"],
"@angular/*": ["../../node_modules/@angular/*"],
"@nationalbankbelgium/stark-core": ["."]
},
"outDir": "../../dist/packages/stark-core"
Expand Down
1 change: 1 addition & 0 deletions packages/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"importHelpers": false,
"paths": {
"rxjs/*": ["../node_modules/rxjs/*"],
"@angular/*": ["../node_modules/@angular/*"],
"@nationalbankbelgium/stark-*": ["./*"]
},
"skipDefaultLibCheck": true,
Expand Down
6 changes: 3 additions & 3 deletions starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"@angular/platform-server": "5.2.10",
"@angular/router": "5.2.10",
"@mdi/angular-material": "2.2.43",
"@nationalbankbelgium/stark-core": "file:../dist/packages-dist/stark-core/nationalbankbelgium-stark-core-10.0.0-alpha.2-13e40e3.tgz",
"@nationalbankbelgium/stark-core": "file:../dist/packages-dist/stark-core/nationalbankbelgium-stark-core-10.0.0-alpha.2-5fde14d.tgz",
"@ngrx/store": "5.2.0",
"@uirouter/angular": "1.0.1",
"@uirouter/visualizer": "6.0.0",
Expand All @@ -134,8 +134,8 @@
"web-animations-js": "2.3.1"
},
"devDependencies": {
"@nationalbankbelgium/stark-build": "file:../dist/packages-dist/stark-build/nationalbankbelgium-stark-build-10.0.0-alpha.2-13e40e3.tgz",
"@nationalbankbelgium/stark-testing": "file:../dist/packages-dist/stark-testing/nationalbankbelgium-stark-testing-10.0.0-alpha.2-13e40e3.tgz",
"@nationalbankbelgium/stark-build": "file:../dist/packages-dist/stark-build/nationalbankbelgium-stark-build-10.0.0-alpha.2-5fde14d.tgz",
"@nationalbankbelgium/stark-testing": "file:../dist/packages-dist/stark-testing/nationalbankbelgium-stark-testing-10.0.0-alpha.2-5fde14d.tgz",
"@types/core-js": "0.9.46",
"@types/hammerjs": "2.0.35",
"@types/node": "6.0.106",
Expand Down
11 changes: 0 additions & 11 deletions tsconfig.json

This file was deleted.

0 comments on commit 98d294c

Please sign in to comment.