madvinking / yarn-isolate-workspace Goto Github PK
View Code? Open in Web Editor NEWisolate a yarn workspace
License: Other
isolate a yarn workspace
License: Other
In a yarn workspace with "root" dependencies i.e. dependencies that should be included in all projects and are listed in the root package.json and installed with yarn add -W eslint
, it appears that they are ignored when running npx yarn-isolate-workspace
on a child workspace.
This appears to correctly resolve sibling dependencies (which is awesome), but I don't think it covers this situation.
Am I misusing this library? Or is there a way to add support for this?
First off, wanted to say that I love this package, it solved a major issue I was having, so thank you for it.
Second, I wanted to request two options that I think could potentially be helpful:
When isolating a workspace, the files and directories of the isolated package are not copied into the _isolated_
directory, I had to write a script to handle this. It'd be great if this could be supported natively.
Most often when using this tool, all required node_modules are installed in the workspace root already, so it'd be nice to simply copy them over to the isolated workspace and not have to yarn install
again.
@Madvinking
Hi, maybe I am miss-understanding use case of workspaces-src-less
Here it removes all dev deps:
yarn-isolate-workspace/src/index.js
Line 75 in 96b5cf0
But this files are supposed to be used while building isolated package? So devDependencies should exist?
Here is the diff that solved my problem:
diff --git a/node_modules/yarn-isolate-workspace/src/index.js b/node_modules/yarn-isolate-workspace/src/index.js
index 6a389da..2bce714 100755
--- a/node_modules/yarn-isolate-workspace/src/index.js
+++ b/node_modules/yarn-isolate-workspace/src/index.js
@@ -72,7 +72,6 @@ function resolveWorkspacesNewLocation() {
subWorkspace.pkgJsonLocation = path.join(subWorkspace.newLocation, 'package.json');
fs.mkdirSync(subWorkspace.newLocation, { recursive: true });
- subWorkspace.pkgJson.devDependencies = {};
fs.writeFileSync(subWorkspace.pkgJsonLocation, JSON.stringify(subWorkspace.pkgJson, null, 2));
const files = workspacesExcludeGlob
@@ -196,7 +195,7 @@ function createYarnLock() {
if (!projectWorkspaces[name] && !list.includes(depName)) {
list.push(depName);
} else if (projectWorkspaces[name]) {
- recursive(projectWorkspaces[name].pkgJson.dependencies);
+ recursive({...projectWorkspaces[name].pkgJson.dependencies, ...projectWorkspaces[name].pkgJson.devDependencies});
}
});
};
Hey there, you project fits my needs unfortunately it was designed for yarn v2
Any idea what the gaps are?
Anyway - might be useful to add to the doc ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.