mirror of
https://github.com/primer/css.git
synced 2024-12-19 04:01:49 +03:00
32 lines
768 B
Plaintext
32 lines
768 B
Plaintext
|
#!/usr/bin/env node
|
||
|
const fs = require('fs')
|
||
|
const globby = require('globby')
|
||
|
const path = require('path')
|
||
|
|
||
|
const getPackages = (debug) => {
|
||
|
const lernaConfig = require('../lerna.json')
|
||
|
const packageGlobs = lernaConfig.packages
|
||
|
return globby(packageGlobs)
|
||
|
.then(packagePaths => {
|
||
|
return packagePaths.filter(pkg => {
|
||
|
try {
|
||
|
require.resolve(`../${pkg}/package.json`)
|
||
|
return true
|
||
|
} catch (error) {
|
||
|
if (debug) {
|
||
|
console.warn('No package.json in %s', pkg)
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
})
|
||
|
}
|
||
|
|
||
|
if (module.parent) {
|
||
|
module.exports = getPackages
|
||
|
} else {
|
||
|
getPackages(true).then(packages => {
|
||
|
console.warn('%d packages:', packages.length)
|
||
|
packages.forEach(pkg => console.log(pkg))
|
||
|
})
|
||
|
}
|