8000 feat: move create-electron-app into forge (#2988) · electron/forge@a2eadbc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit a2eadbc

Browse files
feat: move create-electron-app into forge (#2988)
* feat: move create-electron-app into forge * build: do stuff * build: how dare we ignore this file * chore: add README * fix: name bin for cre correctly * fix: disable eslint for CEA * build: bust ci cache * fix: set version to 74 * debug: remove windows-latest run * debug: bump windows bolt 0.21.2 -> 0.24.10 * debug: pre-install cli * debug: bolt to 0.22.4 * build: make stub electron-forge.js file in dist for windows build to work * Revert "debug: bolt to 0.22.4" This reverts commit 8d63243. * Revert "debug: pre-install cli" This reverts commit dcb2a66. * Revert "debug: bump windows bolt 0.21.2 -> 0.24.10" This reverts commit 2458c60. * Revert "debug: remove windows-latest run" This reverts commit 37847a2. * Revert "build: bust ci cache" This reverts commit 4b35ffe. * build: move stub folder to preinstall hook * Reland: bump windows bolt 0.21.2 -> 0.24.10 * build: add shim script for windows, remove unneeded deps * build: improve tools/maybe-shim-windows.js Co-authored-by: Samuel Attard <sam@electronjs.org> Co-authored-by: Samuel Attard <sattard@salesforce.com> Co-authored-by: Samuel Attard <sam@electronjs.org>
1 parent 524e3cd commit a2eadbc

File tree

7 files changed

+78
-3
lines changed

7 files changed

+78
-3
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
}
6666
},
6767
{
68-
"files": ["packages/api/cli/src/**/*.ts", "tools/*.{js,ts}"],
68+
"files": ["packages/api/cli/src/**/*.ts", "packages/external/create-electron-app/src/**/*.ts", "tools/*.{js,ts}"],
6969
"rules": {
7070
"no-process-exit": "off",
7171
"node/shebang": [

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
shell: bash
5454
run: |
5555
case "$(uname -s)" in
56-
Windows*|CYGWIN*|MINGW*|MSYS*) BOLT_VERSION=0.21.2 ;;
56+
Windows*|CYGWIN*|MINGW*|MSYS*) BOLT_VERSION=0.24.10 ;;
5757
*) BOLT_VERSION=latest ;;
5858
esac
5959
npm install -g bolt@$BOLT_VERSION
@@ -109,7 +109,7 @@ jobs:
109109
shell: bash
110110
run: |
111111
case "$(uname -s)" in
112-
Windows*|CYGWIN*|MINGW*|MSYS*) BOLT_VERSION=0.21.2 ;;
112+
Windows*|CYGWIN*|MINGW*|MSYS*) BOLT_VERSION=0.24.10 ;;
113113
*) BOLT_VERSION=latest ;;
114114
esac
115115
npm install -g bolt@$BOLT_VERSION

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"bolt": {
1010
"workspaces": [
1111
"packages/api/*",
12+
"packages/external/*",
1213
"packages/maker/*",
1314
"packages/publisher/*",
1415
"packages/utils/*",
@@ -31,6 +32,7 @@
3132
"lint:fix": "prettier --write .",
3233
"test": "xvfb-maybe cross-env TS_NODE_PROJECT='./tsconfig.test.json' TS_NODE_FILES=1 mocha './tools/test-globber.ts'",
3334
"test:fast": "xvfb-maybe cross-env TS_NODE_PROJECT='./tsconfig.test.json' TEST_FAST_ONLY=1 TS_NODE_FILES=1 mocha './tools/test-globber.ts'",
35+
"preinstall": "node ./tools/maybe-shim-windows.js",
3436
"postinstall": "rimraf node_modules/.bin/*.ps1 && ts-node ./tools/gen-tsconfigs.ts && ts-node ./tools/gen-ts-glue.ts",
3537
"prepare": "husky install"
3638
},
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## create-electron-app
2+
3+
Create Electron App allows you to quickly bootstrap a new Electron app, using Electron Forge.
4+
5+
### Usage
6+
7+
Initialize a new project by running the following:
8+
9+
```
10+
// yarn 1
11+
yarn create electron-app my-app
12+
13+
// npm
14+
npx create-electron-app@latest my-app
15+
```
16+
17+
You should now have a directory called my-app with an ultra-minimal Electron app boilerplate inside. If you head into that directory and start up the app, you'll be all set to start developing!
18+
19+
```
20+
// yarn 1
21+
cd my-app
22+
yarn start
23+
24+
// npm
25+
cd my-app
26+
npm start
27+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "create-electron-app",
3+
"version": "6.0.0-beta.74",
4+
"description": "Create Electron App",
5+
"main": "dist/index.js",
6+
"typings": "dist/index.d.ts",
7+
"author": "Samuel Attard",
8+
"license": "MIT",
9+
"dependencies": {
10+
"@electron-forge/cli": "6.0.0-beta.74"
11+
},
12+
"bin": {
13+
"create-electron-app": "dist/index.js"
14+
}
15+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env node
2+
3+
/* eslint-disable */
4+
import '@electron-forge/cli/dist/electron-forge-init';

tools/maybe-shim-windows.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
/*
5+
* Adds a shim to fix Windows symlinking with create-electron-app.
6+
* Should run on Windows only.
7+
* More details: https://github.com/boltpkg/bolt/issues/207
8+
*/
9+
function createShim(shimPath) {
10+
fs.mkdirSync(path.dirname(shimPath), { recursive: true });
11+
fs.writeFileSync(shimPath, '');
12+
}
13+
14+
async function main() {
15+
const srcRoot = path.resolve(__dirname, '..');
16+
const cli = path.resolve(srcRoot, 'packages', 'api', 'cli', 'dist', 'electron-forge.js');
17+
const cea = path.resolve(srcRoot, 'packages', 'external', 'create-electron-app', 'dist', 'index.js');
18+
createShim(cli);
19+
createShim(cea);
20+
}
21+
22+
if (process.platform === 'win32') {
23+
main().catch((err) => {
24+
console.error(err);
25+
process.exit(1);
26+
});
27+
}

0 commit comments

Comments
 (0)
0