0.2.1 • Published 5 months ago

create-electron-webpack v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

:flight_departure: create-electron-webpack

Yet another create-electron-app.

preview

:rocket: Getting Started

npm create electron-webpack

demo

You can also directly specify the project name, the template, and the package manager you want to use via additional command line options.

For example, to scaffold a React + TypeScript project, run:

# in the case of npm 7+, extra double-dash is needed:
npm create electron-webpack myapp -- --template react-ts --manager pnpm

or if you prefer Yarn:

yarn create electron-webpack your_app -t vue -m yarn

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

:thumbsup: Features

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

The template provided by this scaffold is NOT an all-in-one. It provides only the necessary and sufficient settings so that you can customize it as you like. In other words, it has no "eject".

:green_book: API

Templates

JavaScriptTypeScript
vanillavanilla-ts
reactreact-ts
vuevue-ts
sveltesvelte-ts
preactpreact-ts
solidsolid-ts

Command line options

optiondescription
--template, -tSelect a template (required)
--manager, -mSelect a package manager: npm(default), pnpm, yarn

:hammer_and_wrench: Usage

# on development with hot reloading
% npm run dev

# on production
% npm run build

:package: How to package your app to share?

It is recommended to use electron-builder.

npm install --save-dev electron-builder

Here's a sample script builder.ts for electron-builder:

import { build } from "electron-builder";

build({
  config: {
    appId: "com.Electron.ElectronApp",
    productName: "Electron App",
    artifactName: "${productName}-${version}-${platform}-${arch}.${ext}",
    files: ["dist/**/*"],
    directories: {
      output: "release",
    },
  },
});

And then run the script above...

npx ts-node ./builder.ts

See Common Configuration for more details.

:cyclone: How to generate your own app icon?

You can use Elephicon to generate Microsoft ICO or Apple ICNS from PNG files.

And then, specify the path to the icon file to conifig.platform.icon in your builder.(j|t)s.

require("electron-builder").build({
  config: {
    win: {
      icon: "assets/icon.ico",
    },
    mac: {
      icon: "assets/icon.icns",
    },
  },
});

: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: /\.s?css$/,
        use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
      },
    ],
  },

:camera_flash: Screen shots

Hot reload in renderer process

Hot reload in main process

:copyright: Copyright

Copyright (c) 2022 sprout2000

0.1.11

10 months ago

0.1.12

7 months ago

0.1.13

7 months ago

0.2.1

5 months ago

0.2.0

5 months ago

0.1.10

10 months ago

0.1.9

10 months ago

0.1.8

11 months ago

0.0.10

1 year ago

0.0.11

1 year ago

0.0.12

1 year ago

0.0.13

1 year ago

0.1.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.0.9

1 year ago

0.1.7

12 months ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.6

12 months ago

0.1.5

12 months ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago