diff --git a/package.json b/package.json index 0d881cd..0aef0c9 100644 --- a/package.json +++ b/package.json @@ -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" @@ -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", diff --git a/projects/ngx-echarts/package.json b/projects/ngx-echarts/package.json index 5aed371..59a94c8 100644 --- a/projects/ngx-echarts/package.json +++ b/projects/ngx-echarts/package.json @@ -1,6 +1,6 @@ { "name": "@twp0217/ngx-echarts", - "version": "6.0.1", + "version": "0.0.0", "description": "Angular(v2+) ECharts component", "repository": { "type": "git", diff --git a/scripts/readme.js b/scripts/readme.js new file mode 100644 index 0000000..874b00e --- /dev/null +++ b/scripts/readme.js @@ -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)); \ No newline at end of file diff --git a/scripts/version.js b/scripts/version.js new file mode 100644 index 0000000..7c7731f --- /dev/null +++ b/scripts/version.js @@ -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' }); \ No newline at end of file