Coder Social home page Coder Social logo

lbassin / electron-angular-webpack Goto Github PK

View Code? Open in Web Editor NEW
61.0 13.0 14.0 3.19 MB

A simple kit for Electron, Angular 6 and Webpack 4 including a live reload system for Angular.

License: MIT License

TypeScript 25.47% HTML 2.51% JavaScript 68.99% CSS 3.03%
electron webpack angular boilerplate live-reload skeleton kit

electron-angular-webpack's Introduction

THIS PROJECT IS OUT OF DATE AND NOT MAINTAINED


A simple kit for Electron, Angular 8 and Webpack 4 including a live reload system for Angular

The boilerplate include loaders for TypeScript and Sass

Commands are available to package your app or create installer on Windows, Mac and Linux

Feel free to take a look at the boilerplate skeleton here

Quick start

Prerequisites

Be sure to have Node >= 8.0 and NPM >= 5 installed on your computer/server

You can download NodeJS by following this link, take the LTS version. The installer will install Node and Npm.

# check node version
node -v

# check npm version
npm -v

If you are confronted to the following error while executing our commands on Mac OS :

ERROR in {project_name}/image.jpg
     Module build failed: Error: dyld: Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib
       Referenced from: /Users/{project_name}/node_modules/mozjpeg/vendor/cjpeg
       Reason: image not found  

Please run this command : brew install libpng. See issue here.

Create a new project and install npm packages

# clone via ssh
git clone [email protected]:lbassin/electron-angular-webpack.git
# or clone via https
git clone https://github.com/lbassin/electron-angular-webpack.git

# change directory to the app
cd electron-angular-webpack

# install dependencies with npm
npm install

Commands

Command Description
npm run dev Execute the app with a live reload system and source mapping
npm run prod Build the app with css/js optimizations and minifications
npm run packager:win Package the app with prod configuration and generate .exe & supporting files
↳ Default configuration : Platform Win32, Arch x64
npm run packager:mac Package the app with prod configuration and generate .app & supporting files
↳ Default configuration : Platform Darwin, Arch x64
npm run packager:linux Package the app with prod configuration and generate executable & supporting files
↳ Default configuration : Platform Linux, Arch x64
npm run installer:win Create Squirrel installer to distribute your app easily
↳ Setup.exe will install app in app_data directory
↳ A desktop shortcut will be created
↳ Default configuration : Platform Win32, Arch x64 ~ Tested on Windows 10
npm run installer:mac Create DMG installer to distribute your app easily
↳ Require XCode and XCode Command Line Tools
↳ XCode licence must be accepted : sudo xcodebuild -license accept
↳ Default configuration : Platform Darwin, Arch x64 ~ Tested on High Sierra 10.13
npm run installer:linux Create DEB installer to distribute your app easily
↳ Default configuration : Platform Linux, Arch x64 ~ Tested on Ubuntu 16.04
  • To change the default configuration of packagers and/or installers :
    • Go to ./builder/packager.js and/or ./builder/installer.js
    • Edit spec['platform'] and/or spec['arch'] calls in the switch
    • You can add your own platform and arch in the object spec but refer to this doc

Skeleton

electron-angular-webpack/
 ├──builder/                       # packagers and installers config folder
 │   ├──icons/                     # multi os app icons
 │   │   ├──linux/                 # app icon folder for linux
 │   │   │   └──icon.png           ~ must be a png
 │   │   ├──mac/                   # app icon folder for mac
 │   │   │   └──icon.icns          ~ must be a icns
 │   │   └──windows/               # app icon folder for windows
 │   │       └──icon.ico           ~ must be a ico
 │   │
 │   ├──installer.js               ~ config file for installers
 │   │
 │   └──packager.js                ~ config file for packagers
 │
 ├──src/                           # angular app folder
 │
 ├──.gitignore                     ~ untracked files to ignore
 ├──LICENSE.md                     ~ license of this project
 ├──README.md                      ~ contains information about this project
 ├──electron.ts                    ~ entry file for Electron
 ├──package-lock.json              ~ describes the exact tree that was generated by node/npm (vers. > 8)
 ├──package.json                   ~ manifest about applications, modules, packages, and more
 ├──postcss.config.js              ~ postcss loader configuration file
 ├──tsconfig.json                  ~ specifies root files and compiler options required to compile
 └──webpack.config.js              ~ webpack main configuration file

In addition to this structure, our commands will create these elements :

 .
 ├──dist/                          # compiled code/library
 │
 ├──node_modules/                  # non-global libraries are installed here
 │
 ├──mac_packager/                  # packager folder for mac (removed after npm run installer:mac)
 ├──mac_installer/                 # installer folder for mac
 │
 ├──linux_packager/                # packager folder for linux (removed after npm run installer:linux)
 ├──linux_installer/               # installer folder for linux
 │
 ├──win_packager/                  # packager folder for windows (removed after npm run installer:win)
 └──win_installer/                 # installer folder for windows

Creators

Laurent BASSIN Maxime MARQUET
Laurent BASSIN Maxime MARQUET
Github Linkedin Github Linkedin

Contributors

Nhữ Bảo Vũ
Nhữ Bảo Vũ

License

MIT © Laurent BASSIN & Maxime MARQUET

electron-angular-webpack's People

Contributors

lbassin avatar nphias avatar vunb avatar w-raken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

electron-angular-webpack's Issues

npm run prod: electron.js 'exports' undefined

Hi @lbassin

npm run dev (all ok!)

..omissis...

Entrypoint undefined = index.html
[0] ./node_modules/html-webpack-plugin/lib/loader.js!./src/index.hbs 833 bytes {0} [built]
[1] ./node_modules/underscore-template-loader/file-loader.js?url=global.scss!./src/global.scss 67 bytes {0} [built]

「wdm」: Compiled successfully.

ALL OK!

but ...

npm run prod

[7] ./src/main.ts 302 bytes {1} [built]
[213] ./src/app/app.module.ts 7.46 KiB {1} [built]
[223] ./src/app/app.component.ts 1.77 KiB {1} [built]
[224] ./src/app/providers/electron.service.ts 1.93 KiB {1} [built]
[227] ./src/app/app.icons.module.ts 1.25 KiB {1} [built]
[232] ./src/app/services/app.service.ts 15.6 KiB {1} [built]
[235] ./src/app/batch/batch.component.ts 11.4 KiB {1} [built]
[236] ./src/app/services/report.service.ts 24.4 KiB {1} [built]
[365] ./src/app/services/data.service.ts 20.2 KiB {1} [built]
[469] ./src/app/formly/typeahead-type.component.ts 3.09 KiB {1} [built]
+ 538 hidden modules
Child html-webpack-plugin for "index.html":
Asset Size Chunks Chunk Names
global.0c971e08a5.css 148 KiB [emitted]
+ 1 hidden asset
[0] ./node_modules/html-webpack-plugin/lib/loader.js!./src/index.hbs 833 bytes {0} [built]
[1] ./node_modules/underscore-template-loader/file-loader.js?url=global.scss!./src/global.scss 67 bytes {0} [built]

webpack-error

Dialog Box Error:

D:\PROGETTI\electron-angular-webpack\electron.js
Row: 2
'exports' undefined
Code : 800A1391

Thanks!

Error not working

I only : clone, instal & run dev :/

Executing task: npm run dev <

[email protected] dev C:\electron\electron-angular-webpack
tsc electron.ts --outDir . && cross-env NODE_ENV=dev webpack-dev-server --port=4200

i 「wds」: Project is running at http://localhost:4200/
i 「wds」: webpack output is served from /
i 「wds」: 404s will fallback to /index.html
i 「wdm」: wait until bundle finished: /
× 「wdm」: Hash: fd6da217c01f71056371
Version: webpack 4.16.5
Time: 13119ms
Built at: 2018-08-20 13:18:15
Asset Size Chunks Chunk Names
index.html 2.33 KiB [emitted]
logo.14a6bdb2e1.png 81.3 KiB [emitted]
app.component.96c13c7ca7.html 99 bytes [emitted]
electron.js 697 KiB 0 [emitted] electron
corejs.js 1.27 MiB 1 [emitted] corejs
zonejs.js 1010 KiB 2 [emitted] zonejs
app.js 7.22 MiB 3 [emitted] app
package.json 2.71 KiB [emitted]
Entrypoint electron = electron.js
Entrypoint corejs = corejs.js
Entrypoint zonejs = zonejs.js
Entrypoint app = app.js
[1] multi (webpack)-dev-server/client?http://localhost:4200 ./electron 40 bytes {0} [built]
[2] (webpack)-dev-server/client?http://localhost:4200 7.78 KiB {0} {1} {2} {3} [built]
[4] ./node_modules/strip-ansi/index.js 161 bytes {0} {1} {2} {3} [built]
[6] ./node_modules/loglevel/lib/loglevel.js 7.68 KiB {0} {1} {2} {3} [built]
[17] (webpack)/hot/emitter.js 75 bytes {0} {1} {2} {3} [built]
[19] ./electron.ts 4.35 KiB {0} [built]
[21] external "path" 42 bytes {0} [built]
[23] multi (webpack)-dev-server/client?http://localhost:4200 core-js/client/shim 40 bytes {1} [built]
[24] ./node_modules/core-js/client/shim.js 233 KiB {1} [built]
[25] multi (webpack)-dev-server/client?http://localhost:4200 zone.js/dist/zone 40 bytes {2} [built]
[26] ./node_modules/zone.js/dist/zone.js 127 KiB {2} [built]
[27] multi (webpack)-dev-server/client?http://localhost:4200 ./src/main.ts 40 bytes {3} [built]
[28] ./src/main.ts 302 bytes {3} [built]
[29] ./node_modules/@angular/platform-browser-dynamic/fesm5/platform-browser-dynamic.js 20.2 KiB {3} [built]
[234] ./src/app/app.module.ts 1.25 KiB {3} [built]
+ 223 hidden modules

ERROR in ./src/app/app.component.scss
Module build failed (from ./node_modules/postcss-loader/src/index.js):
Error: Cannot find module 'autoprefixer'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (C:\electron\electron-angular-webpack\postcss.config.js:3:9)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at requireFromString (C:\electron\electron-angular-webpack\node_modules\require-from-string\index.js:28:4)
at parseJsFile (C:\electron\electron-angular-webpack\node_modules\cosmiconfig\dist\loadJs.js:15:15)
@ ./src/app/app.component.ts 17:24-55
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi (webpack)-dev-server/client?http://localhost:4200 ./src/main.ts

ERROR in Error: Child compilation failed:
Module build failed (from ./node_modules/postcss-loader/src/index.js):
Error: Cannot find module 'autoprefixer'

  • loader.js:581 Function.Module._resolveFilename
    internal/modules/cjs/loader.js:581:15

  • loader.js:507 Function.Module._load
    internal/modules/cjs/loader.js:507:25

  • loader.js:637 Module.require
    internal/modules/cjs/loader.js:637:17

  • helpers.js:20 require
    internal/modules/cjs/helpers.js:20:18

  • postcss.config.js:3 Object.
    C:/electron/electron-angular-webpack/postcss.config.js:3:9

  • loader.js:689 Module._compile
    internal/modules/cjs/loader.js:689:30

  • index.js:28 requireFromString
    [electron-angular-webpack]/[require-from-string]/index.js:28:4

  • Error: Cannot find module 'autoprefixer'

  • compiler.js:79 childCompiler.runAsChild
    [electron-angular-webpack]/[html-webpack-plugin]/lib/compiler.js:79:16

  • Compiler.js:296 compile
    [electron-angular-webpack]/[webpack]/lib/Compiler.js:296:11

  • Compiler.js:553 hooks.afterCompile.callAsync.err
    [electron-angular-webpack]/[webpack]/lib/Compiler.js:553:14

  • Hook.js:35 AsyncSeriesHook.lazyCompileHook [as _callAsync]
    [electron-angular-webpack]/[tapable]/lib/Hook.js:35:21

  • Compiler.js:550 compilation.seal.err
    [electron-angular-webpack]/[webpack]/lib/Compiler.js:550:30

  • Hook.js:35 AsyncSeriesHook.lazyCompileHook [as _callAsync]
    [electron-angular-webpack]/[tapable]/lib/Hook.js:35:21

  • Compilation.js:1294 hooks.optimizeAssets.callAsync.err
    [electron-angular-webpack]/[webpack]/lib/Compilation.js:1294:35

  • Hook.js:35 AsyncSeriesHook.lazyCompileHook [as _callAsync]
    [electron-angular-webpack]/[tapable]/lib/Hook.js:35:21

  • Compilation.js:1285 hooks.optimizeChunkAssets.callAsync.err
    [electron-angular-webpack]/[webpack]/lib/Compilation.js:1285:32

  • Hook.js:35 AsyncSeriesHook.lazyCompileHook [as _callAsync]
    [electron-angular-webpack]/[tapable]/lib/Hook.js:35:21

  • Compilation.js:1280 hooks.additionalAssets.callAsync.err
    [electron-angular-webpack]/[webpack]/lib/Compilation.js:1280:36

Child html-webpack-plugin for "index.html":
1 asset
Entrypoint undefined = index.html
[0] ./node_modules/html-webpack-plugin/lib/loader.js!./src/index.hbs 678 bytes {0} [built]
[1] ./node_modules/underscore-template-loader/file-loader.js?url=global.scss!./src/global.scss 785 bytes {0} [built] [failed] [1 error]

ERROR in ./src/global.scss (./node_modules/underscore-template-loader/file-loader.js?url=global.scss!./src/global.scss)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
Error: Cannot find module 'autoprefixer'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (C:\electron\electron-angular-webpack\postcss.config.js:3:9)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at requireFromString (C:\electron\electron-angular-webpack\node_modules\require-from-string\index.js:28:4)
    at parseJsFile (C:\electron\electron-angular-webpack\node_modules\cosmiconfig\dist\loadJs.js:15:15)
 @ ./src/index.hbs (./node_modules/html-webpack-plugin/lib/loader.js!./src/index.hbs) 7:93-230

i 「wdm」: Failed to compile

Failed to run after package updates

'cross-env' is not recognized as an internal or external command, operable program or batch file
Error: Cannot find module 'webpack'
Error: Cannot find module 'webpack-cli/bin/config-yargs'
Error: Cannot find module 'neo-async'

2018-05-14T04_21_32_767Z-debug.log
2018-05-14T04_23_18_003Z-debug.log
2018-05-14T04_03_13_894Z-debug.log
2018-05-14T04_10_42_183Z-debug.log
2018-05-14T04_08_18_245Z-debug.log
2018-05-14T04_01_44_831Z-debug.log
2018-05-14T04_24_09_445Z-debug.log

Cannot generate new components

When I try to generate a new component in the project, I get this error:

Local workspace file ('angular.json') could not be found.

Where do I get the angular.json file?

Exclude src folder after created package installer

Hi @lbassin

I want to create installer with only packed and minified code in dist folder. But when install application, it contains and extracts the source code src of project.

I dont want distribute the original code to customer. How can i exclude the src folder?
Here below is my application after installation.

electron

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.