2.1.3 • Published 1 year ago

electron-starter v2.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

:flight_departure: electron-starter

npm

Yet another create-electron-app.

:rocket: Getting Started

npx electron-starter

demo

:thumbsup: Features

  • Supports hot reloading in both the main and renderer processes.
  • Available in 8 flavors.
  • No complicated pre-made settings.

:inbox_tray: Installation

npm i -g electron-starter

:green_book: Usage

electron-starter <project-name> --template <template> [--manager <package manager>]

If the arguments are missing or invalid, the command will fall back to interactive mode.

Templates

JavaScriptTypeScript
reactreact-ts
vuevue-ts
sveltesvelte-ts
preactpreact-ts

Options

optiondescription
--template, -tSelect a template (required)
--manager, -mSelect a package manager: npm(default), pnpm, yarn
--version, -vShow version number
--helpShow help

:hammer_and_wrench: Development & Production

# on development with hot reloading
% npm run dev

# on production
% npm run build

:art: How to use sass (.scss) in your project

You will need to add sass and sass-loader:

npm install --save-dev sass sass-loader

And then, update your webpack.config.(j|t)s:

    module: {
      rules: [
        {
-         test: /\.css$/,
+         test: /\.s?css$/,
-         use: [MiniCssExtractPlugin.loader, "css-loader"],
+         use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
        },
      ],
    },

:electric_plug: How to load developer tools (React, Vue3)

electron-devtools-installer is recommended.

npm install --save-dev electron-devtools-installer
// Example for Vue3
import installExtension, { VUEJS3_DEVTOOLS } from "electron-devtools-installer";

app.whenReady().then(() => {
  installExtension(VUEJS3_DEVTOOLS, {
    loadExtensionOptions: { allowFileAccess: true },
  }).then(() => mainWindow.webContents.openDevTools());
});

Manual loading

Or you will need to install React Devtools or Vue.js devtools Google Chrome extension manually.

Example in the case that you prefer electron-search-devtools to load already installed devtools:

npm install --save-dev electron-search-devtools
// load `session` and `searchDevtools`
import { app, session } from "electron";
import { searchDevtools } from "electron-search-devtools";

app.whenReady().then(() => {
  // 'REACT' or 'VUE3'
  searchDevtools("VUE3").then((devtools) => {
    // 'allowFileAccess' is required
    session.defaultSession.loadExtension(devtools, { allowFileAccess: true });
  });
});

:package: How to package your app to publish

Use electron-builder or electron-packager.

npm install --save-dev electron-builder

Sample script for electron-builder builder.js:

require("electron-builder").build({
  config: {
    productName: "Electron App",
    // File macros are available --> "Electron App-1.0.0-win32.exe"
    artifactName: "${productName}-${version}-${platform}.${ext}",
    copyright: "",
    /**
     * A glob patterns relative to the app directory,
     * which specifies which files to include.
     */
    files: ["dist/**/*"],
    // Meta data directories
    directories: {
      output: "release",
      buildResources: "assets",
    },
    win: {
      // App icon
      icon: "assets/win32.ico",
    },
    mac: {
      icon: "assets/darwin.icns",
      // Avoid automatic code signing
      identity: null,
    },
  },
});

And then run the script:

node ./builder.js

Sample icons are available in the assets directory of this repository.

:copyright: Copyright

Copyright (c) 2022 sprout2000

2.1.3

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.0

1 year ago

2.0.10

1 year ago

2.0.9

1 year ago

2.0.8

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.9.0

1 year ago

1.8.5

1 year ago

1.8.4

1 year ago

1.8.3

1 year ago

1.8.2

1 year ago

1.8.1

1 year ago

1.8.0

1 year ago

1.7.5

1 year ago

1.7.4

1 year ago

1.7.3

1 year ago

1.7.2

1 year ago

1.7.1

1 year ago

1.7.0

1 year ago

1.6.1

1 year ago

1.6.0

1 year ago

1.5.1

1 year ago

1.5.0

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.5

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.3

1 year ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago