Skip to content

Commit

Permalink
Init link helper to work on a project outside of the workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrebodin committed Jun 8, 2019
1 parent 649df34 commit 41b9a72
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
15 changes: 0 additions & 15 deletions packages/README.md

This file was deleted.

25 changes: 25 additions & 0 deletions scripts/link.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const { join } = require('path');
const execa = require('execa');
const fs = require('fs-extra');
const { promisify } = require('util');
const glob = promisify(require('glob').glob);

async function run() {
const packageDirs = await glob('packages/*');

console.log('Linking all packages');

const packages = packageDirs.map(dir => ({
dir,
pkgJSON: fs.readJSONSync(join(dir, 'package.json')),
}));

await Promise.all(
packages.map(({ dir }) => execa('yarn', ['link'], { cwd: dir }))
);

const packageNames = packages.map(p => p.pkgJSON.name).join(' ');
console.log(`Package names: \n ${packageNames}\n`);
}

run().catch(err => console.error(err));

0 comments on commit 41b9a72

Please sign in to comment.