mirror of
https://github.com/strapi/strapi.git
synced 2025-12-25 06:04:29 +00:00
Init link helper to work on a project outside of the workspace
This commit is contained in:
parent
649df34583
commit
41b9a72e95
@ -1,15 +0,0 @@
|
||||
# The Strapi monorepo
|
||||
|
||||
Juggling a multimodule project over multiple repos is pretty difficult for contributing.
|
||||
|
||||
Strapi follows a monorepo approach, all officially maintained modules are in the same repository-- this one.
|
||||
|
||||
Pros:
|
||||
- Single lint, build, test and release process.
|
||||
- Easy to coordinate changes across modules.
|
||||
- Single place to report issues and track milestones.
|
||||
- Easier to setup a development environment.
|
||||
|
||||
Cons:
|
||||
- Codebase looks more intimidating.
|
||||
- Repo is bigger in size.
|
||||
25
scripts/link.js
Normal file
25
scripts/link.js
Normal file
@ -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));
|
||||
Loading…
x
Reference in New Issue
Block a user