forked from shapeshift/lib
-
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.
chore: yarn link scripts and docs (shapeshift#116)
- Loading branch information
1 parent
3c375ed
commit d51169b
Showing
4 changed files
with
62 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules | |
config | ||
babel.config.js | ||
generated | ||
scripts |
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
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,19 @@ | ||
const { readdirSync } = require('fs') | ||
const util = require('util') | ||
const exec = util.promisify(require('child_process').exec) | ||
|
||
async function main() { | ||
// link or unlink | ||
const args = process.argv.slice(2) | ||
const prefix = args[0] === 'unlink' ? 'un' : '' | ||
// get package names | ||
const lsPackages = readdirSync('packages', { withFileTypes: true }) | ||
const packageDirectories = lsPackages.filter(dir => dir.isDirectory()) | ||
const packageNames = packageDirectories.map(({ name }) => name) | ||
// do linky things | ||
const promises = packageNames.map(async package => (await exec(`cd packages/${package} && yarn ${prefix}link --colors`)).stdout) | ||
const result = (await Promise.all(promises)).join('') | ||
console.log(result) | ||
} | ||
|
||
main() |