-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #541 from Mavrin/master
Create publisher to release branch
- Loading branch information
Showing
4 changed files
with
181 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ coverage | |
.idea | ||
.vscode | ||
.DS_Store | ||
yarn.lock | ||
yarn.lock | ||
prepared |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}); |