mirror of
https://github.com/primer/css.git
synced 2024-11-30 01:04:04 +03:00
31 lines
823 B
JavaScript
Executable File
31 lines
823 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
const execa = require('execa')
|
|
const fse = require('fs-extra')
|
|
const globby = require('globby')
|
|
|
|
const revertPackages = () => {
|
|
const lernaConfig = require('../lerna.json')
|
|
const globs = lernaConfig.packages
|
|
const jsons = globs.map(glob => glob + '/package.json')
|
|
const tarballs = globs.map(glob => glob + '/*.tgz')
|
|
const opts = {stdio: 'inherit'}
|
|
return Promise.all([
|
|
execa('git', ['checkout', '--'].concat(globs), opts),
|
|
globby(tarballs)
|
|
.then(paths => {
|
|
if (paths.length) {
|
|
console.warn('deleting %d tarball(s)', paths.length)
|
|
return Promise.all(
|
|
paths.map(tgz => fse.remove(tgz))
|
|
)
|
|
}
|
|
}),
|
|
])
|
|
}
|
|
|
|
if (module.parent) {
|
|
module.exports = revertPackages
|
|
} else {
|
|
revertPackages().then(() => process.exit(0))
|
|
}
|