Skip to content

Commit 2967377

Browse files
committed
Update examples
1 parent 4e786e4 commit 2967377

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

examples/background-process.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
// See the License for the specific language governing permissions and
1515
// limitations under the License.
1616

17-
let serve = $`npx serve`
17+
const serve = $`npx serve`
1818

19-
for await (let chunk of serve.stdout) {
19+
for await (const chunk of serve.stdout) {
2020
if (chunk.includes('Accepting connections')) break
2121
}
2222

examples/backup-github.mjs

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
// See the License for the specific language governing permissions and
1515
// limitations under the License.
1616

17-
let username = await question('What is your GitHub username? ')
18-
let token = await question('Do you have GitHub token in env? ', {
17+
const username = await question('What is your GitHub username? ')
18+
const token = await question('Do you have GitHub token in env? ', {
1919
choices: Object.keys(process.env),
2020
})
2121

@@ -29,14 +29,14 @@ let res = await fetch(
2929
`https://api.github.com/users/${username}/repos?per_page=1000`,
3030
{ headers }
3131
)
32-
let data = await res.json()
33-
let urls = data.map((x) =>
32+
const data = await res.json()
33+
const urls = data.map((x) =>
3434
x.git_url.replace('git://github.com/', 'git@github.com:')
3535
)
3636

3737
await $`mkdir -p backups`
3838
cd('./backups')
3939

40-
for (let url of urls) {
40+
for (const url of urls) {
4141
await $`git clone ${url}`
4242
}

examples/interactive.mjs

+12-12
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
// See the License for the specific language governing permissions and
1515
// limitations under the License.
1616

17-
let { stdin, stdout } = $`npm init`
17+
const p = $`npm init`.stdio('pipe')
1818

19-
for await (let chunk of stdout) {
20-
if (chunk.includes('package name:')) stdin.write('test\n')
21-
if (chunk.includes('version:')) stdin.write('1.0.0\n')
22-
if (chunk.includes('description:')) stdin.write('My test package\n')
23-
if (chunk.includes('entry point:')) stdin.write('index.mjs\n')
24-
if (chunk.includes('test command:')) stdin.write('test.mjs\n')
25-
if (chunk.includes('git repository:')) stdin.write('my-org/repo\n')
26-
if (chunk.includes('keywords:')) stdin.write('foo, bar\n')
27-
if (chunk.includes('author:')) stdin.write('Anton Medvedev\n')
28-
if (chunk.includes('license:')) stdin.write('MIT\n')
29-
if (chunk.includes('Is this OK?')) stdin.write('yes\n')
19+
for await (const chunk of p.stdout) {
20+
if (chunk.includes('package name:')) p.stdin.write('test\n')
21+
if (chunk.includes('version:')) p.stdin.write('1.0.0\n')
22+
if (chunk.includes('description:')) p.stdin.write('My test package\n')
23+
if (chunk.includes('entry point:')) p.stdin.write('index.mjs\n')
24+
if (chunk.includes('test command:')) p.stdin.write('test.mjs\n')
25+
if (chunk.includes('git repository:')) p.stdin.write('my-org/repo\n')
26+
if (chunk.includes('keywords:')) p.stdin.write('foo, bar\n')
27+
if (chunk.includes('author:')) p.stdin.write('Anton Medvedev\n')
28+
if (chunk.includes('license:')) p.stdin.write('MIT\n')
29+
if (chunk.includes('Is this OK?')) p.stdin.write('yes\n')
3030
}

examples/parallel.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
import { spinner } from 'zx/experimental'
1818

19-
let tests = await glob('test/*.test.js')
19+
const tests = await glob('test/*.test.js')
2020
await spinner('running tests', async () => {
2121
try {
22-
let res = await Promise.all(tests.map((file) => $`npx uvu . ${file}`))
22+
const res = await Promise.all(tests.map((file) => $`npx uvu . ${file}`))
2323
res.forEach((r) => console.log(r.toString()))
2424
console.log(chalk.bgGreen.black(' SUCCESS '))
2525
} catch (e) {

0 commit comments

Comments
 (0)