diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/buildConstants.js | 10 | ||||
-rw-r--r-- | config/fileURLToDirname.js | 10 | ||||
-rw-r--r-- | config/fileUrlToDirname.js | 10 | ||||
-rw-r--r-- | config/jest.config.base.js | 14 |
4 files changed, 22 insertions, 22 deletions
diff --git a/config/buildConstants.js b/config/buildConstants.js index 3c55500..dfe2ab0 100644 --- a/config/buildConstants.js +++ b/config/buildConstants.js | |||
@@ -1,14 +1,14 @@ | |||
1 | import { readFileSync } from 'fs'; | 1 | import { readFileSync } from 'node:fs'; |
2 | import { join } from 'path'; | 2 | import path from 'node:path'; |
3 | 3 | ||
4 | import fileURLToDirname from './fileURLToDirname.js'; | 4 | import fileUrlToDirname from './fileUrlToDirname.js'; |
5 | 5 | ||
6 | const thisDir = fileURLToDirname(import.meta.url); | 6 | const thisDir = fileUrlToDirname(import.meta.url); |
7 | 7 | ||
8 | // We import this from a vite config, where top-level await is not available (es2021), | 8 | // We import this from a vite config, where top-level await is not available (es2021), |
9 | // so we have to use the synchronous filesystem API. | 9 | // so we have to use the synchronous filesystem API. |
10 | const electronVendorsJson = readFileSync( | 10 | const electronVendorsJson = readFileSync( |
11 | join(thisDir, '../.electron-vendors.cache.json'), | 11 | path.join(thisDir, '../.electron-vendors.cache.json'), |
12 | 'utf8', | 12 | 'utf8', |
13 | ); | 13 | ); |
14 | 14 | ||
diff --git a/config/fileURLToDirname.js b/config/fileURLToDirname.js deleted file mode 100644 index 70654cb..0000000 --- a/config/fileURLToDirname.js +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | import { dirname } from 'path'; | ||
2 | import { fileURLToPath } from 'url'; | ||
3 | |||
4 | /** | ||
5 | * @param {string} url | ||
6 | * @returns {string} | ||
7 | */ | ||
8 | export default function fileURLToDirname(url) { | ||
9 | return dirname(fileURLToPath(url)); | ||
10 | } | ||
diff --git a/config/fileUrlToDirname.js b/config/fileUrlToDirname.js new file mode 100644 index 0000000..9b51305 --- /dev/null +++ b/config/fileUrlToDirname.js | |||
@@ -0,0 +1,10 @@ | |||
1 | import path from 'node:path'; | ||
2 | import { fileURLToPath } from 'node:url'; | ||
3 | |||
4 | /** | ||
5 | * @param {string} url | ||
6 | * @returns {string} | ||
7 | */ | ||
8 | export default function fileUrlToDirname(url) { | ||
9 | return path.dirname(fileURLToPath(url)); | ||
10 | } | ||
diff --git a/config/jest.config.base.js b/config/jest.config.base.js index 21f93be..d9865f9 100644 --- a/config/jest.config.base.js +++ b/config/jest.config.base.js | |||
@@ -1,24 +1,24 @@ | |||
1 | import { join } from 'path'; | 1 | import path from 'node:path'; |
2 | 2 | ||
3 | import fileURLToDirname from './fileURLToDirname.js'; | 3 | import fileUrlToDirname from './fileUrlToDirname.js'; |
4 | 4 | ||
5 | const thisDir = fileURLToDirname(import.meta.url); | 5 | const thisDir = fileUrlToDirname(import.meta.url); |
6 | 6 | ||
7 | /** @type {import('@jest/types').Config.InitialOptions} */ | 7 | /** @type {import('@jest/types').Config.InitialOptions} */ |
8 | export default { | 8 | export default { |
9 | transform: { | 9 | transform: { |
10 | '\\.tsx?$': join(thisDir, 'jestEsbuildTransformer.js'), | 10 | '\\.tsx?$': path.join(thisDir, 'jestEsbuildTransformer.js'), |
11 | }, | 11 | }, |
12 | extensionsToTreatAsEsm: ['.ts', '.tsx'], | 12 | extensionsToTreatAsEsm: ['.ts', '.tsx'], |
13 | moduleNameMapper: { | 13 | moduleNameMapper: { |
14 | '^@sophie/(.+)$': join(thisDir, '../packages/$1/src/index.ts'), | 14 | '^@sophie/(.+)$': path.join(thisDir, '../packages/$1/src/index.ts'), |
15 | '^(\\.{1,2}/.*)\\.jsx?$': '$1', | 15 | '^(\\.{1,2}/.*)\\.jsx?$': '$1', |
16 | // Workaround for jest to recognize the vendored dependencies of chalk. | 16 | // Workaround for jest to recognize the vendored dependencies of chalk. |
17 | '^#ansi-styles$': join( | 17 | '^#ansi-styles$': path.join( |
18 | thisDir, | 18 | thisDir, |
19 | '../node_modules/chalk/source/vendor/ansi-styles/index.js', | 19 | '../node_modules/chalk/source/vendor/ansi-styles/index.js', |
20 | ), | 20 | ), |
21 | '^#supports-color$': join( | 21 | '^#supports-color$': path.join( |
22 | thisDir, | 22 | thisDir, |
23 | '../node_modules/chalk/source/vendor/supports-color/index.js', | 23 | '../node_modules/chalk/source/vendor/supports-color/index.js', |
24 | ), | 24 | ), |