Skip to content

Commit

Permalink
finalize build
Browse files Browse the repository at this point in the history
  • Loading branch information
scttcper committed Jan 14, 2018
1 parent 1e894e1 commit 11a50ed
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 34 deletions.
30 changes: 0 additions & 30 deletions build.sh

This file was deleted.

73 changes: 73 additions & 0 deletions build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { copySync } from 'fs-extra';
import { build } from 'ng-packagr';
import { join } from 'path';
import * as rimraf from 'rimraf';


const MODULE_NAMES = [
'alpha',
'block',
'chrome',
'circle',
'compact',
'github',
'hue',
'material',
'photoshop',
'sketch',
'slider',
'swatches',
'twitter',
];

async function main() {
// cleanup dist
rimraf.sync(join(process.cwd(), '/dist'));


// make helpers
await build({
project: join(process.cwd(), '/src/lib/helpers/package.json')
});
await copySync(
join(process.cwd(), '/dist/helpers'),
join(process.cwd(), '/dist/package-dist/helpers'),
);

// make common
rimraf.sync(join(process.cwd(), '/src/lib/common/node_modules'));
await copySync(
join(process.cwd(), '/dist/helpers'),
join(process.cwd(), '/src/lib/common/node_modules/ngx-color/helpers'),
);
await build({
project: join(process.cwd(), 'src/lib/common/package.json'),
});
await copySync(
join(process.cwd(), '/dist/common'),
join(process.cwd(), '/dist/package-dist'),
);


for (const m of MODULE_NAMES) {
rimraf.sync(join(process.cwd(), `/src/lib/components/${m}/node_modules`));
await copySync(
join(process.cwd(), '/dist/package-dist'),
join(process.cwd(), `/src/lib/components/${m}/node_modules/ngx-color`),
);
await build({
project: join(process.cwd(), `src/lib/components/${m}/package.json`),
});

}
}

main()
.then(() => console.log('success'))
.catch((e) => {
console.error(e);
process.exit(1);
});

// cpx.copy('README.md', 'dist');
// cpx.copy('LICENSE', 'dist');
34 changes: 31 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "./build.sh",
"build": "ts-node build.ts",
"publish": "cd dist/packages-dist && npm publish",
"bundlesize": "npx bundlesize",
"ghpages": "ng build --aot --output-hashing=all --named-chunks=false --build-optimizer --environment=prod --sourcemaps=false --extract-css=true --no-progress --baseHref='/ngx-color/'",
Expand Down Expand Up @@ -40,11 +40,14 @@
"@angular/cli": "1.6.4",
"@angular/compiler-cli": "^5.2.0",
"@angular/language-service": "^5.2.0",
"@types/fs-extra": "^5.0.0",
"@types/jasmine": "^2.8.4",
"@types/jasminewd2": "^2.0.3",
"@types/node": "^9.3.0",
"@types/tinycolor2": "^1.4.0",
"codelyzer": "^4.0.2",
"cpx": "^1.5.0",
"fs-extra": "^5.0.0",
"jasmine-core": "^2.8.0",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^2.0.0",
Expand All @@ -53,8 +56,10 @@
"karma-coverage-istanbul-reporter": "^1.3.3",
"karma-jasmine": "^1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"ncp": "^2.0.0",
"ng-packagr": "^2.0.0-rc.10",
"protractor": "^5.2.2",
"rimraf": "^2.6.2",
"ts-node": "^4.1.0",
"tslint": "^5.9.1",
"typescript": "2.6.x"
Expand Down

0 comments on commit 11a50ed

Please sign in to comment.