Skip to content

Commit 31ee093

Browse files
committed
Simplify examples by not using execa
1 parent 93b52e3 commit 31ee093

File tree

9 files changed

+27
-143
lines changed

9 files changed

+27
-143
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,5 @@ jobs:
2323
with:
2424
version: 8.x.x
2525

26-
- name: Install
27-
run: pnpm i
28-
2926
- name: Test
3027
run: node ./build-examples.mjs

build-examples.mjs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
import { readdirSync, readFileSync, existsSync } from 'fs'
2-
import { execa } from 'execa'
1+
import { readdirSync, readFileSync, existsSync } from 'node:fs'
2+
import { spawn } from 'node:child_process'
33

4-
const id = Math.random().toString(36).substr(2, 9)
4+
function exec(command, params, ops) {
5+
let p = spawn(command, params, ops);
6+
7+
return new Promise((resolveFunc) => {
8+
p.on("exit", (code) => {
9+
resolveFunc(code);
10+
});
11+
});
12+
}
513

614
const examples = readdirSync('./')
715
.filter((f) => existsSync(`./${f}/package.json`))
@@ -13,13 +21,13 @@ const examples = readdirSync('./')
1321
async function buildExamples () {
1422
for (const example of examples) {
1523
console.log(`building ${example.folder}...`)
16-
await execa('pnpm', ['i'], { stdio: 'inherit', cwd: example.folder })
17-
await execa('pnpm', ['build'], { stdio: 'inherit', cwd: example.folder })
24+
await exec('pnpm', ['i'], { stdio: 'inherit', cwd: example.folder })
25+
await exec('pnpm', ['build'], { stdio: 'inherit', cwd: example.folder })
1826
}
1927

2028
for (const typescriptExample of examples.filter((ex) => ex.package.scripts.typecheck != null)) {
2129
console.log(`typechecking ${typescriptExample.folder}...`)
22-
await execa('pnpm', ['typecheck'], { stdio: 'inherit', cwd: typescriptExample.folder })
30+
await exec('pnpm', ['typecheck'], { stdio: 'inherit', cwd: typescriptExample.folder })
2331
}
2432
}
2533

package.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

pnpm-lock.yaml

Lines changed: 0 additions & 117 deletions
This file was deleted.

vue-2-vite-typescript/pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vue-2-webpack/pnpm-lock.yaml

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vue-3-vite-external-translations/pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vue-3-vite-typescript/pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vue-3-vue-cli/pnpm-lock.yaml

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)