Skip to content

Commit

Permalink
build: refactor build script
Browse files Browse the repository at this point in the history
  • Loading branch information
kukhariev committed May 20, 2019
1 parent b0dacc5 commit ebfb3e4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scripts/build.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/* tslint:disable */
import * as util from 'util';
import { build } from 'ng-packagr';
import * as fs from 'fs';
import * as rimraf from 'rimraf';
const copyFile = util.promisify(fs.copyFile);
const unlink = util.promisify(fs.unlink);
const writeFile = util.promisify(fs.writeFile);

(async () => {
rimraf.sync('dist');
try {
const packageJson = JSON.parse(fs.readFileSync('package.json').toString());
delete packageJson['devDependencies'];
delete packageJson['scripts'];
delete packageJson['private'];
delete packageJson['dependencies'];
delete packageJson['husky'];
delete packageJson.devDependencies;
delete packageJson.scripts;
delete packageJson.private;
delete packageJson.dependencies;
delete packageJson.husky;
delete packageJson['lint-staged'];
delete packageJson['config'];
delete packageJson.config;
packageJson.peerDependencies = {
'@angular/common': '^6.0.0 || ^7.0.0',
rxjs: '^6.0.0'
Expand All @@ -28,7 +28,7 @@ const unlink = util.promisify(fs.unlink);
},
dest: '../../dist/uploadx'
};
fs.writeFileSync('src/uploadx/package.json', JSON.stringify(packageJson, undefined, 2));
await writeFile('src/uploadx/package.json', JSON.stringify(packageJson, undefined, 2));
await build({ project: 'src/uploadx/package.json' });
await copyFile('LICENSE', 'dist/uploadx/LICENSE');
await copyFile('README.md', 'dist/uploadx/README.md');
Expand Down

0 comments on commit ebfb3e4

Please sign in to comment.