Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: path issue on Windows (#5725)

LongYinan25e8b8306f5b
diff --git a/packages/frontend/templates/build.mjs b/packages/frontend/templates/build.mjs
index 26769eff55..5659277ed3 100644
--- a/packages/frontend/templates/build.mjs
+++ b/packages/frontend/templates/build.mjs
@@ -1,31 +1,32 @@
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';
// 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', {
- cwd: path.resolve(__dirname, 'onboarding'),
+ cwd: path.join(__dirname, 'onboarding'),
});
const imports = jsonFiles
- .map((fileName, index) => {
- return `import json_${index} from './onboarding/${fileName}';`;
- })
+ .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')}
+${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.resolve(__dirname, 'templates.gen.ts'), template);
+fs.writeFileSync(path.join(__dirname, 'templates.gen.ts'), template);
diff --git a/packages/frontend/templates/templates.gen.ts b/packages/frontend/templates/templates.gen.ts
index 7188531ffb..aaf6e85bcb 100644
--- a/packages/frontend/templates/templates.gen.ts
+++ b/packages/frontend/templates/templates.gen.ts
@@ -1,29 +1,29 @@
/* eslint-disable simple-import-sort/imports */
// Auto generated, do not edit manually
import json_0 from './onboarding/wbXL4bZcblxLKC6ETqcQ1.snapshot.json';
-import json_1 from './onboarding/rzyBHDgN5KIlEYzB9oBaD.snapshot.json';
-import json_2 from './onboarding/nPPyOV0JBNKu5hvW9hE00.snapshot.json';
-import json_3 from './onboarding/info.json';
-import json_4 from './onboarding/e5cYLNpIRUb-nwpSZGdix.snapshot.json';
-import json_5 from './onboarding/b1F2xKjgZ4ISHhXNe1kck.snapshot.json';
-import json_6 from './onboarding/Scod6coKmJJ-waH1-jkiW.snapshot.json';
-import json_7 from './onboarding/RCpxnWMtBWmUZy5awgJBh.snapshot.json';
-import json_8 from './onboarding/GWsRbUtMF4Ee6foVg-H9R.snapshot.json';
+import json_1 from './onboarding/Scod6coKmJJ-waH1-jkiW.snapshot.json';
+import json_2 from './onboarding/rzyBHDgN5KIlEYzB9oBaD.snapshot.json';
+import json_3 from './onboarding/RCpxnWMtBWmUZy5awgJBh.snapshot.json';
+import json_4 from './onboarding/nPPyOV0JBNKu5hvW9hE00.snapshot.json';
+import json_5 from './onboarding/info.json';
+import json_6 from './onboarding/GWsRbUtMF4Ee6foVg-H9R.snapshot.json';
+import json_7 from './onboarding/e5cYLNpIRUb-nwpSZGdix.snapshot.json';
+import json_8 from './onboarding/b1F2xKjgZ4ISHhXNe1kck.snapshot.json';
import json_9 from './onboarding/9iIScyvuIB_kUKbs1AYOQ.snapshot.json';
import json_10 from './onboarding/0nee_XzkrN23Xy7HMoXL-.snapshot.json';
import json_11 from './onboarding/-P-O4GSfVGTkI16zJRVa4.snapshot.json';
export const onboarding = {
'wbXL4bZcblxLKC6ETqcQ1.snapshot.json': json_0,
-'rzyBHDgN5KIlEYzB9oBaD.snapshot.json': json_1,
-'nPPyOV0JBNKu5hvW9hE00.snapshot.json': json_2,
-'info.json': json_3,
-'e5cYLNpIRUb-nwpSZGdix.snapshot.json': json_4,
-'b1F2xKjgZ4ISHhXNe1kck.snapshot.json': json_5,
-'Scod6coKmJJ-waH1-jkiW.snapshot.json': json_6,
-'RCpxnWMtBWmUZy5awgJBh.snapshot.json': json_7,
-'GWsRbUtMF4Ee6foVg-H9R.snapshot.json': json_8,
-'9iIScyvuIB_kUKbs1AYOQ.snapshot.json': json_9,
-'0nee_XzkrN23Xy7HMoXL-.snapshot.json': json_10,
-'-P-O4GSfVGTkI16zJRVa4.snapshot.json': json_11
+ 'Scod6coKmJJ-waH1-jkiW.snapshot.json': json_1,
+ 'rzyBHDgN5KIlEYzB9oBaD.snapshot.json': json_2,
+ 'RCpxnWMtBWmUZy5awgJBh.snapshot.json': json_3,
+ 'nPPyOV0JBNKu5hvW9hE00.snapshot.json': json_4,
+ 'info.json': json_5,
+ 'GWsRbUtMF4Ee6foVg-H9R.snapshot.json': json_6,
+ 'e5cYLNpIRUb-nwpSZGdix.snapshot.json': json_7,
+ 'b1F2xKjgZ4ISHhXNe1kck.snapshot.json': json_8,
+ '9iIScyvuIB_kUKbs1AYOQ.snapshot.json': json_9,
+ '0nee_XzkrN23Xy7HMoXL-.snapshot.json': json_10,
+ '-P-O4GSfVGTkI16zJRVa4.snapshot.json': json_11
}
\ No newline at end of file