Skip to content

Commit 77bfbb2

Browse files
committed
Add Manifest for languages packs and themes packs
Add Js / font to themes packs
1 parent 2a68aa0 commit 77bfbb2

36 files changed

Lines changed: 1534 additions & 120 deletions

config/checkpack.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ const fileReference = JSON.parse(
7676
fs.readFileSync(referenceFile, "UTF-8").toString()
7777
)
7878
console.log("")
79+
const META_KEYS = new Set(["_manifest"])
7980
console.log(chalk.green("Checking extra entries..."))
8081
Object.keys(fileTarget).map((key) => {
82+
if (META_KEYS.has(key)) return
8183
if (typeof fileReference[key] == "undefined") {
8284
console.log(chalk.yellow(key + " : " + fileTarget[key]))
8385
count++
@@ -93,6 +95,7 @@ count = 0
9395
console.log("")
9496
console.log(chalk.green("Checking missing entries..."))
9597
Object.keys(fileReference).map((key) => {
98+
if (META_KEYS.has(key)) return
9699
if (typeof fileTarget[key] == "undefined") {
97100
count++
98101
console.log(chalk.red(key + " : " + fileReference[key]))

config/fill-missing-root-lang.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ rootFiles.forEach((fileName) => {
3535
}
3636
})
3737
if (added === 0) return
38-
// Preserve order: lang first, then reference keys
38+
// Preserve order: _manifest first, lang second, then reference keys
3939
const out = {}
40+
if (data._manifest !== undefined) out._manifest = data._manifest
4041
if (data.lang !== undefined) out.lang = data.lang
4142
refKeys.forEach((key) => {
4243
out[key] = data[key] !== undefined ? data[key] : ""

config/list-languages.js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ const fs = require("fs")
99
const languagesPath = path.normalize(__dirname + "/../languages/")
1010
const packs = ["printerpack", "cncgrblpack", "cncgrblhalpack", "sandtablepack"]
1111

12-
// Collect code -> name from root lang-*.json first, then from packs (to get names for any lang only in packs)
13-
const codeToName = {}
12+
// Collect code -> { name, manifest? } from root lang-*.json first, then from packs
13+
const codeToInfo = {}
1414

1515
function addFromFile(filePath) {
1616
try {
@@ -21,7 +21,9 @@ function addFromFile(filePath) {
2121
const base = path.basename(filePath, ".json")
2222
if (!base.startsWith("lang-")) return
2323
const code = base.replace(/^lang-/, "")
24-
if (!codeToName[code]) codeToName[code] = name
24+
if (!codeToInfo[code]) {
25+
codeToInfo[code] = { name, manifest: data._manifest || null }
26+
}
2527
} catch (e) {
2628
// skip invalid or missing
2729
}
@@ -48,18 +50,33 @@ packs.forEach((pack) => {
4850
})
4951

5052
// Sort by code
51-
const codes = Object.keys(codeToName).sort()
53+
const codes = Object.keys(codeToInfo).sort()
5254

5355
// Output Markdown table
5456
const outPath = process.argv[2] || path.join(__dirname, "../docs/languages.md")
57+
58+
const hasManifestInfo = codes.some((c) => codeToInfo[c].manifest)
59+
60+
const header = hasManifestInfo
61+
? ["| Code | Name | RTL | Version | Owner |", "|------|------|-----|---------|-------|"]
62+
: ["| Code | Name |", "|------|------|"]
63+
64+
const rows = codes.map((code) => {
65+
const { name, manifest: m } = codeToInfo[code]
66+
if (!hasManifestInfo) return `| ${code} | ${name} |`
67+
const rtl = m && m.rtl ? "✓" : ""
68+
const ver = (m && m.version) || ""
69+
const owner = (m && m.owner) ? `[${m.owner}](${m.github || "#"})` : (m && m.owner) || ""
70+
return `| ${code} | ${name} | ${rtl} | ${ver} | ${owner} |`
71+
})
72+
5573
const lines = [
5674
"# Language packs – codes and names",
5775
"",
58-
"Generated by `node config/list-languages.js`. Scan of `languages/` (root and packs) for `lang-*.json`; name from the `lang` key.",
76+
"Generated by `node config/list-languages.js`. Scan of `languages/` (root and packs) for `lang-*.json`.",
5977
"",
60-
"| Code | Name |",
61-
"|------|------|",
62-
...codes.map((code) => `| ${code} | ${codeToName[code]} |`),
78+
...header,
79+
...rows,
6380
"",
6481
]
6582

config/server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ function filesList(mypath, destination) {
178178
const getAllFiles = function (dirPath, arrayOfFiles = []) {
179179
let files = fs.readdirSync(dirPath) || []
180180
const newFiles = files.reduce((acc, file) => {
181-
const fullpath = dirPath + "/" + file
181+
const fullpath = path.join(dirPath, file)
182182
return fs.statSync(fullpath).isDirectory()
183183
? getAllFiles(fullpath, acc)
184184
: [...acc, fullpath]
@@ -188,7 +188,7 @@ const getAllFiles = function (dirPath, arrayOfFiles = []) {
188188

189189
const getTotalSize = function (directoryPath) {
190190
const allFiles = getAllFiles(directoryPath)
191-
console.log("allFiles", allFiles)
191+
if (MOCK_VERBOSE) console.log("allFiles", allFiles)
192192
return allFiles.reduce(
193193
(acc, currFile) => acc + fs.statSync(currFile).size,
194194
0

dist/BUNDLE_SIZES.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ Generated by `tools/release_bundle_sizes.py`. Use this table in RELEASE_*.md or
44

55
| Target | Subtarget | Gzip Path | Gzip Size | Brotli Path | Brotli Size |
66
|--------|-----------|-----------|-----------|-------------|-------------|
7-
| CNC | GRBL | CNC\GRBL\index.html.gz | 91.2 KB | CNC\GRBL\index.html.br | 75.6 KB |
8-
| CNC | GRBLHal | CNC\GRBLHal\index.html.gz | 95.8 KB | CNC\GRBLHal\index.html.br | 79.0 KB |
9-
| Printer3D | Marlin | Printer3D\Marlin\index.html.gz | 97.1 KB | Printer3D\Marlin\index.html.br | 80.2 KB |
10-
| Printer3D | Marlin-embedded | Printer3D\Marlin-embedded\index.html.gz | 96.6 KB | Printer3D\Marlin-embedded\index.html.br | 79.8 KB |
11-
| Printer3D | Repetier | Printer3D\Repetier\index.html.gz | 96.0 KB | Printer3D\Repetier\index.html.br | 79.3 KB |
12-
| Printer3D | Smoothieware | Printer3D\Smoothieware\index.html.gz | 95.6 KB | Printer3D\Smoothieware\index.html.br | 78.8 KB |
13-
| SandTable | GRBL | SandTable\GRBL\index.html.gz | 83.4 KB | SandTable\GRBL\index.html.br | 69.1 KB |
7+
| CNC | GRBL | CNC\GRBL\index.html.gz | 91.8 KB | CNC\GRBL\index.html.br | 76.1 KB |
8+
| CNC | GRBLHal | CNC\GRBLHal\index.html.gz | 96.6 KB | CNC\GRBLHal\index.html.br | 79.5 KB |
9+
| Printer3D | Marlin | Printer3D\Marlin\index.html.gz | 97.9 KB | Printer3D\Marlin\index.html.br | 80.9 KB |
10+
| Printer3D | Marlin-embedded | Printer3D\Marlin-embedded\index.html.gz | 97.2 KB | Printer3D\Marlin-embedded\index.html.br | 80.4 KB |
11+
| Printer3D | Repetier | Printer3D\Repetier\index.html.gz | 96.6 KB | Printer3D\Repetier\index.html.br | 79.8 KB |
12+
| Printer3D | Smoothieware | Printer3D\Smoothieware\index.html.gz | 96.3 KB | Printer3D\Smoothieware\index.html.br | 79.5 KB |
13+
| SandTable | GRBL | SandTable\GRBL\index.html.gz | 84.1 KB | SandTable\GRBL\index.html.br | 69.6 KB |
1414

15-
**Total Gzip size:** 655.6 KB (671366 bytes).
16-
**Total Brotli size:** 541.8 KB (554806 bytes).
15+
**Total Gzip size:** 660.5 KB (676340 bytes).
16+
**Total Brotli size:** 545.7 KB (558760 bytes).

dist/CNC/GRBL/index.html.br

487 Bytes
Binary file not shown.

dist/CNC/GRBL/index.html.gz

672 Bytes
Binary file not shown.

dist/CNC/GRBLHal/index.html.br

504 Bytes
Binary file not shown.

dist/CNC/GRBLHal/index.html.gz

756 Bytes
Binary file not shown.
633 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)