Skip to content

Commit 34c48a7

Browse files
committed
files formatted
1 parent c5e4f42 commit 34c48a7

File tree

256 files changed

+98662
-3364
lines changed

Some content is hidden

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

256 files changed

+98662
-3364
lines changed

.vscode/settings.json

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
{
22
"yaml.schemas": {
3-
"packages/spec/dist/mosaic-schema.json": [
4-
"specs/yaml/*",
5-
"docs/public/specs/yaml/*"
6-
]
3+
"packages/spec/dist/mosaic-schema.json": ["specs/yaml/*", "docs/public/specs/yaml/*"]
74
},
8-
"json.schemas": [{
9-
"fileMatch": [
10-
"specs/json/*",
11-
"docs/public/specs/json/*"
12-
],
13-
"url": "./packages/spec/dist/mosaic-schema.json"
14-
}]
15-
}
5+
"json.schemas": [
6+
{
7+
"fileMatch": ["specs/json/*", "docs/public/specs/json/*"],
8+
"url": "./packages/spec/dist/mosaic-schema.json"
9+
}
10+
]
11+
}

bin/prepare-examples.js

Lines changed: 44 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -22,75 +22,63 @@ const jsonDocsDir = join(docsDir, 'public', 'specs', 'json');
2222
const esmDocsDir = join(docsDir, 'public', 'specs', 'esm');
2323
const exampleDir = join(docsDir, 'examples');
2424

25-
const specToTS = spec => {
25+
const specToTS = (spec) => {
2626
return `import { Spec } from '@uwdata/mosaic-spec';
2727
2828
export const spec : Spec = ${JSON.stringify(spec, 0, 2)};
2929
`;
30-
}
30+
};
3131

32-
const files = await Promise.allSettled((await readdir(specDir))
33-
.filter(name => extname(name) === '.yaml')
34-
.map(async name => {
35-
const base = basename(name, '.yaml');
36-
const file = resolve(specDir, name);
37-
const text = await readFile(file, 'utf8');
32+
const files = await Promise.allSettled(
33+
(await readdir(specDir))
34+
.filter((name) => extname(name) === '.yaml')
35+
.map(async (name) => {
36+
const base = basename(name, '.yaml');
37+
const file = resolve(specDir, name);
38+
const text = await readFile(file, 'utf8');
3839

39-
// parse spec and perform code generation
40-
// do this first to catch any errors
41-
const spec = parse(text);
42-
const ast = parseSpec(spec);
43-
const code = astToESM(ast);
40+
// parse spec and perform code generation
41+
// do this first to catch any errors
42+
const spec = parse(text);
43+
const ast = parseSpec(spec);
44+
const code = astToESM(ast);
4445

45-
try {
46-
await Promise.all([
47-
// write ESM DSL spec to tests
48-
writeFile(resolve(esmTestDir, `${base}.js`), code),
49-
// write JSON spec to tests
50-
writeFile(
51-
resolve(jsonTestDir, `${base}.json`),
52-
JSON.stringify(ast.toJSON(), 0, 2)
53-
),
54-
// write TS JSON spec to tests
55-
writeFile(
56-
resolve(tsTestDir, `${base}.ts`),
57-
specToTS(spec)
58-
),
59-
// copy YAML file to docs
60-
copyFile(file, resolve(yamlDocsDir, `${base}.yaml`)),
61-
// write JSON spec to docs
62-
writeFile(
63-
resolve(jsonDocsDir, `${base}.json`),
64-
JSON.stringify(spec, 0, 2)
65-
),
66-
// write ESM DSL spec to docs
67-
writeFile(resolve(esmDocsDir, `${base}.js`), code),
68-
// write examples page to docs
69-
writeFile(
70-
resolve(exampleDir, `${base}.md`),
71-
examplePage(base, spec.meta)
72-
)
73-
]);
74-
} catch (err) {
75-
console.error(err);
76-
}
46+
try {
47+
await Promise.all([
48+
// write ESM DSL spec to tests
49+
writeFile(resolve(esmTestDir, `${base}.js`), code),
50+
// write JSON spec to tests
51+
writeFile(resolve(jsonTestDir, `${base}.json`), JSON.stringify(ast.toJSON(), 0, 2)),
52+
// write TS JSON spec to tests
53+
writeFile(resolve(tsTestDir, `${base}.ts`), specToTS(spec)),
54+
// copy YAML file to docs
55+
copyFile(file, resolve(yamlDocsDir, `${base}.yaml`)),
56+
// write JSON spec to docs
57+
writeFile(resolve(jsonDocsDir, `${base}.json`), JSON.stringify(spec, 0, 2)),
58+
// write ESM DSL spec to docs
59+
writeFile(resolve(esmDocsDir, `${base}.js`), code),
60+
// write examples page to docs
61+
writeFile(resolve(exampleDir, `${base}.md`), examplePage(base, spec.meta))
62+
]);
63+
} catch (err) {
64+
console.error(err);
65+
}
7766

78-
return base;
79-
})
67+
return base;
68+
})
8069
);
8170

8271
// output successfully written examples
83-
console.log(JSON.stringify(
84-
files
85-
.filter(x => x.status === 'fulfilled')
86-
.map(x => x.value),
87-
0, 2
88-
));
72+
console.log(
73+
JSON.stringify(
74+
files.filter((x) => x.status === 'fulfilled').map((x) => x.value),
75+
0,
76+
2
77+
)
78+
);
8979

9080
// output unsuccessful example errors
91-
files
92-
.filter(x => x.status === 'rejected')
93-
.forEach(x => console.error(x.reason));
81+
files.filter((x) => x.status === 'rejected').forEach((x) => console.error(x.reason));
9482

9583
function examplePage(spec, { title = spec, description, credit } = {}) {
9684
return `<script setup>

bin/publish-schema.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { copyFile, readFile, symlink, unlink } from 'node:fs/promises';
66
async function link(schemaFile, linkFile) {
77
try {
88
await unlink(linkFile);
9-
} catch (err) { // eslint-disable-line @typescript-eslint/no-unused-vars
9+
} catch (err) {
10+
// eslint-disable-line @typescript-eslint/no-unused-vars
1011
// file may not have existed
1112
}
1213
await symlink(schemaFile, linkFile);

data/countries-110m.json

Lines changed: 10206 additions & 1 deletion
Large diffs are not rendered by default.

data/penguins.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3077,4 +3077,4 @@
30773077
"body_mass": 5400,
30783078
"sex": "MALE"
30793079
}
3080-
]
3080+
]

data/us-counties-10m.json

Lines changed: 85398 additions & 1 deletion
Large diffs are not rendered by default.

dev/setup.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ export async function setDatabaseConnector(type) {
4040
connector = new RestConnector({ uri: 'https://localhost:3000/' });
4141
break;
4242
case 'wasm':
43-
connector = wasm || (wasm = new DuckDBWASMConnector({
44-
config: { filesystem: { forceFullHTTPReads: true } }
45-
}));
43+
connector =
44+
wasm ||
45+
(wasm = new DuckDBWASMConnector({
46+
config: { filesystem: { forceFullHTTPReads: true } }
47+
}));
4648
break;
4749
default:
4850
throw new Error(`Unrecognized connector type: ${type}`);

docs/.vitepress/config.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineConfig } from 'vitepress'
1+
import { defineConfig } from 'vitepress';
22
import viteConfig from '../../vite.config.js';
33

44
// https://vitepress.dev/reference/site-config
@@ -19,12 +19,13 @@ export default defineConfig({
1919
siteTitle: false,
2020

2121
footer: {
22-
message: 'Mosaic is a collaboration of the <a href="https://idl.uw.edu/">UW Interactive Data Lab</a> and the <a href="https://dig.cmu.edu/">CMU Data Interaction Group</a>.',
22+
message:
23+
'Mosaic is a collaboration of the <a href="https://idl.uw.edu/">UW Interactive Data Lab</a> and the <a href="https://dig.cmu.edu/">CMU Data Interaction Group</a>.',
2324
copyright: 'Released under the BSD License. Copyright © 2023-Present UW Interactive Data Lab.'
2425
},
2526

2627
search: {
27-
provider: "local"
28+
provider: 'local'
2829
},
2930

3031
nav: [
@@ -79,9 +80,7 @@ export default defineConfig({
7980
{
8081
text: 'Examples',
8182
collapsed: true,
82-
items: [
83-
{ text: 'Overview', link: '/examples/' }
84-
],
83+
items: [{ text: 'Overview', link: '/examples/' }]
8584
},
8685
{
8786
text: 'Basic Marks & Inputs',
@@ -165,9 +164,7 @@ export default defineConfig({
165164
{
166165
text: 'API Reference',
167166
collapsed: true,
168-
items: [
169-
{ text: 'Overview', link: '/api/' }
170-
],
167+
items: [{ text: 'Overview', link: '/api/' }]
171168
},
172169
{
173170
text: 'Mosaic Core',
@@ -233,7 +230,7 @@ export default defineConfig({
233230
{ text: 'DuckDB API', link: '/api/duckdb/duckdb' },
234231
{ text: 'Data Server', link: '/api/duckdb/data-server' }
235232
]
236-
},
233+
}
237234
]
238235
},
239236

@@ -242,4 +239,4 @@ export default defineConfig({
242239
{ icon: 'bluesky', link: 'https://bsky.app/profile/idl.uw.edu' }
243240
]
244241
}
245-
})
242+
});

docs/.vitepress/theme/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import DefaultTheme from 'vitepress/theme';
22
import Example from './Example.vue';
3-
import Layout from "./Layout.vue";
3+
import Layout from './Layout.vue';
44
import './custom.css';
55

66
export default {

docs/public/contours.yaml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@ params:
44
bandwidth: 50
55
thresholds: 10
66
plot:
7-
- mark: raster
8-
data: { from: penguins }
9-
x: bill_length
10-
y: bill_depth
11-
fill: species
12-
bandwidth: $bandwidth
13-
- mark: contour
14-
data: { from: penguins }
15-
x: bill_length
16-
y: bill_depth
17-
stroke: species
18-
bandwidth: $bandwidth
19-
thresholds: $thresholds
20-
- mark: dot
21-
data: { from: penguins }
22-
x: bill_length
23-
y: bill_depth
24-
fill: black
25-
r: 1
7+
- mark: raster
8+
data: { from: penguins }
9+
x: bill_length
10+
y: bill_depth
11+
fill: species
12+
bandwidth: $bandwidth
13+
- mark: contour
14+
data: { from: penguins }
15+
x: bill_length
16+
y: bill_depth
17+
stroke: species
18+
bandwidth: $bandwidth
19+
thresholds: $thresholds
20+
- mark: dot
21+
data: { from: penguins }
22+
x: bill_length
23+
y: bill_depth
24+
fill: black
25+
r: 1
2626
xDomain: [31.7, 55.5]
2727
yDomain: [12.2, 21.8]
2828
xAxis: null
2929
yAxis: null
3030
margins: { left: 0, top: 0, right: 0, bottom: 0 }
3131
width: 680
32-
height: 680
32+
height: 680

0 commit comments

Comments
 (0)