mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08:00
fix: path issue on Windows (#5725)
This commit is contained in:
@@ -1,31 +1,32 @@
|
|||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import path from 'node:path';
|
import path, { join } from 'node:path';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import * as glob from 'glob';
|
import * as glob from 'glob';
|
||||||
|
|
||||||
// purpose: bundle all json files into one json file in onboarding folder
|
// purpose: bundle all json files into one json file in onboarding folder
|
||||||
const __dirname = new URL('.', import.meta.url).pathname;
|
const __dirname = join(fileURLToPath(import.meta.url), '..');
|
||||||
|
|
||||||
const jsonFiles = glob.sync('./*.json', {
|
const jsonFiles = glob.sync('./*.json', {
|
||||||
cwd: path.resolve(__dirname, 'onboarding'),
|
cwd: path.join(__dirname, 'onboarding'),
|
||||||
});
|
});
|
||||||
|
|
||||||
const imports = jsonFiles
|
const imports = jsonFiles
|
||||||
.map((fileName, index) => {
|
.map(
|
||||||
return `import json_${index} from './onboarding/${fileName}';`;
|
(fileName, index) => `import json_${index} from './onboarding/${fileName}';`
|
||||||
})
|
)
|
||||||
.join('\n');
|
.join('\n');
|
||||||
|
|
||||||
const exports = `export const onboarding = {
|
const exports = `export const onboarding = {
|
||||||
${jsonFiles
|
${jsonFiles
|
||||||
.map((fileName, index) => {
|
.map((fileName, index) => {
|
||||||
return `'${fileName}': json_${index}`;
|
return ` '${fileName}': json_${index}`;
|
||||||
})
|
})
|
||||||
.join(',\n')}
|
.join(',\n')}
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
const template = `/* eslint-disable simple-import-sort/imports */
|
const template = `/* eslint-disable simple-import-sort/imports */
|
||||||
// Auto generated, do not edit manually
|
// Auto generated, do not edit manually
|
||||||
${imports}\n\n${exports}`;
|
${imports}\n\n${exports}`;
|
||||||
|
|
||||||
fs.writeFileSync(path.resolve(__dirname, 'templates.gen.ts'), template);
|
fs.writeFileSync(path.join(__dirname, 'templates.gen.ts'), template);
|
||||||
|
|||||||
@@ -1,29 +1,29 @@
|
|||||||
/* eslint-disable simple-import-sort/imports */
|
/* eslint-disable simple-import-sort/imports */
|
||||||
// Auto generated, do not edit manually
|
// Auto generated, do not edit manually
|
||||||
import json_0 from './onboarding/wbXL4bZcblxLKC6ETqcQ1.snapshot.json';
|
import json_0 from './onboarding/wbXL4bZcblxLKC6ETqcQ1.snapshot.json';
|
||||||
import json_1 from './onboarding/rzyBHDgN5KIlEYzB9oBaD.snapshot.json';
|
import json_1 from './onboarding/Scod6coKmJJ-waH1-jkiW.snapshot.json';
|
||||||
import json_2 from './onboarding/nPPyOV0JBNKu5hvW9hE00.snapshot.json';
|
import json_2 from './onboarding/rzyBHDgN5KIlEYzB9oBaD.snapshot.json';
|
||||||
import json_3 from './onboarding/info.json';
|
import json_3 from './onboarding/RCpxnWMtBWmUZy5awgJBh.snapshot.json';
|
||||||
import json_4 from './onboarding/e5cYLNpIRUb-nwpSZGdix.snapshot.json';
|
import json_4 from './onboarding/nPPyOV0JBNKu5hvW9hE00.snapshot.json';
|
||||||
import json_5 from './onboarding/b1F2xKjgZ4ISHhXNe1kck.snapshot.json';
|
import json_5 from './onboarding/info.json';
|
||||||
import json_6 from './onboarding/Scod6coKmJJ-waH1-jkiW.snapshot.json';
|
import json_6 from './onboarding/GWsRbUtMF4Ee6foVg-H9R.snapshot.json';
|
||||||
import json_7 from './onboarding/RCpxnWMtBWmUZy5awgJBh.snapshot.json';
|
import json_7 from './onboarding/e5cYLNpIRUb-nwpSZGdix.snapshot.json';
|
||||||
import json_8 from './onboarding/GWsRbUtMF4Ee6foVg-H9R.snapshot.json';
|
import json_8 from './onboarding/b1F2xKjgZ4ISHhXNe1kck.snapshot.json';
|
||||||
import json_9 from './onboarding/9iIScyvuIB_kUKbs1AYOQ.snapshot.json';
|
import json_9 from './onboarding/9iIScyvuIB_kUKbs1AYOQ.snapshot.json';
|
||||||
import json_10 from './onboarding/0nee_XzkrN23Xy7HMoXL-.snapshot.json';
|
import json_10 from './onboarding/0nee_XzkrN23Xy7HMoXL-.snapshot.json';
|
||||||
import json_11 from './onboarding/-P-O4GSfVGTkI16zJRVa4.snapshot.json';
|
import json_11 from './onboarding/-P-O4GSfVGTkI16zJRVa4.snapshot.json';
|
||||||
|
|
||||||
export const onboarding = {
|
export const onboarding = {
|
||||||
'wbXL4bZcblxLKC6ETqcQ1.snapshot.json': json_0,
|
'wbXL4bZcblxLKC6ETqcQ1.snapshot.json': json_0,
|
||||||
'rzyBHDgN5KIlEYzB9oBaD.snapshot.json': json_1,
|
'Scod6coKmJJ-waH1-jkiW.snapshot.json': json_1,
|
||||||
'nPPyOV0JBNKu5hvW9hE00.snapshot.json': json_2,
|
'rzyBHDgN5KIlEYzB9oBaD.snapshot.json': json_2,
|
||||||
'info.json': json_3,
|
'RCpxnWMtBWmUZy5awgJBh.snapshot.json': json_3,
|
||||||
'e5cYLNpIRUb-nwpSZGdix.snapshot.json': json_4,
|
'nPPyOV0JBNKu5hvW9hE00.snapshot.json': json_4,
|
||||||
'b1F2xKjgZ4ISHhXNe1kck.snapshot.json': json_5,
|
'info.json': json_5,
|
||||||
'Scod6coKmJJ-waH1-jkiW.snapshot.json': json_6,
|
'GWsRbUtMF4Ee6foVg-H9R.snapshot.json': json_6,
|
||||||
'RCpxnWMtBWmUZy5awgJBh.snapshot.json': json_7,
|
'e5cYLNpIRUb-nwpSZGdix.snapshot.json': json_7,
|
||||||
'GWsRbUtMF4Ee6foVg-H9R.snapshot.json': json_8,
|
'b1F2xKjgZ4ISHhXNe1kck.snapshot.json': json_8,
|
||||||
'9iIScyvuIB_kUKbs1AYOQ.snapshot.json': json_9,
|
'9iIScyvuIB_kUKbs1AYOQ.snapshot.json': json_9,
|
||||||
'0nee_XzkrN23Xy7HMoXL-.snapshot.json': json_10,
|
'0nee_XzkrN23Xy7HMoXL-.snapshot.json': json_10,
|
||||||
'-P-O4GSfVGTkI16zJRVa4.snapshot.json': json_11
|
'-P-O4GSfVGTkI16zJRVa4.snapshot.json': json_11
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user