This repository has been archived by the owner on Aug 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
37 additions
and
30 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
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 |
---|---|---|
@@ -1,32 +1,38 @@ | ||
const { sync } = require('execa') | ||
const mkdirp = require('mkdirp') | ||
const path = require('path') | ||
const { exec } = require('execa-pro') | ||
|
||
const { version } = require('../lerna.json') | ||
; (async () => { | ||
const target = process.argv.slice(2)[0] | ||
const remote = sync('git', ['config', 'remote.origin.url']).stdout | ||
|
||
const cwd = path.join(process.cwd(), 'tmp/gh-pages') | ||
;(async () => { | ||
const target = process.argv.slice(2)[0] | ||
const remote = await exec('git config remote.origin.url') | ||
await exec(`mkdirp ${cwd}`) | ||
await exec( | ||
[ | ||
`git init`, | ||
`git remote add --fetch origin ${remote[0].stdout}`, | ||
`git checkout -b gh-pages`, | ||
`git checkout gh-pages`, | ||
`rm -rf ${target || 'latest'}`, | ||
`mkdirp v`, | ||
`cp -r ../../packages/docs/build ${target || `v/${version}`}`, | ||
`cp -r ../../packages/docs/build ${target || 'latest'}`, | ||
`cp -r ../../packages/docs/build/404.html 404.html`, | ||
`git add --all`, | ||
`git commit --allow-empty -m gh-pages`, | ||
`git push --force --quiet origin gh-pages`, | ||
], | ||
{ | ||
cwd, | ||
stdio: 'inherit', | ||
reject: false, | ||
} | ||
) | ||
})() | ||
const { version } = require('../lerna.json') | ||
const cwd = path.join(process.cwd(), 'tmp/gh-pages') | ||
mkdirp.sync(cwd) | ||
|
||
const commands = | ||
[ | ||
`git init`, | ||
`git remote add --fetch origin ${remote[0].stdout}`, | ||
`git checkout -b gh-pages`, | ||
`git checkout gh-pages`, | ||
`rm -rf ${target || 'latest'}`, | ||
`mkdirp v`, | ||
`cp -r ../../packages/docs/build ${target || `v/${version}`}`, | ||
`cp -r ../../packages/docs/build ${target || 'latest'}`, | ||
`cp -r ../../packages/docs/build/404.html 404.html`, | ||
`git add --all`, | ||
`git commit --allow-empty -m gh-pages`, | ||
`git push --force --quiet origin gh-pages`, | ||
] | ||
|
||
commands.forEach(cmd => { | ||
const c = cmd.split(' ') | ||
|
||
sync(c[0], c.slice(1), { | ||
cwd, | ||
stdio: 'inherit', | ||
reject: false, | ||
}) | ||
}) | ||
})() |