Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(init): move templates from core deps to create-electron-app deps #3320

Closed
Closed
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
5 changes: 0 additions & 5 deletions packages/api/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@
"@electron-forge/plugin-base": "6.4.1",
"@electron-forge/publisher-base": "6.4.1",
"@electron-forge/shared-types": "6.4.1",
"@electron-forge/template-base": "6.4.1",
"@electron-forge/template-vite": "6.4.1",
"@electron-forge/template-vite-typescript": "6.4.1",
"@electron-forge/template-webpack": "6.4.1",
"@electron-forge/template-webpack-typescript": "6.4.1",
"@electron/get": "^2.0.0",
"@electron/rebuild": "^3.2.10",
"@malept/cross-spawn-promise": "^2.0.0",
Expand Down
7 changes: 6 additions & 1 deletion packages/external/create-electron-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
"author": "Samuel Attard",
"license": "MIT",
"dependencies": {
"@electron-forge/cli": "6.4.1"
"@electron-forge/cli": "6.4.1",
"@electron-forge/template-base": "6.4.1",
"@electron-forge/template-vite": "6.4.1",
"@electron-forge/template-vite-typescript": "6.4.1",
"@electron-forge/template-webpack": "6.4.1",
"@electron-forge/template-webpack-typescript": "6.4.1"
},
"bin": {
"create-electron-app": "dist/index.js"
Expand Down
29 changes: 29 additions & 0 deletions tools/sync-templates.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import * as path from 'path';

import * as fs from 'fs-extra';

const BASE_DIR = path.resolve(__dirname, '..');
const TEMPLATES_DIR = path.resolve(BASE_DIR, 'packages', 'template');
const CREATE_ELECTRON_APP_PKG_JSON = path.resolve(BASE_DIR, 'packages', 'external', 'create-electron-app', 'package.json');

(async () => {
const createAppPj = await fs.readJson(CREATE_ELECTRON_APP_PKG_JSON);

const templates: Array<Record<string, string>> = [];
for (const subDir of await fs.readdirSync(TEMPLATES_DIR)) {
const templateName = `@electron-forge/template-${subDir}`;
templates.push({
[templateName]: createAppPj.version,
});
}

const packageJson = {
...createAppPj,
dependencies: {
'@electron-forge/cli': createAppPj.version,
...templates.reduce((acc, curr) => ({ ...acc, ...curr }), {}),
},
};

await fs.writeJson(CREATE_ELECTRON_APP_PKG_JSON, packageJson, { spaces: 2 });
})().catch((err) => console.log(err));