feat(core): use zip snapshot for onboarding page (#6495)

This commit is contained in:
EYHN
2024-04-15 02:16:08 +00:00
parent 9b620ecbc9
commit 1656b33ce3
17 changed files with 108 additions and 2009 deletions

View File

@@ -1,32 +0,0 @@
import fs from 'node:fs';
import path, { join } from 'node:path';
import { fileURLToPath } from 'node:url';
import * as glob from 'glob';
// purpose: bundle all json files into one json file in onboarding folder
const __dirname = join(fileURLToPath(import.meta.url), '..');
const jsonFiles = glob.sync('./*.json', {
cwd: path.join(__dirname, 'onboarding'),
});
const imports = jsonFiles
.map(
(fileName, index) => `import json_${index} from './onboarding/${fileName}';`
)
.join('\n');
const exports = `export const onboarding = {
${jsonFiles
.map((fileName, index) => {
return ` '${fileName}': json_${index}`;
})
.join(',\n')}
}`;
const template = `/* eslint-disable simple-import-sort/imports */
// Auto generated, do not edit manually
${imports}\n\n${exports}`;
fs.writeFileSync(path.join(__dirname, 'templates.gen.ts'), template);

File diff suppressed because one or more lines are too long

View File

@@ -1,21 +0,0 @@
{
"type": "info",
"id": "dc61f2e3-a973-432f-a463-164a15cfc778",
"pageVersion": 2,
"workspaceVersion": 2,
"properties": {
"tags": {
"options": []
}
},
"pages": [
{
"id": "W-d9_llZ6rE-qoTiHKTk4",
"createDate": 1706862386590,
"tags": [],
"favorite": false,
"title": "Write, Draw, Plan all at Once.",
"updatedDate": 1709110332309
}
]
}

Binary file not shown.

View File

@@ -4,11 +4,11 @@
"sideEffect": false,
"version": "0.14.0",
"scripts": {
"postinstall": "node ./build.mjs && node ./build-edgeless.mjs"
"postinstall": "node ./build-edgeless.mjs"
},
"type": "module",
"exports": {
".": "./templates.gen.ts",
"./onboarding.zip": "./onboarding/onboarding.zip",
"./edgeless": "./edgeless-templates.gen.ts",
"./build-edgeless": "./build-edgeless.mjs"
},

View File

@@ -1,11 +0,0 @@
/* eslint-disable simple-import-sort/imports */
// Auto generated, do not edit manually
import json_0 from './onboarding/info.json';
import json_1 from './onboarding/blob.json';
import json_2 from './onboarding/W-d9_llZ6rE-qoTiHKTk4.snapshot.json';
export const onboarding = {
'info.json': json_0,
'blob.json': json_1,
'W-d9_llZ6rE-qoTiHKTk4.snapshot.json': json_2
}