Giter Site home page Giter Site logo

cubiknerubik / angular-electron-typeorm-starter Goto Github PK

View Code? Open in Web Editor NEW
67.0 9.0 31.0 5.59 MB

This is a start kit for easy launch of Electron, Angular 8 + Material and TypeORM + SQLite.

License: MIT License

JavaScript 13.04% TypeScript 64.84% HTML 14.43% SCSS 7.69%

angular-electron-typeorm-starter's Introduction

Electron Logo

Build Status License

Watch on GitHub Star on GitHub

Quickstart

git clone https://github.com/CubikNeRubik/angular-electron-typeorm-starter.git
npm install
npm start

Introduction

This is a start kit for easy launch of Electron, Angular 6 and TypeORM.

Currently runs with:

  • Angular v8.0.3
  • Electron v5.0.4
  • Electron Builder v20.44.1
  • Angular Material v8.0.1
  • TypeORM v0.2.18
  • SQLite v4.0.9

With this start kit, you can :

  • Run your app in a local development environment with Electron & Hot reload
  • Run your app in a production environment
  • Package your app into an executable file for Linux, Windows & Mac

Getting Started

Clone this repository locally :

git clone https://github.com/CubikNeRubik/angular-electron-typeorm-starter.git

Install dependencies with npm :

npm install

If you want to generate Angular components with Angular-cli , you MUST install @angular/cli in npm global context.
Please follow Angular-cli documentation if you had installed a previous version of angular-cli.

npm install -g @angular/cli

To build for development

  • in a terminal window -> npm start

The application code is managed by main.ts. In this sample, the app runs with a simple Angular App (http://localhost:4200) and an Electron window whitch can edit data in database. The Angular component contains an example of Electron, TypeORM and NodeJS native lib import. If you need to add additional dependencies you shoud put it to extra-webpack.config.js. You can desactivate "Developer Tools" by commenting win.webContents.openDevTools(); in main.ts.

Included Commands

Command Description
npm run build Build the app. Your built files are in the /dist folder.
npm run build:prod Build the app with Angular aot. Your built files are in the /dist folder.
npm run electron:local Builds your application and start electron
npm run electron:linux Builds your application and creates an app consumable on linux system
npm run electron:windows On a Windows OS, builds your application and creates an app consumable in windows 32/64 bit systems
npm run electron:mac On a MAC OS, builds your application and generates a .app file of your application that can be run on Mac

Your application is optimised. Only /dist folder and node dependencies are included in the executable.

Known issues

  1. Browser mode. You can't use TypeORM in browser so it is not possible.If you need to run app in browser and don't need TypeORM you can use angular-electron for that.
  2. Windows Build. You cannot make build for windows if path to project folder contains spaces or not latin letters.

angular-electron-typeorm-starter's People

Contributors

dependabot[bot] avatar metair 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  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-electron-typeorm-starter's Issues

upgrade to angular 8.0.3

can u please provide a way to upgrade this starter pack to angular 7 or even a clue for doing that?

Error after ugrade

Hi,
Your example is great, so I use it to startt my own application.
but I encounter an issue after I upgrade the angular module from 8.0.3 to 8.2.35. I've got an error when start the app. So i reload your example from your repository and try to update your' app.
got the same error.
Below the error I've got at 'npm run start' command.
Have you an idea to solve this issue ?

[error] ReferenceError: path is not defined at Object.getBrowserConfig (/Volumes/Data/ProjetNodes/TestUpdate/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/browser.js:62:22) at webpack_browser_config_1.generateBrowserWebpackConfigFromContext.wco (/Volumes/Data/ProjetNodes/TestUpdate/node_modules/@angular-devkit/build-angular/src/browser/index.js:55:27) at scriptTargets.map.scriptTarget (/Volumes/Data/ProjetNodes/TestUpdate/node_modules/@angular-devkit/build-angular/src/utils/webpack-browser-config.js:69:26) at Array.map (<anonymous>) at generateWebpackConfig (/Volumes/Data/ProjetNodes/TestUpdate/node_modules/@angular-devkit/build-angular/src/utils/webpack-browser-config.js:33:26) at process._tickCallback (internal/process/next_tick.js:68:7) at Function.Module.runMain (internal/modules/cjs/loader.js:832:11) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Typescript

Hello,

I don't get any typescript warnings and it's hard to see changes. Am I doing something wrond is is this the nature of this starter bundle?

(New to electron and typeorm)

npm install fails

There might be something wrong with my environment, guide me, it fails on this point (logs)

1078 verbose stack Error: [email protected] install: node-pre-gyp install --fallback-to-build
1078 verbose stack Exit status 1
1078 verbose stack at EventEmitter. (C:\Users\abidzaidi\AppData\Roaming\nvm\v13.9.0\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
1078 verbose stack at EventEmitter.emit (events.js:321:20)
1078 verbose stack at ChildProcess. (C:\Users\abidzaidi\AppData\Roaming\nvm\v13.9.0\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
1078 verbose stack at ChildProcess.emit (events.js:321:20)
1078 verbose stack at maybeClose (internal/child_process.js:1026:16)
1078 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
1079 verbose pkgid [email protected]
1080 verbose cwd D:\source\angular\angular-electron-typeorm-starter
1081 verbose Windows_NT 10.0.18362
1082 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "i"
1083 verbose node v13.9.0
1084 verbose npm v6.13.7
1085 error code ELIFECYCLE
1086 error errno 1
1087 error [email protected] install: node-pre-gyp install --fallback-to-build
1087 error Exit status 1
1088 error Failed at the [email protected] install script.
1088 error This is probably not a problem with npm. There is likely additional logging output above.
1089 verbose exit [ 1, true ]

TypeOrm databaseService in RenderThread How?

Thanx Thanx Thanx For creating this Repo.

Hello!!!
my background is .net and I m new to web world.

1- from my understanding electron has two threads
main , render and typeOrm should be running on main thread(to use file system for sqlite or mysql). but here I m seeing its happening in (render thread) AppComponent. how its working ?

2- where databaseService is being injected in first place ?

`export class AppComponent {
users: User[] = [];
displayedColumns: string[] = ['Id', 'FirstName', 'LastName', 'Age'];

firstName = '';
lastName = '';
age = '';
constructor(private databaseService: DatabaseService) {
this.getUsers();
}`

bcs in AppModule provider is emptyArray

image

Please Help and Thanx for this great repo. I could not tell How Much I am thankfull for it.

SQLITE_ERROR: near "}" (solved)

Just wanted to make a note in case anyone else encounters same issue but when I build executable TypeOrm seems to not use any table names and after turning logging on I saw I was getting the following:-

query: SELECT * FROM "sqlite_master" WHERE "type" = 'table' AND "name" IN ('e')

or in my case

query: SELECT * FROM "sqlite_master" WHERE "type" = 'table' AND "name" IN ('t', 't', 't', 't', 't')

The error was SQLITE_ERROR: near "}"

I managed to fix by manually putting table names in i.e.

@Entity({ name: "user"})
export class User extends BaseEntity {
  ...
}

updating packages to the lastest

Hi, I am working on the project using angular and electron. I wanna bring in typeorm for sqlite and ms sql. Does angular-electron-typeorm-starter support current angular 9, electron 8.1.1 and typeorm 0.2.24?

Error after run "npm install" command

download new version from "branches -> angular-version-update" and run "npm install" command in root
after install dependencies, hapend this error:
err

Possible issue: unnecessary reference to Gnome extension?!?

I'm not sure if this is an actual issue with this repo or specific to my machine but I haven't seen this error with any other repos on this machine.

  • npm run electron:local succeeds but there is a warning that a theme file is missing.
(electron:15902): Gtk-WARNING **: 22:11:35.889: Theme parsing error: gtk.css:1:110: Failed to import: Error opening file /home/tonydiep/.local/share/gnome-shell/extensions/[email protected]/styles/buttons-right.css: No such file or directory
[15902:0714/221138.082757:ERROR:CONSOLE(972)] "TypeError: Cannot read property 'pseudoType' of undefined TypeError: Cannot read property 'pseudoType' of undefined
    at SDK.DOMNode._removeChild (chrome-devtools://devtools/bundled/shell.js:4301:28)
    at SDK.DOMModel._childNodeRemoved (chrome-devtools://devtools/bundled/shell.js:4420:121)
    at SDK.DOMDispatcher.childNodeRemoved (chrome-devtools://devtools/bundled/shell.js:4464:54)
    at Protocol.InspectorBackend._DispatcherPrototype.dispatch (chrome-devtools://devtools/bundled/shell.js:3399:26)
    at Protocol.SessionRouter._onMessage (chrome-devtools://devtools/bundled/shell.js:3355:41)
    at SDK.MainConnection._dispatchMessage (chrome-devtools://devtools/bundled/shell.js:3486:17)
    at Common.Object.dispatchEventToListeners (chrome-devtools://devtools/bundled/shell.js:494:23)
    at innerDispatch (chrome-devtools://devtools/bundled/shell.js:972:98)
    at Host.InspectorFrontendAPIImpl._dispatch (chrome-devtools://devtools/bundled/shell.js:972:1)
    at DevToolsAPIImpl._dispatchOnInspectorFrontendAPI (chrome-devtools://devtools/bundled/devtools_compatibility.js:57:36)", source: chrome-devtools://devtools/bundled/shell.js (972)
  • I'm not using this particular theme / Gnome extension so something in the repo may be referencing this file?
  • I do not get this warning with any other repo
  • workaround is to install https://github.com/hardpixel/unite-shell

Electron Linux build fails because icons don't exist?

npm run electron:linux fails with

⨯ icon directory /home/tonydiep/Projects/angular-electron-typeorm-starter/dist doesn't contain icons

May be related to issue with electron-builder
electron-userland/electron-builder#2570

  ⨯ icon directory /home/tonydiep/Projects/angular-electron-typeorm-starter/dist doesn't contain icons
github.com/develar/app-builder/pkg/icons.CollectIcons
	/Volumes/data/Documents/app-builder/pkg/icons/collect-icons.go:72
github.com/develar/app-builder/pkg/icons.doConvertIcon
	/Volumes/data/Documents/app-builder/pkg/icons/icon-converter.go:194
github.com/develar/app-builder/pkg/icons.ConvertIcon
	/Volumes/data/Documents/app-builder/pkg/icons/icon-converter.go:56
github.com/develar/app-builder/pkg/icons.ConfigureCommand.func1
	/Volumes/data/Documents/app-builder/pkg/icons/icon-converter.go:33
github.com/alecthomas/kingpin.(*actionMixin).applyActions
	/Volumes/data/go/pkg/mod/github.com/alecthomas/[email protected]+incompatible/actions.go:28
github.com/alecthomas/kingpin.(*Application).applyActions
	/Volumes/data/go/pkg/mod/github.com/alecthomas/[email protected]+incompatible/app.go:557
github.com/alecthomas/kingpin.(*Application).execute
	/Volumes/data/go/pkg/mod/github.com/alecthomas/[email protected]+incompatible/app.go:390
github.com/alecthomas/kingpin.(*Application).Parse
	/Volumes/data/go/pkg/mod/github.com/alecthomas/[email protected]+incompatible/app.go:222
main.main
	/Volumes/data/Documents/app-builder/main.go:78
runtime.main
	/usr/local/Cellar/go/1.12.6/libexec/src/runtime/proc.go:200
runtime.goexit
	/usr/local/Cellar/go/1.12.6/libexec/src/runtime/asm_amd64.s:1337
github.com/develar/app-builder/pkg/icons.doConvertIcon
	/Volumes/data/Documents/app-builder/pkg/icons/icon-converter.go:196
github.com/develar/app-builder/pkg/icons.ConvertIcon
	/Volumes/data/Documents/app-builder/pkg/icons/icon-converter.go:56
github.com/develar/app-builder/pkg/icons.ConfigureCommand.func1
	/Volumes/data/Documents/app-builder/pkg/icons/icon-converter.go:33
github.com/alecthomas/kingpin.(*actionMixin).applyActions
	/Volumes/data/go/pkg/mod/github.com/alecthomas/[email protected]+incompatible/actions.go:28
github.com/alecthomas/kingpin.(*Application).applyActions
	/Volumes/data/go/pkg/mod/github.com/alecthomas/[email protected]+incompatible/app.go:557
github.com/alecthomas/kingpin.(*Application).execute
	/Volumes/data/go/pkg/mod/github.com/alecthomas/[email protected]+incompatible/app.go:390
github.com/alecthomas/kingpin.(*Application).Parse
	/Volumes/data/go/pkg/mod/github.com/alecthomas/[email protected]+incompatible/app.go:222
main.main
	/Volumes/data/Documents/app-builder/main.go:78
runtime.main
	/usr/local/Cellar/go/1.12.6/libexec/src/runtime/proc.go:200
runtime.goexit
	/usr/local/Cellar/go/1.12.6/libexec/src/runtime/asm_amd64.s:1337

Error: /home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-bin/linux/x64/app-builder exited with code 1
    at ChildProcess.childProcess.once.code (/home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/builder-util/src/util.ts:244:14)
    at Object.onceWrapper (events.js:286:20)
    at ChildProcess.emit (events.js:198:13)
    at maybeClose (internal/child_process.js:982:16)
    at Socket.stream.socket.on (internal/child_process.js:389:11)
    at Socket.emit (events.js:198:13)
    at Pipe._handle.close (net.js:606:12)
From previous event:
    at LinuxPackager.resolveIcon (/home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/platformPackager.ts:594:101)
    at /home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/targets/LinuxTargetHelper.ts:35:35
    at Generator.next (<anonymous>)
From previous event:
    at LinuxTargetHelper.computeDesktopIcons (/home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/targets/LinuxTargetHelper.ts:23:36)
    at Lazy.LinuxTargetHelper.iconPromise (/home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/targets/LinuxTargetHelper.ts:11:54)
    at Lazy.get value [as value] (/home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/lazy-val/src/main.ts:18:25)
    at LinuxTargetHelper.get icons [as icons] (/home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/targets/LinuxTargetHelper.ts:19:29)
    at /home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/targets/AppImageTarget.ts:43:19
From previous event:
    at AppImageTarget.build (/home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/targets/AppImageTarget.ts:27:44)
    at Function.buildAsyncTargets (/home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/platformPackager.ts:140:36)
    at LinuxPackager.packageInDistributableFormat (/home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/platformPackager.ts:119:24)
    at /home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/platformPackager.ts:114:10
    at Generator.next (<anonymous>)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
From previous event:
    at LinuxPackager.pack (/home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/platformPackager.ts:111:95)
    at /home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/packager.ts:430:24
    at Generator.next (<anonymous>)
    at xfs.stat (/home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/fs-extra-p/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16)
    at /home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/graceful-fs/polyfills.js:287:18
    at FSReqWrap.oncomplete (fs.js:154:5)
From previous event:
    at Packager.doBuild (/home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/packager.ts:396:24)
    at /home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/packager.ts:366:57
    at Generator.next (<anonymous>)
    at /home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/graceful-fs/graceful-fs.js:99:16
    at /home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.args [as oncomplete] (fs.js:140:20)
From previous event:
    at Packager._build (/home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/packager.ts:335:133)
    at /home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/packager.ts:331:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
From previous event:
    at Packager.build (/home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/packager.ts:288:14)
    at build (/home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/app-builder-lib/src/index.ts:59:28)
    at build (/home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/electron-builder/src/builder.ts:228:10)
    at then (/home/tonydiep/Projects/angular-electron-typeorm-starter/node_modules/electron-builder/src/cli/cli.ts:49:19)

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.