Skip to content

Commit

Permalink
Add test for workspace focusing
Browse files Browse the repository at this point in the history
  • Loading branch information
tekihei2317 committed Apr 21, 2023
1 parent cb284e4 commit a06f8b0
Show file tree
Hide file tree
Showing 9 changed files with 728 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ yarn_2_install() {
cd "$build_dir" || return

if [ -n "$YARN2_FOCUS_WORKSPACE" ]; then
echo "Running with focused workspace $YARN2_FOCUS_WORKSPACE"
echo "Running focused install for workspace $YARN2_FOCUS_WORKSPACE"
monitor "yarn-2-install" yarn workspaces focus "$YARN2_FOCUS_WORKSPACE"
else
monitor "yarn-2-install" yarn install --immutable 2>&1
Expand Down Expand Up @@ -178,7 +178,7 @@ yarn_prune_devdependencies() {
return 0
fi
if [ -n "$YARN2_FOCUS_WORKSPACE" ]; then
echo "Running yarn workspaces focus --production ${YARN2_FOCUS_WORKSPACE}"
echo "Running focused install with --production flag"
monitor "yarn-prune" yarn workspaces focus --production $YARN2_FOCUS_WORKSPACE
return 0
fi
Expand Down
4 changes: 4 additions & 0 deletions test/fixtures/yarn-2-workspaces/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.yarn/*
!.yarn/releases
!.yarn/plugins

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions test/fixtures/yarn-2-workspaces/.yarn/releases/yarn-berry.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions test/fixtures/yarn-2-workspaces/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nodeLinker: "node-modules"

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: ".yarn/releases/yarn-berry.js"
8 changes: 8 additions & 0 deletions test/fixtures/yarn-2-workspaces/apps/server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@sample/server",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"express": "^4.18.2"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/yarn-2-workspaces/apps/web/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@sample/web",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"react": "^18.2.0"
}
}
11 changes: 11 additions & 0 deletions test/fixtures/yarn-2-workspaces/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "yarn-2-workspaces",
"version": "1.0.0",
"workspaces": [
"apps/*"
],
"scripts": {
"start": "echo start"
},
"license": "MIT"
}
Loading

0 comments on commit a06f8b0

Please sign in to comment.