Skip to content

Commit

Permalink
refactor: 更新文件替换的方法
Browse files Browse the repository at this point in the history
  • Loading branch information
twp0217 committed Nov 13, 2018
1 parent d50a343 commit d9507a6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"name": "ngx-echarts-demo",
"version": "6.0.1",
"version": "6.0.2",
"scripts": {
"ng": "ng",
"start": "npm run build:lib && ng serve",
"build": "npm run build:lib && ng build",
"build:lib": "ng build ngx-echarts --prod && npm run copy:readme",
"build:lib": "ng build ngx-echarts --prod && npm run readme && npm run version",
"changelog:init": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"copy:readme": "ncp ./README.md ./dist/ngx-echarts/README.md",
"publish": "npm publish ./dist/ngx-echarts --access=public",
"publish:demo": "ng build --base-href /ngx-echarts/ --prod && gh-pages -d ./dist/ngx-echarts-demo",
"readme": "node ./scripts/readme.js",
"version": "node ./scripts/version.js",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
Expand Down Expand Up @@ -46,12 +47,12 @@
"html-loader": "^0.5.5",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"jsonfile": "^5.0.0",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"ncp": "^2.0.0",
"ng-packagr": "^4.4.0",
"protractor": "~5.4.0",
"raw-loader": "^0.5.1",
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-echarts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@twp0217/ngx-echarts",
"version": "6.0.1",
"version": "0.0.0",
"description": "Angular(v2+) ECharts component",
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions scripts/readme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const fs = require('fs');
const sourceFile = './README.md';
const targetFile = './dist/ngx-echarts/README.md';

fs.createReadStream(sourceFile).pipe(fs.createWriteStream(targetFile));
9 changes: 9 additions & 0 deletions scripts/version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const jsonfile = require('jsonfile');
const sourceFile = './package.json';
const targetFile = './dist/ngx-echarts/package.json';

const sourceObject = jsonfile.readFileSync(sourceFile);
const targetObject = jsonfile.readFileSync(targetFile);
targetObject.version = sourceObject.version;

jsonfile.writeFileSync(targetFile, targetObject, { spaces: 2, EOL: '\r\n' });

0 comments on commit d9507a6

Please sign in to comment.