Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.12
22.13
14 changes: 0 additions & 14 deletions knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,24 +142,10 @@
"entry": ["spec/**/*.spec.ts"],
"project": ["src/**/*.ts!", "spec/**/*.ts"]
},
"packages/template/vite-typescript": {
"entry": ["spec/**/*.spec.ts"],
"project": ["src/**/*.ts!", "spec/**/*.ts"]
},
"packages/template/webpack": {
"entry": ["spec/**/*.spec.ts"],
"project": ["src/**/*.ts!", "spec/**/*.ts"]
},
"packages/template/webpack-typescript": {
"entry": ["spec/**/*.spec.ts"],
"project": ["src/**/*.ts!", "spec/**/*.ts"],
"ignoreDependencies": [
"@electron-forge/maker-.*",
"@electron-forge/plugin-webpack",
"webpack",
"listr2"
]
},
"packages/utils/core-utils": {
"entry": ["src/remote-rebuild.ts!", "spec/**/*.spec.ts"],
"project": ["src/**/*.ts!", "spec/**/*.ts"]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"type": "module",
"engines": {
"node": ">= 22.12.0"
"node": ">= "
},
"resolutions": {
"ajv@8.17.1": "^8.18.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"semver": "^7.2.1"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"funding": [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/api/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"log-symbols": "^4.0.0"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"funding": [
{
Expand Down
4 changes: 1 addition & 3 deletions packages/external/create-electron-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@
"author": "Samuel Attard",
"license": "MIT",
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/core-utils": "workspace:*",
"@electron-forge/shared-types": "workspace:*",
"@electron-forge/template-base": "workspace:*",
"@electron-forge/template-vite": "workspace:*",
"@electron-forge/template-vite-typescript": "workspace:*",
"@electron-forge/template-webpack": "workspace:*",
"@electron-forge/template-webpack-typescript": "workspace:*",
"@inquirer/prompts": "^6.0.1",
"@listr2/prompt-adapter-inquirer": "^2.0.22",
"@malept/cross-spawn-promise": "^2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,18 @@ describe('findTemplate', () => {
'Failed to locate custom template: "non-existent-template".',
);
});

describe('deprecated -typescript templates', () => {
it('should provide a helpful error for vite-typescript', async () => {
await expect(findTemplate('vite-typescript')).rejects.toThrowError(
/no longer exists.*--template vite/,
);
});

it('should provide a helpful error for webpack-typescript', async () => {
await expect(findTemplate('webpack-typescript')).rejects.toThrowError(
/no longer exists.*--template webpack/,
);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const initCommand = program
'--package-manager [name]',
'Set a specific package manager to use for your Forge project. Supported package managers are `npm`, `pnpm`, and `yarn`. You can also specify an exact version to use (e.g. `yarn@1.22.22`).',
)
.option('--typescript', 'Use TypeScript in the template.')
.action(async (dir) => {
const options = initCommand.opts();
const tasks = new Listr<InitOptions>(
Expand All @@ -52,6 +53,7 @@ const initCommand = program
initOpts.copyCIFiles = Boolean(options.copyCiFiles);
initOpts.force = Boolean(options.force);
initOpts.skipGit = Boolean(options.skipGit);
initOpts.typescript = Boolean(options.typescript);
initOpts.dir = resolveWorkingDir(dir, false);
initOpts.electronVersion = options.electronVersion ?? 'latest';
initOpts.packageManager = options.packageManager ?? 'npm@latest';
Expand Down Expand Up @@ -120,29 +122,27 @@ const initCommand = program
},
);

let language: string | undefined;

if (bundler !== 'base') {
language = await prompt.run<Prompt<string | undefined, any>>(
initOpts.typescript = await prompt.run<Prompt<boolean, any>>(
select,
{
message: 'Select a programming language',
choices: [
{
name: 'JavaScript',
value: undefined,
value: false,
},
{
name: 'TypeScript',
value: 'typescript',
value: true,
},
],
},
);
}

initOpts.packageManager = packageManager;
initOpts.template = `${bundler}${language ? `-${language}` : ''}`;
initOpts.template = bundler;

// TODO: add prompt for passing in an exact version as well
initOpts.electronVersion = await prompt.run<Prompt<string, any>>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ export const findTemplate = async (
}
}
if (!foundTemplate) {
const tsMatch = template.match(/^(.+)-typescript$/);
if (tsMatch) {
throw new Error(
`The "${template}" template no longer exists. Use "--template ${tsMatch[1]}" instead and select TypeScript when prompted.`,
);
}
throw new Error(`Failed to locate custom template: "${template}".`);
} else {
d(`found template module at: ${foundTemplate.path}`);
Expand Down
12 changes: 12 additions & 0 deletions packages/external/create-electron-app/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export interface InitOptions {
* Force a package manager to use (npm|yarn|pnpm).
*/
packageManager?: string;
/**
* Whether to use TypeScript in the template.
*/
typescript?: boolean;
}

async function validateTemplate(
Expand Down Expand Up @@ -95,9 +99,16 @@ export async function init({
skipGit = false,
electronVersion = 'latest',
packageManager,
typescript = false,
}: InitOptions): Promise<void> {
d(`Initializing in: ${dir}`);

if (typescript && template === 'base') {
throw new Error(
'The "base" template does not support TypeScript. Use "--template vite" or "--template webpack" with "--typescript".',
);
}

const runner = new Listr<{
templateModule: ForgeTemplate;
pm: PMDetails;
Expand Down Expand Up @@ -173,6 +184,7 @@ export async function init({
const tasks = await templateModule.initializeTemplate(dir, {
copyCIFiles,
force,
typescript,
});
if (tasks) {
return task.newListr(tasks, { concurrent: false });
Expand Down
2 changes: 1 addition & 1 deletion packages/maker/appx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"vitest": "catalog:"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/core-utils": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/maker/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"vitest": "catalog:"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/shared-types": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/maker/deb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"vitest": "catalog:"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/maker-base": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/maker/dmg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"vitest": "catalog:"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/maker-base": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/maker/flatpak/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"vitest": "catalog:"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/maker-base": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/maker/msix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"vitest": "catalog:"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/core-utils": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/maker/pkg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"vitest": "catalog:"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/maker-base": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/maker/rpm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"vitest": "catalog:"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/maker-base": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/maker/snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"vitest": "catalog:"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/maker-base": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/maker/squirrel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"exports": "./dist/MakerSquirrel.js",
"typings": "dist/MakerSquirrel.d.ts",
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/maker-base": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/maker/wix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"exports": "./dist/MakerWix.js",
"typings": "dist/MakerWix.d.ts",
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/core-utils": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/maker/zip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"vitest": "catalog:"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/maker-base": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/auto-unpack-natives/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"exports": "./dist/AutoUnpackNativesPlugin.js",
"typings": "dist/AutoUnpackNativesPlugin.d.ts",
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/plugin-base": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"exports": "./dist/Plugin.js",
"typings": "dist/Plugin.d.ts",
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/shared-types": "workspace:*"
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/fuses/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@electron/fuses": "^2.0.0"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/plugin-base": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/local-electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"exports": "./dist/LocalElectronPlugin.js",
"typings": "dist/LocalElectronPlugin.d.ts",
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/plugin-base": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"xvfb-maybe": "^0.2.1"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"xvfb-maybe": "^0.2.1"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/core-utils": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/publisher/base-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"vitest": "catalog:"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/publisher/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"vitest": "catalog:"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/publisher/bitbucket/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"exports": "./dist/PublisherBitbucket.js",
"typings": "dist/PublisherBitbucket.d.ts",
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/publisher-base": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/publisher/electron-release-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"vitest": "catalog:"
},
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/publisher-base": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/publisher/gcs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"exports": "./dist/PublisherGCS.js",
"typings": "dist/PublisherGCS.d.ts",
"engines": {
"node": ">= 22.12.0"
"node": ">= 22.13.0"
},
"dependencies": {
"@electron-forge/publisher-static": "workspace:*",
Expand Down
Loading