-
-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle additional yarn
workspace definition formats
#463
Handle additional yarn
workspace definition formats
#463
Conversation
if (fs.existsSync(path.join(this.cwd, this.nodeModulesBackupLocation))) { | ||
restoreTasks.push(copy(path.join(this.cwd, this.nodeModulesBackupLocation), | ||
path.join(this.cwd, this.nodeModules), { clobber: true })); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yarn workspaces can hoist packages in such a way that a node_modules
folder may never be created. This checks the existence of the directory before trying to restore it
if (fs.existsSync(path.join(this.cwd, this.nodeModules))) { | ||
backupTasks.push(copy(path.join(this.cwd, this.nodeModules), | ||
path.join(this.cwd, this.nodeModulesBackupLocation), { clobber: true })); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to above, but when backing up packages
Codecov Report
@@ Coverage Diff @@
## master #463 +/- ##
==========================================
+ Coverage 96.88% 96.91% +0.03%
==========================================
Files 17 17
Lines 577 584 +7
==========================================
+ Hits 559 566 +7
Misses 18 18
Continue to review full report at Codecov.
|
Is there anything else I need to do? Any information that's missing that I could provide? |
let workspaceGlobs = packageJSON.workspaces | ||
|
||
if (workspaceGlobs && workspaceGlobs.packages) { | ||
workspaceGlobs = workspaceGlobs.packages | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you tweak this to be specific about what we expect? I'm thinking of something like:
let workspaceGlobs = Array.isArray(packageJSON.workspaces) ? packageJSON.workspaces : packageJSON.workspaces.packages;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! Ended up with
if (Array.isArray(packageJSON.workspaces)) {
workspaceGlobs = packageJSON.workspaces
}
if (packageJSON.workspaces && Array.isArray(packageJSON.workspaces.packages)) {
workspaceGlobs = packageJSON.workspaces.packages
}
so it's specific about each case
yarn
workspace definition formats
Thank you @BarryThePenguin! |
No worries! The latest ember times talked about using mono-repos to manage large ember apps. It mentions ember-try at the end, so it was a good reminder! |
Yarn workspaces can have two different definitions
and
This PR adds support for the second definition