diff --git a/.eslintrc.json b/.eslintrc.json index 39a02aebee..4947d302a0 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -65,7 +65,7 @@ } }, { - "files": ["packages/api/cli/src/**/*.ts", "tools/*.{js,ts}"], + "files": ["packages/api/cli/src/**/*.ts", "packages/external/create-electron-app/src/**/*.ts", "tools/*.{js,ts}"], "rules": { "no-process-exit": "off", "node/shebang": [ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 62300f507a..66a45e0af3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: shell: bash run: | case "$(uname -s)" in - Windows*|CYGWIN*|MINGW*|MSYS*) BOLT_VERSION=0.21.2 ;; + Windows*|CYGWIN*|MINGW*|MSYS*) BOLT_VERSION=0.24.10 ;; *) BOLT_VERSION=latest ;; esac npm install -g bolt@$BOLT_VERSION @@ -109,7 +109,7 @@ jobs: shell: bash run: | case "$(uname -s)" in - Windows*|CYGWIN*|MINGW*|MSYS*) BOLT_VERSION=0.21.2 ;; + Windows*|CYGWIN*|MINGW*|MSYS*) BOLT_VERSION=0.24.10 ;; *) BOLT_VERSION=latest ;; esac npm install -g bolt@$BOLT_VERSION diff --git a/package.json b/package.json index 0c78b97d25..3fb184a7c5 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "bolt": { "workspaces": [ "packages/api/*", + "packages/external/*", "packages/maker/*", "packages/publisher/*", "packages/utils/*", @@ -31,6 +32,7 @@ "lint:fix": "prettier --write .", "test": "xvfb-maybe cross-env TS_NODE_PROJECT='./tsconfig.test.json' TS_NODE_FILES=1 mocha './tools/test-globber.ts'", "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'", + "preinstall": "node ./tools/maybe-shim-windows.js", "postinstall": "rimraf node_modules/.bin/*.ps1 && ts-node ./tools/gen-tsconfigs.ts && ts-node ./tools/gen-ts-glue.ts", "prepare": "husky install" }, diff --git a/packages/external/create-electron-app/README.md b/packages/external/create-electron-app/README.md new file mode 100644 index 0000000000..b20c86eacc --- /dev/null +++ b/packages/external/create-electron-app/README.md @@ -0,0 +1,27 @@ +## create-electron-app + +Create Electron App allows you to quickly bootstrap a new Electron app, using Electron Forge. + +### Usage + +Initialize a new project by running the following: + +``` +// yarn 1 +yarn create electron-app my-app + +// npm +npx create-electron-app@latest my-app +``` + +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! + +``` +// yarn 1 +cd my-app +yarn start + +// npm +cd my-app +npm start +``` diff --git a/packages/external/create-electron-app/package.json b/packages/external/create-electron-app/package.json new file mode 100644 index 0000000000..32d6be3fe7 --- /dev/null +++ b/packages/external/create-electron-app/package.json @@ -0,0 +1,15 @@ +{ + "name": "create-electron-app", + "version": "6.0.0-beta.74", + "description": "Create Electron App", + "main": "dist/index.js", + "typings": "dist/index.d.ts", + "author": "Samuel Attard", + "license": "MIT", + "dependencies": { + "@electron-forge/cli": "6.0.0-beta.74" + }, + "bin": { + "create-electron-app": "dist/index.js" + } +} diff --git a/packages/external/create-electron-app/src/index.ts b/packages/external/create-electron-app/src/index.ts new file mode 100644 index 0000000000..0cb57e085f --- /dev/null +++ b/packages/external/create-electron-app/src/index.ts @@ -0,0 +1,4 @@ +#!/usr/bin/env node + +/* eslint-disable */ +import '@electron-forge/cli/dist/electron-forge-init'; diff --git a/tools/maybe-shim-windows.js b/tools/maybe-shim-windows.js new file mode 100644 index 0000000000..6804b8694d --- /dev/null +++ b/tools/maybe-shim-windows.js @@ -0,0 +1,27 @@ +const fs = require('fs'); +const path = require('path'); + +/* + * Adds a shim to fix Windows symlinking with create-electron-app. + * Should run on Windows only. + * More details: https://github.com/boltpkg/bolt/issues/207 + */ +function createShim(shimPath) { + fs.mkdirSync(path.dirname(shimPath), { recursive: true }); + fs.writeFileSync(shimPath, ''); +} + +async function main() { + const srcRoot = path.resolve(__dirname, '..'); + const cli = path.resolve(srcRoot, 'packages', 'api', 'cli', 'dist', 'electron-forge.js'); + const cea = path.resolve(srcRoot, 'packages', 'external', 'create-electron-app', 'dist', 'index.js'); + createShim(cli); + createShim(cea); +} + +if (process.platform === 'win32') { + main().catch((err) => { + console.error(err); + process.exit(1); + }); +}