Skip to content

Commit 8e09081

Browse files
author
Guy Bedford
authored
Run Prettier (#942)
1 parent 5d20b52 commit 8e09081

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+28373
-15215
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ jobs:
106106
ci/clang-format.sh
107107
- run: |
108108
ci/rustfmt.sh
109+
- run: npm install
110+
- run: npm run format:check
109111

110112
test-npm-package:
111113
if: github.ref != 'refs/heads/main'
@@ -233,7 +235,7 @@ jobs:
233235

234236
sdktest:
235237
concurrency:
236-
group: ${{ github.head_ref }}--sdktest-${{matrix.platform == 'compute' && matrix.profile || ''}}-${{matrix.platform}}
238+
group: ${{ github.head_ref }}--sdktest-${{matrix.profile}}-${{matrix.platform}}
237239
if: github.ref != 'refs/heads/main'
238240
runs-on: ubuntu-latest
239241
strategy:

.github/workflows/release-please.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ jobs:
4343
with:
4444
node-version: 'lts/*'
4545

46-
- run: npm install --mode=update-lockfile
46+
- run: npm update
4747
working-directory: ./documentation
4848
- run: npm run docusaurus docs:version "$(npm pkg get version --json --prefix=../ | jq -r)"
4949
working-directory: ./documentation
5050

51-
- run: npm install --mode=update-lockfile
51+
- run: npm update
5252
working-directory: ./documentation/app
5353
- run: npm run build:files
5454
working-directory: ./documentation/app

.prettierrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}
Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
11
import test from 'brittle';
2-
import { getBinPath } from 'get-bin-path'
2+
import { getBinPath } from 'get-bin-path';
33
import { prepareEnvironment } from '@jakechampion/cli-testing-library';
44

5-
const cli = await getBinPath({name:"js-compute"})
5+
const cli = await getBinPath({ name: 'js-compute' });
66

77
test('should build the fastly condition', async function (t) {
8-
const { execute, cleanup, writeFile, exists, path } = await prepareEnvironment();
9-
t.teardown(async function () {
10-
await cleanup();
11-
});
8+
const { execute, cleanup, writeFile, exists, path } =
9+
await prepareEnvironment();
10+
t.teardown(async function () {
11+
await cleanup();
12+
});
1213

13-
await writeFile('./index.js', `import '#test';`)
14-
await writeFile('./test.js', `addEventListener('fetch', function(){})`)
15-
await writeFile('./package.json', `{ "type": "module", "imports": { "#test": { "fastly": "./test.js" } } }`)
14+
await writeFile('./index.js', `import '#test';`);
15+
await writeFile('./test.js', `addEventListener('fetch', function(){})`);
16+
await writeFile(
17+
'./package.json',
18+
`{ "type": "module", "imports": { "#test": { "fastly": "./test.js" } } }`,
19+
);
1620

17-
t.is(await exists('./app.wasm'), false)
21+
t.is(await exists('./app.wasm'), false);
1822

19-
const { code, stdout, stderr } = await execute(process.execPath, `${cli} ${path}/index.js ${path}/app.wasm`);
23+
const { code, stdout, stderr } = await execute(
24+
process.execPath,
25+
`${cli} ${path}/index.js ${path}/app.wasm`,
26+
);
2027

21-
t.is(await exists('./app.wasm'), true)
22-
t.alike(stdout, []);
23-
t.alike(stderr, []);
24-
t.is(code, 0);
28+
t.is(await exists('./app.wasm'), true);
29+
t.alike(stdout, []);
30+
t.alike(stderr, []);
31+
t.is(code, 0);
2532
});
Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
import test from 'brittle';
2-
import { getBinPath } from 'get-bin-path'
2+
import { getBinPath } from 'get-bin-path';
33
import { prepareEnvironment } from '@jakechampion/cli-testing-library';
44

5-
const cli = await getBinPath({name:"js-compute"})
5+
const cli = await getBinPath({ name: 'js-compute' });
66

77
test('should create wasm file and return zero exit code', async function (t) {
8-
const { execute, cleanup, writeFile, exists, path } = await prepareEnvironment();
9-
t.teardown(async function () {
10-
await cleanup();
11-
});
8+
const { execute, cleanup, writeFile, exists, path } =
9+
await prepareEnvironment();
10+
t.teardown(async function () {
11+
await cleanup();
12+
});
1213

13-
await writeFile('./index.js', `addEventListener('fetch', function(){})`)
14-
15-
t.is(await exists('./bin/main.wasm'), false)
14+
await writeFile('./index.js', `addEventListener('fetch', function(){})`);
1615

17-
const { code, stdout, stderr } = await execute(process.execPath, `${cli} ${path}/index.js`);
16+
t.is(await exists('./bin/main.wasm'), false);
1817

19-
t.is(await exists('./bin/main.wasm'), true)
20-
t.alike(stdout, []);
21-
t.alike(stderr, []);
22-
t.is(code, 0);
18+
const { code, stdout, stderr } = await execute(
19+
process.execPath,
20+
`${cli} ${path}/index.js`,
21+
);
22+
23+
t.is(await exists('./bin/main.wasm'), true);
24+
t.alike(stdout, []);
25+
t.alike(stderr, []);
26+
t.is(code, 0);
2327
});
Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
import test from 'brittle';
2-
import { getBinPath } from 'get-bin-path'
2+
import { getBinPath } from 'get-bin-path';
33
import { prepareEnvironment } from '@jakechampion/cli-testing-library';
44

5-
const cli = await getBinPath({name:"js-compute"})
5+
const cli = await getBinPath({ name: 'js-compute' });
66

77
test('should create output directory, wasm file and return zero exit code', async function (t) {
8-
const { execute, cleanup, writeFile, exists, path } = await prepareEnvironment();
9-
t.teardown(async function () {
10-
await cleanup();
11-
});
8+
const { execute, cleanup, writeFile, exists, path } =
9+
await prepareEnvironment();
10+
t.teardown(async function () {
11+
await cleanup();
12+
});
1213

13-
await writeFile('./index.js', `addEventListener('fetch', function(){})`)
14-
15-
t.is(await exists('./my/cool/app.wasm'), false)
14+
await writeFile('./index.js', `addEventListener('fetch', function(){})`);
1615

17-
const { code, stdout, stderr } = await execute(process.execPath, `${cli} ${path}/index.js ${path}/my/cool/app.wasm`);
16+
t.is(await exists('./my/cool/app.wasm'), false);
1817

19-
t.is(await exists('./my/cool/app.wasm'), true)
20-
t.alike(stdout, []);
21-
t.alike(stderr, []);
22-
t.is(code, 0);
18+
const { code, stdout, stderr } = await execute(
19+
process.execPath,
20+
`${cli} ${path}/index.js ${path}/my/cool/app.wasm`,
21+
);
22+
23+
t.is(await exists('./my/cool/app.wasm'), true);
24+
t.alike(stdout, []);
25+
t.alike(stderr, []);
26+
t.is(code, 0);
2327
});
Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
import test from 'brittle';
2-
import { getBinPath } from 'get-bin-path'
2+
import { getBinPath } from 'get-bin-path';
33
import { prepareEnvironment } from '@jakechampion/cli-testing-library';
44

5-
const cli = await getBinPath({name:"js-compute"})
5+
const cli = await getBinPath({ name: 'js-compute' });
66

77
test('should return non-zero exit code', async function (t) {
8-
const { execute, cleanup, makeDir, writeFile, path} = await prepareEnvironment();
9-
t.teardown(async function () {
10-
await cleanup();
11-
});
12-
await makeDir('./engine.wasm')
13-
await writeFile('./bin/index.js', `addEventListener('fetch', function(){})`)
14-
const { code, stdout, stderr } = await execute(process.execPath, `${cli} --engine-wasm ${path}/engine.wasm`);
8+
const { execute, cleanup, makeDir, writeFile, path } =
9+
await prepareEnvironment();
10+
t.teardown(async function () {
11+
await cleanup();
12+
});
13+
await makeDir('./engine.wasm');
14+
await writeFile('./bin/index.js', `addEventListener('fetch', function(){})`);
15+
const { code, stdout, stderr } = await execute(
16+
process.execPath,
17+
`${cli} --engine-wasm ${path}/engine.wasm`,
18+
);
1519

16-
t.alike(stdout, []);
17-
t.alike(stderr, ['Error: The `wasmEngine` path does not point to a file: {{base}}/engine.wasm']);
18-
t.is(code, 1);
20+
t.alike(stdout, []);
21+
t.alike(stderr, [
22+
'Error: The `wasmEngine` path does not point to a file: {{base}}/engine.wasm',
23+
]);
24+
t.is(code, 1);
1925
});

integration-tests/cli/help.test.js

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
11
import test from 'brittle';
2-
import { getBinPath } from 'get-bin-path'
2+
import { getBinPath } from 'get-bin-path';
33
import { prepareEnvironment } from '@jakechampion/cli-testing-library';
4-
import { readFileSync } from "node:fs";
5-
import { fileURLToPath } from "node:url";
6-
import { dirname, join } from "node:path";
4+
import { readFileSync } from 'node:fs';
5+
import { fileURLToPath } from 'node:url';
6+
import { dirname, join } from 'node:path';
77
const __dirname = dirname(fileURLToPath(import.meta.url));
88

9-
const packageJson = readFileSync(join(__dirname, "../../package.json"), {
10-
encoding: "utf-8",
9+
const packageJson = readFileSync(join(__dirname, '../../package.json'), {
10+
encoding: 'utf-8',
1111
});
1212
const version = JSON.parse(packageJson).version;
1313

14-
const cli = await getBinPath({name:"js-compute"})
14+
const cli = await getBinPath({ name: 'js-compute' });
1515

1616
test('--help should return help on stdout and zero exit code', async function (t) {
17-
const { execute, cleanup } = await prepareEnvironment();
18-
t.teardown(async function () {
19-
await cleanup();
20-
});
21-
const { code, stdout, stderr } = await execute(cli, `--help`);
17+
const { execute, cleanup } = await prepareEnvironment();
18+
t.teardown(async function () {
19+
await cleanup();
20+
});
21+
const { code, stdout, stderr } = await execute(cli, `--help`);
2222

23-
t.is(code, 0);
24-
t.alike(stdout, [
25-
`js-compute-runtime-cli.js ${version}`,
26-
'USAGE:',
27-
'js-compute-runtime-cli.js [FLAGS] [OPTIONS] [ARGS]',
28-
'FLAGS:',
29-
'-h, --help Prints help information',
30-
'-V, --version Prints version information',
31-
'OPTIONS:',
32-
'--engine-wasm <engine-wasm> The JS engine Wasm file path',
33-
'--enable-experimental-high-resolution-time-methods Enable experimental high-resolution fastly.now() method',
34-
'--enable-experimental-top-level-await Enable experimental top level await',
35-
'--debug-build Use the debug build of the JS engine with C++ stack traces',
36-
'ARGS:',
37-
"<input> The input JS script's file path [default: bin/index.js]",
38-
'<output> The file path to write the output Wasm module to [default: bin/main.wasm]'
39-
])
40-
t.alike(stderr, [])
23+
t.is(code, 0);
24+
t.alike(stdout, [
25+
`js-compute-runtime-cli.js ${version}`,
26+
'USAGE:',
27+
'js-compute-runtime-cli.js [FLAGS] [OPTIONS] [ARGS]',
28+
'FLAGS:',
29+
'-h, --help Prints help information',
30+
'-V, --version Prints version information',
31+
'OPTIONS:',
32+
'--engine-wasm <engine-wasm> The JS engine Wasm file path',
33+
'--enable-experimental-high-resolution-time-methods Enable experimental high-resolution fastly.now() method',
34+
'--enable-experimental-top-level-await Enable experimental top level await',
35+
'--debug-build Use the debug build of the JS engine with C++ stack traces',
36+
'ARGS:',
37+
"<input> The input JS script's file path [default: bin/index.js]",
38+
'<output> The file path to write the output Wasm module to [default: bin/main.wasm]',
39+
]);
40+
t.alike(stderr, []);
4141
});
4242

4343
test('-h should return help on stdout and zero exit code', async function (t) {
44-
const { execute, cleanup } = await prepareEnvironment();
45-
t.teardown(async function () {
46-
await cleanup();
47-
});
48-
const { code, stdout, stderr } = await execute(cli, `-h`);
49-
50-
t.is(code, 0);
51-
t.alike(stdout, [
52-
`js-compute-runtime-cli.js ${version}`,
53-
'USAGE:',
54-
'js-compute-runtime-cli.js [FLAGS] [OPTIONS] [ARGS]',
55-
'FLAGS:',
56-
'-h, --help Prints help information',
57-
'-V, --version Prints version information',
58-
'OPTIONS:',
59-
'--engine-wasm <engine-wasm> The JS engine Wasm file path',
60-
'--enable-experimental-high-resolution-time-methods Enable experimental high-resolution fastly.now() method',
61-
'--enable-experimental-top-level-await Enable experimental top level await',
62-
'--debug-build Use the debug build of the JS engine with C++ stack traces',
63-
'ARGS:',
64-
"<input> The input JS script's file path [default: bin/index.js]",
65-
'<output> The file path to write the output Wasm module to [default: bin/main.wasm]'
66-
])
67-
t.alike(stderr, [])
44+
const { execute, cleanup } = await prepareEnvironment();
45+
t.teardown(async function () {
46+
await cleanup();
47+
});
48+
const { code, stdout, stderr } = await execute(cli, `-h`);
49+
50+
t.is(code, 0);
51+
t.alike(stdout, [
52+
`js-compute-runtime-cli.js ${version}`,
53+
'USAGE:',
54+
'js-compute-runtime-cli.js [FLAGS] [OPTIONS] [ARGS]',
55+
'FLAGS:',
56+
'-h, --help Prints help information',
57+
'-V, --version Prints version information',
58+
'OPTIONS:',
59+
'--engine-wasm <engine-wasm> The JS engine Wasm file path',
60+
'--enable-experimental-high-resolution-time-methods Enable experimental high-resolution fastly.now() method',
61+
'--enable-experimental-top-level-await Enable experimental top level await',
62+
'--debug-build Use the debug build of the JS engine with C++ stack traces',
63+
'ARGS:',
64+
"<input> The input JS script's file path [default: bin/index.js]",
65+
'<output> The file path to write the output Wasm module to [default: bin/main.wasm]',
66+
]);
67+
t.alike(stderr, []);
6868
});
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
import test from 'brittle';
2-
import { getBinPath } from 'get-bin-path'
2+
import { getBinPath } from 'get-bin-path';
33
import { prepareEnvironment } from '@jakechampion/cli-testing-library';
44

5-
const cli = await getBinPath({name:"js-compute"})
5+
const cli = await getBinPath({ name: 'js-compute' });
66

77
test('should return non-zero exit code', async function (t) {
8-
const { execute, cleanup, makeDir} = await prepareEnvironment();
9-
t.teardown(async function () {
10-
await cleanup();
11-
});
12-
await makeDir('./bin/index.js')
13-
const { code, stdout, stderr } = await execute(process.execPath, cli);
8+
const { execute, cleanup, makeDir } = await prepareEnvironment();
9+
t.teardown(async function () {
10+
await cleanup();
11+
});
12+
await makeDir('./bin/index.js');
13+
const { code, stdout, stderr } = await execute(process.execPath, cli);
1414

15-
t.alike(stdout, []);
16-
t.alike(stderr, ['Error: The `input` path does not point to a file: {{base}}/bin/index.js']);
17-
t.is(code, 1);
15+
t.alike(stdout, []);
16+
t.alike(stderr, [
17+
'Error: The `input` path does not point to a file: {{base}}/bin/index.js',
18+
]);
19+
t.is(code, 1);
1820
});

0 commit comments

Comments
 (0)