@glossarist/concept-browser 0.7.71 → 0.7.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/astro.config.mjs +55 -0
- package/package.json +4 -4
- package/scripts/bridge-to-astro.mjs +8 -14
- package/src/content.config.ts +7 -4
package/astro.config.mjs
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineConfig } from 'astro/config';
|
|
2
|
+
import vue from '@astrojs/vue';
|
|
3
|
+
import sitemap from '@astrojs/sitemap';
|
|
4
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
5
|
+
import yaml from 'js-yaml';
|
|
6
|
+
import { readFileSync } from 'fs';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
import { resolve, dirname } from 'path';
|
|
9
|
+
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const pkg = JSON.parse(readFileSync(resolve(__dirname, 'package.json'), 'utf-8'));
|
|
12
|
+
const pkgVersion = pkg.version;
|
|
13
|
+
|
|
14
|
+
const site = process.env.SITE_URL || 'https://www.geolexica.org';
|
|
15
|
+
const base = process.env.BASE_PATH || '/';
|
|
16
|
+
|
|
17
|
+
export default defineConfig({
|
|
18
|
+
root: __dirname,
|
|
19
|
+
site,
|
|
20
|
+
base,
|
|
21
|
+
output: 'static',
|
|
22
|
+
publicDir: resolve(process.cwd(), 'public'),
|
|
23
|
+
integrations: [
|
|
24
|
+
vue({ appEntrypoint: '/src/islands/app-entry' }),
|
|
25
|
+
sitemap(),
|
|
26
|
+
],
|
|
27
|
+
i18n: {
|
|
28
|
+
defaultLocale: 'eng',
|
|
29
|
+
locales: ['eng', 'fra', 'deu', 'jpn', 'ara', 'zho', 'rus', 'spa', 'kor', 'swe', 'pol', 'fin', 'dan', 'nld', 'msa'],
|
|
30
|
+
routing: {
|
|
31
|
+
prefixDefaultLocale: false,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
prefetch: {
|
|
35
|
+
prefetchAll: true,
|
|
36
|
+
defaultStrategy: 'viewport',
|
|
37
|
+
},
|
|
38
|
+
vite: {
|
|
39
|
+
plugins: [
|
|
40
|
+
tailwindcss(),
|
|
41
|
+
{
|
|
42
|
+
name: 'yaml-transform',
|
|
43
|
+
enforce: 'pre',
|
|
44
|
+
transform(code, id) {
|
|
45
|
+
if (!id.endsWith('.yml') && !id.endsWith('.yaml')) return;
|
|
46
|
+
const data = yaml.load(code);
|
|
47
|
+
return { code: `export default ${JSON.stringify(data)}`, map: null };
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
define: {
|
|
52
|
+
__CONCEPT_BROWSER_VERSION__: JSON.stringify(pkgVersion),
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glossarist/concept-browser",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.74",
|
|
4
4
|
"description": "Vue SPA for browsing Glossarist terminology datasets with cross-reference resolution, graph visualization, and multi-language support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"@astrojs/sitemap": "^3.7.3",
|
|
33
33
|
"@astrojs/vue": "^7.0.1",
|
|
34
34
|
"@plurimath/plurimath": "^0.2.2",
|
|
35
|
+
"@tailwindcss/vite": "^4.3.2",
|
|
35
36
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
36
37
|
"astro": "^7.0.7",
|
|
37
38
|
"d3": "^7.9.0",
|
|
@@ -41,6 +42,7 @@
|
|
|
41
42
|
"jszip": "^3.10.1",
|
|
42
43
|
"pinia": "^2.3.1",
|
|
43
44
|
"sharp": "^0.34.5",
|
|
45
|
+
"tailwindcss": "^4.3.2",
|
|
44
46
|
"vite": "^8.1.4",
|
|
45
47
|
"vue": "^3.5.13",
|
|
46
48
|
"vue-router": "^4.5.1"
|
|
@@ -50,7 +52,6 @@
|
|
|
50
52
|
"@rdfjs/dataset": "^2.0.2",
|
|
51
53
|
"@stryker-mutator/core": "^9.6.1",
|
|
52
54
|
"@stryker-mutator/vitest-runner": "^9.6.1",
|
|
53
|
-
"@tailwindcss/vite": "^4.3.2",
|
|
54
55
|
"@types/d3": "^7.4.3",
|
|
55
56
|
"@types/n3": "^1.26.1",
|
|
56
57
|
"@vue/test-utils": "^2.4.8",
|
|
@@ -58,7 +59,6 @@
|
|
|
58
59
|
"happy-dom": "^20.9.0",
|
|
59
60
|
"n3": "^1.26.0",
|
|
60
61
|
"rdf-validate-shacl": "^0.4.5",
|
|
61
|
-
"tailwindcss": "^4.3.2",
|
|
62
62
|
"typescript": "~5.7.3",
|
|
63
63
|
"vitest": "^4.1.5",
|
|
64
64
|
"vue-tsc": "^2.2.8"
|
|
@@ -93,11 +93,11 @@
|
|
|
93
93
|
"src",
|
|
94
94
|
"data",
|
|
95
95
|
"public/favicon.svg",
|
|
96
|
+
"astro.config.mjs",
|
|
96
97
|
"index.html",
|
|
97
98
|
"vite.config.ts",
|
|
98
99
|
"tsconfig.json",
|
|
99
100
|
"tailwind.config.js",
|
|
100
|
-
"postcss.config.js",
|
|
101
101
|
"env.d.ts"
|
|
102
102
|
]
|
|
103
103
|
}
|
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Data bridge: converts
|
|
3
|
-
* content collections at src/content/. Run before `astro build`.
|
|
2
|
+
* Data bridge: converts public/data/*.json into Astro content collections.
|
|
4
3
|
*
|
|
5
|
-
* Reads: public/data/datasets.json, public/data/{id}/manifest.json
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* Reads from the CONSUMER's CWD: public/data/datasets.json, public/data/{id}/manifest.json
|
|
5
|
+
* Writes to the CONSUMER's CWD: .cb-content/{datasets,groups,concepts,pages}/
|
|
6
|
+
*
|
|
7
|
+
* The package directory (node_modules/@glossarist/concept-browser/) is NEVER written to.
|
|
9
8
|
*/
|
|
10
9
|
import { readFileSync, writeFileSync, mkdirSync, existsSync, readdirSync } from 'fs';
|
|
11
|
-
import { join
|
|
12
|
-
import { fileURLToPath } from 'url';
|
|
10
|
+
import { join } from 'path';
|
|
13
11
|
|
|
14
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
12
|
const CWD = process.cwd();
|
|
16
|
-
const PKG_ROOT = join(__dirname, '..');
|
|
17
|
-
// Read generated data from the CONSUMER's working directory (where
|
|
18
|
-
// generate-data.mjs writes public/data/). Write content collections
|
|
19
|
-
// to the PACKAGE's src/content/ (where Astro expects them).
|
|
20
13
|
const PUBLIC_DATA = join(CWD, 'public', 'data');
|
|
21
14
|
const PUBLIC_ROOT = join(CWD, 'public');
|
|
22
|
-
const CONTENT_DIR = join(
|
|
15
|
+
const CONTENT_DIR = join(CWD, '.cb-content');
|
|
23
16
|
|
|
24
17
|
function readJson(p) {
|
|
25
18
|
if (!existsSync(p)) return null;
|
|
@@ -140,6 +133,7 @@ for (const g of groups) {
|
|
|
140
133
|
// --- Pages (from public/pages/*.json) ---
|
|
141
134
|
const pagesDir = join(CWD, 'public', 'pages');
|
|
142
135
|
if (existsSync(pagesDir)) {
|
|
136
|
+
mkdirSync(join(CONTENT_DIR, 'pages'), { recursive: true });
|
|
143
137
|
for (const file of readdirSync(pagesDir)) {
|
|
144
138
|
if (!file.endsWith('.json')) continue;
|
|
145
139
|
const page = readJson(join(pagesDir, file));
|
package/src/content.config.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { defineCollection, z } from 'astro:content';
|
|
2
2
|
import { glob } from 'astro/loaders';
|
|
3
|
+
import { resolve } from 'path';
|
|
4
|
+
|
|
5
|
+
const cbContent = resolve(process.cwd(), '.cb-content');
|
|
3
6
|
|
|
4
7
|
const datasets = defineCollection({
|
|
5
|
-
loader: glob({ pattern: '**/*.json', base: '
|
|
8
|
+
loader: glob({ pattern: '**/*.json', base: resolve(cbContent, 'datasets') }),
|
|
6
9
|
schema: z.object({
|
|
7
10
|
id: z.string(),
|
|
8
11
|
title: z.string(),
|
|
@@ -25,7 +28,7 @@ const datasets = defineCollection({
|
|
|
25
28
|
});
|
|
26
29
|
|
|
27
30
|
const groups = defineCollection({
|
|
28
|
-
loader: glob({ pattern: '**/*.json', base: '
|
|
31
|
+
loader: glob({ pattern: '**/*.json', base: resolve(cbContent, 'groups') }),
|
|
29
32
|
schema: z.object({
|
|
30
33
|
id: z.string(),
|
|
31
34
|
label: z.string(),
|
|
@@ -38,7 +41,7 @@ const groups = defineCollection({
|
|
|
38
41
|
});
|
|
39
42
|
|
|
40
43
|
const concepts = defineCollection({
|
|
41
|
-
loader: glob({ pattern: '**/*.json', base: '
|
|
44
|
+
loader: glob({ pattern: '**/*.json', base: resolve(cbContent, 'concepts') }),
|
|
42
45
|
schema: z.object({
|
|
43
46
|
registerId: z.string(),
|
|
44
47
|
conceptId: z.string(),
|
|
@@ -73,7 +76,7 @@ const concepts = defineCollection({
|
|
|
73
76
|
});
|
|
74
77
|
|
|
75
78
|
const pages = defineCollection({
|
|
76
|
-
loader: glob({ pattern: '**/*.{md,json}', base: '
|
|
79
|
+
loader: glob({ pattern: '**/*.{md,json}', base: resolve(cbContent, 'pages') }),
|
|
77
80
|
schema: z.object({
|
|
78
81
|
title: z.string(),
|
|
79
82
|
type: z.string().optional(),
|