项目作者: Pushfor

项目描述 :
Docker + Yarn + Electron + Gulp + TypeScript + Squirrel + Golden-Layout + Angular 4 + React
高级语言: CSS
项目地址: git://github.com/Pushfor/typeddocker.git
创建时间: 2017-10-12T22:06:28Z
项目社区:https://github.com/Pushfor/typeddocker

开源协议:MIT License

下载


Typeddocker

Build Status

This repository is still under development and not ready for reuse.

Docker + Yarn + Electron + Gulp + TypeScript

Goal

  • Boilerplate to allow building complex TypeScript applications served as a vendor indepentant website or a desktop application

It is not…

  • an actual application
  • thing that force you to some UI framework
  • uncommon problem
  • full web stack - you should use some varnish, nginx, elb in front

Ingridients

  • Core technologies
    • Docker - to ship it vendor independent
    • TypeScript - ES6/7/8 + types + decorators + interfaces
    • Sass - most popular CSS D.R.Y. language
    • HTML - because it’s there
  • Framework / Engine
    • Express (Node 8) - just serve, no magic
    • Electron - windows, osx, linux
    • Vanilla

Usage

  1. cd docker
  2. ./restart.deamon.sh

Contribute

  • fork -> code -> test -> PR -> merge -> repeat
  • be constructive

Structure

  1. /docker
  2. /compose
  3. /app
  4. /src
  5. /apps
  6. /angular - TBD, example, deployed to public/angular
  7. /electron - TBD< electron node process
  8. /express - express server app
  9. /react - TBD, example, deployed to public/react
  10. /vanilla - example, deployed to public
  11. /vue - example, deployed to public/vue
  12. /node_modules - not checked in, shared for all projects
  13. gulpfile.js
  14. package.json
  15. tsconfig.json
  16. yarn.lock
  17. /Dockerfile
  18. /nginx - tbd
  19. .env - to be excluded from the repo
  20. .env.json - to be exluded from the repo
  21. /volumes

Use cases

  • App is composed of:
    • backend which serves files and expose microservices
    • frontend which can be one or many applicaitons using one or many frameworks
      • applications are distributed across folders
      • applicaitons share cookies/localstorage because of the same domain/process

To Do

[x] Docker
[x] Gulp
[x] Sass
[ ] Vanilla
[x] Angular 4
[x] Angular 4 AOT
[ ] React
[ ] Vue
[ ] Jasmine
[ ] Travis
[ ] Protractor
[ ] Istanbul

Web application

  1. I====================================I
  2. I Docker I
  3. I |-------------|---> serve
  4. I | Express | I
  5. I |-------------|<--> microservices
  6. I ^ I
  7. I | I
  8. I |------| 1-n |-------------| I
  9. I | Gulp |----->| HTML/JS/CSS | I
  10. I |------| |-------------| I
  11. I ^ I
  12. I | I
  13. I |--------------------------------| I
  14. I | Source: TypeScript, Scss, HTML | I
  15. I |--------------------------------| I
  16. I====================================I
  • Shipped as docker container
  • Source is tranformed on startup by gulp tasks
  • Dist files are served by express
  • Microservices are exposed by express
    • Thanks to express we can do serverside rendering

Electron application

  1. I====================================I
  2. I Electron executab I
  3. I |-------------| I
  4. I /--->| Main |<--> microservices
  5. I | |-------------| I
  6. I | I
  7. I | |-------------| I
  8. I | | Render |---> serve
  9. I |/-->| HTML/JS/CSS | I
  10. I | |-------------| I
  11. I==========|=========================I
  12. |
  13. I==========|=========================I
  14. I Docker | I
  15. I |------| I
  16. I | Gulp | I
  17. I |------| I
  18. I ^ I
  19. I | I
  20. I |--------------------------------| I
  21. I | Source: TypeScript, Scss, HTML | I
  22. I |--------------------------------| I
  23. I====================================I
  • Source is tranformed on build by gulp tasks
  • Dist files are served by electron main process
  • Microservices are exposed by main process (ipc)
  • Shipped as executable (.exe, .app) or update package (.zip, .nupkg)

Solution

  1. I====================================I
  2. I Docker |---------| I
  3. I /-| Express | I
  4. I / \ / |---------| I
  5. I web/desktop -< I
  6. I \ / \ I |----------|
  7. I ^ \---------------------| Electron |
  8. I | I |----------|
  9. I |-------------| I
  10. I | HTML/JS/CSS | I
  11. I |-------------| I
  12. I ^ I
  13. I | I
  14. I |------| I
  15. I | Gulp | I
  16. I |------| I
  17. I ^ I
  18. I | I
  19. I |--------------------------------| I
  20. I | Source: TypeScript, Scss, HTML | I
  21. I |--------------------------------| I
  22. I====================================I
  • Docker
    • cares about enironment and requirements
  • TypeScript, Scss, HTML
    • shared source files
  • Gulp
    • produce dist files from source files
    • can watch source file changes to update dist (dev mode)
    • can run karma/jasmine/protractor/cucumber
    • startup express or builds electron distibutable and packages it
  • Express
    • Serves static files from dist folder
      • HTML
      • JavaScript (es5)
      • CSS3
      • SVG, fonts, PNG
    • Expose microservices
      • via websockets
  • Electron
    • Serves static files from build folder
      • as above
    • Expose microservices
      • use electron ipc protocol

Licence

MIT License

Copyright (c) 2017-present, Pushfor Limited.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.