From 2414079dcb4f17e9561e04203c4009cef887eb70 Mon Sep 17 00:00:00 2001 From: Jamil Omar Date: Tue, 16 Jul 2019 14:53:25 -0400 Subject: [PATCH] feat: angular template --- cli/package.ts | 21 +++- lib/cli/init.ts | 6 +- templates/angular-package/LICENSE | 22 ++++ templates/angular-package/README.md | 114 ++++++++++++++++++ templates/angular-package/_env | 1 + templates/angular-package/_labsharerc | 11 +- templates/angular-package/_prettierignore | 3 +- templates/angular-package/_prettierrc | 4 +- templates/angular-package/config/default.json | 1 + templates/angular-package/index.d.ts | 1 - templates/angular-package/package.json | 67 ++++++---- templates/angular-package/test/README.md | 3 + templates/angular-package/test/karma.conf.js | 65 ++++++---- .../test/{main-index.ts => test-index.ts} | 10 +- templates/angular-package/tsconfig.json | 15 ++- templates/angular-package/tslint.json | 11 +- .../ui/app/app-routing.module.ts | 9 ++ .../angular-package/ui/app/app.component.html | 2 +- .../{app.component.css => app.component.scss} | 0 .../ui/app/app.component.spec.ts | 21 ++-- .../angular-package/ui/app/app.component.ts | 15 ++- templates/angular-package/ui/app/app.keys.ts | 5 +- .../angular-package/ui/app/app.module.ts | 59 +++------ .../angular-package/ui/app/app.routes.ts | 14 --- templates/angular-package/ui/app/app.types.ts | 2 +- .../ui/app/core/core.module.ts | 11 ++ .../app/{ => core}/home/home.component.html | 0 .../home/home.component.scss} | 0 .../{ => core}/home/home.component.spec.ts | 2 + .../ui/app/core/home/home.component.ts | 22 ++++ .../ui/app/core/services/README.md | 1 + .../ui/app/home/home.component.ts | 20 --- .../ui/app/shared/ui-router.services.ts | 13 -- .../app/shell/auth/login/login.component.html | 0 .../app/shell/auth/login/login.component.scss | 0 .../app/shell/auth/login/login.component.ts | 14 +++ .../shell/auth/logout/logout.component.html | 0 .../shell/auth/logout/logout.component.scss | 4 + .../app/shell/auth/logout/logout.component.ts | 14 +++ .../ui/app/shell/services/index.ts | 1 + .../app/shell/services/ng-routing.service.ts | 9 ++ .../app/shell/version/version.component.html | 4 + .../app/shell/version/version.component.scss | 4 + .../ui/app/shell/version/version.component.ts | 19 +++ .../ui/app/theme/theme.component.html | 11 ++ .../ui/app/theme/theme.component.scss | 9 ++ .../ui/app/theme/theme.component.ts | 72 +++++++++++ .../ui/app/theme/theme.module.ts | 13 ++ templates/angular-package/ui/favicon.ico | Bin 0 -> 5430 bytes templates/angular-package/ui/index.d.ts | 7 ++ templates/angular-package/ui/index.ejs | 1 + templates/angular-package/ui/main.ts | 11 +- templates/angular-package/ui/polyfills.ts | 2 +- templates/common/codecov.yml | 2 + templates/inmutable/ui/_travis.yml | 44 +++++++ 55 files changed, 600 insertions(+), 192 deletions(-) create mode 100644 templates/angular-package/LICENSE create mode 100644 templates/angular-package/README.md create mode 100644 templates/angular-package/_env delete mode 100644 templates/angular-package/index.d.ts create mode 100644 templates/angular-package/test/README.md rename templates/angular-package/test/{main-index.ts => test-index.ts} (80%) create mode 100644 templates/angular-package/ui/app/app-routing.module.ts rename templates/angular-package/ui/app/{app.component.css => app.component.scss} (100%) delete mode 100644 templates/angular-package/ui/app/app.routes.ts create mode 100644 templates/angular-package/ui/app/core/core.module.ts rename templates/angular-package/ui/app/{ => core}/home/home.component.html (100%) rename templates/angular-package/ui/app/{home/home.component.css => core/home/home.component.scss} (100%) rename templates/angular-package/ui/app/{ => core}/home/home.component.spec.ts (87%) create mode 100644 templates/angular-package/ui/app/core/home/home.component.ts create mode 100644 templates/angular-package/ui/app/core/services/README.md delete mode 100644 templates/angular-package/ui/app/home/home.component.ts delete mode 100644 templates/angular-package/ui/app/shared/ui-router.services.ts create mode 100644 templates/angular-package/ui/app/shell/auth/login/login.component.html create mode 100644 templates/angular-package/ui/app/shell/auth/login/login.component.scss create mode 100644 templates/angular-package/ui/app/shell/auth/login/login.component.ts create mode 100644 templates/angular-package/ui/app/shell/auth/logout/logout.component.html create mode 100644 templates/angular-package/ui/app/shell/auth/logout/logout.component.scss create mode 100644 templates/angular-package/ui/app/shell/auth/logout/logout.component.ts create mode 100644 templates/angular-package/ui/app/shell/services/index.ts create mode 100644 templates/angular-package/ui/app/shell/services/ng-routing.service.ts create mode 100644 templates/angular-package/ui/app/shell/version/version.component.html create mode 100644 templates/angular-package/ui/app/shell/version/version.component.scss create mode 100644 templates/angular-package/ui/app/shell/version/version.component.ts create mode 100644 templates/angular-package/ui/app/theme/theme.component.html create mode 100644 templates/angular-package/ui/app/theme/theme.component.scss create mode 100644 templates/angular-package/ui/app/theme/theme.component.ts create mode 100644 templates/angular-package/ui/app/theme/theme.module.ts create mode 100644 templates/angular-package/ui/favicon.ico create mode 100644 templates/angular-package/ui/index.d.ts create mode 100644 templates/common/codecov.yml create mode 100644 templates/inmutable/ui/_travis.yml diff --git a/cli/package.ts b/cli/package.ts index b53fefd..b5b8b20 100644 --- a/cli/package.ts +++ b/cli/package.ts @@ -3,8 +3,8 @@ import * as gulp from 'gulp' import * as template from 'gulp-template' import * as rename from 'gulp-rename' -import {PackageUpdate} from '../lib/package/update' -import {startCase} from 'lodash' +import { PackageUpdate } from '../lib/package/update' +import { startCase } from 'lodash' const _ = require('underscore.string'); const inquirer = require('inquirer'); @@ -28,7 +28,7 @@ module.exports = { message: 'Which type of LabShare package do you want to create?', type: 'list', default: 'cli', - choices: ['cli', 'ui', 'api' , 'angular'] + choices: ['cli', 'ui', 'api', 'angular'] }, { name: 'appName', @@ -77,6 +77,21 @@ module.exports = { .on('end', () => { this.log.info(`Successfully created LabShare ${answers.projectType} package...`); }); + if (answers.projectType === 'angular') { + gulp.src([ + `${__dirname}/../templates/inmutable/ui/**` + ]) + .pipe(rename(file => { + if (file.basename[0] === '_') { + file.basename = '.' + file.basename.slice(1); + } + })) + .pipe(gulp.dest('./')) + .on('end', () => { + this.log.info(`Successfully moved inmutable LabShare ${answers.projectType} package's files...`); + }); + + } }); }, update() { diff --git a/lib/cli/init.ts b/lib/cli/init.ts index 749f9ba..2a41ea7 100644 --- a/lib/cli/init.ts +++ b/lib/cli/init.ts @@ -32,9 +32,9 @@ export function init(): void { global.LabShare = global.LabShare || labShare; global.LabShare.Config = config; - let logDirectory: string = _.get(config, 'lsc.Log.Path'); - let fluentD = _.get(config, 'lsc.Log.FluentD', {}); - let format = _.get(config, 'lsc.Log.Format', {}); + let logDirectory: string = _.get(config, 'lsc.Log.Path' ,_.get(config, 'lsc.log.path')); + let fluentD =_.get(config, 'lsc.Log.FluentD', _.get(config, 'lsc.log.fluentD', {})); + let format = _.get(config, 'lsc.Log.Format', _.get(config, 'lsc.log.format', {})); // default logger global.LabShare.Logger = Logger({ diff --git a/templates/angular-package/LICENSE b/templates/angular-package/LICENSE new file mode 100644 index 0000000..ba93465 --- /dev/null +++ b/templates/angular-package/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) <%= appYear %> LabShare + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/templates/angular-package/README.md b/templates/angular-package/README.md new file mode 100644 index 0000000..b06939f --- /dev/null +++ b/templates/angular-package/README.md @@ -0,0 +1,114 @@ +# <%= appTitle %> + +## Overview + +This is a template project with all the LabShare's features, such as Authentication, Usage, Configuration and more. + +## Tutorial + +- Install all the packages: `npm i` + +- To run this project in development mode, you need to use the command line: `lsc start site` + +* To run this project as a desktop app, you need to use the command line: `lsc start app` + +* To build this project as a production bundle, you need to use the command line: `lsc build site` + +* For more information, go to @labshare/shell-ui. + +## Contents + +- **UI** - Main UI folder. +- **App** - Main App Folder. +- **Core**: Main Functionality module, all the current's project logic should go here. +- **Shell**: Shell Module, all the default routes, and services initialization goes here. +- **Theme**: UI Module, all the settings for the main ui module goes here. +- **app-routing**: Main Routing module. +- **App Module**: Main module. + +## Application Configuration + +For adding configuration to the application, you have two options: + +- Create a config.json file at the root folder (legacy version). +- Change the default values at default.json; With this approach, you can take advantage of + [configjs](https://www.npmjs.com/package/config) and have several features like: Support for multiple configurations: + Add a file with the name of the configuration you will like to use: `staging.json` For loading lsc with the new + configuration, type: + +```sh +lsc start site --config=staging +``` + +Adding the `--config={name of the environment}`, allows you to have multiple configurations. + +If you desire to use environment variables, you can create a .env file and change the configuration to either +`default.ts` or `default.js` and export the process.env.VARIABLE_NAME: + +```js +//default.js +module.exports ={ +"configuration_value" : process.env.VALUE; +} +``` + +## Environment Configuration + +If you want to change your environment configuration, you will need to the .labsharerc file, there are the options: + +```json +{ + "tsConfig": "tsconfig.json", // path to you tsconfig file + "build": { + // build options + "main": "ui/main", // main entry point + "polyfills": "ui/polyfills", // polyfills path + "assets": "ui/assets", // assets folder + "app": "ui/app", // app path + "index": "ui/index.ejs" // index file + }, + "serve": { + // development server + "open": true, // open a new browser window + "hot": true, // hot reload + "port": 8080, // development port + "historyApiFallback": true, // history api fallback + "stats": "minimal" // stats + // you can add more settings, check webpack dev server options for more // information + } +} +``` + +## NPM Scripts + +- **start**: Starts the site in dev mode +- **test:watch**: Tests and development with watch +- **test**: Run tests +- **coverage**: Run coverage +- **prettier**: Run prettier for fixing the code structure +- **lint**: Run lint for checking the code +- **lint:fix**: Fixes all lint and prettier issues +- **tslint**: Run tslint for checking ts code +- **tslint:fix**: Fixes any tslint issues +- **prettier:check**: Check the code with Prettier +- **prettier:cli**: Run the prettier cli +- **prettier:fix**:Fixes any prettier issue +- **build**: Builds the site +- **commitmsg**: Checks the commit messages +- **semantic-release**: Runs the semantic release + +## Docs + +Section for the project's documentation. + +## TravisCI + +The [travisCI](https://travis-ci.com/) file configuration. + +## Codecov + +[Codecov](https://codecov.io) configuration File. + +## License + +MIT diff --git a/templates/angular-package/_env b/templates/angular-package/_env new file mode 100644 index 0000000..69b462e --- /dev/null +++ b/templates/angular-package/_env @@ -0,0 +1 @@ +TEST="test value with Rafa" \ No newline at end of file diff --git a/templates/angular-package/_labsharerc b/templates/angular-package/_labsharerc index cf8eff4..ba34d32 100644 --- a/templates/angular-package/_labsharerc +++ b/templates/angular-package/_labsharerc @@ -1,10 +1,17 @@ { + "tsConfig" : "tsconfig.json", "build": { "main": "ui/main", "polyfills": "ui/polyfills", + "assets": "ui/assets", + "app": "ui/app", "index": "ui/index.ejs" }, - "electron":{ - "debug":false + "serve":{ + "open": true, + "hot": true, + "port": 8080, + "historyApiFallback": true, + "stats": "minimal" } } \ No newline at end of file diff --git a/templates/angular-package/_prettierignore b/templates/angular-package/_prettierignore index fa57fec..3540b38 100644 --- a/templates/angular-package/_prettierignore +++ b/templates/angular-package/_prettierignore @@ -4,4 +4,5 @@ /images *.json CHANGELOG.md -*.yml \ No newline at end of file +*.yml +index.js \ No newline at end of file diff --git a/templates/angular-package/_prettierrc b/templates/angular-package/_prettierrc index 9196c05..55ff6e3 100644 --- a/templates/angular-package/_prettierrc +++ b/templates/angular-package/_prettierrc @@ -1,8 +1,8 @@ { "bracketSpacing": false, "singleQuote": true, - "printWidth": 80, - "trailingComma": "all", + "printWidth": 120, + "trailingComma": "none", "overrides": [ { "files": "**/*.md", diff --git a/templates/angular-package/config/default.json b/templates/angular-package/config/default.json index 077404a..598649b 100644 --- a/templates/angular-package/config/default.json +++ b/templates/angular-package/config/default.json @@ -1,3 +1,4 @@ { + "test-config":"Hello from config" } \ No newline at end of file diff --git a/templates/angular-package/index.d.ts b/templates/angular-package/index.d.ts deleted file mode 100644 index 6f4dd67..0000000 --- a/templates/angular-package/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare var APP_CONF: any; diff --git a/templates/angular-package/package.json b/templates/angular-package/package.json index c8a1753..eb3ddb9 100644 --- a/templates/angular-package/package.json +++ b/templates/angular-package/package.json @@ -2,7 +2,7 @@ "name": "<%= appNameSlug %>", "namespace": "", "main": "./ui/main.ts", - "version": "<%= appVersion %>", + "version": "0.0.0", "description": "<%= appDescription %>", "private": true, "contributors": "https://github.com/LabShare/<%= appNameSlug %>/graphs/contributors", @@ -15,10 +15,19 @@ }, "license": "MIT", "scripts": { + "start": "lsc start site", + "test:watch": "karma start ./test/karma.conf.js --single-run false", "test": "karma start ./test/karma.conf.js", - "lint": "tslint -p tsconfig.json -c tslint.json", - "lint:fix": "tslint --fix -p tsconfig.json -c tslint.json", - "build": "lsc build web", + "coverage": "karma start ./test/karma.conf.js --singleRun=true", + "prettier": "prettier \"**/*.ts\" \"**/*.js\" \"**/*.md\"", + "lint": "npm run prettier:check && npm run tslint", + "lint:fix": "npm run tslint:fix && npm run prettier:fix", + "tslint": "tslint -p tsconfig.json -c tslint.json", + "tslint:fix": "tslint -p tsconfig.json -c tslint.json --fix", + "prettier:check": "npm run prettier -- -l", + "prettier:cli": "npm run prettier -- -c", + "prettier:fix": "npm run prettier:cli -- --write", + "build": "lsc build site", "commitmsg": "commitlint -e $GIT_PARAMS", "semantic-release": "semantic-release" }, @@ -26,32 +35,38 @@ "@labshare/shell-ui": "*" }, "dependencies": { - "@angular/common": "^6.0.4", - "@angular/core": "^6.0.4", + "@angular/animations": "^6.1.10", + "@angular/common": "6.1.10", + "@angular/core": "^6.1.10", "@angular/forms": "^6.1.10", - "@angular/http": "^6.0.4", - "@angular/router": "^6.0.4", + "@angular/http": "^6.1.10", + "@angular/router": "^6.1.10", "@labshare/ngx-core-services": "^1.0.0", - "@uirouter/angular": "^3.0.0", - "config": "^3.1.0", + "@labshare/ngx-stateful": "^2.0.9", + "@labshare/stateful-components": "^2.0.1", + "acorn": "^6.2.0", "core-js": "^3.0.1", - "hammerjs": "^2.0.8", "lodash": "^4.6.1", "rxjs": "^6.5.1", - "zone.js": "^0.9.0" + "zone.js": "~0.8.26" }, "devDependencies": { - "@angular/compiler": "^6.0.4", - "@angular/compiler-cli": "^6.0.4", - "@angular/platform-browser": "^6.0.4", - "@angular/platform-browser-dynamic": "^6.0.4", + "@angular/compiler": "^6.1.10", + "@angular/compiler-cli": "^6.1.10", + "@angular/platform-browser": "^6.1.10", + "@angular/platform-browser-dynamic": "^6.1.10", "@commitlint/cli": "^6.2.0", "@commitlint/config-conventional": "^6.1.3", "@labshare/semantic-release-config": "^1.0.0", "@labshare/shell-ui": "^1.0.0", + "@ngtools/webpack": "^6.2.9", "@types/jasmine": "^2.5.54", + "angular-router-loader": "~0.8", "angular2-template-loader": "^0.6.2", - "hard-source-webpack-plugin": "^0.10.1", + "awesome-typescript-loader": "^5.2.1", + "css-loader": "^3.0.0", + "file-loader": "^4.0.0", + "fork-ts-checker-webpack-plugin": "^1.3.7", "html-loader": "0.5.5", "html-webpack-plugin": "3.2.0", "husky": "^0.14.3", @@ -62,16 +77,26 @@ "karma-coverage": "^1.1.1", "karma-coverage-istanbul-reporter": "^2.0.0", "karma-jasmine": "^1.1.0", + "karma-ng-html2js-preprocessor": "^1.0.0", "karma-phantomjs-launcher": "^1.0.4", "karma-sourcemap-loader": "^0.3.7", "karma-typescript": "^3.0.8", "karma-webpack": "^4.0.0-beta.0", + "ng-annotate-loader": "^0.6.1", + "ng-annotate-patched": "^1.10.0", "null-loader": "^0.1.1", "prettier": "^1.18.2", + "sass-loader": "^7.1.0", "semantic-release": "^15.5.0", - "ts-loader": "^4.3.0", - "tslint-angular": "^1.1.0", - "typescript": "^2.7.2", - "webpack": "4.24.0" + "style-loader": "^0.23.1", + "to-string-loader": "^1.1.5", + "ts-loader": "^6.0.4", + "tslint-angular": "^1.1.2", + "typescript": "~2.9.0", + "url-loader": "^2.0.0", + "webpack": "^4.25.1", + "webpack-dev-server": "^3.7.2", + "webpack-hot-middleware": "^2.21.1", + "webpack-merge": "^4.2.1" } } diff --git a/templates/angular-package/test/README.md b/templates/angular-package/test/README.md new file mode 100644 index 0000000..1333817 --- /dev/null +++ b/templates/angular-package/test/README.md @@ -0,0 +1,3 @@ +# Tests + +Your project's tests can go here. diff --git a/templates/angular-package/test/karma.conf.js b/templates/angular-package/test/karma.conf.js index 6e127f7..7b3e9ad 100644 --- a/templates/angular-package/test/karma.conf.js +++ b/templates/angular-package/test/karma.conf.js @@ -1,18 +1,22 @@ 'use strict'; const {join} = require('path'); -const HardSourceWebpackPlugin = require('hard-source-webpack-plugin'); +const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); module.exports = function(config) { let configuration = { basePath: '../', frameworks: ['jasmine'], - files: ['test/main-index.ts'], + files: ['test/test-index.ts'], customLaunchers: { Chrome_travis_ci: { base: 'Chrome', - flags: ['--no-sandbox'], + flags: ['--no-sandbox', '--remote-debugging-port=9999'] }, + ChromeDebugging: { + base: 'Chrome', + flags: ['--remote-debugging-port=9333'] + } }, reporters: ['progress', 'coverage-istanbul'], coverageIstanbulReporter: { @@ -20,7 +24,7 @@ module.exports = function(config) { reports: ['html', 'lcovonly', 'text-summary'], // base output directory. If you include %browser% in the path it will be replaced with the karma browser name - dir: join(__dirname, '../', 'coverage'), + dir: join('test', 'ui', 'coverage'), // Combines coverage information from multiple browsers into one report rather than outputting a report // for each browser. @@ -32,28 +36,28 @@ module.exports = function(config) { // stop istanbul outputting messages like `File [filename] ignored, nothing could be mapped` skipFilesWithNoCoverage: false, - verbose: false, // output config used by istanbul for debugging + verbose: false // output config used by istanbul for debugging }, preprocessors: { - 'test/main-index.ts': ['webpack'], + 'test/test-index.ts': ['webpack'] }, webpackMiddleware: { - stats: 'errors-only', + stats: 'errors-only' }, exclude: [], - port: 8080, - browsers: ['ChromeHeadless'], + port: 9999, + browsers: ['ChromeHeadless'], //ChromeDebugging ChromeHeadless singleRun: true, browserConsoleLogOptions: { level: 'log', format: '%b %T: %m', - terminal: true, + terminal: true }, // Workaround for test timeout issue: https://github.com/jasmine/jasmine/issues/1327#issuecomment-332939551 browserNoActivityTimeout: 150000, mime: { // Chrome version 55+ has a bug with TS. See: https://stackoverflow.com/a/41054760 - 'text/x-typescript': ['ts', 'tsx'], + 'text/x-typescript': ['ts', 'tsx'] }, colors: true, // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG @@ -62,7 +66,7 @@ module.exports = function(config) { mode: 'development', resolve: { // Add '.ts' and '.tsx' as a resolvable extension. - extensions: ['.ts', '.tsx', '.js'], + extensions: ['.ts', '.tsx', '.js'] }, module: { rules: [ @@ -70,9 +74,16 @@ module.exports = function(config) { test: /\.tsx?$/, use: { loader: 'ts-loader', - options: {}, + options: { + transpileOnly: true // IMPORTANT! use transpileOnly mode to speed-up compilation + } }, - exclude: '/node_modules', + exclude: '/node_modules' + }, + { + test: /\.ts$/, + loaders: ['awesome-typescript-loader', 'angular2-template-loader'], + exclude: [/\.e2e\.ts$/] }, { test: /ui\/.+(\.ts|\.js)$/, @@ -80,31 +91,35 @@ module.exports = function(config) { loader: 'istanbul-instrumenter-loader', enforce: 'post', options: { - esModules: true, - }, + esModules: true + } }, { test: /\.html$/, - use: ['html-loader'], + use: ['html-loader'] + }, + { + test: /\.(scss|sass)$/, + use: ['to-string-loader', 'css-loader', 'sass-loader'] }, { test: /\.css$/, - use: ['null-loader'], + use: ['null-loader'] }, { test: /\.scss$/, - use: ['null-loader'], + use: ['null-loader'] }, { test: /\.(jpe|jpg|png|woff|woff2|eot|ttf|svg)(\?.*$|$)/, - loader: 'null-loader', - }, - ], + loader: 'null-loader' + } + ] }, - plugins: [new HardSourceWebpackPlugin()], + plugins: [new ForkTsCheckerWebpackPlugin()], cache: true, - devtool: 'inline-source-map', - }, + devtool: 'inline-source-map' + } }; if (process.env.TRAVIS) { diff --git a/templates/angular-package/test/main-index.ts b/templates/angular-package/test/test-index.ts similarity index 80% rename from templates/angular-package/test/main-index.ts rename to templates/angular-package/test/test-index.ts index 1dae926..c31480b 100644 --- a/templates/angular-package/test/main-index.ts +++ b/templates/angular-package/test/test-index.ts @@ -11,10 +11,7 @@ import 'zone.js/dist/async-test'; import 'zone.js/dist/fake-async-test'; import {getTestBed} from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting, -} from '@angular/platform-browser-dynamic/testing'; +import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing'; // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. declare const __karma__: any; @@ -24,10 +21,7 @@ declare const require: any; __karma__.loaded = function() {}; // First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting(), -); +getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); // Then we find all the tests. const context = require.context('../ui', true, /spec$/i); diff --git a/templates/angular-package/tsconfig.json b/templates/angular-package/tsconfig.json index 2d38c98..529c705 100644 --- a/templates/angular-package/tsconfig.json +++ b/templates/angular-package/tsconfig.json @@ -1,16 +1,14 @@ { "compilerOptions": { "moduleResolution": "node", - "inlineSourceMap": true, "target": "es5", "module": "commonjs", "declaration": false, - "experimentalDecorators": true, "emitDecoratorMetadata": true, + "experimentalDecorators": true, "allowJs": true, "skipLibCheck": true, "suppressImplicitAnyIndexErrors": true, - "inlineSources": true, "stripInternal": true, "lib": [ "es2015", @@ -19,7 +17,8 @@ ] }, "files": [ - "ui/main.ts" + "ui/main.ts", + "ui/index.d.ts" ], "paths": { "@angular/*": [ @@ -32,5 +31,11 @@ "node_modules", "dist", "test" - ] + ], + "angularCompilerOptions": { + "strictMetadataEmit": true, + "skipCodeGeneration": false, + "skipTemplateCodegen": true, + "debug": true + } } diff --git a/templates/angular-package/tslint.json b/templates/angular-package/tslint.json index b23cb1f..c80ffa6 100644 --- a/templates/angular-package/tslint.json +++ b/templates/angular-package/tslint.json @@ -1,5 +1,8 @@ { - "extends": [ - "tslint-angular" - ] -} + "extends": ["tslint-angular"], + "rules": { + "max-line-length": { + "options": [300] + } + } + } \ No newline at end of file diff --git a/templates/angular-package/ui/app/app-routing.module.ts b/templates/angular-package/ui/app/app-routing.module.ts new file mode 100644 index 0000000..7b7fe5b --- /dev/null +++ b/templates/angular-package/ui/app/app-routing.module.ts @@ -0,0 +1,9 @@ +import {NgModule} from '@angular/core'; +import {Routes, RouterModule} from '@angular/router'; +import {HomeComponent} from './core/home/home.component'; +const appRoutes: Routes = [{path: '', component: HomeComponent}]; +@NgModule({ + imports: [RouterModule.forRoot(appRoutes)], + exports: [RouterModule] +}) +export class AppRoutingModule {} diff --git a/templates/angular-package/ui/app/app.component.html b/templates/angular-package/ui/app/app.component.html index 1110b5c..070c041 100644 --- a/templates/angular-package/ui/app/app.component.html +++ b/templates/angular-package/ui/app/app.component.html @@ -2,4 +2,4 @@

Welcome to {{ title }}!

- \ No newline at end of file + diff --git a/templates/angular-package/ui/app/app.component.css b/templates/angular-package/ui/app/app.component.scss similarity index 100% rename from templates/angular-package/ui/app/app.component.css rename to templates/angular-package/ui/app/app.component.scss diff --git a/templates/angular-package/ui/app/app.component.spec.ts b/templates/angular-package/ui/app/app.component.spec.ts index fc80097..6dbb275 100644 --- a/templates/angular-package/ui/app/app.component.spec.ts +++ b/templates/angular-package/ui/app/app.component.spec.ts @@ -1,10 +1,16 @@ -import { TestBed, async } from '@angular/core/testing'; -import { AppComponent } from './app.component'; - +import {TestBed, async} from '@angular/core/testing'; +import {AppComponent} from './app.component'; +import {ThemeModule} from './theme/theme.module'; +import {AuthService} from '@labshare/ngx-core-services'; +import {AppRoutingModule} from './app-routing.module'; +import {HomeComponent} from './core/home/home.component'; +import {APP_BASE_HREF} from '@angular/common'; describe('AppComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [AppComponent], + imports: [ThemeModule, AppRoutingModule], + declarations: [AppComponent, HomeComponent], + providers: [AuthService, {provide: APP_BASE_HREF, useValue: '/'}] }).compileComponents(); })); @@ -19,11 +25,4 @@ describe('AppComponent', () => { const app = fixture.debugElement.componentInstance; expect(app.title).toEqual('<%= appNameSlug %>'); }); - - it('should render title in a h1 tag', () => { - const fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - const compiled = fixture.debugElement.nativeElement; - expect(compiled.querySelector('h1').textContent).toContain('Welcome to <%= appNameSlug %>!'); - }); }); diff --git a/templates/angular-package/ui/app/app.component.ts b/templates/angular-package/ui/app/app.component.ts index 4e1750a..0d86e8c 100644 --- a/templates/angular-package/ui/app/app.component.ts +++ b/templates/angular-package/ui/app/app.component.ts @@ -1,10 +1,17 @@ -import { Component } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; +import {AuthService} from '@labshare/ngx-core-services'; @Component({ selector: 'app-root', - template: require('./app.component.html'), - styles: [require('./app.component.css').toString()], + templateUrl: './app.component.html', + styleUrls: ['./app.component.scss'] }) -export class AppComponent { +export class AppComponent implements OnInit { + constructor(private authService: AuthService) {} title = '<%= appNameSlug %>'; + ngOnInit(): void { + this.authService.configure().subscribe(done => { + this.authService.onAuthCallback(); + }); + } } diff --git a/templates/angular-package/ui/app/app.keys.ts b/templates/angular-package/ui/app/app.keys.ts index 5139879..fd3686a 100644 --- a/templates/angular-package/ui/app/app.keys.ts +++ b/templates/angular-package/ui/app/app.keys.ts @@ -1,5 +1,2 @@ // All the constants goes here -export namespace AppKeys { - export const ROOT = 'root'; - export const HOME_URL = '/home'; -} +export namespace AppKeys {} diff --git a/templates/angular-package/ui/app/app.module.ts b/templates/angular-package/ui/app/app.module.ts index c5893b5..67fa8ff 100644 --- a/templates/angular-package/ui/app/app.module.ts +++ b/templates/angular-package/ui/app/app.module.ts @@ -1,53 +1,22 @@ import {BrowserModule} from '@angular/platform-browser'; import {CommonModule} from '@angular/common'; -import {NgModule, APP_INITIALIZER} from '@angular/core'; -import {UIRouterModule} from '@uirouter/angular'; -import {HttpClientModule, HTTP_INTERCEPTORS} from '@angular/common/http'; -import { - AuthService, - AuthInterceptor, - OidcNavigationService, - NgxCoreServicesModule, - Config, -} from '@labshare/ngx-core-services'; -import {UIRouterService} from './shared/ui-router.services'; -import {routes} from './app.routes'; -import {HomeComponent} from './home/home.component'; +import {NgModule} from '@angular/core'; +import {HttpClientModule} from '@angular/common/http'; +import {AppRoutingModule} from './app-routing.module'; +import {CoreModule} from './core/core.module'; import {AppComponent} from './app.component'; +import {ThemeModule} from './theme/theme.module'; +import {ShellModule} from './shell/shell.module'; +import '../assets/styles.scss'; +import '../favicon.ico'; -// app initializer for Auth -export function initializeAuth(auth: AuthService): () => Promise { - return async () => { - return auth.configure().toPromise(); - }; -} - -// Export Angular 4 feature module +// Export Angular 6 feature module @NgModule({ - declarations: [AppComponent, HomeComponent], + declarations: [AppComponent], entryComponents: [], exports: [], - imports: [ - BrowserModule, - HttpClientModule, - CommonModule, - NgxCoreServicesModule.forRoot(APP_CONF), - UIRouterModule.forRoot(routes), - ], - providers: [ - // App initializer - { - provide: APP_INITIALIZER, - useFactory: initializeAuth, - deps: [AuthService], - multi: true, - }, - // Enable the interceptors - {provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true}, - // Enable UIRouting Navigation for Auth Service - {provide: OidcNavigationService, useClass: UIRouterService}, - ], - bootstrap: [AppComponent], + imports: [BrowserModule, HttpClientModule, CommonModule, ShellModule, CoreModule, ThemeModule, AppRoutingModule], + providers: [], + bootstrap: [AppComponent] }) - -export class <%= appTitle %>Module {} +export class AppModule {} diff --git a/templates/angular-package/ui/app/app.routes.ts b/templates/angular-package/ui/app/app.routes.ts deleted file mode 100644 index 3b083ed..0000000 --- a/templates/angular-package/ui/app/app.routes.ts +++ /dev/null @@ -1,14 +0,0 @@ -// All the routes goes here -import {HomeComponent} from './home/home.component'; -import {AppKeys} from './app.keys'; -export const routes = { - states: [ - { - name: AppKeys.ROOT, - url: AppKeys.HOME_URL, - component: HomeComponent, - }, - ], - useHash: false, - otherwise: {state: AppKeys.ROOT}, -}; diff --git a/templates/angular-package/ui/app/app.types.ts b/templates/angular-package/ui/app/app.types.ts index 604c43a..1b88485 100644 --- a/templates/angular-package/ui/app/app.types.ts +++ b/templates/angular-package/ui/app/app.types.ts @@ -1 +1 @@ -// all the types and interfaces goes here \ No newline at end of file +// all the types and interfaces goes here diff --git a/templates/angular-package/ui/app/core/core.module.ts b/templates/angular-package/ui/app/core/core.module.ts new file mode 100644 index 0000000..86fc99c --- /dev/null +++ b/templates/angular-package/ui/app/core/core.module.ts @@ -0,0 +1,11 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; +import {HomeComponent} from './home/home.component'; +import {AppRoutingModule} from '../app-routing.module'; +@NgModule({ + imports: [CommonModule, AppRoutingModule, FormsModule], + declarations: [HomeComponent], + exports: [AppRoutingModule, HomeComponent] +}) +export class CoreModule {} diff --git a/templates/angular-package/ui/app/home/home.component.html b/templates/angular-package/ui/app/core/home/home.component.html similarity index 100% rename from templates/angular-package/ui/app/home/home.component.html rename to templates/angular-package/ui/app/core/home/home.component.html diff --git a/templates/angular-package/ui/app/home/home.component.css b/templates/angular-package/ui/app/core/home/home.component.scss similarity index 100% rename from templates/angular-package/ui/app/home/home.component.css rename to templates/angular-package/ui/app/core/home/home.component.scss diff --git a/templates/angular-package/ui/app/home/home.component.spec.ts b/templates/angular-package/ui/app/core/home/home.component.spec.ts similarity index 87% rename from templates/angular-package/ui/app/home/home.component.spec.ts rename to templates/angular-package/ui/app/core/home/home.component.spec.ts index 6924794..82480b0 100644 --- a/templates/angular-package/ui/app/home/home.component.spec.ts +++ b/templates/angular-package/ui/app/core/home/home.component.spec.ts @@ -1,4 +1,5 @@ import {async, ComponentFixture, TestBed} from '@angular/core/testing'; +import {ConfigService} from '@labshare/ngx-core-services'; import {HomeComponent} from './home.component'; describe('HomeComponent', () => { @@ -9,6 +10,7 @@ describe('HomeComponent', () => { TestBed.configureTestingModule({ imports: [], declarations: [HomeComponent], + providers: [ConfigService] }).compileComponents(); })); diff --git a/templates/angular-package/ui/app/core/home/home.component.ts b/templates/angular-package/ui/app/core/home/home.component.ts new file mode 100644 index 0000000..a064a04 --- /dev/null +++ b/templates/angular-package/ui/app/core/home/home.component.ts @@ -0,0 +1,22 @@ +// Example Angular component + +'use strict'; + +import {Component} from '@angular/core'; +import {OnInit} from '@angular/core'; +import {ConfigService} from '@labshare/ngx-core-services'; + +@Component({ + selector: 'app-home', + templateUrl: './home.component.html', + styleUrls: ['./home.component.scss'] +}) +export class HomeComponent implements OnInit { + public message = `<%= appTitle %>'s home page`; + + constructor(private config: ConfigService) {} + + ngOnInit() { + this.message = `<%= appTitle %>'s home page with ` + this.config.get('test-config'); + } +} diff --git a/templates/angular-package/ui/app/core/services/README.md b/templates/angular-package/ui/app/core/services/README.md new file mode 100644 index 0000000..61e6857 --- /dev/null +++ b/templates/angular-package/ui/app/core/services/README.md @@ -0,0 +1 @@ +Core's services goes here. diff --git a/templates/angular-package/ui/app/home/home.component.ts b/templates/angular-package/ui/app/home/home.component.ts deleted file mode 100644 index b26f7ad..0000000 --- a/templates/angular-package/ui/app/home/home.component.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Example Angular component - -'use strict'; - -import {Component} from '@angular/core'; -import {OnInit} from '@angular/core'; - -@Component({ - selector: 'app-home', - template: require('./home.component.html'), - styles: [require('./home.component.css').toString()], -}) -export class HomeComponent implements OnInit { - - public message = '<%= appNameSlug %>\'s home page'; - - constructor() {} - - ngOnInit() {} -} diff --git a/templates/angular-package/ui/app/shared/ui-router.services.ts b/templates/angular-package/ui/app/shared/ui-router.services.ts deleted file mode 100644 index c35aa4d..0000000 --- a/templates/angular-package/ui/app/shared/ui-router.services.ts +++ /dev/null @@ -1,13 +0,0 @@ -// UIRouter services for supporting ui router -import {Injectable, Optional, Injector} from '@angular/core'; -import {UIRouter} from '@uirouter/angular'; -import * as _ from 'lodash'; -@Injectable() -export class UIRouterService { - constructor(private router: UIRouter) {} - navigate(url: string) { - if (!_.isEmpty(url)) { - this.router.stateService.go(url); - } - } -} \ No newline at end of file diff --git a/templates/angular-package/ui/app/shell/auth/login/login.component.html b/templates/angular-package/ui/app/shell/auth/login/login.component.html new file mode 100644 index 0000000..e69de29 diff --git a/templates/angular-package/ui/app/shell/auth/login/login.component.scss b/templates/angular-package/ui/app/shell/auth/login/login.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/templates/angular-package/ui/app/shell/auth/login/login.component.ts b/templates/angular-package/ui/app/shell/auth/login/login.component.ts new file mode 100644 index 0000000..445f9bb --- /dev/null +++ b/templates/angular-package/ui/app/shell/auth/login/login.component.ts @@ -0,0 +1,14 @@ +import {Component, OnInit} from '@angular/core'; +import {AuthService} from '@labshare/ngx-core-services'; +@Component({ + templateUrl: './login.component.html', + styleUrls: ['./login.component.scss'] +}) +export class LoginComponent implements OnInit { + constructor(private authService: AuthService) {} + ngOnInit() { + this.authService.configure().subscribe(done => { + this.authService.login(); + }); + } +} diff --git a/templates/angular-package/ui/app/shell/auth/logout/logout.component.html b/templates/angular-package/ui/app/shell/auth/logout/logout.component.html new file mode 100644 index 0000000..e69de29 diff --git a/templates/angular-package/ui/app/shell/auth/logout/logout.component.scss b/templates/angular-package/ui/app/shell/auth/logout/logout.component.scss new file mode 100644 index 0000000..a79b8c1 --- /dev/null +++ b/templates/angular-package/ui/app/shell/auth/logout/logout.component.scss @@ -0,0 +1,4 @@ +/* theme's style rules */ +.content{ + width: calc(100% - 382px); + float: left;} \ No newline at end of file diff --git a/templates/angular-package/ui/app/shell/auth/logout/logout.component.ts b/templates/angular-package/ui/app/shell/auth/logout/logout.component.ts new file mode 100644 index 0000000..402cce0 --- /dev/null +++ b/templates/angular-package/ui/app/shell/auth/logout/logout.component.ts @@ -0,0 +1,14 @@ +import {Component, OnInit} from '@angular/core'; +import {AuthService} from '@labshare/ngx-core-services'; +@Component({ + templateUrl: './logout.component.html', + styleUrls: ['./logout.component.scss'] +}) +export class LogoutComponent implements OnInit { + constructor(private authService: AuthService) {} + ngOnInit() { + this.authService.configure().subscribe(done => { + this.authService.logout(); + }); + } +} diff --git a/templates/angular-package/ui/app/shell/services/index.ts b/templates/angular-package/ui/app/shell/services/index.ts new file mode 100644 index 0000000..f0e1c18 --- /dev/null +++ b/templates/angular-package/ui/app/shell/services/index.ts @@ -0,0 +1 @@ +export * from './ng-routing.service'; diff --git a/templates/angular-package/ui/app/shell/services/ng-routing.service.ts b/templates/angular-package/ui/app/shell/services/ng-routing.service.ts new file mode 100644 index 0000000..b319f12 --- /dev/null +++ b/templates/angular-package/ui/app/shell/services/ng-routing.service.ts @@ -0,0 +1,9 @@ +import {Injectable} from '@angular/core'; +import {Router} from '@angular/router'; +@Injectable() +export class NgRoutingService { + constructor(private router: Router) {} + navigate(url: string) { + this.router.navigate([url]); + } +} diff --git a/templates/angular-package/ui/app/shell/version/version.component.html b/templates/angular-package/ui/app/shell/version/version.component.html new file mode 100644 index 0000000..4983a92 --- /dev/null +++ b/templates/angular-package/ui/app/shell/version/version.component.html @@ -0,0 +1,4 @@ +

Home

+ + {{ message }} + \ No newline at end of file diff --git a/templates/angular-package/ui/app/shell/version/version.component.scss b/templates/angular-package/ui/app/shell/version/version.component.scss new file mode 100644 index 0000000..a79b8c1 --- /dev/null +++ b/templates/angular-package/ui/app/shell/version/version.component.scss @@ -0,0 +1,4 @@ +/* theme's style rules */ +.content{ + width: calc(100% - 382px); + float: left;} \ No newline at end of file diff --git a/templates/angular-package/ui/app/shell/version/version.component.ts b/templates/angular-package/ui/app/shell/version/version.component.ts new file mode 100644 index 0000000..a2369aa --- /dev/null +++ b/templates/angular-package/ui/app/shell/version/version.component.ts @@ -0,0 +1,19 @@ +// Example Angular component + +'use strict'; + +import {Component} from '@angular/core'; +import {OnInit} from '@angular/core'; + +@Component({ + selector: 'shell-version', + templateUrl: './version.component.html', + styleUrls: ['./version.component.scss'] +}) +export class VersionComponent implements OnInit { + public message = PROJECT_BUILD_VERSION; + + constructor() {} + + ngOnInit() {} +} diff --git a/templates/angular-package/ui/app/theme/theme.component.html b/templates/angular-package/ui/app/theme/theme.component.html new file mode 100644 index 0000000..0739ce4 --- /dev/null +++ b/templates/angular-package/ui/app/theme/theme.component.html @@ -0,0 +1,11 @@ +
+
+ +
+
+ +
+ +
+
+
\ No newline at end of file diff --git a/templates/angular-package/ui/app/theme/theme.component.scss b/templates/angular-package/ui/app/theme/theme.component.scss new file mode 100644 index 0000000..df5f708 --- /dev/null +++ b/templates/angular-package/ui/app/theme/theme.component.scss @@ -0,0 +1,9 @@ +/* theme's style rules */ + +#main-container { + display: flex ; + flex-direction:row +} +#main-section { + width: 100% +} \ No newline at end of file diff --git a/templates/angular-package/ui/app/theme/theme.component.ts b/templates/angular-package/ui/app/theme/theme.component.ts new file mode 100644 index 0000000..90f1a50 --- /dev/null +++ b/templates/angular-package/ui/app/theme/theme.component.ts @@ -0,0 +1,72 @@ +import { + ApplicationRef, + Component, + Optional, + SkipSelf, + Input, + forwardRef, + ChangeDetectorRef, + ChangeDetectionStrategy +} from '@angular/core'; +import {StatefulComponent, StatefulParent, StatefulService} from '@labshare/ngx-stateful'; +import {Router} from '@angular/router'; + +export const STATE = () => ({ + selectedItem: `LABSHARE_ON_SELECTED`, + sectionItems: [ + { + name: 'First leftmost item', + id: 'first-item', + icon: 'http://placekitten.com/50/50' + }, + { + name: 'Second leftmost item', + id: 'second-item', + icon: 'http://placekitten.com/80/80' + } + ], + items: [{name: 'home', link: 'home', icon: 'th'}, {name: 'version', link: 'version', icon: 'th-large'}] +}); + +export const UTILS = {}; + +export const PROPS = {}; + +@Component({ + selector: 'sc-theme', + templateUrl: './theme.component.html', + styleUrls: ['./theme.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: StatefulParent, + useExisting: forwardRef(() => ThemeComponent) + } + ] +}) +export class ThemeComponent extends StatefulComponent { + updateProps = {}; + + constructor( + public inj: ChangeDetectorRef, + @Optional() @SkipSelf() public statefulParent: StatefulParent, + public statefulService: StatefulService, + public appRef: ApplicationRef, + private router: Router + ) { + super(inj, STATE, statefulParent, statefulService, appRef); + } + + public changeItem(selected) { + switch (selected.link) { + case 'home': + this.router.navigate(['']); + break; + case 'version': + this.router.navigate(['version']); + break; + } + + console.log(selected); + } +} diff --git a/templates/angular-package/ui/app/theme/theme.module.ts b/templates/angular-package/ui/app/theme/theme.module.ts new file mode 100644 index 0000000..404554a --- /dev/null +++ b/templates/angular-package/ui/app/theme/theme.module.ts @@ -0,0 +1,13 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {ThemeComponent} from './theme.component'; +import {TopNavModule} from '@labshare/stateful-components'; +import {LeftNavModule} from '@labshare/stateful-components'; +import {RouterModule} from '@angular/router'; +@NgModule({ + imports: [CommonModule, TopNavModule, LeftNavModule, RouterModule], + providers: [], + declarations: [ThemeComponent], + exports: [ThemeComponent] +}) +export class ThemeModule {} diff --git a/templates/angular-package/ui/favicon.ico b/templates/angular-package/ui/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..8081c7ceaf2be08bf59010158c586170d9d2d517 GIT binary patch literal 5430 zcmc(je{54#6vvCoAI3i*G5%$U7!sA3wtMZ$fH6V9C`=eXGJb@R1%(I_{vnZtpD{6n z5Pl{DmxzBDbrB>}`90e12m8T*36WoeDLA&SD_hw{H^wM!cl_RWcVA!I+x87ee975; z@4kD^=bYPn&pmG@(+JZ`rqQEKxW<}RzhW}I!|ulN=fmjVi@x{p$cC`)5$a!)X&U+blKNvN5tg=uLvuLnuqRM;Yc*swiexsoh#XPNu{9F#c`G zQLe{yWA(Y6(;>y|-efAy11k<09(@Oo1B2@0`PtZSkqK&${ zgEY}`W@t{%?9u5rF?}Y7OL{338l*JY#P!%MVQY@oqnItpZ}?s z!r?*kwuR{A@jg2Chlf0^{q*>8n5Ir~YWf*wmsh7B5&EpHfd5@xVaj&gqsdui^spyL zB|kUoblGoO7G(MuKTfa9?pGH0@QP^b#!lM1yHWLh*2iq#`C1TdrnO-d#?Oh@XV2HK zKA{`eo{--^K&MW66Lgsktfvn#cCAc*(}qsfhrvOjMGLE?`dHVipu1J3Kgr%g?cNa8 z)pkmC8DGH~fG+dlrp(5^-QBeEvkOvv#q7MBVLtm2oD^$lJZx--_=K&Ttd=-krx(Bb zcEoKJda@S!%%@`P-##$>*u%T*mh+QjV@)Qa=Mk1?#zLk+M4tIt%}wagT{5J%!tXAE;r{@=bb%nNVxvI+C+$t?!VJ@0d@HIyMJTI{vEw0Ul ze(ha!e&qANbTL1ZneNl45t=#Ot??C0MHjjgY8%*mGisN|S6%g3;Hlx#fMNcL<87MW zZ>6moo1YD?P!fJ#Jb(4)_cc50X5n0KoDYfdPoL^iV`k&o{LPyaoqMqk92wVM#_O0l z09$(A-D+gVIlq4TA&{1T@BsUH`Bm=r#l$Z51J-U&F32+hfUP-iLo=jg7Xmy+WLq6_tWv&`wDlz#`&)Jp~iQf zZP)tu>}pIIJKuw+$&t}GQuqMd%Z>0?t%&BM&Wo^4P^Y z)c6h^f2R>X8*}q|bblAF?@;%?2>$y+cMQbN{X$)^R>vtNq_5AB|0N5U*d^T?X9{xQnJYeU{ zoZL#obI;~Pp95f1`%X3D$Mh*4^?O?IT~7HqlWguezmg?Ybq|7>qQ(@pPHbE9V?f|( z+0xo!#m@Np9PljsyxBY-UA*{U*la#8Wz2sO|48_-5t8%_!n?S$zlGe+NA%?vmxjS- zHE5O3ZarU=X}$7>;Okp(UWXJxI%G_J-@IH;%5#Rt$(WUX?6*Ux!IRd$dLP6+SmPn= z8zjm4jGjN772R{FGkXwcNv8GBcZI#@Y2m{RNF_w8(Z%^A*!bS*!}s6sh*NnURytky humW;*g7R+&|Ledvc-<%= appTitle %> + diff --git a/templates/angular-package/ui/main.ts b/templates/angular-package/ui/main.ts index a517140..ac97e28 100644 --- a/templates/angular-package/ui/main.ts +++ b/templates/angular-package/ui/main.ts @@ -1,6 +1,11 @@ -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { <%= appTitle %>Module } from './app/app.module'; +import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; +import {AppModule} from './app/app.module'; +import {enableProdMode} from '@angular/core'; + +if (ENABLE_PROD_MODE === true) { + enableProdMode(); +} platformBrowserDynamic() - .bootstrapModule(<%= appTitle %>Module) + .bootstrapModule(AppModule) .catch(err => console.error(err)); diff --git a/templates/angular-package/ui/polyfills.ts b/templates/angular-package/ui/polyfills.ts index 60c4fd1..346fada 100644 --- a/templates/angular-package/ui/polyfills.ts +++ b/templates/angular-package/ui/polyfills.ts @@ -78,4 +78,4 @@ import 'core-js/features/reflect'; /*************************************************************************************************** * APPLICATION IMPORTS - */ \ No newline at end of file + */ diff --git a/templates/common/codecov.yml b/templates/common/codecov.yml new file mode 100644 index 0000000..0f3fa05 --- /dev/null +++ b/templates/common/codecov.yml @@ -0,0 +1,2 @@ +codecov: + token: [PLEASE ADD YOUR CODECOV TOKEN] \ No newline at end of file diff --git a/templates/inmutable/ui/_travis.yml b/templates/inmutable/ui/_travis.yml new file mode 100644 index 0000000..78938f8 --- /dev/null +++ b/templates/inmutable/ui/_travis.yml @@ -0,0 +1,44 @@ +language: node_js +node_js: + - lts/* + - node +sudo: required +addons: + chrome: stable +before_install: + - |- + if [ $TRAVIS_PULL_REQUEST == false ] && [ $TRAVIS_BRANCH == "master" ]; + then + echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > ~/.npmrc; + else + echo "//registry.npmjs.org/:_authToken=\${NPM_INSTALL_TOKEN}" > ~/.npmrc; + fi + - 'git config --global url."git@github.com:".insteadOf "https://github.com/"' +install: + - npm i -g lsc codecov + - npm install + - npm rebuild +script: + - npm run build + - npm run lint + - xvfb-run npm run coverage + - codecov +notifications: + email: false +matrix: + allow_failures: + - node_js: node +branches: + except: + - /^v\d+\.\d+\.\d+$/ +jobs: + include: + - stage: release + if: branch = master + node_js: lts/* + script: skip + deploy: + provider: script + skip_cleanup: true + script: + - npm run semantic-release \ No newline at end of file