Skip to content

Commit

Permalink
chore: update builds to use custom tsconfig (ngxs#297)
Browse files Browse the repository at this point in the history
* chore: update builds to use custom tsconfig

* chore: fix integration

* chore: fix build config

* fix: tweak config
  • Loading branch information
Danny Blue authored Apr 16, 2018
1 parent 663d2cb commit 242c8fa
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 17 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
"// - BUILDING": "Run Apps in dev and with packaged modules",
"build": "yarn build:packages && ts-node tools/set-metadata",
"build:packages": "ts-node tools/package",
"build:integration": "ng build --prod --app 1 #requires yarn package",
"build:integration": "ng build --prod --app 1 #requires yarn build",
"// - TESTING": "Test all modules",
"test": "ng test",
"test:integration": "ng test --app 1 #requires yarn package",
"test:integration": "ng test --app 1 #requires yarn build",
"// - CI": "Ci Testing",
"test:ci": "ng test --code-coverage --progress=false --single-run",
"test:ci:integration": "ng test --progress=false --app 1 --single-run && ng build --prod --progress=false --app 1",
Expand Down
18 changes: 4 additions & 14 deletions tools/package.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env node
'use strict';

import { remove } from 'fs-extra';
import { execute, getPackages } from './utils';
import { ngPackagr } from 'ng-packagr';
import { join } from 'path';

import { getPackages } from './utils';

async function main(specificPackage?: string) {
// get all packages
Expand All @@ -22,23 +23,12 @@ async function main(specificPackage?: string) {
try {
await ngPackagr()
.forProject(pack.ngPackagrProjectPath)
.withTsConfig(join(__dirname, '../tsconfig.build.json'))
.build();
} catch (err) {
console.error('ngPackagr build failed', err);
throw err;
}

// link the packages so they can find each other
try {
await execute(`npm link ${pack.buildPath}`);
await remove(`${pack.buildPath}/package-lock.json`);
await remove(`${pack.buildPath}/node_modules`);

console.log(`${pack.packageName} linked`);
} catch (err) {
console.log('failed to link npm builds', err);
throw err;
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion tools/set-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ async function main() {
}

// save the package file after we have updated the keys and peerDependencies
await writeFile(packPath, JSON.stringify(packPackage, null, 2), () => console.error('Write failed!'));
await writeFile(packPath, JSON.stringify(packPackage, null, 2), err => {
if (err) {
console.error('Write failed!');
}
});
}

console.log(`package version set to ${ngxsJson.version}`);
Expand Down
21 changes: 21 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": "./tsconfig.json",
"angularCompilerOptions": {
"flatModuleId": "AUTOGENERATED",
"flatModuleOutFile": "AUTOGENERATED"
},
"compilerOptions": {
"paths": {
"@ngxs/*": ["../../builds/*"]
},
"target": "es2015",
"module": "es2015",
"moduleResolution": "node",
"declaration": true,
"sourceMap": true,
"inlineSources": true,
"skipLibCheck": true,
"importHelpers": true
},
"files": ["AUTOGENERATED"]
}

0 comments on commit 242c8fa

Please sign in to comment.