Skip to content

Commit

Permalink
Merge pull request #541 from Mavrin/master
Browse files Browse the repository at this point in the history
Create publisher to release branch
  • Loading branch information
Mavrin authored Aug 14, 2018
2 parents cef40cb + f3f02ce commit d60c4b2
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ coverage
.idea
.vscode
.DS_Store
yarn.lock
yarn.lock
prepared
146 changes: 136 additions & 10 deletions package-lock.json

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

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
"test": "npm run build && karma start",
"lint": "tslint src/**/*.ts src/**/*.js plugins/**/*.ts plugins/**/*.js task/**/*.js config/**/*.js --exclude src/addons/**/*.*",
"devtest": "npm run build:dev && karma start --taucharts-debug",
"prepublishOnly": "npm run build"
"prepublishOnly": "npm run build",
"publishToReleaseBranch": "node tasks/publishToReleaseBranch.js"
},
"devDependencies": {
"@types/d3": "4.11.0",
Expand All @@ -63,6 +64,8 @@
"d3": "4.13.0",
"extract-text-webpack-plugin": "4.0.0-beta.0",
"file-saver": "1.3.3",
"fs-extra": "7.0.0",
"gh-pages": "1.2.0",
"istanbul-instrumenter-loader": "3.0.0",
"jquery": "3.3.1",
"js-schema": "1.0.1",
Expand All @@ -77,15 +80,13 @@
"karma-webpack": "2.0.13",
"less": "3.0.1",
"less-loader": "4.1.0",
"minimist": "1.2.0",
"mocha": "5.0.4",
"style-loader": "0.20.3",
"tau-tooltip": "1.1.3",
"ts-loader": "4.0.1",
"tslint": "5.9.1",
"tslint-eslint-rules": "5.1.0",
"typescript": "2.7.2",
"vinyl-source-stream": "2.0.0",
"webpack": "4.1.1",
"webpack-bundle-analyzer": "2.11.1",
"webpack-cli": "2.0.11",
Expand Down
39 changes: 39 additions & 0 deletions tasks/publishToReleaseBranch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const ghpages = require('gh-pages');
const {resolve, join} = require('path');
const resolvePath = (relativePath) => resolve(__dirname, relativePath);
const fs = require('fs-extra');

const dist = resolvePath('../dist');
const prepared = resolvePath('../prepared');
const examples = resolvePath('../examples');
const license = resolvePath('../LICENSE');
const readme = resolvePath('../README.md');
const types = resolvePath('../types');
const packagejson = resolvePath('../package.json');

async function publish() {
await fs.remove(prepared);
await fs.copy(dist, join(prepared, 'dist'));
await fs.copy(examples, join(prepared, 'examples'));
await fs.copy(types, join(prepared, 'types'));
await fs.copy(license, join(prepared, 'LICENSE'));
await fs.copy(readme, join(prepared, 'README.md'));
await fs.copy(packagejson, join(prepared, 'package.json'));
return new Promise((resolve, reject) => {
ghpages.publish(prepared, {
branch: 'release'
}, function (err) {
if (err) {
reject(err);
} else {
resolve();
}
});
})
}

publish()
.then(() => console.log('publish to release branch success'))
.catch((err) => {
console.log('could not publish to release branch', err)
});

0 comments on commit d60c4b2

Please sign in to comment.