-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
108 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
packages: | ||
- 'packages/*' | ||
- 'packages/playground/**' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// pnpm treats file: protocols as link:, so it doesn't copy the actual files | ||
// into node_modules, causing Vite to still consider those deps linked. | ||
// This script is called from postinstall hooks in playground packages that | ||
// uses the file: protocol, and copies the file: deps into node_modules. | ||
|
||
const fs = require('fs-extra') | ||
const path = require('path') | ||
const root = process.cwd() | ||
const pkg = require(path.join(root, 'package.json')) | ||
|
||
let hasPatched | ||
for (const [key, val] of Object.entries(pkg.dependencies)) { | ||
if (val.startsWith('file:')) { | ||
hasPatched = true | ||
const src = path.resolve(root, val.slice('file:'.length)) | ||
const dest = path.resolve(root, 'node_modules', key) | ||
fs.removeSync(dest) | ||
fs.copySync(src, dest, { | ||
dereference: true | ||
}) | ||
console.log(`patched ${val}`) | ||
} | ||
} | ||
|
||
if (hasPatched) { | ||
// remove node_modules/.ignored as pnpm will think our patched files are | ||
// installed by another package manager and move them into this directory. | ||
// On further installs it will error out if this directory is not empty. | ||
fs.removeSync(path.resolve(root, 'node_modules', '.ignored')) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
if (!/pnpm/.test(process.env.npm_execpath || '')) { | ||
console.warn( | ||
`\u001b[33mThis repository requires using pnpm as the package manager ` + | ||
` for scripts to work properly.\u001b[39m\n` | ||
) | ||
process.exit(1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters