cc4-embedded-system 3.1.8 → 3.1.10
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/README.md +22 -5
- package/dist/makefsdata.js +2 -0
- package/dist/public/index.html +7 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,19 +2,30 @@
|
|
|
2
2
|
- This version based on [html-minifier-next](https://github.com/j9t/html-minifier-next) and rewrite [lwIP makefsdata](https://github.com/m-labs/lwip/tree/master/src/apps/httpd/makefsdata), run on localhost, default port: ```3000```.
|
|
3
3
|
- This tool is deployed on [npm package](https://www.npmjs.com/package/cc4-embedded-system).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Demo
|
|
6
|
+
- Select input directory
|
|
7
|
+
|
|
8
|
+

|
|
9
|
+
- Select output file path
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
- Result
|
|
13
|
+
|
|
14
|
+

|
|
6
15
|
|
|
7
16
|
## Structure
|
|
8
17
|
```text
|
|
9
18
|
CC4EmbeddedSystem/
|
|
10
19
|
├── src/
|
|
11
20
|
│ ├── gui.ts // Express server & CLI entry point
|
|
12
|
-
│ │
|
|
21
|
+
│ │ └── utils.ts // To get latest tool version
|
|
13
22
|
│ └── makefsdata.ts // Core C code generation & minification logic
|
|
14
23
|
├── public/
|
|
15
24
|
│ └── index.html // Web GUI dashboard
|
|
16
25
|
├── Sereenshot/
|
|
17
|
-
│
|
|
26
|
+
│ ├── inputs.png // Demo image
|
|
27
|
+
│ ├── output.png // Demo image
|
|
28
|
+
│ └── v3.1.10.png // Demo image
|
|
18
29
|
├── node_modules/ // Required submodules during development
|
|
19
30
|
├── dist/ // Compiled JavaScript output (Auto-generated)
|
|
20
31
|
├── package.json // Project configuration & dependencies
|
|
@@ -37,6 +48,10 @@ CC4EmbeddedSystem/
|
|
|
37
48
|
```bash
|
|
38
49
|
cc4es --port 3002
|
|
39
50
|
```
|
|
51
|
+
- Update
|
|
52
|
+
```bash
|
|
53
|
+
npm install -g cc4-embedded-system@latest
|
|
54
|
+
```
|
|
40
55
|
### Development
|
|
41
56
|
```bash
|
|
42
57
|
# build
|
|
@@ -47,8 +62,10 @@ npm link
|
|
|
47
62
|
cc4es
|
|
48
63
|
|
|
49
64
|
# publish
|
|
65
|
+
npm whoami # verify
|
|
50
66
|
npm login
|
|
51
|
-
|
|
52
|
-
npm run
|
|
67
|
+
npm version patch --no-git-tag-version # if increase version
|
|
68
|
+
npm run dev # dev mode for testing
|
|
69
|
+
npm run build # build the newest
|
|
53
70
|
npm publish --access public
|
|
54
71
|
```
|
package/dist/makefsdata.js
CHANGED
|
@@ -322,10 +322,12 @@ export async function runMakeFsData(opts) {
|
|
|
322
322
|
if (rootNode) {
|
|
323
323
|
cOutput += `#define FS_ROOT file_${rootNode.varName}\n#define FS_NUMFILES ${orderedFileEntries.length + (hasRealRedirhome ? 0 : 1)}\n`;
|
|
324
324
|
fs.writeFileSync(opts.outputFile, cOutput);
|
|
325
|
+
const convertedSize = fs.statSync(opts.outputFile).size;
|
|
325
326
|
console.log(`\n✨ Success! Output written to: ${opts.outputFile}`);
|
|
326
327
|
return {
|
|
327
328
|
originalSize: totalOriginalSize,
|
|
328
329
|
compressedSize: totalCompressedSize,
|
|
330
|
+
convertedSize: convertedSize,
|
|
329
331
|
filesCount: orderedFileEntries.length
|
|
330
332
|
};
|
|
331
333
|
}
|
package/dist/public/index.html
CHANGED
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
<label>Input Directory</label>
|
|
58
58
|
<div class="input-row">
|
|
59
59
|
<input type="text" id="inputPath" placeholder="e.g., C:\Project\web">
|
|
60
|
-
<button type="button" class="btn-browse" onclick="handleBrowse('inputPath', 'dir')">
|
|
60
|
+
<button type="button" class="btn-browse" onclick="handleBrowse('inputPath', 'dir')">Browse ...</button>
|
|
61
61
|
</div>
|
|
62
62
|
</div>
|
|
63
63
|
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
<label>Output File (fsdata.c)</label>
|
|
66
66
|
<div class="input-row">
|
|
67
67
|
<input type="text" id="outputPath" placeholder="e.g., ./fsdata.c">
|
|
68
|
-
<button type="button" class="btn-browse" onclick="handleBrowse('outputPath', 'file')">
|
|
68
|
+
<button type="button" class="btn-browse" onclick="handleBrowse('outputPath', 'file')">Browse ...</button>
|
|
69
69
|
</div>
|
|
70
70
|
</div>
|
|
71
71
|
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
<div class="stats-title">📊 Compression Analysis</div>
|
|
99
99
|
<div class="stats-info">
|
|
100
100
|
<span>Compressed: <span id="compSize" style="color: #9cdcfe;">0</span> KB</span>
|
|
101
|
+
<span>Converted: <span id="convSize" style="color: #dcdcaa;">0</span> KB</span>
|
|
101
102
|
<span>Original: <span id="origSize" style="color: #ce9178;">0</span> KB</span>
|
|
102
103
|
</div>
|
|
103
104
|
<div class="bar-container">
|
|
@@ -261,9 +262,10 @@
|
|
|
261
262
|
const panel = document.getElementById('statsPanel');
|
|
262
263
|
panel.style.display = 'block';
|
|
263
264
|
|
|
264
|
-
const { originalSize, compressedSize } = result.stats;
|
|
265
|
+
const { originalSize, compressedSize, convertedSize } = result.stats;
|
|
265
266
|
const origKB = (originalSize / 1024).toFixed(2);
|
|
266
267
|
const compKB = (compressedSize / 1024).toFixed(2);
|
|
268
|
+
const convKB = (convertedSize / 1024).toFixed(2);
|
|
267
269
|
|
|
268
270
|
// ratio: the saved percentage
|
|
269
271
|
const ratio = originalSize > 0 ? (((originalSize - compressedSize) / originalSize) * 100).toFixed(1) : 0;
|
|
@@ -272,6 +274,7 @@
|
|
|
272
274
|
|
|
273
275
|
document.getElementById('origSize').innerText = origKB;
|
|
274
276
|
document.getElementById('compSize').innerText = compKB;
|
|
277
|
+
document.getElementById('convSize').innerText = convKB;
|
|
275
278
|
document.getElementById('barText').innerText = `${ratio}% Size Reduced`;
|
|
276
279
|
|
|
277
280
|
// actual used percentage
|
|
@@ -314,4 +317,4 @@
|
|
|
314
317
|
</div>
|
|
315
318
|
|
|
316
319
|
</body>
|
|
317
|
-
</html>
|
|
320
|
+
</html>
|