Skip to content

Commit 1f9c513

Browse files
committed
chore: don't attempt to convert test project to ESM
1 parent 2cac70e commit 1f9c513

1 file changed

Lines changed: 0 additions & 38 deletions

File tree

packages/utils/test-utils/src/template-tests.ts

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import path from 'node:path';
33
import { pathToFileURL } from 'node:url';
44
import fs from 'node:fs';
55
import debug from 'debug';
6-
import { updatePackageJSON } from './index.js';
76
import { afterEach, beforeEach, describe, expect, test } from 'vitest';
87
import os from 'node:os';
98

@@ -204,43 +203,6 @@ export function testForgeTemplate({
204203
].join('\n'),
205204
);
206205

207-
// TODO decide if we want to keep this or remove it in favor of manually
208-
// updating any files that need to change when moving a project to ESM.
209-
// Non-TypeScript templates are left untouched since they'd also need
210-
// `forge.config.js` to be converted to ESM.
211-
if (moduleFormat === 'es' && templateName.endsWith('-typescript')) {
212-
let mainProcessEntrypointContent = await fs.promises.readFile(
213-
mainProcessEntrypoint,
214-
{ encoding: 'utf-8' },
215-
);
216-
217-
const importElectronSquirrelStartup = `import started from 'electron-squirrel-startup';`;
218-
219-
await fs.promises.writeFile(
220-
mainProcessEntrypoint,
221-
mainProcessEntrypointContent
222-
.replaceAll(/preload\.c?js/g, 'preload.js')
223-
.replaceAll('__dirname', 'import.meta.dirname')
224-
.replace(
225-
importElectronSquirrelStartup,
226-
[
227-
'\n',
228-
`import { createRequire } from 'node:module';`,
229-
`const require = createRequire(import.meta.url);`,
230-
`const started = require('electron-squirrel-startup')`,
231-
].join('\n'),
232-
),
233-
);
234-
235-
await updatePackageJSON(tmpDir, async (packageJSON) => {
236-
packageJSON.type = 'module';
237-
238-
(packageJSON.main as string).replace(/\.c?js/, '.js');
239-
240-
return packageJSON;
241-
});
242-
}
243-
244206
const electronForgeStartOutput = await spawn(
245207
packageManager,
246208
['run', 'start'],

0 commit comments

Comments
 (0)