workflow: move to pnpm (#4766)

This commit is contained in:
Evan You
2021-10-08 14:23:30 -04:00
committed by GitHub
parent 3c500e422f
commit 61c5fbd3e3
19 changed files with 7097 additions and 6844 deletions

View File

@@ -7,10 +7,10 @@ or "esm,cjs"):
```
# name supports fuzzy match. will build all packages with name containing "dom":
yarn build dom
nr build dom
# specify the format to output
yarn build core --formats cjs
nr build core --formats cjs
```
*/

View File

@@ -1,6 +0,0 @@
if (!/yarn\.js$/.test(process.env.npm_execpath || '')) {
console.warn(
'\u001b[33mThis repository requires Yarn 1.x for scripts to work properly.\u001b[39m\n'
)
process.exit(1)
}

View File

@@ -6,13 +6,13 @@ formats to watch (defaults to "global"):
```
# name supports fuzzy match. will watch all packages with name containing "dom"
yarn dev dom
nr dev dom
# specify the format to output
yarn dev core --formats cjs
nr dev core --formats cjs
# Can also drop all __DEV__ blocks with:
__DEV__=false yarn dev
__DEV__=false nr dev
```
*/

7
scripts/preinstall.js Normal file
View File

@@ -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)
}

View File

@@ -80,7 +80,7 @@ async function main() {
step('\nRunning tests...')
if (!skipTests && !isDryRun) {
await run(bin('jest'), ['--clearCache'])
await run('yarn', ['test', '--bail'])
await run('npm', ['test', '--', '--bail'])
} else {
console.log(`(skipped)`)
}
@@ -92,16 +92,16 @@ async function main() {
// build all packages with types
step('\nBuilding all packages...')
if (!skipBuild && !isDryRun) {
await run('yarn', ['build', '--release'])
await run('npm', ['run', 'build', '--', '--release'])
// test generated dts files
step('\nVerifying type declarations...')
await run('yarn', ['test-dts-only'])
await run('npm', ['run', 'test-dts-only'])
} else {
console.log(`(skipped)`)
}
// generate changelog
await run(`yarn`, ['changelog'])
await run(`npm`, ['run', 'changelog'])
const { stdout } = await run('git', ['diff'], { stdio: 'pipe' })
if (stdout) {
@@ -205,6 +205,8 @@ async function publishPackage(pkgName, version, runIfNotDry) {
step(`Publishing ${pkgName}...`)
try {
await runIfNotDry(
// note: use of yarn is intentional here as we rely on its publishing
// behavior.
'yarn',
[
'publish',