GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(gs1): resolve generator paths from import.meta.url · u8array/ZPLab@b2e7dc5

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • scripts
    • gen-gs1-catalog.mjs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎scripts/gen-gs1-catalog.mjs‎

Copy file name to clipboardExpand all lines: scripts/gen-gs1-catalog.mjs
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
// Deterministic generator: GS1 Barcode Syntax Dictionary -> internal AI catalog.
22
// Source authoritative (GS1 AISBL, from BWIPP+Zint), matches bwip-js renderer.
33
import { readFileSync, writeFileSync } from 'node:fs';
4-
const src = readFileSync('scripts/data/gs1-syntax-dictionary.txt', 'utf8');
4+
import { join } from 'node:path';
5+
import { fileURLToPath } from 'node:url';
6+
7+
const ROOT = fileURLToPath(new URL('..', import.meta.url));
8+
const src = readFileSync(join(ROOT, 'scripts', 'data', 'gs1-syntax-dictionary.txt'), 'utf8');
59

610
function groupFor(ai) {
711
const p3 = ai.slice(0, 3);
@@ -108,5 +112,5 @@ const header = `// GENERATED from the GS1 Barcode Syntax Dictionary (GS1 AISBL,
108112
import type { Gs1AiCatalogEntry } from './gs1AiCatalog.types';
109113
110114
export const GS1_AI_FULL_CATALOG: readonly Gs1AiCatalogEntry[] = [`;
111-
writeFileSync('src/lib/gs1AiCatalog.ts', header + '\n' + out.map(toLine).join('\n') + '\n];\n');
115+
writeFileSync(join(ROOT, 'src', 'lib', 'gs1AiCatalog.ts'), header + '\n' + out.map(toLine).join('\n') + '\n];\n');
112116
console.log('wrote src/lib/gs1AiCatalog.ts with', out.length, 'entries');

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.