├── .editorconfig
├── .eslintignore
├── .eslintrc.json
├── .gitattributes
├── .gitignore
├── .npmignore
├── .nycrc
├── .travis.yml
├── .yo-rc.json
├── CHANGELOG.md
├── LICENSE
├── README.md
├── _ng
├── client
│ ├── angular.js
│ ├── client_factory.js
│ ├── style.js
│ ├── sub_generators_component.js
│ ├── sub_generators_controller.js
│ ├── sub_generators_decorator.js
│ ├── sub_generators_directive.js
│ ├── sub_generators_factory.js
│ ├── sub_generators_filter.js
│ ├── sub_generators_model.js
│ ├── sub_generators_module.js
│ ├── sub_generators_pipe.js
│ ├── sub_generators_resource.js
│ ├── sub_generators_service.js
│ ├── sub_generators_style.js
│ ├── sub_generators_view.js
│ └── vue.js
├── full
│ └── generator.js
├── server
│ ├── go_base.js
│ ├── go_echo.js
│ ├── go_factory.js
│ ├── node_base.js
│ ├── node_express.js
│ ├── node_factory.js
│ ├── node_koa.js
│ ├── server_factory.js
│ └── sub_generators_endpoint.js
└── utils
│ ├── errors.js
│ ├── known_paths.js
│ ├── options_parser.js
│ ├── utils.js
│ └── yeoman-utils.js
├── app
├── index.js
└── templates
│ ├── _.alivrc
│ ├── _.babelrc
│ ├── _.editorconfig
│ ├── _.gitignore
│ ├── _.gitignore_ng2
│ ├── _.gitignore_tsc
│ ├── _.jshintrc
│ ├── _.travis.yml
│ ├── _README.md
│ ├── _gulpfile.babel.js
│ ├── _karma-test-shim.js
│ ├── _karma.conf_ng1.js
│ ├── _karma.conf_ng2.js
│ ├── _karma.conf_vue2.js
│ ├── _package.json
│ ├── _procfile.txt
│ ├── _protractor.conf.js
│ ├── _tsconfig.json
│ ├── _typings_ng2.json
│ ├── _typings_ng2_and_tsc_server.json
│ ├── _typings_tsc_server.json
│ ├── cert
│ ├── ca.crt
│ ├── ca.csr
│ ├── ca.key
│ ├── server.crt
│ ├── server.csr
│ └── server.key
│ ├── client
│ ├── _styles
│ │ ├── todo.css
│ │ ├── todo.less
│ │ └── todo.scss
│ ├── ng1
│ │ └── dev
│ │ │ ├── app.config.js
│ │ │ ├── app.constant.js
│ │ │ ├── app.js
│ │ │ ├── app.route.js
│ │ │ ├── favicon.png
│ │ │ ├── index.html
│ │ │ └── todo
│ │ │ ├── controllers
│ │ │ └── todo-controller.js
│ │ │ ├── models
│ │ │ └── todo-model.js
│ │ │ ├── services
│ │ │ └── todo-dao.js
│ │ │ └── templates
│ │ │ └── todo.html
│ ├── ng2
│ │ └── dev
│ │ │ ├── app.module.ts
│ │ │ ├── app.ts
│ │ │ ├── index.html
│ │ │ ├── index.ts
│ │ │ ├── polyfills.ts
│ │ │ ├── todo
│ │ │ ├── components
│ │ │ │ ├── todo-cmp.ts
│ │ │ │ └── todo-route.ts
│ │ │ ├── services
│ │ │ │ └── todo-service.ts
│ │ │ └── templates
│ │ │ │ └── todo.html
│ │ │ └── vendor.ts
│ └── vue2
│ │ └── dev
│ │ ├── app.config.js
│ │ ├── app.constant.js
│ │ ├── app.route.js
│ │ ├── app.store.js
│ │ ├── app.vue
│ │ ├── index.html
│ │ ├── index.js
│ │ └── todo
│ │ └── components
│ │ └── todo-cmp.vue
│ ├── index_babel.js
│ ├── index_node.js
│ ├── index_tsc.js
│ ├── server
│ ├── go
│ │ └── echo
│ │ │ ├── api
│ │ │ └── todo
│ │ │ │ ├── controller
│ │ │ │ ├── todocontroller.go
│ │ │ │ └── todocontroller_test.go
│ │ │ │ ├── dao
│ │ │ │ ├── tododao.go
│ │ │ │ └── tododao_test.go
│ │ │ │ ├── model
│ │ │ │ ├── todomodel.go
│ │ │ │ └── todomodel_test.go
│ │ │ │ └── route
│ │ │ │ ├── todoroute.go
│ │ │ │ └── todoroute_test.go
│ │ │ ├── common
│ │ │ └── static
│ │ │ │ ├── static.go
│ │ │ │ └── static_test.go
│ │ │ ├── config
│ │ │ ├── dbconfig.go
│ │ │ └── dbconfig_test.go
│ │ │ ├── main.go
│ │ │ ├── main_http2.go
│ │ │ └── routes
│ │ │ ├── routes.go
│ │ │ └── routes_test.go
│ └── node
│ │ ├── express
│ │ ├── server_node_express
│ │ │ ├── api
│ │ │ │ └── todo
│ │ │ │ │ ├── controller
│ │ │ │ │ ├── todo-controller.js
│ │ │ │ │ └── todo-controller_test.js
│ │ │ │ │ ├── dao
│ │ │ │ │ ├── todo-dao.js
│ │ │ │ │ └── todo-dao_test.js
│ │ │ │ │ ├── model
│ │ │ │ │ ├── todo-model.js
│ │ │ │ │ └── todo-model_test.js
│ │ │ │ │ └── route
│ │ │ │ │ ├── todo-route.js
│ │ │ │ │ └── todo-route_test.js
│ │ │ ├── auth
│ │ │ │ └── local
│ │ │ │ │ └── index.js
│ │ │ ├── commons
│ │ │ │ └── static
│ │ │ │ │ └── index.js
│ │ │ ├── config
│ │ │ │ ├── db.conf.js
│ │ │ │ ├── db.conf.test.js
│ │ │ │ ├── db.test.json
│ │ │ │ └── routes.conf.js
│ │ │ ├── constants
│ │ │ │ └── db.json
│ │ │ ├── routes
│ │ │ │ └── index.js
│ │ │ ├── server.js
│ │ │ └── server_http2.js
│ │ ├── server_node_express_babel
│ │ │ ├── api
│ │ │ │ └── todo
│ │ │ │ │ ├── controller
│ │ │ │ │ ├── todo-controller.js
│ │ │ │ │ └── todo-controller_test.js
│ │ │ │ │ ├── dao
│ │ │ │ │ ├── todo-dao.js
│ │ │ │ │ └── todo-dao_test.js
│ │ │ │ │ ├── model
│ │ │ │ │ ├── todo-model.js
│ │ │ │ │ └── todo-model_test.js
│ │ │ │ │ └── route
│ │ │ │ │ ├── todo-route.js
│ │ │ │ │ └── todo-route_test.js
│ │ │ ├── auth
│ │ │ │ └── local
│ │ │ │ │ └── index.js
│ │ │ ├── commons
│ │ │ │ └── static
│ │ │ │ │ └── index.js
│ │ │ ├── config
│ │ │ │ ├── db.conf.js
│ │ │ │ ├── db.conf.test.js
│ │ │ │ ├── db.test.json
│ │ │ │ └── routes.conf.js
│ │ │ ├── constants
│ │ │ │ └── db.json
│ │ │ ├── routes
│ │ │ │ └── index.js
│ │ │ ├── server.js
│ │ │ └── server_http2.js
│ │ └── server_node_express_typescript
│ │ │ ├── api
│ │ │ └── todo
│ │ │ │ ├── controller
│ │ │ │ ├── todo-controller.ts
│ │ │ │ └── todo-controller_test.js
│ │ │ │ ├── dao
│ │ │ │ ├── todo-dao.ts
│ │ │ │ └── todo-dao_test.js
│ │ │ │ ├── model
│ │ │ │ ├── todo-model.ts
│ │ │ │ └── todo-model_test.js
│ │ │ │ └── route
│ │ │ │ ├── todo-route.ts
│ │ │ │ └── todo-route_test.js
│ │ │ ├── auth
│ │ │ └── local
│ │ │ │ └── index.ts
│ │ │ ├── commons
│ │ │ └── static
│ │ │ │ └── index.ts
│ │ │ ├── config
│ │ │ ├── db.conf.test.js
│ │ │ ├── db.conf.ts
│ │ │ ├── db.test.json
│ │ │ └── routes.conf.ts
│ │ │ ├── constants
│ │ │ └── db.json
│ │ │ ├── routes
│ │ │ └── index.ts
│ │ │ ├── server.ts
│ │ │ └── server_http2.ts
│ │ └── koa
│ │ ├── server_node_koa
│ │ ├── api
│ │ │ └── todo
│ │ │ │ ├── controller
│ │ │ │ ├── todo-controller.js
│ │ │ │ └── todo-controller_test.js
│ │ │ │ ├── dao
│ │ │ │ ├── todo-dao.js
│ │ │ │ └── todo-dao_test.js
│ │ │ │ ├── model
│ │ │ │ ├── todo-model.js
│ │ │ │ └── todo-model_test.js
│ │ │ │ └── route
│ │ │ │ ├── todo-route.js
│ │ │ │ └── todo-route_test.js
│ │ ├── auth
│ │ │ └── local
│ │ │ │ └── index.js
│ │ ├── commons
│ │ │ └── static
│ │ │ │ └── index.js
│ │ ├── config
│ │ │ ├── db.conf.js
│ │ │ ├── db.conf.test.js
│ │ │ ├── db.test.json
│ │ │ └── routes.conf.js
│ │ ├── constants
│ │ │ └── db.json
│ │ ├── routes
│ │ │ └── index.js
│ │ ├── server.js
│ │ └── server_http2.js
│ │ ├── server_node_koa_babel
│ │ ├── api
│ │ │ └── todo
│ │ │ │ ├── controller
│ │ │ │ ├── todo-controller.js
│ │ │ │ └── todo-controller_test.js
│ │ │ │ ├── dao
│ │ │ │ ├── todo-dao.js
│ │ │ │ └── todo-dao_test.js
│ │ │ │ ├── model
│ │ │ │ ├── todo-model.js
│ │ │ │ └── todo-model_test.js
│ │ │ │ └── route
│ │ │ │ ├── todo-route.js
│ │ │ │ └── todo-route_test.js
│ │ ├── auth
│ │ │ └── local
│ │ │ │ └── index.js
│ │ ├── commons
│ │ │ └── static
│ │ │ │ └── index.js
│ │ ├── config
│ │ │ ├── db.conf.js
│ │ │ ├── db.conf.test.js
│ │ │ ├── db.test.json
│ │ │ └── routes.conf.js
│ │ ├── constants
│ │ │ └── db.json
│ │ ├── routes
│ │ │ └── index.js
│ │ ├── server.js
│ │ └── server_http2.js
│ │ └── server_node_koa_typescript
│ │ ├── api
│ │ └── todo
│ │ │ ├── controller
│ │ │ ├── todo-controller.ts
│ │ │ └── todo-controller_test.js
│ │ │ ├── dao
│ │ │ ├── todo-dao.ts
│ │ │ └── todo-dao_test.js
│ │ │ ├── model
│ │ │ ├── todo-model.ts
│ │ │ └── todo-model_test.js
│ │ │ └── route
│ │ │ ├── todo-route.ts
│ │ │ └── todo-route_test.js
│ │ ├── auth
│ │ └── local
│ │ │ └── index.ts
│ │ ├── commons
│ │ └── static
│ │ │ └── index.ts
│ │ ├── config
│ │ ├── db.conf.test.js
│ │ ├── db.conf.ts
│ │ ├── db.test.json
│ │ └── routes.conf.ts
│ │ ├── constants
│ │ └── db.json
│ │ ├── routes
│ │ └── index.ts
│ │ ├── server.ts
│ │ └── server_http2.ts
│ ├── tasks
│ ├── client
│ │ ├── ng1
│ │ │ ├── build_css.js
│ │ │ ├── build_html.js
│ │ │ ├── build_image.js
│ │ │ ├── build_js.js
│ │ │ ├── const.js
│ │ │ ├── copy.js
│ │ │ ├── del.js
│ │ │ ├── index.js
│ │ │ ├── revision.js
│ │ │ ├── unit_test.js
│ │ │ └── watch.js
│ │ ├── ng2
│ │ │ ├── build_css.js
│ │ │ ├── build_html.js
│ │ │ ├── build_image.js
│ │ │ ├── build_js.js
│ │ │ ├── build_ts.js
│ │ │ ├── const.js
│ │ │ ├── copy.js
│ │ │ ├── del.js
│ │ │ ├── index.js
│ │ │ ├── unit_test.js
│ │ │ └── watch.js
│ │ └── vue2
│ │ │ ├── build_css.js
│ │ │ ├── build_html.js
│ │ │ ├── build_image.js
│ │ │ ├── build_js.js
│ │ │ ├── const.js
│ │ │ ├── copy.js
│ │ │ ├── del.js
│ │ │ ├── index.js
│ │ │ ├── unit_test.js
│ │ │ └── watch.js
│ ├── index.js
│ └── server
│ │ ├── build_tsc.js
│ │ ├── index.js
│ │ └── test.js
│ ├── tests
│ ├── client_ng1
│ │ └── todo
│ │ │ ├── controllers
│ │ │ └── todo-controller_test.js
│ │ │ ├── models
│ │ │ └── todo-model_test.js
│ │ │ └── services
│ │ │ └── todo-dao_test.js
│ ├── client_ng2
│ │ └── todo
│ │ │ ├── components
│ │ │ └── todo-cmp_test.ts
│ │ │ └── services
│ │ │ └── todo-service_test.ts
│ ├── client_vue2
│ │ └── todo
│ │ │ ├── components
│ │ │ └── todo-cmp_test.js
│ │ │ └── models
│ │ │ └── todo-model_test.js
│ ├── e2e
│ │ └── todo.e2e_test.js
│ └── server
│ │ ├── _helpers
│ │ ├── db.js
│ │ └── db.json
│ │ └── todo
│ │ ├── controller
│ │ └── todo-controller_test.js
│ │ ├── dao
│ │ └── todo-dao_test.js
│ │ ├── model
│ │ └── todo-model_test.js
│ │ └── route
│ │ └── todo-route_test.js
│ ├── webpack.config.dev_ng2.js
│ ├── webpack.config.dev_vue2.js
│ ├── webpack.config.prod_ng2.js
│ └── webpack.config.prod_vue2.js
├── component
├── index.js
└── templates
│ ├── ng1
│ ├── component.css
│ ├── component.html
│ ├── component.js
│ └── component_test.js
│ ├── ng2
│ ├── component.css
│ ├── component.html
│ ├── component.ts
│ └── component_test.ts
│ └── vue2
│ ├── component.vue
│ └── component_test.js
├── controller
├── index.js
└── templates
│ └── ng1
│ ├── controller_client.js
│ └── controller_client_test.js
├── decorator
├── index.js
└── templates
│ └── ng1
│ └── decorator.js
├── directive
├── index.js
└── templates
│ ├── ng1
│ ├── directive.js
│ └── directive_test.js
│ ├── ng2
│ ├── directive.ts
│ └── directive_test.ts
│ └── vue2
│ ├── directive.js
│ └── directive_test.js
├── endpoint
├── index.js
└── templates
│ ├── go
│ └── echo
│ │ ├── endpoint.controller.go
│ │ ├── endpoint.controller_test.go
│ │ ├── endpoint.dao.go
│ │ ├── endpoint.dao_test.go
│ │ ├── endpoint.model.go
│ │ ├── endpoint.model_test.go
│ │ ├── endpoint.route.go
│ │ └── endpoint.route_test.go
│ └── node
│ ├── express
│ ├── babel
│ │ ├── endpoint.controller.js
│ │ ├── endpoint.controller_test.js
│ │ ├── endpoint.dao.js
│ │ ├── endpoint.dao_test.js
│ │ ├── endpoint.model.js
│ │ ├── endpoint.model_test.js
│ │ ├── endpoint.route.js
│ │ └── endpoint.route_test.js
│ ├── no_transpiler
│ │ ├── endpoint.controller.js
│ │ ├── endpoint.controller_test.js
│ │ ├── endpoint.dao.js
│ │ ├── endpoint.dao_test.js
│ │ ├── endpoint.model.js
│ │ ├── endpoint.model_test.js
│ │ ├── endpoint.route.js
│ │ └── endpoint.route_test.js
│ └── typescript
│ │ ├── endpoint.controller.ts
│ │ ├── endpoint.controller_test.js
│ │ ├── endpoint.dao.ts
│ │ ├── endpoint.dao_test.js
│ │ ├── endpoint.model.ts
│ │ ├── endpoint.model_test.js
│ │ ├── endpoint.route.ts
│ │ └── endpoint.route_test.js
│ └── koa
│ ├── babel
│ ├── endpoint.controller.js
│ ├── endpoint.controller_test.js
│ ├── endpoint.dao.js
│ ├── endpoint.dao_test.js
│ ├── endpoint.model.js
│ ├── endpoint.model_test.js
│ ├── endpoint.route.js
│ └── endpoint.route_test.js
│ ├── no_transpiler
│ ├── endpoint.controller.js
│ ├── endpoint.controller_test.js
│ ├── endpoint.dao.js
│ ├── endpoint.dao_test.js
│ ├── endpoint.model.js
│ ├── endpoint.model_test.js
│ ├── endpoint.route.js
│ └── endpoint.route_test.js
│ └── typescript
│ ├── endpoint.controller.ts
│ ├── endpoint.controller_test.js
│ ├── endpoint.dao.ts
│ ├── endpoint.dao_test.js
│ ├── endpoint.model.ts
│ ├── endpoint.model_test.js
│ ├── endpoint.route.ts
│ └── endpoint.route_test.js
├── factory
├── index.js
└── templates
│ ├── ng1
│ ├── factory.js
│ └── factory_test.js
│ ├── ng2
│ ├── factory.ts
│ └── factory_test.ts
│ └── vue2
│ ├── factory.js
│ └── factory_test.js
├── filter
├── index.js
└── templates
│ ├── ng1
│ ├── filter.js
│ └── filter_test.js
│ └── vue2
│ ├── filter.js
│ └── filter_test.js
├── logo.png
├── model
├── index.js
└── templates
│ ├── ng1
│ ├── model.js
│ └── model_test.js
│ ├── ng2
│ ├── model.ts
│ └── model_test.ts
│ └── vue2
│ ├── model.js
│ └── model_test.js
├── module
└── index.js
├── package-lock.json
├── package.json
├── pipe
├── index.js
└── templates
│ └── ng2
│ ├── pipe.ts
│ └── pipe_test.js
├── resource
├── index.js
└── templates
│ └── ng1
│ └── resource.js
├── service
├── index.js
└── templates
│ ├── ng1
│ ├── service.js
│ └── service_test.js
│ ├── ng2
│ ├── service.ts
│ └── service_test.ts
│ └── vue2
│ ├── service.js
│ └── service_test.js
├── style
├── index.js
└── templates
│ ├── style.css
│ ├── style.less
│ └── style.scss
├── test
├── _helpers
│ └── mocks.js
├── acceptance
│ ├── test-app-client.js
│ ├── test-app-go.js
│ ├── test-app-node.js
│ ├── test-component.js
│ ├── test-controller.js
│ ├── test-decorator.js
│ ├── test-directive.js
│ ├── test-endpoint.js
│ ├── test-factory.js
│ ├── test-filter.js
│ ├── test-model.js
│ ├── test-module.js
│ ├── test-pipe.js
│ ├── test-resource.js
│ ├── test-service.js
│ ├── test-style.js
│ └── test-view.js
└── unit
│ ├── test-angular.js
│ ├── test-client-factory.js
│ ├── test-generator.js
│ ├── test-go-echo.js
│ ├── test-known-paths.js
│ ├── test-node-express.js
│ ├── test-node-koa.js
│ ├── test-options-parser.js
│ ├── test-server-factory.js
│ ├── test-style.js
│ ├── test-sub-generators-component.js
│ ├── test-sub-generators-controller.js
│ ├── test-sub-generators-decorator.js
│ ├── test-sub-generators-directive.js
│ ├── test-sub-generators-endpoint.js
│ ├── test-sub-generators-factory.js
│ ├── test-sub-generators-filter.js
│ ├── test-sub-generators-model.js
│ ├── test-sub-generators-module.js
│ ├── test-sub-generators-pipe.js
│ ├── test-sub-generators-resource.js
│ ├── test-sub-generators-service.js
│ ├── test-sub-generators-style.js
│ ├── test-sub-generators-view.js
│ ├── test-utils.js
│ ├── test-vue.js
│ └── test-yeoman-utils.js
├── view
├── index.js
└── templates
│ └── view.html
└── yarn.lock
/.editorconfig:
--------------------------------------------------------------------------------
1 | # http://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | indent_style = space
6 | indent_size = 2
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.md]
12 | trim_trailing_whitespace = false
13 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | **/*
2 | !_ng/**
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "node": true,
4 | "browser": false,
5 | "commonjs": true,
6 | "es6": true
7 | },
8 | "extends": "eslint:recommended",
9 | "rules": {
10 | "indent": 0,
11 | "linebreak-style": 0,
12 | "quotes": 0,
13 | "semi": 2
14 | },
15 | "globals": {
16 | "process": true
17 | }
18 | }
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | coverage/
3 | .idea
4 |
5 | *.log
6 | app/**/*.map
7 | app/templates/client/ng2/**/*.js
8 | app/templates/tests/client_ng2/**/*.js
9 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | .idea
2 | node_modules
3 | coverage
4 | test
5 |
6 | .travis.yml
7 | .gitattributes
8 | .editorconfig
9 | .jshintrc
10 |
11 | yarn.lock
12 |
--------------------------------------------------------------------------------
/.nycrc:
--------------------------------------------------------------------------------
1 | {
2 | "temp-directory": "./coverage"
3 | }
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | sudo: true
3 |
4 | node_js:
5 | - 9
6 |
7 | before_install:
8 | - npm install -g istanbul mocha
9 |
10 | script:
11 | - npm run test-ci
12 |
--------------------------------------------------------------------------------
/.yo-rc.json:
--------------------------------------------------------------------------------
1 | {
2 | "generator-generator": {}
3 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Eric M. Dantas
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/_ng/client/client_factory.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const {AngularFactory} = require('./angular');
4 | const {VueFactory} = require('./vue');
5 |
6 | exports.ClientFactory = class ClientFactory {
7 | static tokens() {
8 | return {
9 | ANGULAR: 'angular',
10 | VUE: 'vue'
11 | };
12 | }
13 |
14 | static create(client, token, gen) {
15 | switch(client) {
16 | case ClientFactory.tokens().ANGULAR: return AngularFactory.build(token, gen);
17 | case ClientFactory.tokens().VUE: return VueFactory.build(token, gen);
18 | }
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/_ng/client/style.js:
--------------------------------------------------------------------------------
1 | const knownPaths = require('../utils/known_paths');
2 |
3 | function _getExt(gen) {
4 | let _ext = '';
5 |
6 | switch(gen.stylePreprocessor) {
7 | case "less":
8 | _ext = ".less";
9 | break;
10 |
11 | case "sass":
12 | _ext = ".scss";
13 | break;
14 |
15 | default:
16 | _ext = ".css";
17 | }
18 |
19 | return _ext;
20 | }
21 |
22 |
23 | exports.copyStyleForMainGenerator = function(gen, dest) {
24 | let _ext = _getExt(gen);
25 |
26 | gen.template('client/_styles/todo' + _ext, dest + _ext);
27 | };
28 |
29 | exports.copyStyleForSubGenerator = function(gen, path) {
30 | let _pathTemplate = path || '';
31 | let _ext = _getExt(gen);
32 |
33 | gen.template(`${_pathTemplate}style${_ext}`,
34 | `${knownPaths.PATH_CLIENT_FEATURES + gen.options.feature}/styles/${gen.name}${_ext}`
35 | );
36 | };
37 |
38 | exports.normalizeStylePreprocessor = function(stylePreprocessor) {
39 | return (!!stylePreprocessor && stylePreprocessor !== "none") ? stylePreprocessor : undefined;
40 | };
41 |
42 | exports.getStyleExtension = _getExt;
43 |
--------------------------------------------------------------------------------
/_ng/client/sub_generators_controller.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const optionsParser = require('../utils/options_parser');
4 | const {AngularFactory} = require('./angular');
5 | const {FeatureMissingError} = require('../utils/errors');
6 | const {ModuleDoesntImplementError} = require('../utils/errors');
7 |
8 | exports.ControllerSubGenerator = class ControllerSubGenerator {
9 | constructor(generator) {
10 | this.generator = generator;
11 | this.generator.appName = this.generator.config.get('appName');
12 | this.generator.client = this.generator.config.get('client');
13 | this.generator.testsSeparated = this.generator.config.get('testsSeparated');
14 | }
15 |
16 | initializing() {
17 | this.generator.argument('name', {
18 | required: true,
19 | type: String,
20 | desc: 'controller_client'
21 | });
22 | }
23 |
24 | writing() {
25 | let _feature = optionsParser.getFeature(this.generator.options);
26 | let _client = this.generator.client;
27 |
28 | if (!_feature.length) {
29 | throw new FeatureMissingError();
30 | }
31 |
32 | if (_client !== AngularFactory.tokens().NG1) {
33 | throw new ModuleDoesntImplementError(_client, 'controller');
34 | }
35 |
36 | AngularFactory.build(AngularFactory.tokens().NG1, this.generator).copyController();
37 | }
38 | };
39 |
--------------------------------------------------------------------------------
/_ng/client/sub_generators_decorator.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const optionsParser = require('../utils/options_parser');
4 | const {AngularFactory} = require('./angular');
5 | const {FeatureMissingError} = require('../utils/errors');
6 | const {ModuleDoesntImplementError} = require('../utils/errors');
7 |
8 | exports.DecoratorSubGenerator = class DecoratorSubGenerator {
9 | constructor(generator) {
10 | this.generator = generator;
11 | this.generator.appName = this.generator.config.get('appName');
12 | this.generator.client = this.generator.config.get('client');
13 | this.generator.testsSeparated = this.generator.config.get('testsSeparated');
14 | }
15 |
16 | initializing() {
17 | this.generator.argument('name', {
18 | required: true,
19 | type: String,
20 | desc: 'decorator'
21 | });
22 | }
23 |
24 | writing() {
25 | let _feature = optionsParser.getFeature(this.generator.options);
26 | let _client = this.generator.client;
27 |
28 | if (!_feature.length) {
29 | throw new FeatureMissingError();
30 | }
31 |
32 | if (_client !== AngularFactory.tokens().NG1) {
33 | throw new ModuleDoesntImplementError(_client, 'decorator');
34 | }
35 |
36 | AngularFactory.build(AngularFactory.tokens().NG1, this.generator).copyDecorator();
37 | }
38 | };
39 |
--------------------------------------------------------------------------------
/_ng/client/sub_generators_directive.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const optionsParser = require('../utils/options_parser');
4 | const {FeatureMissingError} = require('../utils/errors');
5 | const {AngularFactory} = require('./angular');
6 | const {VueFactory} = require('./vue');
7 |
8 | exports.DirectiveSubGenerator = class DirectiveSubGenerator {
9 | constructor(generator) {
10 | this.generator = generator;
11 | this.generator.client = this.generator.config.get('client');
12 | this.generator.appName = this.generator.config.get('appName');
13 | this.generator.testsSeparated = this.generator.config.get('testsSeparated');
14 | }
15 |
16 | initializing() {
17 | this.generator.argument('name', {
18 | required: true,
19 | type: String,
20 | desc: 'directive'
21 | });
22 | }
23 |
24 | writing() {
25 | let _feature = optionsParser.getFeature(this.generator.options);
26 | let _client = this.generator.client;
27 |
28 | if (!_feature.length) {
29 | throw new FeatureMissingError();
30 | }
31 |
32 | if ((_client === AngularFactory.tokens().NG1) || (_client === AngularFactory.tokens().NG2)) {
33 | return AngularFactory.build(this.generator.client, this.generator).copyDirective();
34 | }
35 |
36 | if (_client === VueFactory.tokens().VUE2) {
37 | return VueFactory.build(this.generator.client, this.generator).copyDirective();
38 | }
39 | }
40 | };
41 |
--------------------------------------------------------------------------------
/_ng/client/sub_generators_factory.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const optionsParser = require('../utils/options_parser');
4 | const {FeatureMissingError} = require('../utils/errors');
5 | const {AngularFactory} = require('./angular');
6 | const {VueFactory} = require('./vue');
7 |
8 | exports.FactorySubGenerator = class FactorySubGenerator {
9 | constructor(generator) {
10 | this.generator = generator;
11 | this.generator.client = this.generator.config.get('client');
12 | this.generator.appName = this.generator.config.get('appName');
13 | this.generator.testsSeparated = this.generator.config.get('testsSeparated');
14 | }
15 |
16 | initializing() {
17 | this.generator.argument('name', {
18 | required: true,
19 | type: String,
20 | desc: 'factory'
21 | });
22 | }
23 |
24 | writing() {
25 | let _feature = optionsParser.getFeature(this.generator.options);
26 | let _client = this.generator.client;
27 |
28 | if (!_feature.length) {
29 | throw new FeatureMissingError();
30 | }
31 |
32 | if ((_client === AngularFactory.tokens().NG1) || (_client === AngularFactory.tokens().NG2)) {
33 | return AngularFactory.build(this.generator.client, this.generator).copyFactory();
34 | }
35 |
36 | if (_client === VueFactory.tokens().VUE2) {
37 | return VueFactory.build(this.generator.client, this.generator).copyFactory();
38 | }
39 | }
40 | };
41 |
--------------------------------------------------------------------------------
/_ng/client/sub_generators_model.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const optionsParser = require('../utils/options_parser');
4 | const {FeatureMissingError} = require('../utils/errors');
5 | const {AngularFactory} = require('./angular');
6 | const {VueFactory} = require('./vue');
7 |
8 | exports.ModelSubGenerator = class ModelSubGenerator {
9 | constructor(generator) {
10 | this.generator = generator;
11 | this.generator.client = this.generator.config.get('client');
12 | this.generator.appName = this.generator.config.get('appName');
13 | this.generator.testsSeparated = this.generator.config.get('testsSeparated');
14 | }
15 |
16 | initializing() {
17 | this.generator.argument('name', {
18 | required: true,
19 | type: String,
20 | desc: 'model'
21 | });
22 | }
23 |
24 | writing() {
25 | let _feature = optionsParser.getFeature(this.generator.options);
26 | let _client = this.generator.client;
27 |
28 | if (!_feature.length) {
29 | throw new FeatureMissingError();
30 | }
31 |
32 | if ((_client === AngularFactory.tokens().NG1) || (_client === AngularFactory.tokens().NG2)) {
33 | return AngularFactory.build(this.generator.client, this.generator).copyModel();
34 | }
35 |
36 | if (_client === VueFactory.tokens().VUE2) {
37 | return VueFactory.build(this.generator.client, this.generator).copyModel();
38 | }
39 | }
40 | };
41 |
--------------------------------------------------------------------------------
/_ng/client/sub_generators_module.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const optionsParser = require('../utils/options_parser');
4 | const {FeatureMissingError} = require('../utils/errors');
5 | const {AngularFactory} = require('./angular');
6 | const {VueFactory} = require('./vue');
7 |
8 | exports.ModuleSubGenerator = class ModuleSubGenerator {
9 | constructor(generator) {
10 | this.generator = generator;
11 | this.generator.client = this.generator.config.get('client');
12 | this.generator.appName = this.generator.config.get('appName');
13 | this.generator.testsSeparated = this.generator.config.get('testsSeparated');
14 | }
15 |
16 | initializing() {
17 | this.generator.argument('name', {
18 | required: true,
19 | type: String,
20 | desc: 'module'
21 | });
22 | }
23 |
24 | writing() {
25 | let _feature = optionsParser.getFeature(this.generator.options);
26 | let _client = this.generator.client;
27 |
28 | if (!_feature.length) {
29 | throw new FeatureMissingError();
30 | }
31 |
32 | if ((_client === AngularFactory.tokens().NG1) || (_client === AngularFactory.tokens().NG2)) {
33 | return AngularFactory.build(this.generator.client, this.generator).copyModule();
34 | }
35 |
36 | if (_client === VueFactory.tokens().VUE2) {
37 | return VueFactory.build(this.generator.client, this.generator).copyModule();
38 | }
39 | }
40 | };
41 |
--------------------------------------------------------------------------------
/_ng/client/sub_generators_pipe.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const optionsParser = require('../utils/options_parser');
4 | const {AngularFactory} = require('./angular');
5 | const {FeatureMissingError} = require('../utils/errors');
6 | const {ModuleDoesntImplementError} = require('../utils/errors');
7 |
8 | exports.PipeSubGenerator = class PipeSubGenerator {
9 | constructor(generator) {
10 | this.generator = generator;
11 | this.generator.client = this.generator.config.get('client');
12 | this.generator.appName = this.generator.config.get('appName');
13 | this.generator.testsSeparated = this.generator.config.get('testsSeparated');
14 | }
15 |
16 | initializing() {
17 | this.generator.argument('name', {
18 | required: true,
19 | type: String,
20 | desc: 'pipe'
21 | });
22 | }
23 |
24 | writing() {
25 | let _feature = optionsParser.getFeature(this.generator.options);
26 | let _client = this.generator.client;
27 |
28 | if (!_feature.length) {
29 | throw new FeatureMissingError();
30 | }
31 |
32 | if (_client !== AngularFactory.tokens().NG2) {
33 | throw new ModuleDoesntImplementError(_client, 'pipe');
34 | }
35 |
36 | AngularFactory.build(AngularFactory.tokens().NG2, this.generator).copyPipe();
37 | }
38 | };
39 |
--------------------------------------------------------------------------------
/_ng/client/sub_generators_resource.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const optionsParser = require('../utils/options_parser');
4 | const {AngularFactory} = require('./angular');
5 | const {FeatureMissingError} = require('../utils/errors');
6 | const {ModuleDoesntImplementError} = require('../utils/errors');
7 |
8 | exports.ResourceSubGenerator = class ResourceSubGenerator {
9 | constructor(generator) {
10 | this.generator = generator;
11 | this.generator.client = this.generator.config.get('client');
12 | this.generator.appName = this.generator.config.get('appName');
13 | }
14 |
15 | initializing() {
16 | this.generator.argument('name', {
17 | required: true,
18 | type: String,
19 | desc: 'resource'
20 | });
21 | }
22 |
23 | writing() {
24 | let _feature = optionsParser.getFeature(this.generator.options);
25 | let _client = this.generator.client;
26 |
27 | if (!_feature.length) {
28 | throw new FeatureMissingError();
29 | }
30 |
31 | if (_client !== AngularFactory.tokens().NG1) {
32 | throw new ModuleDoesntImplementError(_client, 'resource');
33 | }
34 |
35 | AngularFactory.build(AngularFactory.tokens().NG1, this.generator).copyResource();
36 | }
37 | };
38 |
--------------------------------------------------------------------------------
/_ng/client/sub_generators_service.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const optionsParser = require('../utils/options_parser');
4 | const {FeatureMissingError} = require('../utils/errors');
5 | const {AngularFactory} = require('./angular');
6 | const {VueFactory} = require('./vue');
7 |
8 | exports.ServiceSubGenerator = class ServiceSubGenerator {
9 | constructor(generator) {
10 | this.generator = generator;
11 | this.generator.client = this.generator.config.get('client');
12 | this.generator.appName = this.generator.config.get('appName');
13 | this.generator.testsSeparated = this.generator.config.get('testsSeparated');
14 | }
15 |
16 | initializing() {
17 | this.generator.argument('name', {
18 | required: true,
19 | type: String,
20 | desc: 'service'
21 | });
22 | }
23 |
24 | writing() {
25 | let _feature = optionsParser.getFeature(this.generator.options);
26 | let _client = this.generator.client;
27 |
28 | if (!_feature.length) {
29 | throw new FeatureMissingError();
30 | }
31 |
32 | if ((_client === AngularFactory.tokens().NG1) || (_client === AngularFactory.tokens().NG2)) {
33 | return AngularFactory.build(this.generator.client, this.generator).copyService();
34 | }
35 |
36 | if (_client === VueFactory.tokens().VUE2) {
37 | return VueFactory.build(this.generator.client, this.generator).copyService();
38 | }
39 | }
40 | };
41 |
--------------------------------------------------------------------------------
/_ng/client/sub_generators_style.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const optionsParser = require('../utils/options_parser');
4 | const {FeatureMissingError} = require('../utils/errors');
5 | const {AngularFactory} = require('./angular');
6 | const {VueFactory} = require('./vue');
7 |
8 | exports.StyleSubGenerator = class StyleSubGenerator {
9 | constructor(generator) {
10 | this.generator = generator;
11 | this.generator.client = this.generator.config.get('client');
12 | this.generator.stylePreprocessor = this.generator.config.get('stylePreprocessor');
13 | }
14 |
15 | initializing() {
16 | this.generator.argument('name', {
17 | required: true,
18 | type: String,
19 | desc: 'style'
20 | });
21 | }
22 |
23 | writing() {
24 | let _feature = optionsParser.getFeature(this.generator.options);
25 | let _client = this.generator.client;
26 |
27 | if (!_feature.length) {
28 | throw new FeatureMissingError();
29 | }
30 |
31 | if ((_client === AngularFactory.tokens().NG1) || (_client === AngularFactory.tokens().NG2)) {
32 | return AngularFactory.build(this.generator.client, this.generator).copyStyle();
33 | }
34 |
35 | if (_client === VueFactory.tokens().VUE2) {
36 | return VueFactory.build(this.generator.client, this.generator).copyStyle();
37 | }
38 | }
39 | };
40 |
--------------------------------------------------------------------------------
/_ng/client/sub_generators_view.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const optionsParser = require('../utils/options_parser');
4 | const {AngularFactory} = require('./angular');
5 | const {FeatureMissingError} = require('../utils/errors');
6 |
7 | exports.ViewSubGenerator = class ViewSubGenerator {
8 | constructor(generator) {
9 | this.generator = generator;
10 | this.generator.client = this.generator.config.get('client');
11 | }
12 |
13 | initializing() {
14 | this.generator.argument('name', {
15 | required: true,
16 | type: String,
17 | desc: 'view'
18 | });
19 | }
20 |
21 | writing() {
22 | let feature = optionsParser.getFeature(this.generator.options);
23 |
24 | if (!feature.length) {
25 | throw new FeatureMissingError();
26 | }
27 |
28 | AngularFactory.build(this.generator.client, this.generator).copyTemplate();
29 | }
30 | };
31 |
--------------------------------------------------------------------------------
/_ng/server/go_echo.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const {GoBase} = require('./go_base');
4 |
5 | const SERVER_TOKEN = 'echo';
6 |
7 | exports.GoEcho = class GoEcho extends GoBase {
8 | constructor(generator) {
9 | super(generator, SERVER_TOKEN);
10 | }
11 | };
12 |
--------------------------------------------------------------------------------
/_ng/server/go_factory.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const {GoEcho} = require('./go_echo');
4 |
5 | exports.GoFactory = class GoFactory {
6 | static tokensWebFramework() {
7 | return {
8 | ECHO: 'echo'
9 | };
10 | }
11 |
12 | static build(generator) {
13 | return new GoEcho(generator);
14 | }
15 | };
16 |
--------------------------------------------------------------------------------
/_ng/server/node_express.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const {NodeBaseStandard} = require('./node_base');
4 | const {NodeBaseBabel} = require('./node_base');
5 | const {NodeBaseTypescript} = require('./node_base');
6 |
7 | const SERVER_TOKEN = 'express';
8 |
9 | class NodeExpressStandard extends NodeBaseStandard {
10 | constructor(generator) {
11 | super(generator, SERVER_TOKEN);
12 | }
13 | }
14 |
15 | class NodeExpressBabel extends NodeBaseBabel {
16 | constructor(generator) {
17 | super(generator, SERVER_TOKEN);
18 | }
19 | }
20 |
21 | class NodeExpressTypescript extends NodeBaseTypescript {
22 | constructor(generator) {
23 | super(generator, SERVER_TOKEN);
24 | }
25 | }
26 |
27 | exports.NodeExpressBabel = NodeExpressBabel;
28 | exports.NodeExpressTypescript = NodeExpressTypescript;
29 | exports.NodeExpressStandard = NodeExpressStandard;
30 |
--------------------------------------------------------------------------------
/_ng/server/node_koa.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const {NodeBaseStandard} = require('./node_base');
4 | const {NodeBaseBabel} = require('./node_base');
5 | const {NodeBaseTypescript} = require('./node_base');
6 |
7 | const SERVER_TOKEN = 'koa';
8 |
9 | class NodeKoaStandard extends NodeBaseStandard {
10 | constructor(generator) {
11 | super(generator, SERVER_TOKEN);
12 | }
13 | }
14 |
15 | class NodeKoaBabel extends NodeBaseBabel {
16 | constructor(generator) {
17 | super(generator, SERVER_TOKEN);
18 | }
19 | }
20 |
21 | class NodeKoaTypescript extends NodeBaseTypescript {
22 | constructor(generator) {
23 | super(generator, SERVER_TOKEN);
24 | }
25 | }
26 |
27 | exports.NodeKoaBabel = NodeKoaBabel;
28 | exports.NodeKoaTypescript = NodeKoaTypescript;
29 | exports.NodeKoaStandard = NodeKoaStandard;
30 |
--------------------------------------------------------------------------------
/_ng/server/server_factory.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const {NodeFactory} = require('./node_factory');
4 | const {GoFactory} = require('./go_factory');
5 |
6 | exports.ServerFactory = class ServerFactory {
7 | static tokens() {
8 | return {
9 | NODE: 'node',
10 | GO: 'go'
11 | };
12 | }
13 |
14 | static create(token, gen) {
15 | switch(token) {
16 | case ServerFactory.tokens().NODE: return NodeFactory.build(gen);
17 | case ServerFactory.tokens().GO: return GoFactory.build(gen);
18 | }
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/_ng/utils/errors.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | class ExtendableError extends Error {
4 | constructor(message) {
5 | super(message);
6 | this.name = this.constructor.name;
7 | this.message = message;
8 | Error.captureStackTrace(this, this.constructor.name);
9 | }
10 | }
11 |
12 | exports.FeatureMissingError = class FeatureMissingError extends ExtendableError {
13 | constructor() {
14 | super('Feature is needed. Do it like this: --feature something-here');
15 | }
16 | };
17 |
18 | exports.ModuleDoesntImplementError = class ModuleDoesntImplementError extends ExtendableError {
19 | constructor(module, subGenerator) {
20 | super(`${module} doesn't implement ${subGenerator}.`);
21 | }
22 | };
23 |
--------------------------------------------------------------------------------
/_ng/utils/known_paths.js:
--------------------------------------------------------------------------------
1 | exports.PATH_CLIENT_FEATURES = 'client/dev/';
2 | exports.PATH_SERVER_FEATURES = 'server/api/';
3 |
4 | exports.PATH_CLIENT_FEATURES_TEST = 'tests/client/';
5 | exports.PATH_SERVER_FEATURES_TEST = 'tests/server/';
6 |
--------------------------------------------------------------------------------
/_ng/utils/options_parser.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | exports.getFeature = (opt) => {
4 | return opt && opt.feature ? opt.feature + '/' : '';
5 | };
6 |
7 | exports.isServerOnly = (opt) => {
8 | return opt ? !!opt.serverOnly : false;
9 | };
10 |
11 | exports.isClientOnly = (opt) => {
12 | return opt ? !!opt.clientOnly : false;
13 | };
14 |
--------------------------------------------------------------------------------
/_ng/utils/utils.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | exports.capitalizeFirst = (str) => {
4 | if (!str) {
5 | return '';
6 | }
7 |
8 | return str.charAt(0).toUpperCase() + str.slice(1);
9 | };
10 |
--------------------------------------------------------------------------------
/_ng/utils/yeoman-utils.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | exports.directory = function(gen, paths, opts) {
4 | // [
5 | // ['path1', 'path2']
6 | // ['path3', 'path4']
7 | // ['path5', 'path6']
8 | // ['path7', 'path8']
9 | // ]
10 |
11 | if (!gen) {
12 | throw new TypeError('Generator is not defined.');
13 | }
14 |
15 | if (!gen.template || (typeof gen.template !== 'function')) {
16 | throw new TypeError('Template is not a valid method of the generator.');
17 | }
18 |
19 | paths.forEach((p) => {
20 | gen.template(p[0], p[1], opts);
21 | });
22 | };
23 |
--------------------------------------------------------------------------------
/app/templates/_.alivrc:
--------------------------------------------------------------------------------
1 | {
2 | "quiet": true,
3 | "port": 3000,
4 | "http2": <%= secure %>,
5 | "pathIndex": "client/dev",
6 | "only": [
7 | "client/dev/**/*"
8 | ],
9 | "static": [
10 | "node_modules"
11 | ],
12 | "proxy": true,
13 | "proxyWhen": "/api/*",
14 | <% if (!secure) { %>
15 | "proxyTarget": "http://localhost:3333"
16 | <% } else { %>
17 | "proxyTarget": "https://localhost:3333"
18 | <% } %>
19 | }
20 |
--------------------------------------------------------------------------------
/app/templates/_.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | "env",
4 | "minify"
5 | ],
6 | "plugins": [
7 | "transform-object-rest-spread"
8 | ]
9 | }
10 |
--------------------------------------------------------------------------------
/app/templates/_.editorconfig:
--------------------------------------------------------------------------------
1 | # http://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | indent_style = space
6 | indent_size = 2
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.md]
12 | trim_trailing_whitespace = false
13 |
--------------------------------------------------------------------------------
/app/templates/_.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | coverage
3 | node_modules
4 | unit_coverage
5 | typings
6 |
--------------------------------------------------------------------------------
/app/templates/_.gitignore_ng2:
--------------------------------------------------------------------------------
1 | .idea/
2 | node_modules/
3 | unit_coverage/
4 | client/dev/**/*.js
5 | server/**/*.js
6 |
--------------------------------------------------------------------------------
/app/templates/_.gitignore_tsc:
--------------------------------------------------------------------------------
1 | .idea/
2 | node_modules/
3 | unit_coverage/
4 | server/**/*.js
5 |
--------------------------------------------------------------------------------
/app/templates/_.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "node": true,
3 | "esnext": true,
4 | "bitwise": true,
5 | "camelcase": true,
6 | "curly": true,
7 | "eqeqeq": true,
8 | "immed": true,
9 | "indent": 2,
10 | "latedef": true,
11 | "newcap": true,
12 | "noarg": true,
13 | "quotmark": "single",
14 | "undef": true,
15 | "unused": true,
16 | "strict": true,
17 | "browser": true,
18 | "globals": {
19 | "describe": false,
20 | "it": false,
21 | "before": false,
22 | "beforeEach": false,
23 | "after": false,
24 | "afterEach": false,
25 | "inject": false,
26 | "expect": false,
27 | "spyOn": false
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/templates/_.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 |
3 | node_js:
4 | - "5"
5 |
6 | before_script:
7 | - npm install -g gulp-cli mocha
8 | - npm run-script test-on-travis
9 | - "export DISPLAY=:99.0"
10 | - "sh -e /etc/init.d/xvfb start"
11 |
12 | script:
13 | - gulp coverage_frontend
14 | - npm run-script test-on-travis
15 |
16 | services: mongodb
17 |
--------------------------------------------------------------------------------
/app/templates/_README.md:
--------------------------------------------------------------------------------
1 | # <%= app %>
2 | [](https://travis-ci.org/<%= userNameSpace %>/<%= app %>)
3 | [](https://coveralls.io/r/<%= userNameSpace %>/<%= app %>/?branch=master)
4 |
--------------------------------------------------------------------------------
/app/templates/_gulpfile.babel.js:
--------------------------------------------------------------------------------
1 | require('require-dir')('tasks');
2 |
--------------------------------------------------------------------------------
/app/templates/_procfile.txt:
--------------------------------------------------------------------------------
1 | web: npm start
2 |
--------------------------------------------------------------------------------
/app/templates/_protractor.conf.js:
--------------------------------------------------------------------------------
1 | exports.config = {
2 | specs: ['./tests/e2e/**/*_test.js'],
3 | baseUrl: 'http://localhost:3333/'
4 | }
5 |
--------------------------------------------------------------------------------
/app/templates/_tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "commonjs",
4 | "moduleResolution": "node",
5 | "target": "es5",
6 | "sourceMap": true,
7 | "emitDecoratorMetadata": true,
8 | "experimentalDecorators": true,
9 | "noImplicitAny": false,
10 | "skipLibCheck": true
11 | },
12 | "exclude": [
13 | "node_modules",
14 | "typings"
15 | ],
16 | "filesGlob": [
17 | "**/*.ts",
18 | "typings/main",
19 | "typings/index.d.ts"
20 | ]
21 | }
22 |
--------------------------------------------------------------------------------
/app/templates/_typings_ng2.json:
--------------------------------------------------------------------------------
1 | {
2 | "globalDependencies": {
3 | "es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654",
4 | "jasmine": "registry:dt/jasmine#2.2.0+20160308082659"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/app/templates/_typings_ng2_and_tsc_server.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "bluebird": "registry:npm/bluebird#3.2.1+20160211005852",
4 | "lodash": "registry:npm/lodash#4.0.0+20160305082308"
5 | },
6 | "globalDependencies": {
7 | "es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654",
8 | "body-parser": "registry:dt/body-parser#0.0.0+20160112113357",
9 | "express": "registry:dt/express#4.0.0+20160317120654",
10 | "express-serve-static-core": "registry:dt/express-serve-static-core#0.0.0+20160322035842",
11 | "helmet": "registry:dt/helmet#0.0.0+20160112163250",
12 | "jasmine": "registry:dt/jasmine#2.2.0+20160308082659",
13 | "mime": "registry:dt/mime#0.0.0+20151204023458",
14 | "mongoose": "registry:dt/mongoose#3.8.5+20160316155526",
15 | "morgan": "registry:dt/morgan#1.2.2+20160104041339",
16 | "node": "registry:dt/node#4.0.0+20160311162451",
17 | "serve-static": "registry:dt/serve-static#0.0.0+20160104095738",
18 | "compression": "registry:dt/compression#0.0.0+20160501162003",
19 | "spdy": "registry:dt/spdy#3.4.3+20161005184000"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/templates/_typings_tsc_server.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "bluebird": "registry:npm/bluebird#3.2.1+20160211005852",
4 | "lodash": "registry:npm/lodash#4.0.0+20160305082308"
5 | },
6 | "globalDependencies": {
7 | "body-parser": "registry:dt/body-parser#0.0.0+20160112113357",
8 | "express": "registry:dt/express#4.0.0+20160208031452",
9 | "helmet": "registry:dt/helmet#0.0.0+20160112163250",
10 | "jasmine": "registry:dt/jasmine#2.2.0+20160308082659",
11 | "mime": "registry:dt/mime#0.0.0+20151204023458",
12 | "mongoose": "registry:dt/mongoose#3.8.5+20160209123716",
13 | "morgan": "registry:dt/morgan#1.2.2+20160104041339",
14 | "node": "registry:dt/node#4.0.0+20160311162451",
15 | "serve-static": "registry:dt/serve-static#0.0.0+20160104095738",
16 | "compression": "registry:dt/compression#0.0.0+20160501162003",
17 | "spdy": "registry:dt/spdy#3.4.3+20161005184000"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/templates/cert/ca.crt:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIICgTCCAeoCCQCbu4YUckO4EjANBgkqhkiG9w0BAQsFADCBhDELMAkGA1UEBhMC
3 | QVUxEzARBgNVBAgMClNvbWUtU3RhdGUxDTALBgNVBAcMBENpdHkxDjAMBgNVBAoM
4 | BUFsaXYhMRAwDgYDVQQLDAcwLjAuMC4wMRAwDgYDVQQDDAcwLjAuMC4wMR0wGwYJ
5 | KoZIhvcNAQkBFg55b3VyQGVtYWlsLmNvbTAeFw0xNjAzMTQxNDU3NDlaFw0yNjAz
6 | MTIxNDU3NDlaMIGEMQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEN
7 | MAsGA1UEBwwEQ2l0eTEOMAwGA1UECgwFQWxpdiExEDAOBgNVBAsMBzAuMC4wLjAx
8 | EDAOBgNVBAMMBzAuMC4wLjAxHTAbBgkqhkiG9w0BCQEWDnlvdXJAZW1haWwuY29t
9 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC3zBQEsk5FFM82Zw5lqfM4Tusn
10 | kQR4uXUNF7n5bQzVKRG4jtAZO6pH4QFVtNZZ8MmdbgxDT4e1vpnNH2DCuIFu+iem
11 | 27uMp3FPEcvr3P4BJM718C24THeK3B9XXFY3A16lw5AWkZNzNew6xK0Riuxv/+0z
12 | +lLqQvSjEP4hD5XdWQIDAQABMA0GCSqGSIb3DQEBCwUAA4GBALbWUrdducmvByt7
13 | 4B9aArwJpTpeNejP03vHOLKmGGk1RGQv+3/GwTuBSQL0VhpPHzsNeYBTGuGCNGVW
14 | d68qxBblXN6xxjgPWC7bIKSIvWZ7UVrNn3ALXnADTMVpo2GM/jBbyrswl8Nd4DOm
15 | m7xL0momhmWDCsbkCd4OXNnArMPf
16 | -----END CERTIFICATE-----
17 |
--------------------------------------------------------------------------------
/app/templates/cert/ca.csr:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE REQUEST-----
2 | MIIB9DCCAV0CAQAwgYQxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRl
3 | MQ0wCwYDVQQHDARDaXR5MQ4wDAYDVQQKDAVBbGl2ITEQMA4GA1UECwwHMC4wLjAu
4 | MDEQMA4GA1UEAwwHMC4wLjAuMDEdMBsGCSqGSIb3DQEJARYOeW91ckBlbWFpbC5j
5 | b20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALfMFASyTkUUzzZnDmWp8zhO
6 | 6yeRBHi5dQ0XufltDNUpEbiO0Bk7qkfhAVW01lnwyZ1uDENPh7W+mc0fYMK4gW76
7 | J6bbu4yncU8Ry+vc/gEkzvXwLbhMd4rcH1dcVjcDXqXDkBaRk3M17DrErRGK7G//
8 | 7TP6UupC9KMQ/iEPld1ZAgMBAAGgLzAUBgkqhkiG9w0BCQIxBwwFQWxpdiEwFwYJ
9 | KoZIhvcNAQkHMQoMCEl0c0FsaXZlMA0GCSqGSIb3DQEBCwUAA4GBAFFaMn2vvrp+
10 | zRYpcv4W+KRbZvQwBbSdpw7FcCDK0Hh0D/AYwQWLOn66pR+DfczdHSOKd4W9vwkC
11 | eanyRBFbKDYv3o3JG+rvRM6+rVrh122qDLabtUzsvuZI667twfoIYB9g93sjT0Zx
12 | PvezS863TzA9aSGr78PxAdj3i1do8Vcg
13 | -----END CERTIFICATE REQUEST-----
14 |
--------------------------------------------------------------------------------
/app/templates/cert/ca.key:
--------------------------------------------------------------------------------
1 | -----BEGIN RSA PRIVATE KEY-----
2 | Proc-Type: 4,ENCRYPTED
3 | DEK-Info: DES-EDE3-CBC,D708975DF96D564B
4 |
5 | ELsYF4Ix/FBJVCjFbbDKLrGYl0PSbtZJ1NzCuLgFQLYOtH/B6k/vPPFF3Q1yrAUf
6 | 74CWoQGtUBrx5alAc8I/t2IQTAGtrYpd3q8JB7K41Ki+7wLjVuXNZv7gF2+1emKu
7 | 3BDPGNvDyEukEwsM/nRlArgJAJuOsZ4NEGsHf6LaEjku26UeoPeR+c2K95tKU89b
8 | +vOjwo2I87jJPRhSiiiMRA/q7FerbIUrsVg17AlPO5+I5V7nk8JKP03ODr815tzu
9 | 1N/q9gTyUdV+0Nppvy8FgN2HZcI2f+q1dQfOksFhXv7WWaGlttCgAGA1TZRzvLY2
10 | D5FQg7bAMroCQhBQbTulIuyiiBMGOykQadRKI9MHLjZuCZpBG1Vl1YoQaMCumyy6
11 | /F7+Dp5lX7tEaDP7ALIkxQ3J3FuWVbh9IaTSUvcNTM8MdaRPzt5s7PxVuNbLkXOn
12 | THcOEp/2RSaDM0EQoCIaVEqysIKvObG/INni8jhI2v/a+rlc+f1/y81JvgIV6vjh
13 | KSaWZNSvhtA0QTFk9MbsTEJJJmq6wsQm52z02AyU5aAZ43ew4TglW3+GR2f851R6
14 | JsNJXtdb64BCOfyl/WDJhFcXGJHjk42wYaDkExNprBIc7Sz/IRPMjIlSkWAVGp6M
15 | yIthUsDU/ovf3pJqcdgKTt/9c7v2fItMS/YLiQKhWca/5wK7tmdIng8AGUICyuWb
16 | rpyCASRAQePKj5dqDRxkUVfI43AClSeAy3RQei3t4qjXi6c0iMBdlLt4nCd2dD59
17 | e+yW7KaeTjQSzqKq32PClcCXuL6Bw/ltoQ3JbPEr6ZsnfOHR3PT2Lw==
18 | -----END RSA PRIVATE KEY-----
19 |
--------------------------------------------------------------------------------
/app/templates/cert/server.crt:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIICgTCCAeoCCQDSnca52HRzHzANBgkqhkiG9w0BAQsFADCBhDELMAkGA1UEBhMC
3 | QVUxEzARBgNVBAgMClNvbWUtU3RhdGUxDTALBgNVBAcMBENpdHkxDjAMBgNVBAoM
4 | BUFsaXYhMRAwDgYDVQQLDAcwLjAuMC4wMRAwDgYDVQQDDAcwLjAuMC4wMR0wGwYJ
5 | KoZIhvcNAQkBFg55b3VyQGVtYWlsLmNvbTAeFw0xNjAzMTQxNTAxMDhaFw0yNjAz
6 | MTIxNTAxMDhaMIGEMQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEN
7 | MAsGA1UEBwwEQ2l0eTEOMAwGA1UECgwFQWxpdiExEDAOBgNVBAsMBzAuMC4wLjAx
8 | EDAOBgNVBAMMBzAuMC4wLjAxHTAbBgkqhkiG9w0BCQEWDnlvdXJAZW1haWwuY29t
9 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDbXw9yAWxJ/8eFjamyd9UP95p3
10 | Ku2DNeMRpouOGcneFTiVJedfFaG/aOhL8iZrr96vhSsdSCk1JMCdmY3CjKr6XDRD
11 | ktf7HOjrYzy+A0SkfIUsipZboIKyZFIsb8nYKuL+3RW8yueTQwm7+CTsUoedMNws
12 | 5FI4M8PvClahlwcvJwIDAQABMA0GCSqGSIb3DQEBCwUAA4GBAIuplVDtWiDsotsc
13 | uGw65nST4864k3+GwLML34nAT1hB3bjzu4ITIGz7viWXIfLV6niQXHTe2q3FoIj3
14 | FjXqaQXNEvb5D++eBLzZpi1BfedISXzaDZYoRRCP1or3rChnFB7t8yv1C2qgYeFj
15 | DZAb1e25eTIAhSZyRITCUIiOAVlg
16 | -----END CERTIFICATE-----
17 |
--------------------------------------------------------------------------------
/app/templates/cert/server.csr:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE REQUEST-----
2 | MIIB9DCCAV0CAQAwgYQxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRl
3 | MQ0wCwYDVQQHDARDaXR5MQ4wDAYDVQQKDAVBbGl2ITEQMA4GA1UECwwHMC4wLjAu
4 | MDEQMA4GA1UEAwwHMC4wLjAuMDEdMBsGCSqGSIb3DQEJARYOeW91ckBlbWFpbC5j
5 | b20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANtfD3IBbEn/x4WNqbJ31Q/3
6 | mncq7YM14xGmi44Zyd4VOJUl518Vob9o6EvyJmuv3q+FKx1IKTUkwJ2ZjcKMqvpc
7 | NEOS1/sc6OtjPL4DRKR8hSyKlluggrJkUixvydgq4v7dFbzK55NDCbv4JOxSh50w
8 | 3CzkUjgzw+8KVqGXBy8nAgMBAAGgLzAUBgkqhkiG9w0BCQIxBwwFQWxpdiEwFwYJ
9 | KoZIhvcNAQkHMQoMCEl0c0FsaXZlMA0GCSqGSIb3DQEBCwUAA4GBAIAJdL9+zBIQ
10 | CWk71pW/U71qFkSRK3sQTT6phDHmqvkrS742VOLgSWcRS0bNcRFqmImNzkjQk+mV
11 | 34jpnxBG0dW8WnNnb9HrrcLvLdYPKOwuDwsBuE1v527l4V4+uSp3/pEn92Z1Dgdu
12 | 5Zau1Ru7LG5ZrvgR53PTuy1qwz8e8Gz+
13 | -----END CERTIFICATE REQUEST-----
14 |
--------------------------------------------------------------------------------
/app/templates/cert/server.key:
--------------------------------------------------------------------------------
1 | -----BEGIN RSA PRIVATE KEY-----
2 | MIICWwIBAAKBgQDbXw9yAWxJ/8eFjamyd9UP95p3Ku2DNeMRpouOGcneFTiVJedf
3 | FaG/aOhL8iZrr96vhSsdSCk1JMCdmY3CjKr6XDRDktf7HOjrYzy+A0SkfIUsipZb
4 | oIKyZFIsb8nYKuL+3RW8yueTQwm7+CTsUoedMNws5FI4M8PvClahlwcvJwIDAQAB
5 | AoGAKqJp/Q07v5H/c/xZS78wYH8NvTVRndueOvL0UnS+n/Pd4FbShc9NdUbtRr1U
6 | LD+s9s3Z2EILCDIRYU/TlkkCfXOtx6mNJFGqbMDWaV2Lsa7PNzu8dIYyPF47uB+5
7 | 6O49IQNhnfIhlEcELzScHzhrVUBoNMOVQ3Xxx23kMK3pGbkCQQD5B/sX2WIV9W0N
8 | TvjA+dyF9EHZVxpni5W37Hkpkt17DnWJd0rUR2a6oiCM1pmLjBi4YmUXH/IYy2DE
9 | VL2sdLw9AkEA4YKZ5QAMKFxXVqYnbEcO5viqo1hK9RiV4W/DPnS1vpoLIqUxG/V8
10 | VWywC3e7BP8kUpR9DtGeA40E3R5mMgxbMwJABkIkFkpZQ7ICRpZYfAkLeLZVvU+K
11 | E1YXsiKYPOo69K+9VnIQCFuvAju207NE8pPXvzKB1d3wqJzb1rNGfQIGBQJAeHbs
12 | wMDqvbC+UyJFEvlOg6G4fbOPrygoAJpUYQu1fpEJe8Nk3XugpH1/+VBHTl8BRz/d
13 | Ikplr53oSDqR+xBQswJAbqE5/cMYBBO5ttuutryHs6Xc/WKJ2jkC1r5GMStmNE+p
14 | ZjsdgOoAMEKB97/foVrXEhDy67bc1htugN2j17Ls5w==
15 | -----END RSA PRIVATE KEY-----
16 |
--------------------------------------------------------------------------------
/app/templates/client/ng1/dev/app.config.js:
--------------------------------------------------------------------------------
1 | ;(function(ng) {
2 | "use strict";
3 |
4 | ng.module("<%= appName %>")
5 | .config([
6 | "$locationProvider",
7 | function($locationProvider) {
8 | <% if (!cordova) { %>
9 | $locationProvider.html5Mode(true).hashPrefix('!');
10 | <% } else { %>
11 | $locationProvider.html5Mode(false);
12 | <% } %>
13 | }
14 | ]);
15 | }(window.angular));
16 |
--------------------------------------------------------------------------------
/app/templates/client/ng1/dev/app.constant.js:
--------------------------------------------------------------------------------
1 | ;(function(ng) {
2 | "use strict";
3 |
4 | ng.module("<%= appName %>")
5 | .constant('BASE_API', '/api/');
6 | }(window.angular));
7 |
--------------------------------------------------------------------------------
/app/templates/client/ng1/dev/app.js:
--------------------------------------------------------------------------------
1 | ;(function(ng) {
2 | "use strict";
3 |
4 | ng.module("<%= appName %>", [
5 | "ngRoute"
6 | ]);
7 | }(window.angular));
8 |
--------------------------------------------------------------------------------
/app/templates/client/ng1/dev/app.route.js:
--------------------------------------------------------------------------------
1 | ;(function(ng) {
2 | "use strict";
3 |
4 | ng.module("<%= appName %>")
5 | .config([
6 | "$routeProvider",
7 | function($routeProvider) {
8 | $routeProvider
9 | .when("/", {
10 | templateUrl: "todo/templates/todo.html",
11 | controller: "TodoController",
12 | controllerAs: "todoCtrl"
13 | })
14 | .otherwise({
15 | redirectTo: "/"
16 | });
17 | }
18 | ]);
19 | }(window.angular));
20 |
--------------------------------------------------------------------------------
/app/templates/client/ng1/dev/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/client/ng1/dev/favicon.png
--------------------------------------------------------------------------------
/app/templates/client/ng1/dev/todo/controllers/todo-controller.js:
--------------------------------------------------------------------------------
1 | ;(function(ng) {
2 | "use strict";
3 |
4 | ng.module("<%= appName %>")
5 | .controller("TodoController", [
6 | "$log",
7 | "Todo",
8 | "TodoDAO",
9 | function($log, Todo, TodoDAO) {
10 | this.todo = new Todo();
11 | this.todos = [];
12 | this.title = "Angular1 Todo";
13 |
14 | this.createTodo = function(todo) {
15 | TodoDAO.createTodo(todo)
16 | .then((newTodo) => {
17 | this.todos.push(newTodo);
18 | this.todo = new Todo();
19 | })
20 | .catch($log.error);
21 | };
22 |
23 | this.deleteTodo = function(id) {
24 | TodoDAO.deleteTodo(id)
25 | .then(() => {
26 | return TodoDAO.getAll()
27 | .then((todos) => {
28 | return this.todos = todos;
29 | });
30 | })
31 | .catch($log.error);
32 | };
33 |
34 | ;(() => {
35 | return TodoDAO.getAll()
36 | .then((todos) => {
37 | return this.todos = todos;
38 | })
39 | .catch($log.error);
40 | })();
41 | }
42 | ]);
43 | }(window.angular));
44 |
--------------------------------------------------------------------------------
/app/templates/client/ng1/dev/todo/models/todo-model.js:
--------------------------------------------------------------------------------
1 | ;(function(ng) {
2 | "use strict";
3 |
4 | ng.module("<%= appName %>")
5 | .factory("Todo", [function() {
6 | const MIN_ACCEPTED_LENGTH = 5;
7 |
8 | class Todo {
9 | constructor(t) {
10 | this.todoMessage = null;
11 | ng.extend(this, t);
12 | }
13 |
14 | isValid() {
15 | let _isDefined = ng.isDefined(this.todoMessage);
16 | let _isString = ng.isString(this.todoMessage);
17 | let _isBigEnough = (_isDefined && _isString) ? this.todoMessage.length >= MIN_ACCEPTED_LENGTH : false;
18 |
19 | return _isDefined && _isString && _isBigEnough;
20 | }
21 | }
22 |
23 | return Todo;
24 | }]);
25 | }(window.angular));
26 |
--------------------------------------------------------------------------------
/app/templates/client/ng1/dev/todo/templates/todo.html:
--------------------------------------------------------------------------------
1 |
25 |
--------------------------------------------------------------------------------
/app/templates/client/ng2/dev/app.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from "@angular/core";
2 | import { HttpModule } from "@angular/http";
3 | import { FormsModule, FormBuilder } from "@angular/forms";
4 | import { BrowserModule } from "@angular/platform-browser";
5 | import { App } from "./app";
6 | import { TodoCmp } from "./todo/components/todo-cmp";
7 | import { todoRouting } from "./todo/components/todo-route";
8 | import { TodoService } from "./todo/services/todo-service";
9 |
10 | @NgModule({
11 | imports: [
12 | BrowserModule,
13 | FormsModule,
14 | HttpModule,
15 | todoRouting
16 | ],
17 | declarations: [
18 | App,
19 | TodoCmp,
20 | ],
21 | providers: [
22 | TodoService,
23 | ],
24 | bootstrap: [
25 | App,
26 | ],
27 | })
28 | export class AppModule {}
29 |
--------------------------------------------------------------------------------
/app/templates/client/ng2/dev/app.ts:
--------------------------------------------------------------------------------
1 | import {
2 | Component
3 | } from "@angular/core";
4 |
5 | @Component({
6 | selector: "app",
7 | template: `
8 |
9 | `
10 | })
11 | export class App {
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/app/templates/client/ng2/dev/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | ng2do
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/templates/client/ng2/dev/index.ts:
--------------------------------------------------------------------------------
1 | import {
2 | platformBrowserDynamic
3 | } from "@angular/platform-browser-dynamic";
4 |
5 | import {
6 | AppModule
7 | } from "./app.module";
8 |
9 | platformBrowserDynamic().bootstrapModule(AppModule);
10 |
--------------------------------------------------------------------------------
/app/templates/client/ng2/dev/polyfills.ts:
--------------------------------------------------------------------------------
1 | import 'core-js/es6';
2 | import 'core-js/es7/reflect';
3 | require('zone.js/dist/zone');
4 |
5 | if (process.env.ENV !== 'production') {
6 | Error['stackTraceLimit'] = Infinity;
7 | require('zone.js/dist/long-stack-trace-zone');
8 | }
--------------------------------------------------------------------------------
/app/templates/client/ng2/dev/todo/components/todo-route.ts:
--------------------------------------------------------------------------------
1 | import {
2 | Routes,
3 | RouterModule
4 | } from "@angular/router";
5 |
6 | import {
7 | TodoCmp
8 | } from "../components/todo-cmp";
9 |
10 | const todoRoutes:Routes = [
11 | {
12 | path: "",
13 | component: TodoCmp,
14 | pathMatch: "full"
15 | }
16 | ]
17 |
18 | export const todoRouting = RouterModule.forRoot(todoRoutes);
19 |
--------------------------------------------------------------------------------
/app/templates/client/ng2/dev/todo/templates/todo.html:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
22 |
{{todo.todoMessage}}
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/templates/client/ng2/dev/vendor.ts:
--------------------------------------------------------------------------------
1 | import '@angular/platform-browser';
2 | import '@angular/platform-browser-dynamic';
3 | import '@angular/core';
4 | import '@angular/common';
5 | import '@angular/http';
6 | import '@angular/router';
7 |
8 | import 'rxjs';
9 |
--------------------------------------------------------------------------------
/app/templates/client/vue2/dev/app.config.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/client/vue2/dev/app.config.js
--------------------------------------------------------------------------------
/app/templates/client/vue2/dev/app.constant.js:
--------------------------------------------------------------------------------
1 | export const BASE_API = '/api/'
--------------------------------------------------------------------------------
/app/templates/client/vue2/dev/app.route.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import VueRouter from 'vue-router'
3 | import TodoCmp from './todo/components/todo-cmp'
4 |
5 | Vue.use(VueRouter)
6 |
7 | export default new VueRouter({
8 | mode: 'history',
9 | routes: [
10 | {path: '/', component: TodoCmp},
11 | ]
12 | })
13 |
--------------------------------------------------------------------------------
/app/templates/client/vue2/dev/app.store.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 |
4 | Vue.use(Vuex)
5 |
6 | export default new Vuex.Store({
7 | state: {
8 |
9 | },
10 | mutations: {
11 |
12 | },
13 | getters: {
14 |
15 | },
16 | actions: {
17 |
18 | }
19 | })
--------------------------------------------------------------------------------
/app/templates/client/vue2/dev/app.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/app/templates/client/vue2/dev/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | vue2do
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/templates/client/vue2/dev/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import router from './app.route'
3 | import store from './app.store'
4 | import AppCmp from './app'
5 |
6 | new Vue({
7 | router,
8 | store,
9 | render: h => h(AppCmp),
10 | }).$mount('#app')
11 |
--------------------------------------------------------------------------------
/app/templates/index_babel.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | require('babel-core/register');
4 | require('babel-regenerator-runtime');
5 |
6 | require('./server');
7 |
--------------------------------------------------------------------------------
/app/templates/index_node.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | require('./server');
4 |
--------------------------------------------------------------------------------
/app/templates/index_tsc.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | require('./server');
4 |
--------------------------------------------------------------------------------
/app/templates/server/go/echo/api/todo/controller/todocontroller.go:
--------------------------------------------------------------------------------
1 | package todocontroller
2 |
3 | import (
4 | "<%= repoHostUrl %>/<%= userNameSpace %>/<%= appName %>/server/api/todo/dao"
5 | todo "<%= repoHostUrl %>/<%= userNameSpace %>/<%= appName %>/server/api/todo/model"
6 | "github.com/labstack/echo"
7 | "net/http"
8 | )
9 |
10 | func GetAll(c echo.Context) error {
11 | ts, _ := tododao.All()
12 |
13 | return c.JSON(http.StatusOK, ts)
14 | }
15 |
16 | func GetById(c echo.Context) error {
17 | id := c.Param("id")
18 |
19 | nt, _ := tododao.GetById(id)
20 |
21 | return c.JSON(http.StatusOK, nt)
22 | }
23 |
24 | func NewTodo(c echo.Context) error {
25 | t := new(todo.Todo)
26 |
27 | c.Bind(t)
28 |
29 | nt, _ := tododao.NewTodo(*t)
30 |
31 | return c.JSON(http.StatusOK, nt)
32 | }
33 |
34 | func RemoveTodo(c echo.Context) error {
35 | id := c.Param("id")
36 |
37 | tododao.DeleteTodo(id)
38 |
39 | return c.String(http.StatusOK, "")
40 | }
41 |
--------------------------------------------------------------------------------
/app/templates/server/go/echo/api/todo/controller/todocontroller_test.go:
--------------------------------------------------------------------------------
1 | package todocontroller
2 |
--------------------------------------------------------------------------------
/app/templates/server/go/echo/api/todo/model/todomodel.go:
--------------------------------------------------------------------------------
1 | package todomodel
2 |
3 | import (
4 | "time"
5 |
6 | "gopkg.in/mgo.v2/bson"
7 | )
8 |
9 | type Todo struct {
10 | Id bson.ObjectId `json:"_id,omitempty" bson:"_id,omitempty"`
11 | TodoMessage string `json:"todoMessage,omitempty" bson:"todoMessage"`
12 | CreatedAt time.Time `json:"createdAt,omitempty" bson:"createdAt"`
13 | }
14 |
15 | func (t Todo) IsValid() bool {
16 | if l := len(t.TodoMessage); l > 4 {
17 | return true
18 | }
19 |
20 | return false
21 | }
22 |
23 | type Todos []Todo
24 |
--------------------------------------------------------------------------------
/app/templates/server/go/echo/api/todo/model/todomodel_test.go:
--------------------------------------------------------------------------------
1 | package todomodel
2 |
3 | import (
4 | "testing"
5 | "time"
6 |
7 | "github.com/stretchr/testify/assert"
8 | "gopkg.in/mgo.v2/bson"
9 | )
10 |
11 | var testsModel = []struct {
12 | in Todo
13 | out bool
14 | }{
15 | {
16 | in: Todo{bson.NewObjectId(), "", time.Now()},
17 | out: false,
18 | },
19 | {
20 | in: Todo{bson.NewObjectId(), "sml", time.Now()},
21 | out: false,
22 | },
23 | {
24 | in: Todo{bson.NewObjectId(), "biggggg", time.Now()},
25 | out: true,
26 | },
27 | {
28 | in: Todo{bson.NewObjectId(), "juste", time.Now()},
29 | out: true,
30 | },
31 | {
32 | in: Todo{bson.NewObjectId(), "1231231321", time.Now()},
33 | out: true,
34 | },
35 | {
36 | in: Todo{bson.NewObjectId(), "12312313211231231321123123132112312313211231231321123123132", time.Now()},
37 | out: true,
38 | },
39 | }
40 |
41 | func TestIsValid(t *testing.T) {
42 | for _, _test := range testsModel {
43 | assert.Equal(t, _test.out, _test.in.IsValid())
44 | }
45 | }
46 |
47 | func BenchmarkIsValid(b *testing.B) {
48 | t := Todo{bson.NewObjectId(), "", time.Now()}
49 |
50 | for i := 0; i < b.N; i++ {
51 | t.IsValid()
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/app/templates/server/go/echo/api/todo/route/todoroute.go:
--------------------------------------------------------------------------------
1 | package todoroute
2 |
3 | import (
4 | "<%= repoHostUrl %>/<%= userNameSpace %>/<%= appName %>/server/api/todo/controller"
5 | "github.com/labstack/echo"
6 | )
7 |
8 | func Init(e *echo.Echo) {
9 | e.GET("/api/todos", todocontroller.GetAll)
10 | e.GET("/api/todos/:id", todocontroller.GetById)
11 | e.POST("/api/todos", todocontroller.NewTodo)
12 | e.DELETE("/api/todos/:id", todocontroller.RemoveTodo)
13 | }
14 |
--------------------------------------------------------------------------------
/app/templates/server/go/echo/api/todo/route/todoroute_test.go:
--------------------------------------------------------------------------------
1 | package todoroute
2 |
--------------------------------------------------------------------------------
/app/templates/server/go/echo/common/static/static.go:
--------------------------------------------------------------------------------
1 | package static
2 |
3 | import (
4 | "os"
5 |
6 | "github.com/labstack/echo"
7 | "github.com/labstack/echo/middleware"
8 | )
9 |
10 | func Init(e *echo.Echo) {
11 | e.Use(middleware.Static("node_modules"))
12 |
13 | if env := os.Getenv("GO_ENV"); env == "" {
14 | e.Use(middleware.Static("client/dev"))
15 | } else {
16 | e.Use(middleware.Static("client/dist"))
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/templates/server/go/echo/common/static/static_test.go:
--------------------------------------------------------------------------------
1 | package static
2 |
--------------------------------------------------------------------------------
/app/templates/server/go/echo/config/dbconfig.go:
--------------------------------------------------------------------------------
1 | package dbconfig
2 |
3 | import (
4 | "os"
5 |
6 | "gopkg.in/mgo.v2"
7 | )
8 |
9 | type DB struct {
10 | Session *mgo.Session
11 | }
12 |
13 | func (db *DB) DoDial() (s *mgo.Session, err error) {
14 | return mgo.Dial(DBUrl())
15 | }
16 |
17 | func (db *DB) Name() string {
18 | return "<%= appName %>"
19 | }
20 |
21 | func DBUrl() string {
22 | dburl := os.Getenv("MONGOHQ_URL")
23 |
24 | if dburl == "" {
25 | dburl = "localhost"
26 | }
27 |
28 | return dburl
29 | }
30 |
--------------------------------------------------------------------------------
/app/templates/server/go/echo/config/dbconfig_test.go:
--------------------------------------------------------------------------------
1 | package dbconfig
2 |
3 | import (
4 | "os"
5 | "testing"
6 |
7 | "github.com/stretchr/testify/assert"
8 | )
9 |
10 | var db DB = DB{}
11 |
12 | func cleanEnv() {
13 | os.Setenv("MONGOHQ_URL", "")
14 | }
15 |
16 | func TestGetDbUrl(t *testing.T) {
17 |
18 | assert.Equal(t, "localhost", DBUrl())
19 |
20 | os.Setenv("MONGOHQ_URL", "abc")
21 |
22 | assert.Equal(t, "abc", DBUrl())
23 |
24 | cleanEnv()
25 | }
26 |
27 | func TestDBName(t *testing.T) {
28 | assert.Equal(t, "<%= appName %>", db.Name())
29 | }
30 |
31 | func BenchmarkDoDial(b *testing.B) {
32 | for i := 0; i < b.N; i++ {
33 | db.DoDial()
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/templates/server/go/echo/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "<%= repoHostUrl %>/<%= userNameSpace %>/<%= appName %>/server/routes"
6 | "github.com/labstack/echo"
7 | )
8 |
9 | const port string = ":3333"
10 |
11 | func main() {
12 | fmt.Printf("Running at %v\n", port)
13 |
14 | e := echo.New()
15 |
16 | routes.Init(e)
17 |
18 | err := e.Start(port)
19 |
20 | if err != nil {
21 | panic(err)
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/templates/server/go/echo/main_http2.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "<%= repoHostUrl %>/<%= userNameSpace %>/<%= appName %>/server/routes"
6 | "github.com/labstack/echo"
7 | )
8 |
9 | const port string = ":3333"
10 |
11 | func main() {
12 | fmt.Printf("Running at %v\n", port)
13 |
14 | e := echo.New()
15 |
16 | routes.Init(e)
17 |
18 | err := e.StartTLS(port, "server/cert/server.crt", "server/cert/server.key")
19 |
20 | if err != nil {
21 | panic(err)
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/templates/server/go/echo/routes/routes.go:
--------------------------------------------------------------------------------
1 | package routes
2 |
3 | import (
4 | "compress/gzip"
5 | "<%= repoHostUrl %>/<%= userNameSpace %>/<%= appName %>/server/api/todo/route"
6 | <% if (!differentStaticServer) {%>
7 | "<%= repoHostUrl %>/<%= userNameSpace %>/<%= appName %>/server/common/static"
8 | <% } %>
9 | "github.com/labstack/echo"
10 | "github.com/labstack/echo/middleware"
11 | )
12 |
13 | func Init(e *echo.Echo) {
14 | e.Pre(middleware.RemoveTrailingSlash())
15 | e.Use(middleware.GzipWithConfig(middleware.GzipConfig{
16 | Level: gzip.BestCompression,
17 | }))
18 | <% if (!differentStaticServer) {%>
19 | static.Init(e)
20 | <% } %>
21 | todoroute.Init(e)
22 | }
23 |
--------------------------------------------------------------------------------
/app/templates/server/go/echo/routes/routes_test.go:
--------------------------------------------------------------------------------
1 | package routes
2 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express/api/todo/controller/todo-controller.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const TodoDAO = require("../dao/todo-dao");
4 |
5 | module.exports = class TodoController {
6 | static getAll(req, res) {
7 | TodoDAO
8 | .getAll()
9 | .then(todos => res.status(200).json(todos))
10 | .catch(error => res.status(400).json(error));
11 | }
12 |
13 | static getById(req, res) {
14 | TodoDAO
15 | .getById(req.params.id)
16 | .then(todo => res.status(200).json(todo))
17 | .catch(error => res.status(400).json(error));
18 | }
19 |
20 | static createTodo(req, res) {
21 | let _todo = req.body;
22 |
23 | TodoDAO
24 | .createTodo(_todo)
25 | .then(todo => res.status(201).json(todo))
26 | .catch(error => res.status(400).json(error));
27 | }
28 |
29 | static deleteTodo(req, res) {
30 | let _id = req.params.id;
31 |
32 | TodoDAO
33 | .deleteTodo(_id)
34 | .then(() => res.status(200).end())
35 | .catch(error => res.status(400).json(error));
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express/api/todo/controller/todo-controller_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/express/server_node_express/api/todo/controller/todo-controller_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express/api/todo/model/todo-model.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const mongoose = require("mongoose");
4 |
5 | const _todoSchema = {
6 | todoMessage: {type: String, required: true, trim: true},
7 | createdAt: {type: Date, default: Date.now}
8 | }
9 |
10 | module.exports = mongoose.Schema(_todoSchema);
11 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express/api/todo/model/todo-model_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/express/server_node_express/api/todo/model/todo-model_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express/api/todo/route/todo-route.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const TodoController = require("../controller/todo-controller");
4 |
5 | module.exports = class TodoRoutes {
6 | static init(router) {
7 | router
8 | .route("/api/todos")
9 | .get(TodoController.getAll)
10 | .post(TodoController.createTodo);
11 |
12 | router
13 | .route("/api/todos/:id")
14 | .delete(TodoController.deleteTodo);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express/api/todo/route/todo-route_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/express/server_node_express/api/todo/route/todo-route_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express/auth/local/index.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/express/server_node_express/auth/local/index.js
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express/commons/static/index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const fs = require("fs");
4 | const path = require("path");
5 |
6 | module.exports = class StaticDispatcher {
7 | static sendIndex(req, res) {
8 | const _root = process.cwd();
9 | const _env = process.env.NODE_ENV;
10 | const _folder = _env === "production" ? "dist" : "dev";
11 |
12 | res.type(".html");
13 |
14 | fs.createReadStream(path.join(`${_root}/client/${_folder}/index.html`)).pipe(res);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express/config/db.conf.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const mongoose = require("mongoose");
4 | const Promise = require("bluebird");
5 | const dbConst = require("../constants/db.json");
6 |
7 | module.exports = class DBConfig {
8 | static init() {
9 | const URL = (process.env.NODE_ENV === "production") ? process.env.MONGOHQ_URL
10 | : dbConst.localhost;
11 |
12 | mongoose.Promise = Promise;
13 | mongoose.connect(URL);
14 | mongoose.connection.on("error", console.error.bind(console, "An error ocurred with the DB connection: "));
15 | }
16 | };
17 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express/config/db.conf.test.js:
--------------------------------------------------------------------------------
1 | import Todo from "../api/todo/dao/todo-dao";
2 | import dbJson from "./db.test.json";
3 | import Promise from 'bluebird';
4 |
5 | exports.setupMongoose = (mongoose, done) => {
6 | mongoose.Promise = Promise;
7 | mongoose.models = {};
8 | mongoose.connection.on("error", () => {});
9 | mongoose.connect(dbJson.db.test.url, done);
10 | }
11 |
12 | exports.createTodos = () => {
13 | let _array = [];
14 |
15 | for (let i = 0; i < 10; i++) {
16 | _array.push({_id: "507c7f79bcf86cd7994f6c"+ (i + 10), todoMessage: "aaaaaaa"+i});
17 | }
18 |
19 | return Todo.create(_array);
20 | }
21 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express/config/db.test.json:
--------------------------------------------------------------------------------
1 | {
2 | "db": {
3 | "test": {
4 | "url": "mongodb://localhost/<%= appName %>_test"
5 | }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express/config/routes.conf.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const morgan = require("morgan");
4 | const bodyParser = require("body-parser");
5 | const helmet = require("helmet");
6 | const express = require("express");
7 | const compression = require("compression");
8 | const zlib = require("zlib");
9 |
10 | module.exports = class RouteConfig {
11 | static init(application) {
12 | let _root = process.cwd();
13 | let _nodeModules = "/node_modules/";
14 | let _clientFiles = (process.env.NODE_ENV === "production") ? "/client/dist/" : "/client/dev/";
15 |
16 | application.use(compression({
17 | level: zlib.Z_BEST_COMPRESSION,
18 | threshold: "1kb"
19 | }));
20 |
21 | application.use(express.static(_root + _nodeModules));
22 | application.use(express.static(_root + _clientFiles));
23 | application.use(bodyParser.json());
24 | application.use(morgan("dev"));
25 | application.use(helmet());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express/constants/db.json:
--------------------------------------------------------------------------------
1 | {
2 | "localhost": "mongodb://localhost/<%= appName %>"
3 | }
4 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express/routes/index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const TodoRoutes = require("../api/todo/route/todo-route");
4 | <% if (!differentStaticServer) {%>
5 | const StaticDispatcher = require("../commons/static/index");
6 | <% } %>
7 |
8 | module.exports = class Routes {
9 | static init(app, router) {
10 | TodoRoutes.init(router);
11 | <% if (!differentStaticServer) { %>
12 | router
13 | .route("*")
14 | .get(StaticDispatcher.sendIndex);
15 | <% } %>
16 |
17 | app.use("/", router);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express/server.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const PORT = process.env.PORT || 3333;
4 |
5 | const os = require("os");
6 | const http = require("http");
7 | const express = require("express");
8 | const RoutesConfig = require("./config/routes.conf");
9 | const DBConfig = require("./config/db.conf");
10 | const Routes = require("./routes/index");
11 |
12 | const app = express();
13 |
14 | RoutesConfig.init(app);
15 | DBConfig.init();
16 | Routes.init(app, express.Router());
17 |
18 | http.createServer(app)
19 | .listen(PORT, () => {
20 | console.log(`up and running @: ${os.hostname()} on port: ${PORT}`);
21 | console.log(`enviroment: ${process.env.NODE_ENV}`);
22 | });
23 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express/server_http2.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const PORT = process.env.PORT || 3333;
4 |
5 | const os = require("os");
6 | const http2 = require("spdy");
7 | const express = require("express");
8 | const fs = require("fs");
9 | const RoutesConfig = require("./config/routes.conf");
10 | const DBConfig = require("./config/db.conf");
11 | const Routes = require("./routes/index");
12 |
13 | const app = express();
14 |
15 | RoutesConfig.init(app);
16 | DBConfig.init();
17 | Routes.init(app, express.Router());
18 |
19 | const opts = {
20 | key: fs.readFileSync(__dirname + "/cert/server.key"),
21 | cert: fs.readFileSync(__dirname + "/cert/server.crt")
22 | }
23 |
24 | http2.createServer(opts, app)
25 | .listen(PORT, () => {
26 | console.log(`up and running @: ${os.hostname()} on port: ${PORT}`);
27 | console.log(`enviroment: ${process.env.NODE_ENV}`);
28 | });
29 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_babel/api/todo/controller/todo-controller.js:
--------------------------------------------------------------------------------
1 | import TodoDAO from "../dao/todo-dao";
2 |
3 | export default class TodoController {
4 | static getAll(req, res) {
5 | TodoDAO
6 | .getAll()
7 | .then(todos => res.status(200).json(todos))
8 | .catch(error => res.status(400).json(error));
9 | }
10 |
11 | static getById(req, res) {
12 | TodoDAO
13 | .getById(req.params.id)
14 | .then(todo => res.status(200).json(todo))
15 | .catch(error => res.status(400).json(error));
16 | }
17 |
18 | static createTodo(req, res) {
19 | let _todo = req.body;
20 |
21 | TodoDAO
22 | .createTodo(_todo)
23 | .then(todo => res.status(201).json(todo))
24 | .catch(error => res.status(400).json(error));
25 | }
26 |
27 | static deleteTodo(req, res) {
28 | let _id = req.params.id;
29 |
30 | TodoDAO
31 | .deleteTodo(_id)
32 | .then(() => res.status(200).end())
33 | .catch(error => res.status(400).json(error));
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_babel/api/todo/controller/todo-controller_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/express/server_node_express_babel/api/todo/controller/todo-controller_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_babel/api/todo/model/todo-model.js:
--------------------------------------------------------------------------------
1 | import mongoose from "mongoose";
2 |
3 | const _todoSchema = {
4 | todoMessage: {type: String, required: true, trim: true},
5 | createdAt: {type: Date, default: Date.now}
6 | }
7 |
8 | export default mongoose.Schema(_todoSchema);
9 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_babel/api/todo/model/todo-model_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/express/server_node_express_babel/api/todo/model/todo-model_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_babel/api/todo/route/todo-route.js:
--------------------------------------------------------------------------------
1 | import TodoController from "../controller/todo-controller";
2 |
3 | export default class TodoRoutes {
4 | static init(router) {
5 | router
6 | .route("/api/todos")
7 | .get(TodoController.getAll)
8 | .post(TodoController.createTodo);
9 |
10 | router
11 | .route("/api/todos/:id")
12 | .delete(TodoController.deleteTodo);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_babel/api/todo/route/todo-route_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/express/server_node_express_babel/api/todo/route/todo-route_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_babel/auth/local/index.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/express/server_node_express_babel/auth/local/index.js
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_babel/commons/static/index.js:
--------------------------------------------------------------------------------
1 | import fs from "fs";
2 | import path from "path";
3 |
4 | export default class StaticDispatcher {
5 | static sendIndex(req, res) {
6 | const _root = process.cwd();
7 | const _env = process.env.NODE_ENV;
8 | const _folder = _env === "production" ? "dist" : "dev";
9 |
10 | res.type(".html");
11 |
12 | fs.createReadStream(path.join(`${_root}/client/${_folder}/index.html`)).pipe(res);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_babel/config/db.conf.js:
--------------------------------------------------------------------------------
1 | import mongoose from "mongoose";
2 | import Promise from "bluebird";
3 | import dbConst from "../constants/db.json";
4 |
5 | export default class DBConfig {
6 | static init() {
7 | const URL = (process.env.NODE_ENV === "production") ? process.env.MONGOHQ_URL
8 | : dbConst.localhost;
9 |
10 | mongoose.Promise = Promise;
11 | mongoose.connect(URL);
12 | mongoose.connection.on("error", console.error.bind(console, "An error ocurred with the DB connection: "));
13 | }
14 | };
15 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_babel/config/db.conf.test.js:
--------------------------------------------------------------------------------
1 | import Todo from "../api/todo/dao/todo-dao";
2 | import dbJson from "./db.json";
3 | import Promise from 'bluebird';
4 |
5 | exports.setupMongoose = (mongoose, done) => {
6 | mongoose.Promise = Promise;
7 | mongoose.models = {};
8 | mongoose.connection.on("error", () => {});
9 | mongoose.connect(dbJson.db.test.url, done);
10 | }
11 |
12 | exports.createTodos = () => {
13 | let _array = [];
14 |
15 | for (let i = 0; i < 10; i++) {
16 | _array.push({_id: "507c7f79bcf86cd7994f6c"+ (i + 10), todoMessage: "aaaaaaa"+i});
17 | }
18 |
19 | return Todo.create(_array);
20 | }
21 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_babel/config/db.test.json:
--------------------------------------------------------------------------------
1 | {
2 | "db": {
3 | "test": {
4 | "url": "mongodb://localhost/<%= appName %>_test"
5 | }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_babel/config/routes.conf.js:
--------------------------------------------------------------------------------
1 | import morgan from "morgan";
2 | import bodyParser from "body-parser";
3 | import helmet from "helmet";
4 | import express from "express";
5 | import compression from "compression";
6 | import zlib from "zlib";
7 |
8 | export default class RouteConfig {
9 | static init(application) {
10 | let _root = process.cwd();
11 | let _nodeModules = "/node_modules/";
12 | let _clientFiles = (process.env.NODE_ENV === "production") ? "/client/dist/" : "/client/dev/";
13 |
14 | application.use(compression({
15 | level: zlib.Z_BEST_COMPRESSION,
16 | threshold: "1kb"
17 | }));
18 |
19 | application.use(express.static(_root + _nodeModules));
20 | application.use(express.static(_root + _clientFiles));
21 | application.use(bodyParser.json());
22 | application.use(morgan("dev"));
23 | application.use(helmet());
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_babel/constants/db.json:
--------------------------------------------------------------------------------
1 | {
2 | "localhost": "mongodb://localhost/<%= appName %>"
3 | }
4 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_babel/routes/index.js:
--------------------------------------------------------------------------------
1 | import TodoRoutes from "../api/todo/route/todo-route";
2 | <% if (!differentStaticServer) { %>
3 | import StaticDispatcher from "../commons/static/index";
4 | <% } %>
5 |
6 | export default class Routes {
7 | static init(app, router) {
8 | TodoRoutes.init(router);
9 | <% if (!differentStaticServer) { %>
10 | router
11 | .route("*")
12 | .get(StaticDispatcher.sendIndex);
13 | <% } %>
14 |
15 | app.use("/", router);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_babel/server.js:
--------------------------------------------------------------------------------
1 | const PORT = process.env.PORT || 3333;
2 |
3 | import os from "os";
4 | import express from "express";
5 | import http from "http";
6 | import RoutesConfig from "./config/routes.conf";
7 | import DBConfig from "./config/db.conf";
8 | import Routes from "./routes/index";
9 |
10 | const app = express();
11 |
12 | RoutesConfig.init(app);
13 | DBConfig.init();
14 | Routes.init(app, express.Router());
15 |
16 | http.createServer(app)
17 | .listen(PORT, () => {
18 | console.log(`up and running @: ${os.hostname()} on port: ${PORT}`);
19 | console.log(`enviroment: ${process.env.NODE_ENV}`);
20 | });
21 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_babel/server_http2.js:
--------------------------------------------------------------------------------
1 | const PORT = process.env.PORT || 3333;
2 |
3 | import os from "os";
4 | import express from "express";
5 | import http2 from "spdy";
6 | import fs from "fs";
7 | import RoutesConfig from "./config/routes.conf";
8 | import DBConfig from "./config/db.conf";
9 | import Routes from "./routes/index";
10 |
11 | const app = express();
12 |
13 | RoutesConfig.init(app);
14 | DBConfig.init();
15 | Routes.init(app, express.Router());
16 |
17 | const opts = {
18 | key: fs.readFileSync(__dirname + "/cert/server.key"),
19 | cert: fs.readFileSync(__dirname + "/cert/server.crt")
20 | }
21 |
22 | http2.createServer(opts, app)
23 | .listen(PORT, () => {
24 | console.log(`up and running @: ${os.hostname()} on port: ${PORT}`);
25 | console.log(`enviroment: ${process.env.NODE_ENV}`);
26 | });
27 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_typescript/api/todo/controller/todo-controller.ts:
--------------------------------------------------------------------------------
1 | import * as express from "express";
2 | import TodoDAO from "../dao/todo-dao";
3 |
4 | export class TodoController {
5 | static getAll(req: express.Request, res: express.Response): void {
6 | TodoDAO
7 | ["getAll"]()
8 | .then(todos => res.status(200).json(todos))
9 | .catch(error => res.status(400).json(error));
10 | }
11 |
12 | static getById(req: express.Request, res: express.Response):void {
13 | TodoDAO
14 | ["getById"](req.params.id)
15 | .then(todo => res.status(200).json(todo))
16 | .catch(error => res.status(400).json(error));
17 | }
18 |
19 | static createTodo(req: express.Request, res: express.Response):void {
20 | let _todo = req.body;
21 |
22 | TodoDAO
23 | ["createTodo"](_todo)
24 | .then(todo => res.status(201).json(todo))
25 | .catch(error => res.status(400).json(error));
26 | }
27 |
28 | static deleteTodo(req: express.Request, res: express.Response): void {
29 | let _id = req.params.id;
30 |
31 | TodoDAO
32 | ["deleteTodo"](_id)
33 | .then(() => res.status(200).end())
34 | .catch(error => res.status(400).json(error));
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_typescript/api/todo/controller/todo-controller_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/express/server_node_express_typescript/api/todo/controller/todo-controller_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_typescript/api/todo/model/todo-model.ts:
--------------------------------------------------------------------------------
1 | import * as mongoose from "mongoose";
2 |
3 | let schema = new mongoose.Schema({
4 | todoMessage: {type: String, required: true, trim: true},
5 | createdAt: {type: Date, default: Date.now}
6 | });
7 |
8 | export default schema;
9 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_typescript/api/todo/model/todo-model_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/express/server_node_express_typescript/api/todo/model/todo-model_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_typescript/api/todo/route/todo-route.ts:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import * as express from "express";
4 | import {TodoController} from "../controller/todo-controller";
5 |
6 | export class TodoRoutes {
7 | static init(router: express.Router) {
8 | router
9 | .route("/api/todos")
10 | .get(TodoController.getAll)
11 | .post(TodoController.createTodo);
12 |
13 | router
14 | .route("/api/todos/:id")
15 | .delete(TodoController.deleteTodo);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_typescript/api/todo/route/todo-route_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/express/server_node_express_typescript/api/todo/route/todo-route_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_typescript/auth/local/index.ts:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/express/server_node_express_typescript/auth/local/index.ts
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_typescript/commons/static/index.ts:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import * as express from "express";
4 | import * as fs from "fs";
5 | import * as path from "path";
6 |
7 | export class StaticDispatcher {
8 | static sendIndex(req: express.Request, res: express.Response):void {
9 | const _root = process.cwd();
10 | const _env = process.env.NODE_ENV;
11 | const _folder = _env === "production" ? "dist" : "dev";
12 |
13 | res.type(".html");
14 |
15 | fs.createReadStream(path.join(`${_root}/client/${_folder}/index.html`)).pipe(res);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_typescript/config/db.conf.test.js:
--------------------------------------------------------------------------------
1 | import Todo from "../api/todo/dao/todo-dao";
2 | import dbJson from "./db.test.json";
3 | import Promise from 'bluebird';
4 |
5 | exports.setupMongoose = (mongoose, done) => {
6 | mongoose.Promise = Promise;
7 | mongoose.models = {};
8 | mongoose.connection.on("error", () => {});
9 | mongoose.connect(dbJson.db.test.url, done);
10 | }
11 |
12 | exports.createTodos = () => {
13 | let _array = [];
14 |
15 | for (let i = 0; i < 10; i++) {
16 | _array.push({_id: "507c7f79bcf86cd7994f6c"+ (i + 10), todoMessage: "aaaaaaa"+i});
17 | }
18 |
19 | return Todo.create(_array);
20 | }
21 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_typescript/config/db.conf.ts:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import * as mongoose from "mongoose";
4 | import * as Promise from "bluebird";
5 |
6 | const dbConst = require("../constants/db.json");
7 |
8 | export class DBConfig {
9 | static init():void {
10 | const URL = (process.env.NODE_ENV === "production") ? process.env.MONGOHQ_URL
11 | : dbConst.localhost;
12 |
13 | (mongoose).Promise = Promise;
14 | mongoose.connect(URL);
15 | mongoose.connection.on("error", console.error.bind(console, "An error ocurred with the DB connection: "));
16 | }
17 | };
18 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_typescript/config/db.test.json:
--------------------------------------------------------------------------------
1 | {
2 | "db": {
3 | "test": {
4 | "url": "mongodb://localhost/<%= appName %>_test"
5 | }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_typescript/config/routes.conf.ts:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import * as express from "express";
4 | import * as morgan from "morgan";
5 | import * as bodyParser from "body-parser";
6 | import * as helmet from "helmet";
7 | import * as compression from "compression";
8 | import * as zlib from "zlib";
9 |
10 | export class RoutesConfig {
11 | static init(application: express.Application):void {
12 | let _root = process.cwd();
13 | let _nodeModules = "/node_modules/";
14 | let _clientFiles = (process.env.NODE_ENV === "production") ? "/client/dist/" : "/client/dev/";
15 |
16 | application.use(compression({
17 | level: zlib.Z_BEST_COMPRESSION,
18 | threshold: "1kb"
19 | }));
20 |
21 | application.use(express.static(_root + _nodeModules));
22 | application.use(express.static(_root + _clientFiles));
23 | application.use(bodyParser.json());
24 | application.use(morgan("dev"));
25 | application.use(helmet());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_typescript/constants/db.json:
--------------------------------------------------------------------------------
1 | {
2 | "localhost": "mongodb://localhost/<%= appName %>"
3 | }
4 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_typescript/routes/index.ts:
--------------------------------------------------------------------------------
1 | import * as express from "express";
2 | import {TodoRoutes} from "../api/todo/route/todo-route";
3 | <% if (!differentStaticServer) { %>
4 | import {StaticDispatcher} from "../commons/static/index";
5 | <% } %>
6 |
7 | export class Routes {
8 | static init(app: express.Application, router: express.Router) {
9 | TodoRoutes.init(router);
10 | <% if (!differentStaticServer) { %>
11 | router
12 | .route("*")
13 | .get(StaticDispatcher.sendIndex);
14 | <% } %>
15 |
16 | app.use("/", router);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_typescript/server.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | "use strict";
4 |
5 | let PORT = process.env.PORT || 3333;
6 |
7 | import * as express from "express";
8 | import * as os from "os";
9 | import * as http from "http";
10 | import {RoutesConfig} from "./config/routes.conf";
11 | import {DBConfig} from "./config/db.conf";
12 | import {Routes} from "./routes/index";
13 |
14 | const app = express();
15 |
16 | RoutesConfig.init(app);
17 | DBConfig.init();
18 | Routes.init(app, express.Router());
19 |
20 | http.createServer(app)
21 | .listen(PORT, () => {
22 | console.log(`up and running @: ${os.hostname()} on port: ${PORT}`);
23 | console.log(`enviroment: ${process.env.NODE_ENV}`);
24 | });
25 |
--------------------------------------------------------------------------------
/app/templates/server/node/express/server_node_express_typescript/server_http2.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | "use strict";
4 |
5 | var PORT = process.env.PORT || 3333;
6 |
7 | import * as express from "express";
8 | import * as os from "os";
9 | import * as http2 from "spdy";
10 | import * as fs from "fs";
11 | import {RoutesConfig} from "./config/routes.conf";
12 | import {DBConfig} from "./config/db.conf";
13 | import {Routes} from "./routes/index";
14 |
15 | const app = express();
16 |
17 | RoutesConfig.init(app);
18 | DBConfig.init();
19 | Routes.init(app, express.Router());
20 |
21 | const opts = {
22 | key: fs.readFileSync(__dirname + "/cert/server.key"),
23 | cert: fs.readFileSync(__dirname + "/cert/server.crt")
24 | }
25 |
26 | http2.createServer(opts, app)
27 | .listen(PORT, () => {
28 | console.log(`up and running @: ${os.hostname()} on port: ${PORT}`);
29 | console.log(`enviroment: ${process.env.NODE_ENV}`);
30 | });
31 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa/api/todo/controller/todo-controller.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const TodoDAO = require("../dao/todo-dao");
4 |
5 | module.exports = class TodoController {
6 | async getAll(ctx, next) {
7 | try {
8 | let _todos = await TodoDAO.getAll();
9 | ctx.status = 200;
10 | ctx.body = _todos;
11 | } catch(e) {
12 | ctx.status = 400;
13 | }
14 | }
15 |
16 | async getById(ctx, next) {
17 | try {
18 | let _todo = await TodoDAO.getById(ctx.param.id);
19 | ctx.status = 200;
20 | ctx.body = _todo;
21 | } catch(e) {
22 | ctx.status = 400;
23 | }
24 | }
25 |
26 | async createTodo(ctx, next) {
27 | let _todo = ctx.request.body;
28 |
29 | try {
30 | let _newTodo = await TodoDAO.createTodo(_todo);
31 | ctx.body = _newTodo;
32 | ctx.status = 201;
33 | } catch(e) {
34 | ctx.status = 400;
35 | }
36 | }
37 |
38 | async deleteTodo(ctx, next) {
39 | let _id = ctx.params.id;
40 |
41 | try {
42 | await TodoDAO.deleteTodo(_id);
43 | ctx.status = 200;
44 | } catch(e) {
45 | ctx.status = 400;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa/api/todo/controller/todo-controller_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/koa/server_node_koa/api/todo/controller/todo-controller_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa/api/todo/model/todo-model.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const mongoose = require("mongoose");
4 |
5 | const _todoSchema = {
6 | todoMessage: {type: String, required: true, trim: true},
7 | createdAt: {type: Date, default: Date.now}
8 | }
9 |
10 | module.exports = mongoose.Schema(_todoSchema);
11 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa/api/todo/model/todo-model_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/koa/server_node_koa/api/todo/model/todo-model_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa/api/todo/route/todo-route.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const TodoController = require("../controller/todo-controller");
4 |
5 | module.exports = class TodoRoutes {
6 | static init(router) {
7 | let _todoController = new TodoController();
8 |
9 | router.get("/api/todos", _todoController.getAll);
10 | router.post("/api/todos", _todoController.createTodo);
11 | router.del("/api/todos/:id", _todoController.deleteTodo);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa/api/todo/route/todo-route_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/koa/server_node_koa/api/todo/route/todo-route_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa/auth/local/index.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/koa/server_node_koa/auth/local/index.js
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa/commons/static/index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const send = require("koa-send");
4 |
5 | module.exports = class StaticDispatcher {
6 | static sendIndex() {
7 | const _root = process.cwd();
8 | const _env = process.env.NODE_ENV;
9 |
10 | const _folder = _env === "production" ? "dist" : "dev";
11 |
12 | send(this, `${_root}/client/${_folder}/index.html`);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa/config/db.conf.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const mongoose = require("mongoose");
4 | const Promise = require('bluebird');
5 | const dbConst = require("../constants/db.json");
6 |
7 | module.exports = class DBConfig {
8 | static init() {
9 | const URL = (process.env.NODE_ENV === "production") ? process.env.MONGOHQ_URL
10 | : dbConst.localhost;
11 |
12 | mongoose.Promise = Promise;
13 | mongoose.connect(URL);
14 | mongoose.connection.on("error", console.error.bind(console, "An error ocurred with the DB connection: "));
15 | }
16 | };
17 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa/config/db.conf.test.js:
--------------------------------------------------------------------------------
1 | import Todo from "../api/todo/dao/todo-dao";
2 | import dbJson from "./db.test.json";
3 | import Promise from 'bluebird';
4 |
5 | exports.setupMongoose = (mongoose, done) => {
6 | mongoose.Promise = Promise;
7 | mongoose.models = {};
8 | mongoose.connection.on("error", () => {});
9 | mongoose.connect(dbJson.db.test.url, done);
10 | }
11 |
12 | exports.createTodos = () => {
13 | let _array = [];
14 |
15 | for (let i = 0; i < 10; i++) {
16 | _array.push({_id: "507c7f79bcf86cd7994f6c"+ (i + 10), todoMessage: "aaaaaaa"+i});
17 | }
18 |
19 | return Todo.create(_array);
20 | }
21 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa/config/db.test.json:
--------------------------------------------------------------------------------
1 | {
2 | "db": {
3 | "test": {
4 | "url": "mongodb://localhost/<%= appName %>_test"
5 | }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa/config/routes.conf.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const koa = require("koa");
4 | const serve = require("koa-static");
5 | const bodyParser = require("koa-bodyparser");
6 |
7 | module.exports = class RouteConfig {
8 | static init(application, router) {
9 | let _root = process.cwd();
10 | let _nodeModules = "/node_modules";
11 | let _clientFiles = (process.env.NODE_ENV === "production") ? "/client/dist" : "/client/dev";
12 |
13 | application.use(bodyParser());
14 | application.use(router.routes());
15 | application.use(serve(_root + _nodeModules));
16 | application.use(serve(_root + _clientFiles));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa/constants/db.json:
--------------------------------------------------------------------------------
1 | {
2 | "localhost": "mongodb://localhost/<%= appName %>"
3 | }
4 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa/routes/index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const TodoRoutes = require("../api/todo/route/todo-route");
4 |
5 | module.exports = class Routes {
6 | static init(app, router) {
7 | TodoRoutes.init(router);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa/server.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const PORT = process.env.PORT || 3333;
4 |
5 | const os = require("os");
6 | const http = require("http");
7 | const Koa = require("koa");
8 | const router = require("koa-router")();
9 | const RoutesConfig = require("./config/routes.conf");
10 | const DBConfig = require("./config/db.conf");
11 | const Routes = require("./routes/index");
12 |
13 | const app = new Koa();
14 |
15 | RoutesConfig.init(app, router);
16 | DBConfig.init();
17 | Routes.init(app, router);
18 |
19 | http.createServer(app.callback())
20 | .listen(PORT, () => {
21 | console.log(`up and running @: ${os.hostname()} on port: ${PORT}`);
22 | console.log(`enviroment: ${process.env.NODE_ENV}`);
23 | });
24 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa/server_http2.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const PORT = process.env.PORT || 3333;
4 |
5 | const os = require("os");
6 | const http2 = require("spdy");
7 | const Koa = require("koa");
8 | const router = require("koa-router")();
9 | const fs = require("fs");
10 | const RoutesConfig = require("./config/routes.conf");
11 | const DBConfig = require("./config/db.conf");
12 | const Routes = require("./routes/index");
13 |
14 | const app = new Koa();
15 |
16 | RoutesConfig.init(app, router);
17 | DBConfig.init();
18 | Routes.init(app, router);
19 |
20 | const opts = {
21 | key: fs.readFileSync(__dirname + "/cert/server.key"),
22 | cert: fs.readFileSync(__dirname + "/cert/server.crt")
23 | }
24 |
25 | http2.createServer(opts, app.callback())
26 | .listen(PORT, () => {
27 | console.log(`up and running @: ${os.hostname()} on port: ${PORT}`);
28 | console.log(`enviroment: ${process.env.NODE_ENV}`);
29 | });
30 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_babel/api/todo/controller/todo-controller.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const TodoDAO = require("../dao/todo-dao");
4 |
5 | export default class TodoController {
6 | async getAll(ctx, next) {
7 | try {
8 | let _todos = await TodoDAO.getAll();
9 | ctx.status = 200;
10 | ctx.body = _todos;
11 | } catch(e) {
12 | ctx.status = 400;
13 | }
14 | }
15 |
16 | async getById(ctx, next) {
17 | try {
18 | let _todo = await TodoDAO.getById(ctx.param.id);
19 | ctx.status = 200;
20 | ctx.body = _todo;
21 | } catch(e) {
22 | ctx.status = 400;
23 | }
24 | }
25 |
26 | async createTodo(ctx, next) {
27 | let _todo = ctx.request.body;
28 |
29 | try {
30 | let _newTodo = await TodoDAO.createTodo(_todo);
31 | ctx.body = _newTodo;
32 | ctx.status = 201;
33 | } catch(e) {
34 | ctx.status = 400;
35 | }
36 | }
37 |
38 | async deleteTodo(ctx, next) {
39 | let _id = ctx.params.id;
40 |
41 | try {
42 | await TodoDAO.deleteTodo(_id);
43 | ctx.status = 200;
44 | } catch(e) {
45 | ctx.status = 400;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_babel/api/todo/controller/todo-controller_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/koa/server_node_koa_babel/api/todo/controller/todo-controller_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_babel/api/todo/model/todo-model.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import mongoose from "mongoose";
4 |
5 | const _todoSchema = {
6 | todoMessage: {type: String, required: true, trim: true},
7 | createdAt: {type: Date, default: Date.now}
8 | }
9 |
10 | module.exports = mongoose.Schema(_todoSchema);
11 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_babel/api/todo/model/todo-model_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/koa/server_node_koa_babel/api/todo/model/todo-model_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_babel/api/todo/route/todo-route.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import TodoController from "../controller/todo-controller";
4 |
5 | export default class TodoRoutes {
6 | static init(router) {
7 | let _todoController = new TodoController();
8 |
9 | router.get("/api/todos", _todoController.getAll);
10 | router.post("/api/todos", _todoController.createTodo);
11 | router.del("/api/todos/:id", _todoController.deleteTodo);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_babel/api/todo/route/todo-route_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/koa/server_node_koa_babel/api/todo/route/todo-route_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_babel/auth/local/index.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/koa/server_node_koa_babel/auth/local/index.js
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_babel/commons/static/index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import send from "koa-send";
4 |
5 | export default class StaticDispatcher {
6 | static sendIndex() {
7 | const _root = process.cwd();
8 | const _env = process.env.NODE_ENV;
9 |
10 | const _folder = _env === "production" ? "dist" : "dev";
11 |
12 | send(this, `${_root}/client/${_folder}/index.html`);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_babel/config/db.conf.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import mongoose from "mongoose";
4 | import Promise from "bluebird";
5 | import dbConst from "../constants/db.json";
6 |
7 | export default class DBConfig {
8 | static init() {
9 | const URL = (process.env.NODE_ENV === "production") ? process.env.MONGOHQ_URL
10 | : dbConst.localhost;
11 |
12 | mongoose.Promise = Promise;
13 | mongoose.connect(URL);
14 | mongoose.connection.on("error", console.error.bind(console, "An error ocurred with the DB connection: "));
15 | }
16 | };
17 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_babel/config/db.conf.test.js:
--------------------------------------------------------------------------------
1 | import Todo from "../api/todo/dao/todo-dao";
2 | import dbJson from "./db.test.json";
3 | import Promise from 'bluebird';
4 |
5 | exports.setupMongoose = (mongoose, done) => {
6 | mongoose.Promise = Promise;
7 | mongoose.models = {};
8 | mongoose.connection.on("error", () => {});
9 | mongoose.connect(dbJson.db.test.url, done);
10 | }
11 |
12 | exports.createTodos = () => {
13 | let _array = [];
14 |
15 | for (let i = 0; i < 10; i++) {
16 | _array.push({_id: "507c7f79bcf86cd7994f6c"+ (i + 10), todoMessage: "aaaaaaa"+i});
17 | }
18 |
19 | return Todo.create(_array);
20 | }
21 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_babel/config/db.test.json:
--------------------------------------------------------------------------------
1 | {
2 | "db": {
3 | "test": {
4 | "url": "mongodb://localhost/<%= appName %>_test"
5 | }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_babel/config/routes.conf.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import koa from "koa";
4 | import serve from "koa-static";
5 | import bodyParser from "koa-bodyparser";
6 |
7 | export default class RouteConfig {
8 | static init(application, router) {
9 | let _root = process.cwd();
10 | let _nodeModules = "/node_modules";
11 | let _clientFiles = (process.env.NODE_ENV === "production") ? "/client/dist" : "/client/dev";
12 |
13 | application.use(bodyParser());
14 | application.use(router.routes());
15 | application.use(serve(_root + _nodeModules));
16 | application.use(serve(_root + _clientFiles));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_babel/constants/db.json:
--------------------------------------------------------------------------------
1 | {
2 | "localhost": "mongodb://localhost/<%= appName %>"
3 | }
4 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_babel/routes/index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import TodoRoutes from "../api/todo/route/todo-route";
4 |
5 | module.exports = class Routes {
6 | static init(app, router) {
7 | TodoRoutes.init(router);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_babel/server.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const PORT = process.env.PORT || 3333;
4 |
5 | import os from "os";
6 | import http from "http";
7 | import Koa from "koa";
8 | import routerCb from "koa-router";
9 | import RoutesConfig from "./config/routes.conf";
10 | import DBConfig from "./config/db.conf";
11 | import Routes from "./routes/index";
12 |
13 | const router = routerCb();
14 |
15 | const app = new Koa();
16 |
17 | RoutesConfig.init(app, router);
18 | DBConfig.init();
19 | Routes.init(app, router);
20 |
21 | http.createServer(app.callback())
22 | .listen(PORT, () => {
23 | console.log(`up and running @: ${os.hostname()} on port: ${PORT}`);
24 | console.log(`enviroment: ${process.env.NODE_ENV}`);
25 | });
26 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_babel/server_http2.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const PORT = process.env.PORT || 3333;
4 |
5 | import fs from "fs";
6 | import os from "os";
7 | import http2 from "spdy";
8 | import Koa from "koa";
9 | import routerCb from "koa-router";
10 | import RoutesConfig from "./config/routes.conf";
11 | import DBConfig from "./config/db.conf";
12 | import Routes from "./routes/index";
13 |
14 | const router = routerCb();
15 |
16 | const app = new Koa();
17 |
18 | RoutesConfig.init(app, router);
19 | DBConfig.init();
20 | Routes.init(app, router);
21 |
22 | const opts = {
23 | key: fs.readFileSync(__dirname + "/cert/server.key"),
24 | cert: fs.readFileSync(__dirname + "/cert/server.crt")
25 | }
26 |
27 | http2.createServer(opts, app.callback())
28 | .listen(PORT, () => {
29 | console.log(`up and running @: ${os.hostname()} on port: ${PORT}`);
30 | console.log(`enviroment: ${process.env.NODE_ENV}`);
31 | });
32 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_typescript/api/todo/controller/todo-controller.ts:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const TodoDAO = require("../dao/todo-dao");
4 |
5 | export default class TodoController {
6 | async getAll(ctx, next) {
7 | try {
8 | let _todos = await TodoDAO.getAll();
9 | ctx.status = 200;
10 | ctx.body = _todos;
11 | } catch(e) {
12 | ctx.status = 400;
13 | }
14 | }
15 |
16 | async getById(ctx, next) {
17 | try {
18 | let _todo = await TodoDAO.getById(ctx.param.id);
19 | ctx.status = 200;
20 | ctx.body = _todo;
21 | } catch(e) {
22 | ctx.status = 400;
23 | }
24 | }
25 |
26 | async createTodo(ctx, next) {
27 | let _todo = ctx.request.body;
28 |
29 | try {
30 | let _newTodo = await TodoDAO.createTodo(_todo);
31 | ctx.body = _newTodo;
32 | ctx.status = 201;
33 | } catch(e) {
34 | ctx.status = 400;
35 | }
36 | }
37 |
38 | async deleteTodo(ctx, next) {
39 | let _id = ctx.params.id;
40 |
41 | try {
42 | await TodoDAO.deleteTodo(_id);
43 | ctx.status = 200;
44 | } catch(e) {
45 | ctx.status = 400;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_typescript/api/todo/controller/todo-controller_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/koa/server_node_koa_typescript/api/todo/controller/todo-controller_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_typescript/api/todo/model/todo-model.ts:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import * as mongoose from "mongoose";
4 |
5 | const _todoSchema = {
6 | todoMessage: {type: String, required: true, trim: true},
7 | createdAt: {type: Date, default: Date.now}
8 | }
9 |
10 | module.exports = mongoose.Schema(_todoSchema);
11 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_typescript/api/todo/model/todo-model_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/koa/server_node_koa_typescript/api/todo/model/todo-model_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_typescript/api/todo/route/todo-route.ts:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import * as TodoController from "../controller/todo-controller";
4 |
5 | export default class TodoRoutes {
6 | static init(router) {
7 | let _todoController = new TodoController();
8 |
9 | router.get("/api/todos", _todoController.getAll);
10 | router.post("/api/todos", _todoController.createTodo);
11 | router.del("/api/todos/:id", _todoController.deleteTodo);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_typescript/api/todo/route/todo-route_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/koa/server_node_koa_typescript/api/todo/route/todo-route_test.js
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_typescript/auth/local/index.ts:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/server/node/koa/server_node_koa_typescript/auth/local/index.ts
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_typescript/commons/static/index.ts:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import * as send from "koa-send";
4 |
5 | export default class StaticDispatcher {
6 | static sendIndex() {
7 | const _root = process.cwd();
8 | const _env = process.env.NODE_ENV;
9 |
10 | const _folder = _env === "production" ? "dist" : "dev";
11 |
12 | send(this, `${_root}/client/${_folder}/index.html`);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_typescript/config/db.conf.test.js:
--------------------------------------------------------------------------------
1 | import Todo from "../api/todo/dao/todo-dao";
2 | import dbJson from "./db.test.json";
3 | import Promise from 'bluebird';
4 |
5 | exports.setupMongoose = (mongoose, done) => {
6 | mongoose.Promise = Promise;
7 | mongoose.models = {};
8 | mongoose.connection.on("error", () => {});
9 | mongoose.connect(dbJson.db.test.url, done);
10 | }
11 |
12 | exports.createTodos = () => {
13 | let _array = [];
14 |
15 | for (let i = 0; i < 10; i++) {
16 | _array.push({_id: "507c7f79bcf86cd7994f6c"+ (i + 10), todoMessage: "aaaaaaa"+i});
17 | }
18 |
19 | return Todo.create(_array);
20 | }
21 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_typescript/config/db.conf.ts:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import * as mongoose from "mongoose";
4 | import * as Promise from "bluebird";
5 |
6 | const dbConst = require("../constants/db.json");
7 |
8 | export default class DBConfig {
9 | static init() {
10 | const URL = (process.env.NODE_ENV === "production") ? process.env.MONGOHQ_URL
11 | : dbConst.localhost;
12 |
13 | (mongoose).Promise = Promise;
14 | mongoose.connect(URL);
15 | mongoose.connection.on("error", console.error.bind(console, "An error ocurred with the DB connection: "));
16 | }
17 | };
18 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_typescript/config/db.test.json:
--------------------------------------------------------------------------------
1 | {
2 | "db": {
3 | "test": {
4 | "url": "mongodb://localhost/<%= appName %>_test"
5 | }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_typescript/config/routes.conf.ts:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import koa from "koa";
4 | import serve from "koa-static";
5 | import bodyParser from "koa-bodyparser";
6 |
7 | export default class RouteConfig {
8 | static init(application, router) {
9 | let _root = process.cwd();
10 | let _nodeModules = "/node_modules";
11 | let _clientFiles = (process.env.NODE_ENV === "production") ? "/client/dist" : "/client/dev";
12 |
13 | application.use(bodyParser());
14 | application.use(router.routes());
15 | application.use(serve(_root + _nodeModules));
16 | application.use(serve(_root + _clientFiles));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_typescript/constants/db.json:
--------------------------------------------------------------------------------
1 | {
2 | "localhost": "mongodb://localhost/<%= appName %>"
3 | }
4 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_typescript/routes/index.ts:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import TodoRoutes from "../api/todo/route/todo-route";
4 |
5 | module.exports = class Routes {
6 | static init(app, router) {
7 | TodoRoutes.init(router);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_typescript/server.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | "use strict";
4 |
5 | const PORT = process.env.PORT || 3333;
6 |
7 | import * as os from "os";
8 | import * as http from "http";
9 | import * as Koa from "koa";
10 | import * as routerCb from "koa-router";
11 | import * as RoutesConfig from "./config/routes.conf";
12 | import * as DBConfig from "./config/db.conf";
13 | import * as Routes from "./routes/index";
14 |
15 | const router = routerCb();
16 |
17 | const app = new Koa();
18 |
19 | RoutesConfig.init(app, router);
20 | DBConfig.init();
21 | Routes.init(app, router);
22 |
23 | http.createServer(app.callback())
24 | .listen(PORT, () => {
25 | console.log(`up and running @: ${os.hostname()} on port: ${PORT}`);
26 | console.log(`enviroment: ${process.env.NODE_ENV}`);
27 | });
28 |
--------------------------------------------------------------------------------
/app/templates/server/node/koa/server_node_koa_typescript/server_http2.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | "use strict";
4 |
5 | const PORT = process.env.PORT || 3333;
6 |
7 | import * as fs from "fs";
8 | import * as os from "os";
9 | import * as http2 from "spdy";
10 | import * as Koa from "koa";
11 | import * as routerCb from "koa-router";
12 | import * as RoutesConfig from "./config/routes.conf";
13 | import * as DBConfig from "./config/db.conf";
14 | import * as Routes from "./routes/index";
15 |
16 | const router = routerCb();
17 |
18 | const app = new Koa();
19 |
20 | RoutesConfig.init(app, router);
21 | DBConfig.init();
22 | Routes.init(app, router);
23 |
24 | const opts = {
25 | key: fs.readFileSync(__dirname + "/cert/server.key"),
26 | cert: fs.readFileSync(__dirname + "/cert/server.crt")
27 | }
28 |
29 | http2.createServer(opts, app.callback())
30 | .listen(PORT, () => {
31 | console.log(`up and running @: ${os.hostname()} on port: ${PORT}`);
32 | console.log(`enviroment: ${process.env.NODE_ENV}`);
33 | });
34 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng1/build_html.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp"
2 | import htmlmin from "gulp-htmlmin"
3 | import nginclude from "gulp-nginclude"
4 | import {base, tasks} from "./const"
5 |
6 | const VIEWS = [
7 | base.DIST + "**/*.html"
8 | ]
9 |
10 | gulp.task(tasks.CLIENT_VIEWS_DIST, (done) => {
11 | return gulp.src(VIEWS, {base: base.DIST})
12 | .pipe(htmlmin({
13 | collapseWhitespace: true,
14 | caseSensitive: true
15 | }))
16 | .pipe(nginclude())
17 | .pipe(gulp.dest(base.DIST))
18 | .on('end', () => done());
19 | })
20 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng1/build_image.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp"
2 | import imageMin from "gulp-imagemin"
3 | import {base, tasks} from "./const"
4 |
5 | const IMAGES = [
6 | base.DIST + "**/*.{png,jpg,jpeg,gif}"
7 | ]
8 |
9 | gulp.task(tasks.CLIENT_IMAGE_DIST, (done) => {
10 | return gulp.src(IMAGES, {base: base.DIST})
11 | .pipe(imageMin())
12 | .pipe(gulp.dest(base.DIST))
13 | .on('end', () => done())
14 | })
15 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng1/build_js.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp"
2 | import babel from "gulp-babel"
3 | import {base, tasks} from "./const"
4 | import embedTemplates from "gulp-angular-embed-templates"
5 |
6 | const JS = [
7 | base.DIST + "**/*.js"
8 | ];
9 |
10 | gulp.task(tasks.CLIENT_BUILD_JS_DIST, (done) => {
11 | return gulp.src(JS, {base: base.DIST})
12 | .pipe(babel())
13 | .pipe(embedTemplates())
14 | .pipe(gulp.dest(base.DIST))
15 | .on('end', () => done());
16 | })
17 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng1/const.js:
--------------------------------------------------------------------------------
1 | export const base = {
2 | ROOT: "./",
3 | DEV: "./client/dev/",
4 | <% if (cordova) {%>
5 | DIST: "./client/dist_cordova/www/",
6 | <% } else {%>
7 | DIST: "./client/dist/",
8 | <% } %>
9 | }
10 |
11 | export const tasks = {
12 | CLIENT_VIEWS_DIST: "client.views:dist",
13 | CLIENT_IMAGE_DIST: "client.imgs:dist",
14 | CLIENT_BUILD_CSS_DIST: "client.build_css:dist",
15 | CLIENT_BUILD_JS_DIST: "client.build_js:dist",
16 | CLIENT_DEL_DIST: "client.del:dist",
17 |
18 | CLIENT_COPY: "client.copy",
19 |
20 | CLIENT_UNIT_TEST: "client.unit_test",
21 | CLIENT_COVERAGE: "client.coverage",
22 |
23 | CLIENT_WATCH: "client.watch",
24 |
25 | CLIENT_RELOAD: "client.reload",
26 |
27 | CLIENT_BUILD_DIST: "client.build:dist",
28 |
29 | CLIENT_REVISION: "client.revision",
30 |
31 | <% if (stylePreprocessor === "sass") { %>
32 | CLIENT_COMPILE_TO_CSS: "client.compile_from_sass_to_css:dev"
33 | <% } %>
34 |
35 | <% if (stylePreprocessor === "less") { %>
36 | CLIENT_COMPILE_TO_CSS: "client.compile_from_less_to_css:dev"
37 | <% } %>
38 | }
39 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng1/copy.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp"
2 | import {base, tasks} from "./const"
3 |
4 | gulp.task(tasks.CLIENT_COPY, (done) => {
5 | return gulp.src(base.DEV + "**/*")
6 | .pipe(gulp.dest(base.DIST))
7 | .on('end', () => done())
8 | })
9 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng1/del.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp"
2 | import del from "del"
3 | import {base, tasks} from "./const"
4 |
5 | gulp.task(tasks.CLIENT_DEL_DIST, (done) => {
6 | del.sync([base.DIST])
7 | done()
8 | });
9 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng1/index.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import {base, tasks} from "./const";
3 |
4 | gulp.task(tasks.CLIENT_BUILD_DIST, gulp.series(
5 | tasks.CLIENT_UNIT_TEST,
6 | tasks.CLIENT_DEL_DIST,
7 | tasks.CLIENT_COPY,
8 | tasks.CLIENT_VIEWS_DIST,
9 | gulp.parallel(
10 | tasks.CLIENT_IMAGE_DIST,
11 | tasks.CLIENT_BUILD_JS_DIST,
12 | tasks.CLIENT_BUILD_CSS_DIST
13 | ),
14 | tasks.CLIENT_REVISION
15 | )
16 | )
17 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng1/revision.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp"
2 | import usemin from "gulp-usemin"
3 | import rev from "gulp-rev"
4 | import uglifyJs from "gulp-uglify"
5 | import cleanCss from "gulp-clean-css"
6 | import {tasks, base} from "./const"
7 |
8 | gulp.task(tasks.CLIENT_REVISION, (done) => {
9 | return gulp.src(base.DIST + 'index.html', {base: base.DIST})
10 | .pipe(usemin({
11 | libCss: [rev(), cleanCss()],
12 | appCss: [rev(), cleanCss()],
13 | libJs: [rev(), uglifyJs()],
14 | appJs: [rev(), uglifyJs()]
15 | }))
16 | .pipe(gulp.dest(base.DIST))
17 | .on('end', () => done())
18 | })
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng1/unit_test.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp"
2 | import coveralls from "gulp-coveralls"
3 | import {Server as Karma} from "karma"
4 | import {tasks} from "./const"
5 |
6 | gulp.task(tasks.CLIENT_UNIT_TEST, (done) => {
7 | return new Karma({
8 | configFile: process.cwd() + "/karma.conf.js",
9 | browsers: ["Chrome"],
10 | singleRun: true
11 | }, (exitCode) => done(exitCode)).start()
12 | })
13 |
14 | gulp.task(tasks.CLIENT_COVERAGE, gulp.series(tasks.CLIENT_UNIT_TEST, (done) => {
15 | return gulp.src("unit_coverage/**/lcov.info")
16 | .pipe(coveralls())
17 | .on('end', () => done())
18 | }))
19 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng1/watch.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp"
2 | import {tasks} from "./const"
3 | import Server from "aliv"
4 |
5 | const aliv = new Server({
6 | root: process.cwd()
7 | });
8 |
9 | gulp.task(tasks.CLIENT_WATCH, () => {
10 | return new Promise((res, rej) => {
11 | aliv.start()
12 | return res()
13 | })
14 | })
15 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng2/build_css.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import cssmin from "gulp-clean-css";
3 | import {join} from "path";
4 | import {base, tasks} from "./const";
5 | <% if (stylePreprocessor === "less") { %>
6 | import less from "gulp-less";
7 | <% } %>
8 | <% if (stylePreprocessor === "sass") { %>
9 | import sass from "gulp-sass";
10 | <% } %>
11 |
12 | const CSS = base.DIST + "**/*.css";
13 | <% if (stylePreprocessor === "less") { %>
14 | const LESS = [
15 | base.DEV + "**/*.less"
16 | ];
17 | <% } %>
18 | <% if (stylePreprocessor === "sass") { %>
19 | const SASS = [
20 | base.DEV + "**/*.{sass,scss}"
21 | ];
22 | <% } %>
23 |
24 | <% if (!!stylePreprocessor) { %>
25 | gulp.task(tasks.CLIENT_COMPILE_TO_CSS, () => {
26 | <% if (stylePreprocessor === "less") { %>
27 | return gulp.src(LESS)
28 | .pipe(less())
29 | .on("error", (err) => {
30 | console.log(err);
31 | })
32 | .pipe(gulp.dest(base.DEV));
33 | <% } %>
34 | <% if (stylePreprocessor === "sass") { %>
35 | return gulp.src(SASS)
36 | .pipe(sass())
37 | .on("error", sass.logError)
38 | .pipe(gulp.dest(base.DEV));
39 | <% } %>
40 | });
41 | <% } %>
42 |
43 | gulp.task(tasks.CLIENT_BUILD_CSS_DIST, () => {
44 | return gulp.src(CSS, {base: base.DIST})
45 | .pipe(cssmin())
46 | .pipe(gulp.dest(base.DIST));
47 | });
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng2/build_html.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import htmlmin from "gulp-htmlmin";
3 | import rev from "gulp-rev-append";
4 | import {base, tasks} from "./const";
5 |
6 | const VIEWS = base.DIST + "**/*.html";
7 |
8 | gulp.task(tasks.CLIENT_VIEWS_DIST, () => {
9 | return gulp.src(VIEWS, {base: base.DIST})
10 | .pipe(rev())
11 | .pipe(htmlmin({
12 | collapseWhitespace: true,
13 | caseSensitive: true
14 | }))
15 | .pipe(gulp.dest(base.DIST));
16 | });
17 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng2/build_image.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import imageMin from "gulp-imagemin";
3 | import {base, tasks} from "./const";
4 |
5 | const IMAGES = base.DIST + "**/*.{png,jpg,jpeg,svg,gif}";
6 |
7 | gulp.task(tasks.CLIENT_IMAGE_DIST, () => {
8 | return gulp.src(IMAGES, {base: base.DIST})
9 | .pipe(imageMin())
10 | .pipe(gulp.dest(base.DIST));
11 | });
12 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng2/build_js.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import uglify from "gulp-uglify";
3 | import {base, tasks} from "./const";
4 |
5 | const JS = base.DIST + "**/*.js";
6 |
7 | gulp.task(tasks.CLIENT_JS_DIST, () => {
8 | return gulp.src(JS, {base: base.DIST})
9 | .pipe(uglify())
10 | .pipe(gulp.dest(base.DIST));
11 | });
12 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng2/build_ts.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import tsc from "gulp-typescript";
3 | import {base, tasks} from "./const";
4 |
5 | const TS_CONFIG = base.ROOT + "tsconfig.json";
6 |
7 | gulp.task(tasks.CLIENT_BUILD_TS, () => {
8 | let _tsProject = tsc.createProject(TS_CONFIG);
9 |
10 | return _tsProject.src()
11 | .pipe(_tsProject())
12 | .js
13 | .pipe(gulp.dest("."));
14 | });
15 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng2/const.js:
--------------------------------------------------------------------------------
1 | export const base = {
2 | ROOT: "./",
3 | TEST: "./tests/",
4 | DEV: "./client/dev/",
5 | DIST: "./client/dist/",
6 | DIST_CORDOVA: "./client/dist_cordova/www/"
7 | }
8 |
9 | export const tasks = {
10 | CLIENT_BUILD_DEV: "client.build:dev",
11 | CLIENT_BUILD_DIST: "client.build:dist",
12 |
13 | CLIENT_BUILD_CSS_DIST: "client.build_css:dist",
14 | CLIENT_JS_DIST: "client.build_js:dist",
15 | CLIENT_VIEWS_DIST: "client.views:dist",
16 | CLIENT_IMAGE_DIST: "client.imgs:dist",
17 | CLIENT_DEL_DIST: "client.del:dist",
18 |
19 | CLIENT_COPY: "client.copy",
20 |
21 | CLIENT_UNIT_TEST: "client.unit_test",
22 | CLIENT_COVERAGE: "client.coverage",
23 |
24 | CLIENT_RELOAD: "client.reload",
25 |
26 | CLIENT_WATCH: "client.watch",
27 |
28 | CLIENT_BUILD_TS: "client.build_ts",
29 |
30 | <% if (stylePreprocessor === "sass") { %>
31 | CLIENT_COMPILE_TO_CSS: "client.compile_from_sass_to_css:dev"
32 | <% } %>
33 |
34 | <% if (stylePreprocessor === "less") { %>
35 | CLIENT_COMPILE_TO_CSS: "client.compile_from_less_to_css:dev"
36 | <% } %>
37 | }
38 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng2/copy.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import {base, tasks} from "./const";
3 |
4 | gulp.task(tasks.CLIENT_COPY, () => {
5 | return gulp.src(base.DEV + "**/*")
6 | .pipe(gulp.dest(base.DIST));
7 | });
8 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng2/del.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import del from "del";
3 | import {base, tasks} from "./const";
4 |
5 | gulp.task(tasks.CLIENT_DEL_DIST, () => del.sync([base.DIST]));
6 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng2/index.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import {tasks} from "./const";
3 |
4 | gulp.task(tasks.CLIENT_BUILD_DEV, [
5 | tasks.CLIENT_BUILD_TS
6 | ]);
7 |
8 | gulp.task(tasks.CLIENT_BUILD_DIST, () => {
9 | return new Promise((resolve, reject) => {
10 | runSequence(
11 | tasks.CLIENT_BUILD_TS,
12 | //tasks.CLIENT_UNIT_TEST,
13 | tasks.CLIENT_DEL_DIST,
14 | tasks.CLIENT_COPY,
15 | tasks.CLIENT_VIEWS_DIST,
16 | [
17 | tasks.CLIENT_IMAGE_DIST,
18 | tasks.CLIENT_JS_DIST
19 | ],
20 |
21 | resolve
22 | );
23 |
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng2/unit_test.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import coveralls from "gulp-coveralls";
3 | import {Server as Karma} from "karma";
4 | import {tasks} from "./const";
5 |
6 | gulp.task(tasks.CLIENT_UNIT_TEST, (done) => {
7 | return new Karma({
8 | configFile: process.cwd() + "/karma.conf.js",
9 | browsers: ["Chrome"],
10 | singleRun: true
11 | }, done).start();
12 | });
13 |
14 | gulp.task(tasks.CLIENT_COVERAGE, [tasks.CLIENT_UNIT_TEST], () => {
15 | return gulp.src("unit_coverage/**/lcov.info").pipe(coveralls());
16 | });
17 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/ng2/watch.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import Server from "aliv";
3 | import {base, tasks} from "./const";
4 |
5 | let aliv = new Server({
6 | watch: false,
7 | root: process.cwd()
8 | });
9 |
10 | gulp.task(tasks.CLIENT_RELOAD, () => {
11 | return aliv.reload();
12 | });
13 |
14 | gulp.task(tasks.CLIENT_WATCH, [tasks.CLIENT_BUILD_TS, <% if (!!stylePreprocessor) { %> tasks.CLIENT_COMPILE_TO_CSS <% } %>], () => {
15 | aliv.start();
16 |
17 | let _watchable = [];
18 |
19 | _watchable.push(base.DEV + "**/*.ts");
20 | _watchable.push(base.DEV + "**/*.css");
21 | _watchable.push(base.DEV + "**/*.html");
22 | <% if (stylePreprocessor === "less") { %>
23 | _watchable.push(base.DEV + "**/*.less");
24 | <% } %>
25 | <% if (stylePreprocessor === "sass") { %>
26 | _watchable.push(base.DEV + "**/*.{sass,scss}");
27 | <% } %>
28 |
29 | return gulp.watch(_watchable, [
30 | tasks.CLIENT_BUILD_TS,
31 | <% if (!!stylePreprocessor) { %>
32 | tasks.CLIENT_COMPILE_TO_CSS,
33 | <% } %>
34 | tasks.CLIENT_RELOAD,
35 | ]);
36 | });
37 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/vue2/build_css.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import cssmin from "gulp-clean-css";
3 | import {join} from "path";
4 | import {base, tasks} from "./const";
5 | <% if (stylePreprocessor === "less") { %>
6 | import less from "gulp-less";
7 | <% } %>
8 | <% if (stylePreprocessor === "sass") { %>
9 | import sass from "gulp-sass";
10 | <% } %>
11 |
12 | const CSS = base.DIST + "**/*.css";
13 | <% if (stylePreprocessor === "less") { %>
14 | const LESS = [
15 | base.DEV + "**/*.less"
16 | ];
17 | <% } %>
18 | <% if (stylePreprocessor === "sass") { %>
19 | const SASS = [
20 | base.DEV + "**/*.{sass,scss}"
21 | ];
22 | <% } %>
23 |
24 | <% if (!!stylePreprocessor) { %>
25 | gulp.task(tasks.CLIENT_COMPILE_TO_CSS, () => {
26 | <% if (stylePreprocessor === "less") { %>
27 | return gulp.src(LESS)
28 | .pipe(less())
29 | .on("error", (err) => {
30 | console.log(err);
31 | })
32 | .pipe(gulp.dest(base.DEV));
33 | <% } %>
34 | <% if (stylePreprocessor === "sass") { %>
35 | return gulp.src(SASS)
36 | .pipe(sass())
37 | .on("error", sass.logError)
38 | .pipe(gulp.dest(base.DEV));
39 | <% } %>
40 | });
41 | <% } %>
42 |
43 | gulp.task(tasks.CLIENT_BUILD_CSS_DIST, () => {
44 | return gulp.src(CSS, {base: base.DIST})
45 | .pipe(cssmin())
46 | .pipe(gulp.dest(base.DIST));
47 | });
--------------------------------------------------------------------------------
/app/templates/tasks/client/vue2/build_html.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import htmlmin from "gulp-htmlmin";
3 | import rev from "gulp-rev-append";
4 | import {base, tasks} from "./const";
5 |
6 | const VIEWS = base.DIST + "**/*.html";
7 |
8 | gulp.task(tasks.CLIENT_VIEWS_DIST, () => {
9 | return gulp.src(VIEWS, {base: base.DIST})
10 | .pipe(rev())
11 | .pipe(htmlmin({
12 | collapseWhitespace: true,
13 | caseSensitive: true
14 | }))
15 | .pipe(gulp.dest(base.DIST));
16 | });
17 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/vue2/build_image.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import imageMin from "gulp-imagemin";
3 | import {base, tasks} from "./const";
4 |
5 | const IMAGES = base.DIST + "**/*.{png,jpg,jpeg,svg,gif}";
6 |
7 | gulp.task(tasks.CLIENT_IMAGE_DIST, () => {
8 | return gulp.src(IMAGES, {base: base.DIST})
9 | .pipe(imageMin())
10 | .pipe(gulp.dest(base.DIST));
11 | });
12 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/vue2/build_js.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import babel from "gulp-babel";
3 | import {base, tasks} from "./const";
4 |
5 | const JS = base.DIST + "**/*.js";
6 |
7 | gulp.task(tasks.CLIENT_BUILD_JS_DIST, () => {
8 | return gulp.src(JS, {base: base.DIST})
9 | .pipe(babel({
10 | presets: [
11 | "env",
12 | "minify"
13 | ]
14 | }))
15 | .pipe(gulp.dest(base.DIST));
16 | });
17 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/vue2/const.js:
--------------------------------------------------------------------------------
1 | export const base = {
2 | ROOT: "./",
3 | DEV: "./client/dev/",
4 | DIST: "./client/dist/",
5 | DIST_CORDOVA: "./client/dist_cordova/www/"
6 | }
7 |
8 | export const tasks = {
9 | CLIENT_VIEWS_DIST: "client.views:dist",
10 | CLIENT_IMAGE_DIST: "client.imgs:dist",
11 | CLIENT_BUILD_CSS_DIST: "client.build_css:dist",
12 | CLIENT_BUILD_JS_DIST: "client.build_js:dist",
13 | CLIENT_DEL_DIST: "client.del:dist",
14 |
15 | CLIENT_COPY: "client.copy",
16 |
17 | CLIENT_UNIT_TEST: "client.unit_test",
18 | CLIENT_COVERAGE: "client.coverage",
19 |
20 | CLIENT_WATCH: "client.watch",
21 |
22 | CLIENT_RELOAD: "client.reload",
23 |
24 | CLIENT_BUILD_DIST: "client.build:dist",
25 |
26 | <% if (stylePreprocessor === "sass") { %>
27 | CLIENT_COMPILE_TO_CSS: "client.compile_from_sass_to_css:dev"
28 | <% } %>
29 |
30 | <% if (stylePreprocessor === "less") { %>
31 | CLIENT_COMPILE_TO_CSS: "client.compile_from_less_to_css:dev"
32 | <% } %>
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/vue2/copy.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import {base, tasks} from "./const";
3 |
4 | gulp.task(tasks.CLIENT_COPY, () => {
5 | return gulp.src(base.DEV + "**/*")
6 | .pipe(gulp.dest(base.DIST));
7 | });
8 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/vue2/del.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import del from "del";
3 | import {base, tasks} from "./const";
4 |
5 | gulp.task(tasks.CLIENT_DEL_DIST, () => del.sync([base.DIST]));
6 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/vue2/index.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import runSequence from "run-sequence";
3 | import {base, tasks} from "./const";
4 |
5 | gulp.task(tasks.CLIENT_BUILD_DIST, () => {
6 | return new Promise((resolve, reject) => {
7 | runSequence(
8 | // tasks.CLIENT_UNIT_TEST,
9 | tasks.CLIENT_DEL_DIST,
10 | tasks.CLIENT_COPY,
11 | tasks.CLIENT_VIEWS_DIST,
12 | [
13 | tasks.CLIENT_IMAGE_DIST,
14 | tasks.CLIENT_BUILD_JS_DIST,
15 | tasks.CLIENT_BUILD_CSS_DIST
16 | ],
17 |
18 | resolve
19 | );
20 | });
21 | });
22 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/vue2/unit_test.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import coveralls from "gulp-coveralls";
3 | import {Server as Karma} from "karma";
4 | import {tasks} from "./const";
5 |
6 | gulp.task(tasks.CLIENT_UNIT_TEST, (done) => {
7 | return new Karma({
8 | configFile: process.cwd() + "/karma.conf.js",
9 | browsers: ["Chrome"],
10 | singleRun: true
11 | }, done).start();
12 | });
13 |
14 | gulp.task(tasks.CLIENT_COVERAGE, [tasks.CLIENT_UNIT_TEST], () => {
15 | return gulp.src("unit_coverage/**/lcov.info").pipe(coveralls());
16 | });
17 |
--------------------------------------------------------------------------------
/app/templates/tasks/client/vue2/watch.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import Server from "aliv";
3 | import {base, tasks} from "./const";
4 |
5 | let aliv = new Server({
6 | watch: false,
7 | root: process.cwd()
8 | });
9 |
10 | gulp.task(tasks.CLIENT_RELOAD, () => {
11 | return aliv.reload();
12 | });
13 |
14 | gulp.task(tasks.CLIENT_WATCH, [<% if (!!stylePreprocessor) { %> tasks.CLIENT_COMPILE_TO_CSS <% }%>], () => {
15 | aliv.start();
16 |
17 | let _watchable = [];
18 |
19 | _watchable.push(base.DEV + "**/*.js");
20 | _watchable.push(base.DEV + "**/*.css");
21 | _watchable.push(base.DEV + "**/*.html");
22 | <% if (stylePreprocessor === "less") { %>
23 | _watchable.push(base.DEV + "**/*.less");
24 | <% } %>
25 | <% if (stylePreprocessor === "sass") { %>
26 | _watchable.push(base.DEV + "**/*.{sass,scss}");
27 | <% } %>
28 |
29 | return gulp.watch(_watchable, [
30 | <% if (!!stylePreprocessor) { %>
31 | tasks.CLIENT_COMPILE_TO_CSS,
32 | <% } %>
33 | tasks.CLIENT_RELOAD,
34 | ]);
35 | });
36 |
--------------------------------------------------------------------------------
/app/templates/tasks/index.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp"
2 | import fwdref from "undertaker-forward-reference"
3 |
4 | gulp.registry(fwdref())
5 | <% if (!serverOnly) {%>
6 | require("require-dir")("client")
7 | <% } %>
8 | <% if (nodeServer) {%>
9 | require("require-dir")("server")
10 | <% } %>
11 |
--------------------------------------------------------------------------------
/app/templates/tasks/server/build_tsc.js:
--------------------------------------------------------------------------------
1 | import gulp from "gulp";
2 | import tsc from "gulp-typescript";
3 |
4 | const TS_CONFIG = "./tsconfig.json";
5 |
6 | gulp.task("server.compile_tsc", () => {
7 | let tsconfigSrc = tsc.createProject(TS_CONFIG);
8 |
9 | return tsconfigSrc.src()
10 | .pipe(tsconfigSrc())
11 | .js
12 | .pipe(gulp.dest("./server"));
13 | });
14 |
--------------------------------------------------------------------------------
/app/templates/tasks/server/index.js:
--------------------------------------------------------------------------------
1 | import gulp from 'gulp';
2 |
--------------------------------------------------------------------------------
/app/templates/tasks/server/test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/tasks/server/test.js
--------------------------------------------------------------------------------
/app/templates/tests/client_ng1/todo/models/todo-model_test.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | describe("Todo", function() {
4 | var _Todo;
5 |
6 | beforeEach(module("<%= appName %>"));
7 |
8 | beforeEach(inject(function($injector) {
9 | _Todo = $injector.get("Todo");
10 | }));
11 |
12 | describe("instance", function() {
13 | it("should have the right prop for the instance", function() {
14 | /* jshint -W055 */
15 | var _todo = new _Todo();
16 |
17 | expect(_todo.todoMessage).toBeNull();
18 | });
19 | });
20 |
21 | describe("isValid", function() {
22 | it("should return false, invalid something2do", function() {
23 | /* jshint -W055 */
24 | var _todo = new _Todo();
25 |
26 | expect(_todo.isValid()).toBeFalsy();
27 | });
28 |
29 | it("should return true, new instance is valid", function() {
30 | /* jshint -W055 */
31 | var _todo = new _Todo();
32 | _todo.todoMessage = "I have to walk the dog.";
33 |
34 | expect(_todo.isValid()).toBeTruthy();
35 | });
36 | });
37 | });
38 |
--------------------------------------------------------------------------------
/app/templates/tests/client_ng2/todo/services/todo-service_test.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | <% if (testsSeparated) { %>
4 | import {TodoService} from "../../../../client/dev/todo/services/todo-service";
5 | <% } else { %>
6 | import {TodoService} from "./todo-service";
7 | <% } %>
8 |
9 | describe("todo_service", () => {
10 | describe("creation", () => {
11 | it("should create the service correctly", () => {
12 | expect(true).toBe(true);
13 | });
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/app/templates/tests/client_vue2/todo/components/todo-cmp_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/tests/client_vue2/todo/components/todo-cmp_test.js
--------------------------------------------------------------------------------
/app/templates/tests/client_vue2/todo/models/todo-model_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/tests/client_vue2/todo/models/todo-model_test.js
--------------------------------------------------------------------------------
/app/templates/tests/server/_helpers/db.js:
--------------------------------------------------------------------------------
1 | import Todo from "../../../server/api/todo/dao/todo-dao";
2 | import dbJson from "./db.json";
3 | import Promise from 'bluebird';
4 |
5 | exports.setupMongoose = (mongoose, done) => {
6 | mongoose.Promise = Promise; //Add promise
7 | mongoose.models = {};
8 | mongoose.connection.on("error", () => {});
9 | mongoose.connect(dbJson.db.test.url, done); //pass done
10 | }
11 |
12 | exports.createTodos = () => {
13 | let _array = [];
14 |
15 | for (let i = 0; i < 10; i++) {
16 | _array.push({
17 | _id: "507c7f79bcf86cd7994f6c"+ (i + 10),
18 | todoMessage: "aaaaaaa"+i
19 | });
20 | }
21 |
22 | return Todo.create(_array);
23 | }
24 |
--------------------------------------------------------------------------------
/app/templates/tests/server/_helpers/db.json:
--------------------------------------------------------------------------------
1 | {
2 | "db": {
3 | "test": {
4 | "url": "mongodb://localhost/<%= appName %>_test"
5 | }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/app/templates/tests/server/todo/controller/todo-controller_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/tests/server/todo/controller/todo-controller_test.js
--------------------------------------------------------------------------------
/app/templates/tests/server/todo/model/todo-model_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/tests/server/todo/model/todo-model_test.js
--------------------------------------------------------------------------------
/app/templates/tests/server/todo/route/todo-route_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/app/templates/tests/server/todo/route/todo-route_test.js
--------------------------------------------------------------------------------
/app/templates/webpack.config.prod_ng2.js:
--------------------------------------------------------------------------------
1 | const webpack = require('webpack');
2 | const webpackMerge = require('webpack-merge');
3 | const ExtractTextPlugin = require('extract-text-webpack-plugin');
4 | const commonConfig = require('./webpack.common.js');
5 | const helpers = require('./helpers');
6 |
7 | const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
8 |
9 | module.exports = webpackMerge(commonConfig, {
10 | devtool: 'source-map',
11 |
12 | output: {
13 | path: helpers.root('dist'),
14 | publicPath: '/',
15 | filename: '[name].[hash].js',
16 | chunkFilename: '[id].[hash].chunk.js'
17 | },
18 |
19 | plugins: [
20 | new webpack.NoEmitOnErrorsPlugin(),
21 | new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618
22 | mangle: {
23 | keep_fnames: true
24 | }
25 | }),
26 | new ExtractTextPlugin('[name].[hash].css'),
27 | new webpack.DefinePlugin({
28 | 'process.env': {
29 | 'ENV': JSON.stringify(ENV)
30 | }
31 | }),
32 | new webpack.LoaderOptionsPlugin({
33 | htmlLoader: {
34 | minimize: false // workaround for ng2
35 | }
36 | })
37 | ]
38 | });
--------------------------------------------------------------------------------
/component/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const {Base} = require('yeoman-generator');
4 | const {ComponentSubGenerator} = require('../_ng/client/sub_generators_component');
5 |
6 | module.exports = class ComponentGenerator extends Base {
7 | constructor(args, options, config) {
8 | super(args, options, config);
9 |
10 | this.generator = new ComponentSubGenerator(this);
11 | }
12 |
13 | initializing() {
14 | this.generator.initializing();
15 | }
16 |
17 | writing() {
18 | this.generator.writing();
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/component/templates/ng1/component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/component/templates/ng1/component.css
--------------------------------------------------------------------------------
/component/templates/ng1/component.html:
--------------------------------------------------------------------------------
1 |
2 |
Hello, {{$ctrl.user.name}}!
3 |
4 |
--------------------------------------------------------------------------------
/component/templates/ng1/component.js:
--------------------------------------------------------------------------------
1 | ;(function(ng) {
2 | 'use strict';
3 |
4 | ng.module('<%= appName %>')
5 | .component('<%= name %>', {
6 | templateUrl: '<%= feature %>/templates/<%= name %>.html',
7 | controller: [function () {
8 | this.user = {
9 | name: 'world'
10 | };
11 | }]
12 | });
13 | }(window.angular));
14 |
--------------------------------------------------------------------------------
/component/templates/ng1/component_test.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | describe('<%= name %>', () => {
4 | let $componentController;
5 | beforeEach(module('<%= appName %>'));
6 | beforeEach(inject(function(_$componentController_) {
7 | $componentController = _$componentController_;
8 | }));
9 |
10 | it('should expose a `user` object', function() {
11 | var bindings = {user: {name: 'Boss'}};
12 | var ctrl = $componentController('<%= name %>', null, bindings);
13 |
14 | expect(ctrl.user).toBeDefined();
15 | expect(ctrl.user.name).toBe('Boss');
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/component/templates/ng2/component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/component/templates/ng2/component.css
--------------------------------------------------------------------------------
/component/templates/ng2/component.html:
--------------------------------------------------------------------------------
1 |
2 |
Hello, {{name}}!
3 |
4 |
--------------------------------------------------------------------------------
/component/templates/ng2/component.ts:
--------------------------------------------------------------------------------
1 | import {
2 | Component,
3 | Inject
4 | } from "@angular/core";
5 |
6 | @Component({
7 | selector: "<%= name %>",
8 | templateUrl: "<%= feature %>/templates/<%= name %>.html",
9 | styleUrls: ["<%= feature %>/styles/<%= name %>.css"]
10 | })
11 | export class <%= nameCapitalized %> {
12 | name: string = `yo, I"m your component :D`;
13 | }
14 |
--------------------------------------------------------------------------------
/component/templates/ng2/component_test.ts:
--------------------------------------------------------------------------------
1 | describe('myComponent', () => {
2 | beforeEach(() => {
3 |
4 | });
5 |
6 | describe("creation", () => {
7 |
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/component/templates/vue2/component.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{msg}}
4 |
5 |
6 |
7 |
30 |
31 | <% if (stylePreprocessor === "none") {%>
32 |
44 |
--------------------------------------------------------------------------------
/component/templates/vue2/component_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/component/templates/vue2/component_test.js
--------------------------------------------------------------------------------
/controller/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const {Base} = require('yeoman-generator');
4 | const {ControllerSubGenerator} = require('../_ng/client/sub_generators_controller');
5 |
6 | module.exports = class ControllerGenerator extends Base {
7 | constructor(args, options, config) {
8 | super(args, options, config);
9 |
10 | this.generator = new ControllerSubGenerator(this);
11 | }
12 |
13 | initializing() {
14 | this.generator.initializing();
15 | }
16 |
17 | writing() {
18 | this.generator.writing();
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/controller/templates/ng1/controller_client.js:
--------------------------------------------------------------------------------
1 | ;(function(ng) {
2 | 'use strict';
3 |
4 | ng.module('<%= appName %>')
5 | .controller('<%= name %>', [
6 | function() {
7 |
8 | }
9 | ]);
10 | }(window.angular));
11 |
--------------------------------------------------------------------------------
/controller/templates/ng1/controller_client_test.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | describe('<%= name %>', function() {
4 | var _scope;
5 | var CONTROLLER_NAME = '<%= name %> as ctrl';
6 |
7 | beforeEach(module('<%= appName %>'));
8 |
9 | beforeEach(inject(function($injector) {
10 | _scope = $injector.get('$rootScope').$new();
11 | }));
12 |
13 | describe('init', function() {
14 | it('should create the controller correctly', inject(function($controller) {
15 | $controller(CONTROLLER_NAME, {$scope: _scope});
16 | }));
17 | });
18 |
19 | describe('onLoad', function() {
20 | it('should load correctly', inject(function($controller) {
21 | // ...
22 | }));
23 | });
24 |
25 | describe('onLoad', function() {
26 | it('should load correctly', inject(function($controller) {
27 | // ...
28 | }));
29 | });
30 | });
31 |
--------------------------------------------------------------------------------
/decorator/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const {Base} = require('yeoman-generator');
4 | const {DecoratorSubGenerator} = require('../_ng/client/sub_generators_decorator');
5 |
6 | module.exports = class DecoratorGenerator extends Base {
7 | constructor(args, options, config) {
8 | super(args, options, config);
9 |
10 | this.generator = new DecoratorSubGenerator(this);
11 | }
12 |
13 | initializing() {
14 | this.generator.initializing();
15 | }
16 |
17 | writing() {
18 | this.generator.writing();
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/decorator/templates/ng1/decorator.js:
--------------------------------------------------------------------------------
1 | ;(function(ng) {
2 | 'use strict';
3 |
4 | ng.module('<%= appName %>')
5 | .config([
6 | '$provide',
7 | function($provide) {
8 | $provide.decorator('SomethingToBeDecorated', [
9 | '$delegate',
10 | function($delegate) {
11 | return $delegate;
12 | }
13 | ]);
14 | }
15 | ]);
16 | }(window.angular));
17 |
--------------------------------------------------------------------------------
/directive/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const {Base} = require('yeoman-generator');
4 | const {DirectiveSubGenerator} = require('../_ng/client/sub_generators_directive');
5 |
6 | module.exports = class DirectiveGenerator extends Base {
7 | constructor(args, options, config) {
8 | super(args, options, config);
9 |
10 | this.generator = new DirectiveSubGenerator(this);
11 | }
12 |
13 | initializing() {
14 | this.generator.initializing();
15 | }
16 |
17 | writing() {
18 | this.generator.writing();
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/directive/templates/ng1/directive.js:
--------------------------------------------------------------------------------
1 | ;(function(ng) {
2 | 'use strict';
3 |
4 | ng.module('<%= appName %>')
5 | .directive('<%= name %>', [
6 | function() {
7 | var _link = function(scope, element, attrs) {
8 | console.log(scope);
9 | console.log(element);
10 | console.log(attrs);
11 | };
12 |
13 | var _restrict = 'A';
14 | var _scope = {};
15 | var _replace = true;
16 |
17 | return {
18 | restrict: _restrict,
19 | replace: _replace,
20 | scope: _scope,
21 | link: _link
22 | };
23 | }
24 | ]);
25 | }(window.angular));
26 |
--------------------------------------------------------------------------------
/directive/templates/ng1/directive_test.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | describe('<%= name %>', function() {
4 | var _scope, _compile, _element;
5 |
6 | beforeEach(module('<%= appName %>'));
7 |
8 | beforeEach(inject(function($injector) {
9 | _scope = $injector.get('$rootScope').$new();
10 | _compile = $injector.get('$compile');
11 |
12 | var _html = '<<%= name %>><%= name %>>';
13 |
14 | _element = window.angular.element(_html);
15 |
16 | _compile(_element)(_scope);
17 | _scope.$digest();
18 | }));
19 |
20 | describe('init', function() {
21 | it('should have the directive created', function() {
22 | expect(_element).toBeDefined();
23 | });
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/directive/templates/ng2/directive.ts:
--------------------------------------------------------------------------------
1 | import {
2 | Directive,
3 | OnInit
4 | } from "@angular/core";
5 |
6 | @Directive({
7 | selector: "[directive]",
8 | host: {
9 | "(click)": "clickHandler()"
10 | }
11 | })
12 | export class MyDirective implements OnInit {
13 | onInit() {
14 | console.log("directive init");
15 | }
16 |
17 | clickHandler() {
18 | console.log("directive clicked");
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/directive/templates/ng2/directive_test.ts:
--------------------------------------------------------------------------------
1 | describe('directive', () => {
2 | beforeEach(() => {
3 |
4 | });
5 |
6 | describe("creation", () => {
7 |
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/directive/templates/vue2/directive.js:
--------------------------------------------------------------------------------
1 | export default {
2 | bind(el, binding, vnode) {
3 |
4 | },
5 | inserted(el) {
6 |
7 | },
8 | update(newValue, oldValue) {
9 |
10 | },
11 | componentUpdated() {
12 |
13 | },
14 | unbind() {
15 |
16 | }
17 | }
--------------------------------------------------------------------------------
/directive/templates/vue2/directive_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/directive/templates/vue2/directive_test.js
--------------------------------------------------------------------------------
/endpoint/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const {Base} = require('yeoman-generator');
4 | const {EndpointSubGenerator} = require('../_ng/server/sub_generators_endpoint');
5 |
6 | module.exports = class EndpointGenerator extends Base {
7 | constructor(args, options, config) {
8 | super(args, options, config);
9 |
10 | this.generator = new EndpointSubGenerator(this);
11 | }
12 |
13 | initializing() {
14 | this.generator.initializing();
15 | }
16 |
17 | writing() {
18 | this.generator.writing();
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/endpoint/templates/go/echo/endpoint.controller.go:
--------------------------------------------------------------------------------
1 | package <%= nameLowerCase %>controller
2 |
3 | import (
4 | _ "encoding/json"
5 | _ "<%= repoHostUrl %>/<%= userNameSpace %>/<%= appName %>/server/api/<%= feature %>/dao"
6 | _ <%= nameLowerCase %> "<%= repoHostUrl %>/<%= userNameSpace %>/<%= appName %>/server/api/<%= feature %>/model"
7 | "github.com/labstack/echo"
8 | _ "io/ioutil"
9 | _ "net/http"
10 | )
11 |
12 | func GetAll(c echo.Context) {
13 | }
14 |
15 | func GetById(c echo.Context) {
16 | }
17 |
18 | func New(c echo.Context) {
19 | }
20 |
21 | func Update(c echo.Context) {
22 | }
23 |
24 | func Remove(c echo.Context) {
25 | }
26 |
--------------------------------------------------------------------------------
/endpoint/templates/go/echo/endpoint.controller_test.go:
--------------------------------------------------------------------------------
1 | package <%= nameLowerCase %>controller
2 |
--------------------------------------------------------------------------------
/endpoint/templates/go/echo/endpoint.dao.go:
--------------------------------------------------------------------------------
1 | package <%= nameLowerCase %>dao
2 |
3 | import (
4 | _ "errors"
5 | _ "<%= repoHostUrl %>/<%= userNameSpace %>/<%= appName %>/server/api/<%= feature %>/model"
6 | _ "<%= repoHostUrl %>/<%= userNameSpace %>/<%= appName %>/server/config"
7 | _ "gopkg.in/mgo.v2/bson"
8 | )
9 |
10 | func All() {
11 |
12 | }
13 |
14 | func New() {
15 |
16 | }
17 |
18 | func Update() {
19 |
20 | }
21 |
22 | func Delete() {
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/endpoint/templates/go/echo/endpoint.dao_test.go:
--------------------------------------------------------------------------------
1 | package <%= nameLowerCase %>dao
2 |
3 | import (
4 | _ <%= nameLowerCase %> "<%= repoHostUrl %>/<%= userNameSpace %>/<%= appName %>/server/api/<%= feature %>/model"
5 | _ "github.com/stretchr/testify/assert"
6 | _ "gopkg.in/mgo.v2"
7 | _ "gopkg.in/mgo.v2/bson"
8 | _ "testing"
9 | _ "time"
10 | )
11 |
--------------------------------------------------------------------------------
/endpoint/templates/go/echo/endpoint.model.go:
--------------------------------------------------------------------------------
1 | package <%= nameLowerCase %>model
2 |
3 | import (
4 | "gopkg.in/mgo.v2/bson"
5 | "time"
6 | )
7 |
8 | type <%= name %> struct {
9 | Id bson.ObjectId `json:"_id,omitempty" bson:"_id,omitempty"`
10 | CreatedAt time.Time `json:"createdAt,omitempty" bson:"createdAt"`
11 | }
12 |
13 | func (t <%= name %>) IsValid() bool {
14 | return false
15 | }
16 |
--------------------------------------------------------------------------------
/endpoint/templates/go/echo/endpoint.model_test.go:
--------------------------------------------------------------------------------
1 | package <%= nameLowerCase %>model
2 |
3 | import (
4 | _"github.com/stretchr/testify/assert"
5 | _"gopkg.in/mgo.v2/bson"
6 | _"testing"
7 | _"time"
8 | )
9 |
10 |
--------------------------------------------------------------------------------
/endpoint/templates/go/echo/endpoint.route.go:
--------------------------------------------------------------------------------
1 | package <%= nameLowerCase %>routes
2 |
3 | import (
4 | "<%= repoHostUrl %>/<%= userNameSpace %>/<%= appName %>/server/api/<%= feature %>/controller"
5 | "github.com/labstack/echo"
6 | )
7 |
8 | func Init(e *echo.Echo) {
9 | e.GET("/api/<%= nameLowerCase %>", <%= nameLowerCase %>controller.GetAll)
10 | e.GET("/api/<%= nameLowerCase %>/:id", <%= nameLowerCase %>controller.GetById)
11 | e.POST("/api/<%= nameLowerCase %>", <%= nameLowerCase %>controller.New)
12 | e.PUT("/api/<%= nameLowerCase %>/:id", <%= nameLowerCase %>controller.Update)
13 | e.DELETE("/api/<%= nameLowerCase %>/:id", <%= nameLowerCase %>controller.Remove)
14 | }
15 |
--------------------------------------------------------------------------------
/endpoint/templates/go/echo/endpoint.route_test.go:
--------------------------------------------------------------------------------
1 | package <%= nameLowerCase %>routes
2 |
--------------------------------------------------------------------------------
/endpoint/templates/node/express/babel/endpoint.controller.js:
--------------------------------------------------------------------------------
1 | import <%= name %>DAO from '../dao/<%= name %>-dao';
2 |
3 | export default class <%= name %>Controller {
4 | static getAll(req, res) {
5 | <%= name %>DAO
6 | .getAll()
7 | .then(<%= nameLowerCase %>s => res.status(200).json(<%= nameLowerCase %>s))
8 | .catch(error => res.status(400).json(error));
9 | }
10 |
11 | static createNew(req, res) {
12 | let _<%= nameLowerCase %> = req.body;
13 |
14 | <%= name %>DAO
15 | .createNew(_<%= nameLowerCase %>)
16 | .then(<%= nameLowerCase %> => res.status(201).json(<%= nameLowerCase %>))
17 | .catch(error => res.status(400).json(error));
18 | }
19 |
20 | static removeById(req, res) {
21 | let _id = req.params.id;
22 |
23 | <%= name %>DAO
24 | .removeById(_id)
25 | .then(() => res.status(200).end())
26 | .catch(error => res.status(400).json(error));
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/endpoint/templates/node/express/babel/endpoint.controller_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/express/babel/endpoint.controller_test.js
--------------------------------------------------------------------------------
/endpoint/templates/node/express/babel/endpoint.dao_test.js:
--------------------------------------------------------------------------------
1 | const mongoose = require('mongoose');
2 | const expect = require('chai').expect;
3 | <% if (testsSeparated) { %>
4 | const <%= name %>DAO = require(process.cwd() + '/server/api/<%= feature %>dao/<%= name %>-dao');
5 | const setupMongoose = require('../../_helpers/db').setupMongoose;
6 | <% } else { %>
7 | const <%= name %>DAO = require('./<%= name %>-dao');
8 | const setupMongoose = require('../../../config/db.conf.test').setupMongoose;
9 | <% } %>
10 |
11 |
12 | describe('<%= name %>DAO', () => {
13 | before((done) => {
14 | setupMongoose(mongoose, done);
15 | });
16 |
17 | afterEach(() => {
18 | <%= name %>DAO.remove();
19 | })
20 |
21 | describe('getAll', () => {
22 |
23 | })
24 |
25 | describe('createNew', () => {
26 |
27 | })
28 |
29 | describe('removeById', () => {
30 |
31 | })
32 | })
33 |
--------------------------------------------------------------------------------
/endpoint/templates/node/express/babel/endpoint.model.js:
--------------------------------------------------------------------------------
1 | import mongoose from 'mongoose';
2 |
3 | const _<%= nameLowerCase %>Schema = {
4 | somethingSomething: {type: String, required: true, trim: true},
5 | createdAt: {type: Date, default: Date.now}
6 | }
7 |
8 | export default mongoose.Schema(_<%= nameLowerCase %>Schema);
9 |
--------------------------------------------------------------------------------
/endpoint/templates/node/express/babel/endpoint.model_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/express/babel/endpoint.model_test.js
--------------------------------------------------------------------------------
/endpoint/templates/node/express/babel/endpoint.route.js:
--------------------------------------------------------------------------------
1 | import <%= name %>Controller from '../controller/<%= name %>-controller';
2 |
3 | export default class <%= name %>Routes {
4 | static init(router) {
5 | router
6 | .route('/api/<%= nameLowerCase %>')
7 | .get(<%= name %>Controller.getAll)
8 | .post(<%= name %>Controller.createNew);
9 |
10 | router
11 | .route('/api/<%= nameLowerCase %>/:id')
12 | .delete(<%= name %>Controller.removeById);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/endpoint/templates/node/express/babel/endpoint.route_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/express/babel/endpoint.route_test.js
--------------------------------------------------------------------------------
/endpoint/templates/node/express/no_transpiler/endpoint.controller.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const <%= name %> = require('../dao/<%= name %>-dao');
4 |
5 | module.exports = class <%= name %>Controller {
6 | static getAll(req, res) {
7 | <%= name %>DAO
8 | .getAll()
9 | .then(<%= nameLowerCase %>s => res.status(200).json(<%= nameLowerCase %>s))
10 | .catch(error => res.status(400).json(error));
11 | }
12 |
13 | static createNew(req, res) {
14 | let _<%= nameLowerCase %> = req.body;
15 |
16 | <%= name %>DAO
17 | .createNew(_<%= nameLowerCase %>)
18 | .then(<%= nameLowerCase %> => res.status(201).json(<%= nameLowerCase %>))
19 | .catch(error => res.status(400).json(error));
20 | }
21 |
22 | static removeById(req, res) {
23 | let _id = req.params.id;
24 |
25 | <%= name %>DAO
26 | .removeById(_id)
27 | .then(() => res.status(200).end())
28 | .catch(error => res.status(400).json(error));
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/endpoint/templates/node/express/no_transpiler/endpoint.controller_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/express/no_transpiler/endpoint.controller_test.js
--------------------------------------------------------------------------------
/endpoint/templates/node/express/no_transpiler/endpoint.dao_test.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const mongoose = require('mongoose');
4 | const expect = require('chai').expect;
5 | <% if (testsSeparated) { %>
6 | const <%= name %>DAO = require(process.cwd() + '/server/api/<%= feature %>dao/<%= name %>-dao');
7 | const setupMongoose = require('../../_helpers/db').setupMongoose;
8 | <% } else { %>
9 | const <%= name %>DAO = require('./<%= name %>-dao');
10 | const setupMongoose = require('../../../config/db.conf.test').setupMongoose;
11 | <% } %>
12 |
13 |
14 | describe('<%= name %>DAO', () => {
15 | before((done) => {
16 | setupMongoose(mongoose, done);
17 | });
18 |
19 | afterEach(() => {
20 | <%= name %>DAO.remove();
21 | })
22 |
23 | describe('getAll', () => {
24 |
25 | })
26 |
27 | describe('createNew', () => {
28 |
29 | })
30 |
31 | describe('removeById', () => {
32 |
33 | })
34 | })
35 |
--------------------------------------------------------------------------------
/endpoint/templates/node/express/no_transpiler/endpoint.model.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const mongoose = require('mongoose');
4 |
5 | const _<%= nameLowerCase %>Schema = {
6 | somethingSomething: {type: String, required: true, trim: true},
7 | createdAt: {type: Date, default: Date.now}
8 | }
9 |
10 | module.exports = mongoose.Schema(_<%= nameLowerCase %>Schema);
11 |
--------------------------------------------------------------------------------
/endpoint/templates/node/express/no_transpiler/endpoint.model_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/express/no_transpiler/endpoint.model_test.js
--------------------------------------------------------------------------------
/endpoint/templates/node/express/no_transpiler/endpoint.route.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const <%= name %>Controller = require('../controller/<%= name %>-controller');
4 |
5 | module.exports = class <%= name %>Routes {
6 | static init(router) {
7 | router
8 | .route('/api/<%= nameLowerCase %>')
9 | .get(<%= name %>Controller.getAll)
10 | .post(<%= name %>Controller.createNew);
11 |
12 | router
13 | .route('/api/<%= nameLowerCase %>/:id')
14 | .delete(<%= name %>Controller.removeById);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/endpoint/templates/node/express/no_transpiler/endpoint.route_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/express/no_transpiler/endpoint.route_test.js
--------------------------------------------------------------------------------
/endpoint/templates/node/express/typescript/endpoint.controller.ts:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import * as express from "express";
4 | import {<%= name %>DAO} from "../dao/<%= name %>-dao";
5 |
6 | export class <%= name %>Controller {
7 | static getAll(req:express.Request, res:express.Response) {
8 | <%= name %>DAO
9 | ['getAll']()
10 | .then(<%= nameLowerCase %>s => res.status(200).json(<%= nameLowerCase %>s))
11 | .catch(error => res.status(400).json(error));
12 | }
13 |
14 | static createNew(req:express.Request, res:express.Response) {
15 | let _<%= nameLowerCase %> = req.body;
16 |
17 | <%= name %>DAO
18 | ["createNew"](_<%= nameLowerCase %>)
19 | .then(<%= nameLowerCase %> => res.status(201).json(<%= nameLowerCase %>))
20 | .catch(error => res.status(400).json(error));
21 | }
22 |
23 | static removeById(req:express.Request, res:express.Response) {
24 | let _id = req.params.id;
25 |
26 | <%= name %>DAO
27 | ["removeById"](_id)
28 | .then(() => res.status(200).end())
29 | .catch(error => res.status(400).json(error));
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/endpoint/templates/node/express/typescript/endpoint.controller_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/express/typescript/endpoint.controller_test.js
--------------------------------------------------------------------------------
/endpoint/templates/node/express/typescript/endpoint.dao_test.js:
--------------------------------------------------------------------------------
1 | const mongoose = require('mongoose');
2 | const expect = require('chai').expect;
3 | <% if (testsSeparated) { %>
4 | const <%= name %>DAO = require(process.cwd() + '/server/api/<%= feature %>dao/<%= name %>-dao');
5 | const setupMongoose = require('../../_helpers/db').setupMongoose;
6 | <% } else { %>
7 | const <%= name %>DAO = require('./<%= name %>-dao');
8 | const setupMongoose = require('../../../config/db.conf.test').setupMongoose;
9 | <% } %>
10 |
11 |
12 | describe('<%= name %>DAO', () => {
13 | before((done) => {
14 | setupMongoose(mongoose, done);
15 | });
16 |
17 | afterEach(() => {
18 | <%= name %>DAO.remove();
19 | })
20 |
21 | describe('getAll', () => {
22 |
23 | })
24 |
25 | describe('createNew', () => {
26 |
27 | })
28 |
29 | describe('removeById', () => {
30 |
31 | })
32 | })
33 |
--------------------------------------------------------------------------------
/endpoint/templates/node/express/typescript/endpoint.model.ts:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import * as mongoose from "mongoose";
4 |
5 | var _<%= nameLowerCase %>Schema = new mongoose.Schema({
6 | somethingSomething: {type: String, required: true, trim: true},
7 | createdAt: {type: Date, default: Date.now}
8 | })
9 |
10 | export default (_<%= nameLowerCase %>Schema);
11 |
--------------------------------------------------------------------------------
/endpoint/templates/node/express/typescript/endpoint.model_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/express/typescript/endpoint.model_test.js
--------------------------------------------------------------------------------
/endpoint/templates/node/express/typescript/endpoint.route.ts:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import * as express from "express";
4 | import {<%= name %>Controller} from "../controller/<%= name %>-controller";
5 |
6 | export class <%= name %>Routes {
7 | static init(router:express.Router) {
8 | router
9 | .route("/api/<%= nameLowerCase %>")
10 | .get(<%= name %>Controller.getAll)
11 | .post(<%= name %>Controller.createNew);
12 |
13 | router
14 | .route("/api/<%= nameLowerCase %>/:id")
15 | .delete(<%= name %>Controller.removeById);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/endpoint/templates/node/express/typescript/endpoint.route_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/express/typescript/endpoint.route_test.js
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/babel/endpoint.controller.js:
--------------------------------------------------------------------------------
1 | import <%= name %>DAO from '../dao/<%= name %>-dao';
2 |
3 | export default class <%= name %>Controller {
4 | async getAll() {
5 | try {
6 | let <%= nameLowerCase %>s = await <%= name %>DAO.getAll();
7 | this.body = <%= nameLowerCase %>s;
8 | this.status = 200;
9 | } catch(e) {
10 | this.status = 400;
11 | }
12 | }
13 |
14 | async createNew() {
15 | let _<%= nameLowerCase %> = this.body;
16 |
17 | try {
18 | this.body = await <%= name %>DAO.createNew(_<%= nameLowerCase %>);
19 | this.status = 201;
20 | } catch(e) {
21 | this.status = 400;
22 | }
23 | }
24 |
25 | async removeById() {
26 | let _id = this.params.id;
27 |
28 | try {
29 | await <%= name %>DAO.removeById(_id);
30 | this.status = 200;
31 | } catch(e) {
32 | this.status = 400;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/babel/endpoint.controller_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/koa/babel/endpoint.controller_test.js
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/babel/endpoint.dao_test.js:
--------------------------------------------------------------------------------
1 | const mongoose = require('mongoose');
2 | const expect = require('chai').expect;
3 | <% if (testsSeparated) { %>
4 | const <%= name %>DAO = require(process.cwd() + '/server/api/<%= feature %>dao/<%= name %>-dao');
5 | const setupMongoose = require('../../_helpers/db').setupMongoose;
6 | <% } else { %>
7 | const <%= name %>DAO = require('./<%= name %>-dao');
8 | const setupMongoose = require('../../../config/db.conf.test').setupMongoose;
9 | <% } %>
10 |
11 |
12 | describe('<%= name %>DAO', () => {
13 | before((done) => {
14 | setupMongoose(mongoose, done);
15 | });
16 |
17 | afterEach(() => {
18 | <%= name %>DAO.remove();
19 | })
20 |
21 | describe('getAll', () => {
22 |
23 | })
24 |
25 | describe('createNew', () => {
26 |
27 | })
28 |
29 | describe('removeById', () => {
30 |
31 | })
32 | })
33 |
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/babel/endpoint.model.js:
--------------------------------------------------------------------------------
1 | import mongoose from 'mongoose';
2 |
3 | const _<%= nameLowerCase %>Schema = {
4 | somethingSomething: {type: String, required: true, trim: true},
5 | createdAt: {type: Date, default: Date.now}
6 | }
7 |
8 | export default mongoose.Schema(_<%= nameLowerCase %>Schema);
9 |
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/babel/endpoint.model_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/koa/babel/endpoint.model_test.js
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/babel/endpoint.route.js:
--------------------------------------------------------------------------------
1 | import <%= name %>Controller from '../controller/<%= name %>-controller';
2 |
3 | export default class <%= name %>Routes {
4 | static init(router) {
5 | let <%= name %> new <%= name %>Controller();
6 |
7 | router.get('/api/<%= nameLowerCase %>', <%= name %>.getAll);
8 | router.post('/api/<%= nameLowerCase %>', <%= name %>.createNew);
9 | router.del('/api/<%= nameLowerCase %>/:id', <%= name %>.removeById);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/babel/endpoint.route_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/koa/babel/endpoint.route_test.js
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/no_transpiler/endpoint.controller.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const <%= name %> = require('../dao/<%= name %>-dao');
4 |
5 | module.exports = class <%= name %>Controller {
6 | *getAll() {
7 | try {
8 | let <%= nameLowerCase %>s = yield <%= name %>DAO.getAll();
9 | this.body = <%= nameLowerCase %>s;
10 | this.status = 200;
11 | } catch(e) {
12 | this.status = 400;
13 | }
14 | }
15 |
16 | *createNew() {
17 | let _<%= nameLowerCase %> = this.body;
18 |
19 | try {
20 | this.body = yield <%= name %>DAO.createNew(_<%= nameLowerCase %>);
21 | this.status = 201;
22 | } catch(e) {
23 | this.status = 400;
24 | }
25 | }
26 |
27 | *removeById() {
28 | let _id = this.params.id;
29 |
30 | try {
31 | yield <%= name %>DAO.removeById(_id);
32 | this.status = 200;
33 | } catch(e) {
34 | this.status = 400;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/no_transpiler/endpoint.controller_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/koa/no_transpiler/endpoint.controller_test.js
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/no_transpiler/endpoint.dao_test.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const mongoose = require('mongoose');
4 | const expect = require('chai').expect;
5 | <% if (testsSeparated) { %>
6 | const <%= name %>DAO = require(process.cwd() + '/server/api/<%= feature %>dao/<%= name %>-dao');
7 | const setupMongoose = require('../../_helpers/db').setupMongoose;
8 | <% } else { %>
9 | const <%= name %>DAO = require('./<%= name %>-dao');
10 | const setupMongoose = require('../../../config/db.conf.test').setupMongoose;
11 | <% } %>
12 |
13 |
14 | describe('<%= name %>DAO', () => {
15 | before((done) => {
16 | setupMongoose(mongoose, done);
17 | });
18 |
19 | afterEach(() => {
20 | <%= name %>DAO.remove();
21 | })
22 |
23 | describe('getAll', () => {
24 |
25 | })
26 |
27 | describe('createNew', () => {
28 |
29 | })
30 |
31 | describe('removeById', () => {
32 |
33 | })
34 | })
35 |
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/no_transpiler/endpoint.model.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const mongoose = require('mongoose');
4 |
5 | const _<%= nameLowerCase %>Schema = {
6 | somethingSomething: {type: String, required: true, trim: true},
7 | createdAt: {type: Date, default: Date.now}
8 | }
9 |
10 | module.exports = mongoose.Schema(_<%= nameLowerCase %>Schema);
11 |
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/no_transpiler/endpoint.model_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/koa/no_transpiler/endpoint.model_test.js
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/no_transpiler/endpoint.route.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const <%= name %>Controller = require('../controller/<%= name %>-controller');
4 |
5 | export default class <%= name %>Routes {
6 | static init(router) {
7 | let <%= name %> new <%= name %>Controller();
8 |
9 | router.get('/api/<%= nameLowerCase %>', <%= name %>.getAll);
10 | router.post('/api/<%= nameLowerCase %>', <%= name %>.createNew);
11 | router.del('/api/<%= nameLowerCase %>/:id', <%= name %>.removeById);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/no_transpiler/endpoint.route_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/koa/no_transpiler/endpoint.route_test.js
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/typescript/endpoint.controller.ts:
--------------------------------------------------------------------------------
1 | import * as <%= name %>DAO from '../dao/<%= name %>-dao';
2 |
3 | export default class <%= name %>Controller {
4 | *getAll() {
5 | try {
6 | let <%= nameLowerCase %>s = yield <%= name %>DAO.getAll();
7 | this.body = <%= nameLowerCase %>s;
8 | this.status = 200;
9 | } catch(e) {
10 | this.status = 400;
11 | }
12 | }
13 |
14 | *createNew() {
15 | let _<%= nameLowerCase %> = this.body;
16 |
17 | try {
18 | this.body = yield <%= name %>DAO.createNew(_<%= nameLowerCase %>);
19 | this.status = 201;
20 | } catch(e) {
21 | this.status = 400;
22 | }
23 | }
24 |
25 | *removeById() {
26 | let _id = this.params.id;
27 |
28 | try {
29 | yield <%= name %>DAO.removeById(_id);
30 | this.status = 200;
31 | } catch(e) {
32 | this.status = 400;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/typescript/endpoint.controller_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/koa/typescript/endpoint.controller_test.js
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/typescript/endpoint.dao_test.js:
--------------------------------------------------------------------------------
1 | const mongoose = require('mongoose');
2 | const expect = require('chai').expect;
3 | <% if (testsSeparated) { %>
4 | const <%= name %>DAO = require(process.cwd() + '/server/api/<%= feature %>dao/<%= name %>-dao');
5 | const setupMongoose = require('../../_helpers/db').setupMongoose;
6 | <% } else { %>
7 | const <%= name %>DAO = require('./<%= name %>-dao');
8 | const setupMongoose = require('../../../config/db.conf.test').setupMongoose;
9 | <% } %>
10 |
11 |
12 | describe('<%= name %>DAO', () => {
13 | before((done) => {
14 | setupMongoose(mongoose, done);
15 | });
16 |
17 | afterEach(() => {
18 | <%= name %>DAO.remove();
19 | })
20 |
21 | describe('getAll', () => {
22 |
23 | })
24 |
25 | describe('createNew', () => {
26 |
27 | })
28 |
29 | describe('removeById', () => {
30 |
31 | })
32 | })
33 |
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/typescript/endpoint.model.ts:
--------------------------------------------------------------------------------
1 | import * as mongoose from 'mongoose';
2 |
3 | const _<%= nameLowerCase %>Schema = {
4 | somethingSomething: {type: String, required: true, trim: true},
5 | createdAt: {type: Date, default: Date.now}
6 | }
7 |
8 | export default mongoose.Schema(_<%= nameLowerCase %>Schema);
9 |
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/typescript/endpoint.model_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/koa/typescript/endpoint.model_test.js
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/typescript/endpoint.route.ts:
--------------------------------------------------------------------------------
1 | import * as <%= name %>Controller from '../controller/<%= name %>-controller';
2 |
3 | export default class <%= name %>Routes {
4 | static init(router) {
5 | let <%= name %> new <%= name %>Controller();
6 |
7 | router.get('/api/<%= nameLowerCase %>', <%= name %>.getAll);
8 | router.post('/api/<%= nameLowerCase %>', <%= name %>.createNew);
9 | router.del('/api/<%= nameLowerCase %>/:id', <%= name %>.removeById);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/endpoint/templates/node/koa/typescript/endpoint.route_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/endpoint/templates/node/koa/typescript/endpoint.route_test.js
--------------------------------------------------------------------------------
/factory/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const {Base} = require('yeoman-generator');
4 | const {FactorySubGenerator} = require('../_ng/client/sub_generators_factory');
5 |
6 | module.exports = class FactoryGenerator extends Base {
7 | constructor(args, options, config) {
8 | super(args, options, config);
9 |
10 | this.generator = new FactorySubGenerator(this);
11 | }
12 |
13 | initializing() {
14 | this.generator.initializing();
15 | }
16 |
17 | writing() {
18 | this.generator.writing();
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/factory/templates/ng1/factory.js:
--------------------------------------------------------------------------------
1 | ;(function(ng) {
2 | 'use strict';
3 |
4 | ng.module('<%= appName %>')
5 | .factory('<%= name %>', [
6 | function() {
7 | class <%= name %> {
8 | constructor() {
9 | this.something = 123;
10 | }
11 |
12 | isValid() {
13 | return !!this.something;
14 | }
15 | }
16 |
17 | return <%= name %>;
18 | }
19 | ]);
20 | }(window.angular));
21 |
--------------------------------------------------------------------------------
/factory/templates/ng1/factory_test.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | describe('<%= name %>', function() {
4 | var _<%= name %>;
5 |
6 | beforeEach(module('<%= appName %>'));
7 |
8 | beforeEach(inject(function($injector) {
9 | _<%= name %> = $injector.get('<%= name %>');
10 | }));
11 |
12 | describe('instance', function() {
13 | it('should have the right prop for the instance', function() {
14 | var _something = new _<%= name %>();
15 |
16 | expect(_something.something).toEqual(123);
17 | });
18 | });
19 |
20 | describe('isValid', function() {
21 | it('should return true', function() {
22 | var _something = new _<%= name %>();
23 |
24 | expect(_something.isValid()).toBeTruthy();
25 | });
26 | });
27 | });
28 |
--------------------------------------------------------------------------------
/factory/templates/ng2/factory.ts:
--------------------------------------------------------------------------------
1 | import {Injectable} from '@angular/core';
2 |
3 | interface ISomething {
4 | doSomething(): void;
5 | }
6 |
7 | @Injectable()
8 | export class MyFactory implements ISomething {
9 | doSomething(): void {
10 |
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/factory/templates/ng2/factory_test.ts:
--------------------------------------------------------------------------------
1 | describe('myFactory', () => {
2 | beforeEach(() => {
3 |
4 | });
5 |
6 | describe("creation", () => {
7 |
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/factory/templates/vue2/factory.js:
--------------------------------------------------------------------------------
1 | export class <%= name %> {
2 |
3 | }
--------------------------------------------------------------------------------
/factory/templates/vue2/factory_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/factory/templates/vue2/factory_test.js
--------------------------------------------------------------------------------
/filter/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const {Base} = require('yeoman-generator');
4 | const {FilterSubGenerator} = require('../_ng/client/sub_generators_filter');
5 |
6 | module.exports = class FilterGenerator extends Base {
7 | constructor(args, options, config) {
8 | super(args, options, config);
9 |
10 | this.generator = new FilterSubGenerator(this);
11 | }
12 |
13 | initializing() {
14 | this.generator.initializing();
15 | }
16 |
17 | writing() {
18 | this.generator.writing();
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/filter/templates/ng1/filter.js:
--------------------------------------------------------------------------------
1 | ;(function(ng) {
2 | 'use strict';
3 |
4 | ng.module('<%= appName %>')
5 | .filter('<%= name %>', [
6 | function() {
7 | return function (input) {
8 | if (!input) {
9 | return '';
10 | }
11 |
12 | return input;
13 | }
14 | }
15 | ]);
16 | }(window.angular));
17 |
--------------------------------------------------------------------------------
/filter/templates/ng1/filter_test.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | describe('<%= name %>', function() {
4 | var _<%= name %>;
5 |
6 | beforeEach(module('<%= appName %>'));
7 |
8 | beforeEach(inject(function($filter) {
9 | _<%= name %> = $filter('<%= name %>');
10 | }));
11 |
12 | describe('doSomething', function() {
13 | it('should return an empty string', function() {
14 | var _input = null;
15 | expect(_<%= name %>(_input)).toEqual('');
16 | });
17 |
18 | it('should return the input', function() {
19 | var _input = 'a';
20 | expect(_<%= name %>(_input)).toEqual(_input);
21 | });
22 | });
23 | });
--------------------------------------------------------------------------------
/filter/templates/vue2/filter.js:
--------------------------------------------------------------------------------
1 | export default {
2 | <%= name %>(value, arg1, arg2) {
3 | return value
4 | }
5 | }
--------------------------------------------------------------------------------
/filter/templates/vue2/filter_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/filter/templates/vue2/filter_test.js
--------------------------------------------------------------------------------
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/logo.png
--------------------------------------------------------------------------------
/model/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const {Base} = require('yeoman-generator');
4 | const {ModelSubGenerator} = require('../_ng/client/sub_generators_model');
5 |
6 | module.exports = class ModelGenerator extends Base {
7 | constructor(args, options, config) {
8 | super(args, options, config);
9 |
10 | this.generator = new ModelSubGenerator(this);
11 | }
12 |
13 | initializing() {
14 | this.generator.initializing();
15 | }
16 |
17 | writing() {
18 | this.generator.writing();
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/model/templates/ng1/model.js:
--------------------------------------------------------------------------------
1 | ;(function(ng) {
2 | 'use strict';
3 |
4 | ng.module('<%= appName %>')
5 | .factory('<%= name %>', [
6 | function() {
7 | class <%= name %> {
8 | constructor() {
9 | this.name = '';
10 | this.birthDate = null;
11 | }
12 |
13 | isValid() {
14 | return !!this.name && !!this.birthDate;
15 | }
16 | }
17 |
18 | return <%= name %>;
19 | }
20 | ]);
21 | }(window.angular));
22 |
--------------------------------------------------------------------------------
/model/templates/ng1/model_test.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | describe('<%= name %>', function() {
4 | var _<%= name %>;
5 |
6 | beforeEach(module('<%= appName %>'));
7 |
8 | beforeEach(inject(function($injector) {
9 | _<%= name %> = $injector.get('<%= name %>');
10 | }));
11 |
12 | describe('creation', function() {
13 | it('return a function', function() {
14 | expect(typeof _<%= name %>).toBe('function');
15 | });
16 | });
17 |
18 | describe('isValid', function() {
19 | it('should be valid if name and birth date is setted', function() {
20 | var m = new _<%= name %>();
21 | m.name = 'Felipe Smith';
22 | m.birthDate = new Date();
23 |
24 | expect(m.isValid()).toBe(true);
25 | });
26 |
27 | it('should be not valid if name or birth date is not setted', function () {
28 | var m1 = new _<%= name %>();
29 | expect(m1.isValid()).toBe(false);
30 |
31 | var m2 = new _<%= name %>();
32 | m2.birthDate = new Date();
33 | expect(m2.isValid()).toBe(false);
34 |
35 | var m3 = new _<%= name %>();
36 | m3.name = 'Felipe Smith';
37 | expect(m3.isValid()).toBe(false);
38 | })
39 | })
40 | });
41 |
--------------------------------------------------------------------------------
/model/templates/ng2/model.ts:
--------------------------------------------------------------------------------
1 | import {Injectable} from '@angular/core';
2 |
3 | interface IModel {
4 | doStuff(): number;
5 | }
6 |
7 | @Injectable()
8 | export class MyModel implements IModel {
9 | doStuff(): number {
10 | return 1;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/model/templates/ng2/model_test.ts:
--------------------------------------------------------------------------------
1 | describe('myModel', () => {
2 | beforeEach(() => {
3 |
4 | });
5 |
6 | describe("creation", () => {
7 |
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/model/templates/vue2/model.js:
--------------------------------------------------------------------------------
1 | export class <%= name %>Model {
2 | constructor() {
3 |
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/model/templates/vue2/model_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/model/templates/vue2/model_test.js
--------------------------------------------------------------------------------
/module/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const {Base} = require('yeoman-generator');
4 | const {ModuleSubGenerator} = require('../_ng/client/sub_generators_module');
5 |
6 | module.exports = class ModuleGenerator extends Base {
7 | constructor(args, options, config) {
8 | super(args, options, config);
9 |
10 | this.generator = new ModuleSubGenerator(this);
11 | }
12 |
13 | initializing() {
14 | this.generator.initializing();
15 | }
16 |
17 | writing() {
18 | this.generator.writing();
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/pipe/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const {Base} = require('yeoman-generator');
4 | const {PipeSubGenerator} = require('../_ng/client/sub_generators_pipe');
5 |
6 | module.exports = class PipeGenerator extends Base {
7 | constructor(args, options, config) {
8 | super(args, options, config);
9 |
10 | this.generator = new PipeSubGenerator(this);
11 | }
12 |
13 | initializing() {
14 | this.generator.initializing();
15 | }
16 |
17 | writing() {
18 | this.generator.writing();
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/pipe/templates/ng2/pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: '<%= name %>'
5 | })
6 | export class <%= nameCapitalized %>Pipe implements PipeTransform {
7 | transform(value: number, exponent: string): number {
8 | return value;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/pipe/templates/ng2/pipe_test.js:
--------------------------------------------------------------------------------
1 | describe('pipe_test', () => {
2 | beforeEach(() => {
3 |
4 | });
5 |
6 | describe('do something', () => {
7 |
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/resource/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const {Base} = require('yeoman-generator');
4 | const {ResourceSubGenerator} = require('../_ng/client/sub_generators_resource');
5 |
6 | module.exports = class ResourceGenerator extends Base {
7 | constructor(args, options, config) {
8 | super(args, options, config);
9 |
10 | this.generator = new ResourceSubGenerator(this);
11 | }
12 |
13 | initializing() {
14 | this.generator.initializing();
15 | }
16 |
17 | writing() {
18 | this.generator.writing();
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/resource/templates/ng1/resource.js:
--------------------------------------------------------------------------------
1 | ;(function(ng) {
2 | 'use strict';
3 |
4 | ng.module('<%= appName %>')
5 | .factory('<%= name %>', [
6 | '$resource',
7 | function($resource) {
8 | const _url = '/api/<%= name %>/:id';
9 |
10 | const _params = {
11 | id: '@id'
12 | };
13 |
14 | const _method = {
15 | update: {
16 | method: 'PUT',
17 | isArray: false
18 | },
19 | insert: {
20 | method: 'POST',
21 | isArray: false
22 | },
23 | getAll: {
24 | method: 'GET',
25 | isArray: true
26 | },
27 | getById: {
28 | method: 'GET',
29 | isArray: false
30 | },
31 | delete: {
32 | method: 'DELETE',
33 | isArray: false
34 | },
35 | };
36 |
37 | return $resource(_url, _params, _method);
38 | }
39 | ]);
40 | }(window.angular));
41 |
--------------------------------------------------------------------------------
/service/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const {Base} = require('yeoman-generator');
4 | const {ServiceSubGenerator} = require('../_ng/client/sub_generators_service');
5 |
6 | module.exports = class ServiceGenerator extends Base {
7 | constructor(args, options, config) {
8 | super(args, options, config);
9 |
10 | this.generator = new ServiceSubGenerator(this);
11 | }
12 |
13 | initializing() {
14 | this.generator.initializing();
15 | }
16 |
17 | writing() {
18 | this.generator.writing();
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/service/templates/ng1/service.js:
--------------------------------------------------------------------------------
1 | ;(function(ng) {
2 | 'use strict';
3 |
4 | ng.module('<%= appName %>')
5 | .service('<%= name %>', [
6 | '$q',
7 | function($q) {
8 | this.doSomething = function() {
9 | return $q.when({yo: '!'});
10 | };
11 | }
12 | ]);
13 | }(window.angular));
14 |
--------------------------------------------------------------------------------
/service/templates/ng1/service_test.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | describe('<%= name %>', function() {
4 | var _<%= name %>;
5 |
6 | beforeEach(module('<%= appName %>'));
7 |
8 | beforeEach(inject(function($injector) {
9 | _<%= name %> = $injector.get('<%= name %>');
10 | }));
11 |
12 | describe('doSomething', function() {
13 | it('should be an object', function() {
14 | expect(typeof _<%= name %>).toBe('object');
15 | })
16 |
17 | it('should doSomething', function() {
18 | _<%= name %>.doSomething();
19 | });
20 | });
21 | });
22 |
--------------------------------------------------------------------------------
/service/templates/ng2/service.ts:
--------------------------------------------------------------------------------
1 | import {Injectable} from '@angular/core';
2 |
3 | interface IService {
4 | doStuff(): number;
5 | }
6 |
7 | @Injectable()
8 | export class MyService implements IService {
9 | doStuff(): number {
10 | return 1;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/service/templates/ng2/service_test.ts:
--------------------------------------------------------------------------------
1 | describe('myService', () => {
2 | beforeEach(() => {
3 |
4 | });
5 |
6 | describe("creation", () => {
7 |
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/service/templates/vue2/service.js:
--------------------------------------------------------------------------------
1 | export class <%= name %>Service {
2 | getAll() {
3 | return Promise.resolve([]);
4 | }
5 |
6 | add(todo) {
7 | return Promise.resolve(todo);
8 | }
9 |
10 | remove(id) {
11 | return Promise.resolve(id);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/service/templates/vue2/service_test.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ericmdantas/generator-ng-fullstack/017700e77fc91d03ef647b895a198481286d4ab9/service/templates/vue2/service_test.js
--------------------------------------------------------------------------------
/style/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const {Base} = require('yeoman-generator');
4 | const {StyleSubGenerator} = require('../_ng/client/sub_generators_style');
5 |
6 | module.exports = class StyleGenerator extends Base {
7 | constructor(args, options, config) {
8 | super(args, options, config);
9 |
10 | this.generator = new StyleSubGenerator(this);
11 | }
12 |
13 | initializing() {
14 | this.generator.initializing();
15 | }
16 |
17 | writing() {
18 | this.generator.writing();
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/style/templates/style.css:
--------------------------------------------------------------------------------
1 | h1 {
2 | color: red;
3 | }
4 |
--------------------------------------------------------------------------------
/style/templates/style.less:
--------------------------------------------------------------------------------
1 | h1 {
2 | color: red;
3 | }
4 |
--------------------------------------------------------------------------------
/style/templates/style.scss:
--------------------------------------------------------------------------------
1 | h1 {
2 | color: red;
3 | }
4 |
--------------------------------------------------------------------------------
/test/_helpers/mocks.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const fs = require('fs');
4 |
5 | exports.createYoRc = function(obj, done) {
6 | fs.writeFile('.yo-rc.json', JSON.stringify(obj), done);
7 | };
--------------------------------------------------------------------------------
/test/acceptance/test-decorator.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const assert = require('yeoman-assert');
3 | const helpers = require('yeoman-test');
4 | const {createYoRc} = require('../_helpers/mocks');
5 |
6 | describe('subgenerator -> decorator', () => {
7 | describe('ng1', () => {
8 | before(function (done) {
9 | helpers
10 | .run(path.join(__dirname, '../../decorator'))
11 | .inTmpDir(function(dir) {
12 | createYoRc({
13 | "generator-ng-fullstack": {
14 | "client": "ng1",
15 | "testsSeparated": true
16 | }
17 | }, this.async());
18 | })
19 | .withArguments('newHttp')
20 | .withOptions({ 'skip-install': true, feature: 'dec' })
21 | .on('end', done);
22 | });
23 |
24 | it('creates files', () => {
25 | assert.file([
26 | 'client/dev/dec/decorator/newHttp.js'
27 | ]);
28 | });
29 | })
30 | });
31 |
--------------------------------------------------------------------------------
/test/acceptance/test-resource.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const assert = require('yeoman-assert');
3 | const helpers = require('yeoman-test');
4 | const {createYoRc} = require('../_helpers/mocks');
5 |
6 | describe('subgenerator -> resource', () => {
7 | describe('ng1', () => {
8 | before(function (done) {
9 | helpers
10 | .run(path.join(__dirname, '../../resource'))
11 | .inTmpDir(function(dir) {
12 | createYoRc({
13 | "generator-ng-fullstack": {
14 | "client": "ng1"
15 | }
16 | }, this.async());
17 | })
18 | .withArguments('country')
19 | .withOptions({ 'skip-install': true, feature: 'user-resource' })
20 | .on('end', done);
21 | });
22 |
23 | it('creates files', () => {
24 | assert.file([
25 | 'client/dev/user-resource/resources/country.js'
26 | ]);
27 | });
28 | })
29 | });
30 |
--------------------------------------------------------------------------------
/test/acceptance/test-view.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const assert = require('yeoman-assert');
3 | const helpers = require('yeoman-test');
4 | const {createYoRc} = require('../_helpers/mocks');
5 |
6 | describe('subgenerator -> view', () => {
7 | before(function (done) {
8 | helpers
9 | .run(path.join(__dirname, '../../view'))
10 | .inTmpDir(function(dir) {
11 | createYoRc({
12 | "generator-ng-fullstack": {
13 | "client": "ng1"
14 | }
15 | }, this.async())
16 | })
17 | .withArguments('myNewView')
18 | .withOptions({ 'skip-install': true, feature: 'dec'})
19 | .on('end', done);
20 | });
21 |
22 | it('creates files', () => {
23 | assert.file([
24 | 'client/dev/dec/templates/myNewView.html'
25 | ]);
26 | });
27 | });
28 |
--------------------------------------------------------------------------------
/test/unit/test-client-factory.js:
--------------------------------------------------------------------------------
1 | const {expect} = require('chai');
2 | const sinon = require('sinon');
3 | const {ClientFactory} = require('../../_ng/client/client_factory');
4 | const {AngularFactory} = require('../../_ng/client/angular');
5 | const {VueFactory} = require('../../_ng/client/vue');
6 |
7 | describe('client_factory', () => {
8 | it('should have the right values for the tokens()', () => {
9 | expect(ClientFactory.tokens().ANGULAR).to.equal('angular');
10 | expect(ClientFactory.tokens().VUE).to.equal('vue');
11 | })
12 |
13 | it('should return the right client - angular - ng1', () => {
14 | sinon.mock(AngularFactory.build)
15 |
16 | let gen = {};
17 |
18 | ClientFactory.create('angular', 'ng1', gen);
19 |
20 | expect(AngularFactory.build).to.have.been.called;
21 | });
22 |
23 | it('should return the right client - angular - ng2', () => {
24 | sinon.mock(AngularFactory.build);
25 |
26 | let gen = {};
27 |
28 | ClientFactory.create('angular', 'ng2', gen);
29 |
30 | expect(AngularFactory.build).to.have.been.called;
31 | });
32 |
33 | it('should return the right client - vue - vue2', () => {
34 | sinon.mock(VueFactory.build);
35 |
36 | let gen = {};
37 |
38 | ClientFactory.create('vue', 'vue2', gen);
39 |
40 | expect(VueFactory.build).to.have.been.called;
41 | });
42 | });
43 |
--------------------------------------------------------------------------------
/test/unit/test-known-paths.js:
--------------------------------------------------------------------------------
1 | const {expect} = require('chai');
2 | const knownPaths = require('../../_ng/utils/known_paths');
3 |
4 | describe('knownPaths', () => {
5 | it('should have the right info for PATH_CLIENT_FEATURES', () => {
6 | expect(knownPaths.PATH_CLIENT_FEATURES).to.equal('client/dev/');
7 | })
8 |
9 | it('should have the right info for PATH_CLIENT_FEATURES_TEST', () => {
10 | expect(knownPaths.PATH_CLIENT_FEATURES_TEST).to.equal('tests/client/');
11 | })
12 |
13 | it('should have the right info for PATH_SERVER_FEATURES', () => {
14 | expect(knownPaths.PATH_SERVER_FEATURES).to.equal('server/api/');
15 | })
16 |
17 | it('should have the right info for PATH_SERVER_FEATURES_TEST', () => {
18 | expect(knownPaths.PATH_SERVER_FEATURES_TEST).to.equal('tests/server/');
19 | })
20 | })
21 |
--------------------------------------------------------------------------------
/test/unit/test-server-factory.js:
--------------------------------------------------------------------------------
1 | const {expect} = require('chai');
2 | const sinon = require('sinon');
3 | const {ServerFactory} = require('../../_ng/server/server_factory');
4 | const {NodeFactory} = require('../../_ng/server/node_factory');
5 | const {GoFactory} = require('../../_ng/server/go_factory');
6 |
7 | describe('server_factory', () => {
8 | it('should have the right values for the tokens()', () => {
9 | expect(ServerFactory.tokens().NODE).to.equal('node');
10 | expect(ServerFactory.tokens().GO).to.equal('go');
11 | })
12 |
13 | it('should return the right server - node', () => {
14 | sinon.mock(NodeFactory.build);
15 | sinon.mock(GoFactory.build);
16 |
17 | let gen = {};
18 |
19 | ServerFactory.create('node', gen);
20 |
21 | expect(NodeFactory.build).to.have.been.called;
22 | expect(GoFactory.build).not.to.have.been.called;
23 | });
24 |
25 | it('should return the right server - go', () => {
26 | sinon.mock(NodeFactory.build);
27 | sinon.mock(GoFactory.build);
28 |
29 | let gen = {};
30 |
31 | ServerFactory.create('go', gen);
32 |
33 | expect(NodeFactory.build).to.have.been.called;
34 | expect(GoFactory.build).not.to.have.been.called;
35 | });
36 | });
37 |
--------------------------------------------------------------------------------
/test/unit/test-utils.js:
--------------------------------------------------------------------------------
1 | const {expect} = require('chai');
2 | const utils = require('../../_ng/utils/utils');
3 |
4 | describe('capitalizeFirst', () => {
5 | it('should not capitalize it - nothing passed', () => {
6 | expect(utils.capitalizeFirst()).to.equal('');
7 | })
8 |
9 | it('should capitalize it - one letter', () => {
10 | expect(utils.capitalizeFirst('a')).to.equal('A');
11 | })
12 |
13 | it('should capitalize it - two words', () => {
14 | expect(utils.capitalizeFirst('a b')).to.equal('A b');
15 | })
16 | })
17 |
--------------------------------------------------------------------------------
/view/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const {Base} = require('yeoman-generator');
4 | const {ViewSubGenerator} = require('../_ng/client/sub_generators_view');
5 |
6 | module.exports = class ViewGenerator extends Base {
7 | constructor(args, options, config) {
8 | super(args, options, config);
9 |
10 | this.generator = new ViewSubGenerator(this);
11 | }
12 |
13 | initializing() {
14 | this.generator.initializing();
15 | }
16 |
17 | writing() {
18 | this.generator.writing();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/view/templates/view.html:
--------------------------------------------------------------------------------
1 |
2 |
Hey there, <%= name %>
3 |
4 |
--------------------------------------------------------------------------------