├── .editorconfig ├── .gitignore ├── README.md ├── angular.json ├── e2e ├── protractor.conf.js ├── src │ ├── app.e2e-spec.ts │ └── app.po.ts └── tsconfig.e2e.json ├── htmlapp ├── counter-element.js └── index.html ├── package-lock.json ├── package.json ├── projects ├── counterelement-e2e │ ├── protractor.conf.js │ ├── src │ │ ├── app.e2e-spec.ts │ │ └── app.po.ts │ └── tsconfig.e2e.json ├── counterelement │ ├── browserslist │ ├── karma.conf.js │ ├── src │ │ ├── app │ │ │ ├── app.component.css │ │ │ ├── app.component.html │ │ │ ├── app.component.spec.ts │ │ │ ├── app.component.ts │ │ │ └── app.module.ts │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── main.ts │ │ ├── polyfills.ts │ │ ├── styles.css │ │ └── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.spec.json │ └── tslint.json ├── elementApp-e2e │ ├── protractor.conf.js │ ├── src │ │ ├── app.e2e-spec.ts │ │ └── app.po.ts │ └── tsconfig.e2e.json ├── elementApp │ ├── browserslist │ ├── karma.conf.js │ ├── src │ │ ├── app │ │ │ ├── app.component.css │ │ │ ├── app.component.html │ │ │ ├── app.component.spec.ts │ │ │ ├── app.component.ts │ │ │ └── app.module.ts │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── main.ts │ │ ├── polyfills.ts │ │ ├── styles.css │ │ └── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.spec.json │ └── tslint.json └── my-counter │ ├── README.md │ ├── karma.conf.js │ ├── ng-package.json │ ├── package.json │ ├── src │ ├── lib │ │ ├── counter-decrement │ │ │ ├── counter-decrement.component.css │ │ │ ├── counter-decrement.component.html │ │ │ ├── counter-decrement.component.spec.ts │ │ │ └── counter-decrement.component.ts │ │ ├── counter-increment │ │ │ ├── counter-increment.component.css │ │ │ ├── counter-increment.component.html │ │ │ ├── counter-increment.component.spec.ts │ │ │ └── counter-increment.component.ts │ │ ├── counter-reset │ │ │ ├── counter-reset.component.css │ │ │ ├── counter-reset.component.html │ │ │ ├── counter-reset.component.spec.ts │ │ │ └── counter-reset.component.ts │ │ ├── counter.actions.ts │ │ ├── counter.component.css │ │ ├── counter.component.html │ │ ├── counter.component.spec.ts │ │ ├── counter.component.ts │ │ ├── counter.module.ts │ │ └── counter.reducer.ts │ ├── public-api.ts │ └── test.ts │ ├── tsconfig.lib.json │ ├── tsconfig.spec.json │ └── tslint.json ├── tsconfig.json └── tslint.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events.json 15 | speed-measure-plugin.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NgRxElementDemo 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.4. 4 | 5 | ## Build element for vanillajs 6 | 7 | Follow the below steps to see it in action with vanillajs: 8 | 9 | 1. Run `ng build my-counter` to build the library. 10 | 2. Run `npm run build-element` to create a build. 11 | 3. Run `npm run package` for windows and `npm run package-linux` for linux it will create a `counter-element.js` in `htmlapp` folder. 12 | 4. move to `htmlapp` folder and run `http-server` from command prompt,make sure http-server is installed. 13 | 5. To install http-server use `npm i -g http-server` 14 | 15 | ## Build with Angular App 16 | 17 | Run `npm start` from command prompt it will build the library and run the app on 4201 port. 18 | 19 | ## Development server 20 | 21 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 22 | 23 | ## Code scaffolding 24 | 25 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 26 | 27 | ## Build 28 | 29 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 30 | 31 | ## Running unit tests 32 | 33 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 34 | 35 | ## Running end-to-end tests 36 | 37 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 38 | 39 | ## Further help 40 | 41 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 42 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "my-counter": { 7 | "root": "projects/my-counter", 8 | "sourceRoot": "projects/my-counter/src", 9 | "projectType": "library", 10 | "prefix": "lib", 11 | "architect": { 12 | "build": { 13 | "builder": "@angular-devkit/build-ng-packagr:build", 14 | "options": { 15 | "tsConfig": "projects/my-counter/tsconfig.lib.json", 16 | "project": "projects/my-counter/ng-package.json" 17 | } 18 | }, 19 | "test": { 20 | "builder": "@angular-devkit/build-angular:karma", 21 | "options": { 22 | "main": "projects/my-counter/src/test.ts", 23 | "tsConfig": "projects/my-counter/tsconfig.spec.json", 24 | "karmaConfig": "projects/my-counter/karma.conf.js" 25 | } 26 | }, 27 | "lint": { 28 | "builder": "@angular-devkit/build-angular:tslint", 29 | "options": { 30 | "tsConfig": [ 31 | "projects/my-counter/tsconfig.lib.json", 32 | "projects/my-counter/tsconfig.spec.json" 33 | ], 34 | "exclude": [ 35 | "**/node_modules/**" 36 | ] 37 | } 38 | } 39 | } 40 | }, 41 | "elementApp": { 42 | "root": "projects/elementApp/", 43 | "sourceRoot": "projects/elementApp/src", 44 | "projectType": "application", 45 | "prefix": "app", 46 | "schematics": {}, 47 | "architect": { 48 | "build": { 49 | "builder": "@angular-devkit/build-angular:browser", 50 | "options": { 51 | "outputPath": "dist/elementApp", 52 | "index": "projects/elementApp/src/index.html", 53 | "main": "projects/elementApp/src/main.ts", 54 | "polyfills": "projects/elementApp/src/polyfills.ts", 55 | "tsConfig": "projects/elementApp/tsconfig.app.json", 56 | "assets": [ 57 | "projects/elementApp/src/favicon.ico", 58 | "projects/elementApp/src/assets" 59 | ], 60 | "styles": [ 61 | "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", 62 | "src/styles.css" 63 | ], 64 | "scripts": [ 65 | { 66 | "input": "node_modules/document-register-element/build/document-register-element.js" 67 | } 68 | ], 69 | "es5BrowserSupport": true 70 | }, 71 | "configurations": { 72 | "production": { 73 | "fileReplacements": [ 74 | { 75 | "replace": "projects/elementApp/src/environments/environment.ts", 76 | "with": "projects/elementApp/src/environments/environment.prod.ts" 77 | } 78 | ], 79 | "optimization": true, 80 | "outputHashing": "all", 81 | "sourceMap": false, 82 | "extractCss": true, 83 | "namedChunks": false, 84 | "aot": true, 85 | "extractLicenses": true, 86 | "vendorChunk": false, 87 | "buildOptimizer": true, 88 | "budgets": [ 89 | { 90 | "type": "initial", 91 | "maximumWarning": "2mb", 92 | "maximumError": "5mb" 93 | } 94 | ] 95 | } 96 | } 97 | }, 98 | "serve": { 99 | "builder": "@angular-devkit/build-angular:dev-server", 100 | "options": { 101 | "browserTarget": "elementApp:build" 102 | }, 103 | "configurations": { 104 | "production": { 105 | "browserTarget": "elementApp:build:production" 106 | } 107 | } 108 | }, 109 | "extract-i18n": { 110 | "builder": "@angular-devkit/build-angular:extract-i18n", 111 | "options": { 112 | "browserTarget": "elementApp:build" 113 | } 114 | }, 115 | "test": { 116 | "builder": "@angular-devkit/build-angular:karma", 117 | "options": { 118 | "main": "projects/elementApp/src/test.ts", 119 | "polyfills": "projects/elementApp/src/polyfills.ts", 120 | "tsConfig": "projects/elementApp/tsconfig.spec.json", 121 | "karmaConfig": "projects/elementApp/karma.conf.js", 122 | "styles": [ 123 | "projects/elementApp/src/styles.css" 124 | ], 125 | "scripts": [], 126 | "assets": [ 127 | "projects/elementApp/src/favicon.ico", 128 | "projects/elementApp/src/assets" 129 | ] 130 | } 131 | }, 132 | "lint": { 133 | "builder": "@angular-devkit/build-angular:tslint", 134 | "options": { 135 | "tsConfig": [ 136 | "projects/elementApp/tsconfig.app.json", 137 | "projects/elementApp/tsconfig.spec.json" 138 | ], 139 | "exclude": [ 140 | "**/node_modules/**" 141 | ] 142 | } 143 | } 144 | } 145 | }, 146 | "elementApp-e2e": { 147 | "root": "projects/elementApp-e2e/", 148 | "projectType": "application", 149 | "prefix": "", 150 | "architect": { 151 | "e2e": { 152 | "builder": "@angular-devkit/build-angular:protractor", 153 | "options": { 154 | "protractorConfig": "projects/elementApp-e2e/protractor.conf.js", 155 | "devServerTarget": "elementApp:serve" 156 | }, 157 | "configurations": { 158 | "production": { 159 | "devServerTarget": "elementApp:serve:production" 160 | } 161 | } 162 | }, 163 | "lint": { 164 | "builder": "@angular-devkit/build-angular:tslint", 165 | "options": { 166 | "tsConfig": "projects/elementApp-e2e/tsconfig.e2e.json", 167 | "exclude": [ 168 | "**/node_modules/**" 169 | ] 170 | } 171 | } 172 | } 173 | }, 174 | "counterelement": { 175 | "root": "projects/counterelement/", 176 | "sourceRoot": "projects/counterelement/src", 177 | "projectType": "application", 178 | "prefix": "app", 179 | "schematics": {}, 180 | "architect": { 181 | "build": { 182 | "builder": "@angular-devkit/build-angular:browser", 183 | "options": { 184 | "outputPath": "dist/counterelement", 185 | "index": "projects/counterelement/src/index.html", 186 | "main": "projects/counterelement/src/main.ts", 187 | "polyfills": "projects/counterelement/src/polyfills.ts", 188 | "tsConfig": "projects/counterelement/tsconfig.app.json", 189 | "assets": [ 190 | "projects/counterelement/src/favicon.ico", 191 | "projects/counterelement/src/assets" 192 | ], 193 | "styles": [ 194 | "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", 195 | "src/styles.css" 196 | ], 197 | "scripts": [ 198 | { 199 | "input": "node_modules/document-register-element/build/document-register-element.js" 200 | } 201 | ], 202 | "es5BrowserSupport": true 203 | }, 204 | "configurations": { 205 | "production": { 206 | "fileReplacements": [ 207 | { 208 | "replace": "projects/counterelement/src/environments/environment.ts", 209 | "with": "projects/counterelement/src/environments/environment.prod.ts" 210 | } 211 | ], 212 | "optimization": true, 213 | "outputHashing": "all", 214 | "sourceMap": false, 215 | "extractCss": true, 216 | "namedChunks": false, 217 | "aot": true, 218 | "extractLicenses": true, 219 | "vendorChunk": false, 220 | "buildOptimizer": true, 221 | "budgets": [ 222 | { 223 | "type": "initial", 224 | "maximumWarning": "2mb", 225 | "maximumError": "5mb" 226 | } 227 | ] 228 | } 229 | } 230 | }, 231 | "serve": { 232 | "builder": "@angular-devkit/build-angular:dev-server", 233 | "options": { 234 | "browserTarget": "counterelement:build" 235 | }, 236 | "configurations": { 237 | "production": { 238 | "browserTarget": "counterelement:build:production" 239 | } 240 | } 241 | }, 242 | "extract-i18n": { 243 | "builder": "@angular-devkit/build-angular:extract-i18n", 244 | "options": { 245 | "browserTarget": "counterelement:build" 246 | } 247 | }, 248 | "test": { 249 | "builder": "@angular-devkit/build-angular:karma", 250 | "options": { 251 | "main": "projects/counterelement/src/test.ts", 252 | "polyfills": "projects/counterelement/src/polyfills.ts", 253 | "tsConfig": "projects/counterelement/tsconfig.spec.json", 254 | "karmaConfig": "projects/counterelement/karma.conf.js", 255 | "styles": [ 256 | "projects/counterelement/src/styles.css" 257 | ], 258 | "scripts": [], 259 | "assets": [ 260 | "projects/counterelement/src/favicon.ico", 261 | "projects/counterelement/src/assets" 262 | ] 263 | } 264 | }, 265 | "lint": { 266 | "builder": "@angular-devkit/build-angular:tslint", 267 | "options": { 268 | "tsConfig": [ 269 | "projects/counterelement/tsconfig.app.json", 270 | "projects/counterelement/tsconfig.spec.json" 271 | ], 272 | "exclude": [ 273 | "**/node_modules/**" 274 | ] 275 | } 276 | } 277 | } 278 | }, 279 | "counterelement-e2e": { 280 | "root": "projects/counterelement-e2e/", 281 | "projectType": "application", 282 | "prefix": "", 283 | "architect": { 284 | "e2e": { 285 | "builder": "@angular-devkit/build-angular:protractor", 286 | "options": { 287 | "protractorConfig": "projects/counterelement-e2e/protractor.conf.js", 288 | "devServerTarget": "counterelement:serve" 289 | }, 290 | "configurations": { 291 | "production": { 292 | "devServerTarget": "counterelement:serve:production" 293 | } 294 | } 295 | }, 296 | "lint": { 297 | "builder": "@angular-devkit/build-angular:tslint", 298 | "options": { 299 | "tsConfig": "projects/counterelement-e2e/tsconfig.e2e.json", 300 | "exclude": [ 301 | "**/node_modules/**" 302 | ] 303 | } 304 | } 305 | } 306 | } 307 | }, 308 | "defaultProject": "elementApp" 309 | } 310 | -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './src/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: require('path').join(__dirname, './tsconfig.e2e.json') 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; -------------------------------------------------------------------------------- /e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('Welcome to ngRxElementDemo!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText() { 9 | return element(by.css('app-root h1')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /htmlapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Document 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ng-rx-element-demo", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng build my-counter && ng serve --project=elementApp -o --port=4201", 7 | "build": "ng build", 8 | "build-element": "ng build my-counter && ng build --project=counterelement --prod --output-hashing=none", 9 | "package-linux": "cat dist/counterelement/{runtime,polyfills,scripts,main}.js | gzip > htmlapp/counter-element.js", 10 | "package": "jscat ./dist/counterelement/runtime.js ./dist/counterelement/polyfills.js ./dist/counterelement/scripts.js ./dist/counterelement/main.js > htmlapp/counter-element.js", 11 | "test": "ng test", 12 | "lint": "ng lint", 13 | "e2e": "ng e2e" 14 | }, 15 | "private": true, 16 | "dependencies": { 17 | "@angular/animations": "~7.2.0", 18 | "@angular/cdk": "~7.3.6", 19 | "@angular/common": "~7.2.0", 20 | "@angular/compiler": "~7.2.0", 21 | "@angular/core": "~7.2.0", 22 | "@angular/elements": "^7.2.11", 23 | "@angular/forms": "~7.2.0", 24 | "@angular/material": "^7.3.6", 25 | "@angular/platform-browser": "~7.2.0", 26 | "@angular/platform-browser-dynamic": "~7.2.0", 27 | "@webcomponents/webcomponentsjs": "^2.2.7", 28 | "@angular/router": "~7.2.0", 29 | "@ngrx/store": "^7.4.0", 30 | "core-js": "^2.5.4", 31 | "document-register-element": "^1.7.2", 32 | "hammerjs": "^2.0.8", 33 | "rxjs": "~6.3.3", 34 | "tslib": "^1.9.0", 35 | "zone.js": "~0.8.26" 36 | }, 37 | "devDependencies": { 38 | "@angular-devkit/build-angular": "~0.13.0", 39 | "@angular-devkit/build-ng-packagr": "~0.13.0", 40 | "@angular/cli": "~7.3.4", 41 | "@angular/compiler-cli": "~7.2.0", 42 | "@angular/language-service": "~7.2.0", 43 | "@types/jasmine": "~2.8.8", 44 | "@types/jasminewd2": "~2.0.3", 45 | "@types/node": "~8.9.4", 46 | "cat": "^0.2.0", 47 | "codelyzer": "~4.5.0", 48 | "gzip-cli": "^0.1.3", 49 | "jasmine-core": "~2.99.1", 50 | "jasmine-spec-reporter": "~4.2.1", 51 | "jscat": "0.0.2", 52 | "karma": "~4.0.0", 53 | "karma-chrome-launcher": "~2.2.0", 54 | "karma-coverage-istanbul-reporter": "~2.0.1", 55 | "karma-jasmine": "~1.1.2", 56 | "karma-jasmine-html-reporter": "^0.2.2", 57 | "ng-packagr": "^4.2.0", 58 | "protractor": "~5.4.0", 59 | "ts-node": "~7.0.0", 60 | "tsickle": ">=0.34.0", 61 | "tslib": "^1.9.0", 62 | "tslint": "~5.11.0", 63 | "typescript": "~3.2.2" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /projects/counterelement-e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './src/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: require('path').join(__dirname, './tsconfig.e2e.json') 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; -------------------------------------------------------------------------------- /projects/counterelement-e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('Welcome to counterelement!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /projects/counterelement-e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText() { 9 | return element(by.css('app-root h1')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /projects/counterelement-e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/app", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /projects/counterelement/browserslist: -------------------------------------------------------------------------------- 1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | # 5 | # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed 6 | 7 | > 0.5% 8 | last 2 versions 9 | Firefox ESR 10 | not dead 11 | not IE 9-11 -------------------------------------------------------------------------------- /projects/counterelement/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../../coverage/counterelement'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /projects/counterelement/src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santoshyadavdev/ngRxElementDemo/8e355308019777b7ba1dc59857f5c5d1d5a91a2f/projects/counterelement/src/app/app.component.css -------------------------------------------------------------------------------- /projects/counterelement/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |

4 | Welcome to {{ title }}! 5 |

6 | Angular Logo 7 |
8 |

Here are some links to help you start:

9 | 20 | 21 | -------------------------------------------------------------------------------- /projects/counterelement/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | 4 | describe('AppComponent', () => { 5 | beforeEach(async(() => { 6 | TestBed.configureTestingModule({ 7 | declarations: [ 8 | AppComponent 9 | ], 10 | }).compileComponents(); 11 | })); 12 | 13 | it('should create the app', () => { 14 | const fixture = TestBed.createComponent(AppComponent); 15 | const app = fixture.debugElement.componentInstance; 16 | expect(app).toBeTruthy(); 17 | }); 18 | 19 | it(`should have as title 'counterelement'`, () => { 20 | const fixture = TestBed.createComponent(AppComponent); 21 | const app = fixture.debugElement.componentInstance; 22 | expect(app.title).toEqual('counterelement'); 23 | }); 24 | 25 | it('should render title in a h1 tag', () => { 26 | const fixture = TestBed.createComponent(AppComponent); 27 | fixture.detectChanges(); 28 | const compiled = fixture.debugElement.nativeElement; 29 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to counterelement!'); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /projects/counterelement/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'counterelement'; 10 | } 11 | -------------------------------------------------------------------------------- /projects/counterelement/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 3 | 4 | import { AppComponent } from './app.component'; 5 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 6 | import { CounterModule } from 'my-counter'; 7 | 8 | @NgModule({ 9 | declarations: [ 10 | AppComponent 11 | ], 12 | imports: [ 13 | BrowserModule, 14 | BrowserAnimationsModule, 15 | CounterModule 16 | ], 17 | providers: [], 18 | bootstrap: [], 19 | schemas: [CUSTOM_ELEMENTS_SCHEMA] 20 | }) 21 | export class AppModule { 22 | 23 | ngDoBootstrap() { 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /projects/counterelement/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santoshyadavdev/ngRxElementDemo/8e355308019777b7ba1dc59857f5c5d1d5a91a2f/projects/counterelement/src/assets/.gitkeep -------------------------------------------------------------------------------- /projects/counterelement/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /projects/counterelement/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /projects/counterelement/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santoshyadavdev/ngRxElementDemo/8e355308019777b7ba1dc59857f5c5d1d5a91a2f/projects/counterelement/src/favicon.ico -------------------------------------------------------------------------------- /projects/counterelement/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Counterelement 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /projects/counterelement/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /projects/counterelement/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 22 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 23 | 24 | /** 25 | * Web Animations `@angular/platform-browser/animations` 26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 28 | */ 29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 30 | 31 | /** 32 | * By default, zone.js will patch all possible macroTask and DomEvents 33 | * user can disable parts of macroTask/DomEvents patch by setting following flags 34 | * because those flags need to be set before `zone.js` being loaded, and webpack 35 | * will put import in the top of bundle, so user need to create a separate file 36 | * in this directory (for example: zone-flags.ts), and put the following flags 37 | * into that file, and then add the following code before importing zone.js. 38 | * import './zone-flags.ts'; 39 | * 40 | * The flags allowed in zone-flags.ts are listed here. 41 | * 42 | * The following flags will work for all browsers. 43 | * 44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 46 | * (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 47 | * 48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 50 | * 51 | * (window as any).__Zone_enable_cross_context_check = true; 52 | * 53 | */ 54 | 55 | /*************************************************************************************************** 56 | * Zone JS is required by default for Angular itself. 57 | */ 58 | import 'zone.js/dist/zone'; // Included with Angular CLI. 59 | 60 | 61 | /*************************************************************************************************** 62 | * APPLICATION IMPORTS 63 | */ 64 | import '@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js'; 65 | -------------------------------------------------------------------------------- /projects/counterelement/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /projects/counterelement/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /projects/counterelement/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/app", 5 | "types": [] 6 | }, 7 | "exclude": [ 8 | "test.ts", 9 | "**/*.spec.ts" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /projects/counterelement/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "**/*.spec.ts", 16 | "**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /projects/counterelement/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "app", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "app", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /projects/elementApp-e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './src/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: require('path').join(__dirname, './tsconfig.e2e.json') 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; -------------------------------------------------------------------------------- /projects/elementApp-e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('Welcome to elementApp!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /projects/elementApp-e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText() { 9 | return element(by.css('app-root h1')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /projects/elementApp-e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/app", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /projects/elementApp/browserslist: -------------------------------------------------------------------------------- 1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | # 5 | # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed 6 | 7 | > 0.5% 8 | last 2 versions 9 | Firefox ESR 10 | not dead 11 | not IE 9-11 -------------------------------------------------------------------------------- /projects/elementApp/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../../coverage/elementApp'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /projects/elementApp/src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santoshyadavdev/ngRxElementDemo/8e355308019777b7ba1dc59857f5c5d1d5a91a2f/projects/elementApp/src/app/app.component.css -------------------------------------------------------------------------------- /projects/elementApp/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /projects/elementApp/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | 4 | describe('AppComponent', () => { 5 | beforeEach(async(() => { 6 | TestBed.configureTestingModule({ 7 | declarations: [ 8 | AppComponent 9 | ], 10 | }).compileComponents(); 11 | })); 12 | 13 | it('should create the app', () => { 14 | const fixture = TestBed.createComponent(AppComponent); 15 | const app = fixture.debugElement.componentInstance; 16 | expect(app).toBeTruthy(); 17 | }); 18 | 19 | it(`should have as title 'elementApp'`, () => { 20 | const fixture = TestBed.createComponent(AppComponent); 21 | const app = fixture.debugElement.componentInstance; 22 | expect(app.title).toEqual('elementApp'); 23 | }); 24 | 25 | it('should render title in a h1 tag', () => { 26 | const fixture = TestBed.createComponent(AppComponent); 27 | fixture.detectChanges(); 28 | const compiled = fixture.debugElement.nativeElement; 29 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to elementApp!'); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /projects/elementApp/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'elementApp'; 10 | } 11 | -------------------------------------------------------------------------------- /projects/elementApp/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 3 | 4 | import { AppComponent } from './app.component'; 5 | import { CounterModule } from 'my-counter'; 6 | 7 | @NgModule({ 8 | declarations: [ 9 | AppComponent 10 | ], 11 | imports: [ 12 | BrowserModule, 13 | CounterModule 14 | ], 15 | providers: [], 16 | bootstrap: [AppComponent], 17 | schemas: [CUSTOM_ELEMENTS_SCHEMA] 18 | }) 19 | export class AppModule { } 20 | -------------------------------------------------------------------------------- /projects/elementApp/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santoshyadavdev/ngRxElementDemo/8e355308019777b7ba1dc59857f5c5d1d5a91a2f/projects/elementApp/src/assets/.gitkeep -------------------------------------------------------------------------------- /projects/elementApp/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /projects/elementApp/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /projects/elementApp/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santoshyadavdev/ngRxElementDemo/8e355308019777b7ba1dc59857f5c5d1d5a91a2f/projects/elementApp/src/favicon.ico -------------------------------------------------------------------------------- /projects/elementApp/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ElementApp 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /projects/elementApp/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /projects/elementApp/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 22 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 23 | 24 | /** 25 | * Web Animations `@angular/platform-browser/animations` 26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 28 | */ 29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 30 | 31 | /** 32 | * By default, zone.js will patch all possible macroTask and DomEvents 33 | * user can disable parts of macroTask/DomEvents patch by setting following flags 34 | * because those flags need to be set before `zone.js` being loaded, and webpack 35 | * will put import in the top of bundle, so user need to create a separate file 36 | * in this directory (for example: zone-flags.ts), and put the following flags 37 | * into that file, and then add the following code before importing zone.js. 38 | * import './zone-flags.ts'; 39 | * 40 | * The flags allowed in zone-flags.ts are listed here. 41 | * 42 | * The following flags will work for all browsers. 43 | * 44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 46 | * (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 47 | * 48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 50 | * 51 | * (window as any).__Zone_enable_cross_context_check = true; 52 | * 53 | */ 54 | 55 | /*************************************************************************************************** 56 | * Zone JS is required by default for Angular itself. 57 | */ 58 | import 'zone.js/dist/zone'; // Included with Angular CLI. 59 | 60 | 61 | /*************************************************************************************************** 62 | * APPLICATION IMPORTS 63 | */ 64 | 65 | import '@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js'; 66 | -------------------------------------------------------------------------------- /projects/elementApp/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /projects/elementApp/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /projects/elementApp/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/app", 5 | "types": [] 6 | }, 7 | "exclude": [ 8 | "test.ts", 9 | "**/*.spec.ts" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /projects/elementApp/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "**/*.spec.ts", 16 | "**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /projects/elementApp/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "app", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "app", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /projects/my-counter/README.md: -------------------------------------------------------------------------------- 1 | # MyCounter 2 | 3 | This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.2.0. 4 | 5 | ## Code scaffolding 6 | 7 | Run `ng generate component component-name --project my-counter` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project my-counter`. 8 | > Note: Don't forget to add `--project my-counter` or else it will be added to the default project in your `angular.json` file. 9 | 10 | ## Build 11 | 12 | Run `ng build my-counter` to build the project. The build artifacts will be stored in the `dist/` directory. 13 | 14 | ## Publishing 15 | 16 | After building your library with `ng build my-counter`, go to the dist folder `cd dist/my-counter` and run `npm publish`. 17 | 18 | ## Running unit tests 19 | 20 | Run `ng test my-counter` to execute the unit tests via [Karma](https://karma-runner.github.io). 21 | 22 | ## Further help 23 | 24 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 25 | -------------------------------------------------------------------------------- /projects/my-counter/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../../coverage/my-counter'), 20 | reports: ['html', 'lcovonly'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /projects/my-counter/ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "../../dist/my-counter", 4 | "lib": { 5 | "entryFile": "src/public-api.ts" 6 | } 7 | } -------------------------------------------------------------------------------- /projects/my-counter/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-counter", 3 | "version": "0.0.1", 4 | "peerDependencies": { 5 | "@angular/common": "^7.2.0", 6 | "@angular/core": "^7.2.0" 7 | } 8 | } -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter-decrement/counter-decrement.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santoshyadavdev/ngRxElementDemo/8e355308019777b7ba1dc59857f5c5d1d5a91a2f/projects/my-counter/src/lib/counter-decrement/counter-decrement.component.css -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter-decrement/counter-decrement.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter-decrement/counter-decrement.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CounterDecrementComponent } from './counter-decrement.component'; 4 | 5 | describe('CounterDecrementComponent', () => { 6 | let component: CounterDecrementComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ CounterDecrementComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CounterDecrementComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter-decrement/counter-decrement.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | import { Store } from '@ngrx/store'; 4 | import { Decrement } from '../counter.actions'; 5 | 6 | @Component({ 7 | selector: 'app-counter-decrement', 8 | templateUrl: './counter-decrement.component.html', 9 | styleUrls: ['./counter-decrement.component.css'] 10 | }) 11 | export class CounterDecrementComponent implements OnInit { 12 | 13 | constructor(private store: Store<{ count: number }>) { } 14 | 15 | ngOnInit() { 16 | } 17 | 18 | decrement() { 19 | this.store.dispatch(new Decrement()); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter-increment/counter-increment.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santoshyadavdev/ngRxElementDemo/8e355308019777b7ba1dc59857f5c5d1d5a91a2f/projects/my-counter/src/lib/counter-increment/counter-increment.component.css -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter-increment/counter-increment.component.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter-increment/counter-increment.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CounterIncrementComponent } from './counter-increment.component'; 4 | 5 | describe('CounterIncrementComponent', () => { 6 | let component: CounterIncrementComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ CounterIncrementComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CounterIncrementComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter-increment/counter-increment.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Store, select } from '@ngrx/store'; 3 | import { Increment} from '../counter.actions'; 4 | 5 | @Component({ 6 | selector: 'app-counter-increment', 7 | templateUrl: './counter-increment.component.html', 8 | styleUrls: ['./counter-increment.component.css'] 9 | }) 10 | export class CounterIncrementComponent implements OnInit { 11 | 12 | constructor(private store: Store<{ count: number }>) { } 13 | 14 | ngOnInit() { 15 | } 16 | 17 | increment() { 18 | this.store.dispatch(new Increment()); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter-reset/counter-reset.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santoshyadavdev/ngRxElementDemo/8e355308019777b7ba1dc59857f5c5d1d5a91a2f/projects/my-counter/src/lib/counter-reset/counter-reset.component.css -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter-reset/counter-reset.component.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter-reset/counter-reset.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CounterResetComponent } from './counter-reset.component'; 4 | 5 | describe('CounterResetComponent', () => { 6 | let component: CounterResetComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ CounterResetComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CounterResetComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter-reset/counter-reset.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Store } from '@ngrx/store'; 3 | import { Reset } from '../counter.actions'; 4 | 5 | @Component({ 6 | selector: 'app-counter-reset', 7 | templateUrl: './counter-reset.component.html', 8 | styleUrls: ['./counter-reset.component.css'] 9 | }) 10 | export class CounterResetComponent implements OnInit { 11 | 12 | constructor(private store: Store<{ count: number }>) { } 13 | 14 | ngOnInit() { 15 | } 16 | 17 | reset() { 18 | this.store.dispatch(new Reset()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter.actions.ts: -------------------------------------------------------------------------------- 1 | import { Action } from '@ngrx/store'; 2 | 3 | export enum ActionTypes { 4 | Increment = '[Counter Component] Increment', 5 | Decrement = '[Counter Component] Decrement', 6 | Reset = '[Counter Component] Reset', 7 | } 8 | 9 | export class Increment implements Action { 10 | readonly type = ActionTypes.Increment; 11 | } 12 | 13 | export class Decrement implements Action { 14 | readonly type = ActionTypes.Decrement; 15 | } 16 | 17 | export class Reset implements Action { 18 | readonly type = ActionTypes.Reset; 19 | } 20 | -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santoshyadavdev/ngRxElementDemo/8e355308019777b7ba1dc59857f5c5d1d5a91a2f/projects/my-counter/src/lib/counter.component.css -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter.component.html: -------------------------------------------------------------------------------- 1 |
Current Count: {{ count$ | async }}
2 | -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CounterComponent } from './counter.component'; 4 | 5 | describe('CounterComponent', () => { 6 | let component: CounterComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ CounterComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CounterComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Injector } from '@angular/core'; 2 | import { Store, select } from '@ngrx/store'; 3 | import { Observable } from 'rxjs'; 4 | 5 | 6 | @Component({ 7 | selector: 'app-counter', 8 | templateUrl: './counter.component.html', 9 | styleUrls: ['./counter.component.css'] 10 | }) 11 | export class CounterComponent implements OnInit { 12 | 13 | count$: Observable; 14 | 15 | constructor(private store: Store<{ count: number }>) { 16 | 17 | } 18 | 19 | ngOnInit() { 20 | this.count$ = this.store.pipe(select('count')); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, Injector } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { MatButtonModule } from '@angular/material/button'; 4 | import { CounterComponent } from './counter.component'; 5 | import { CounterIncrementComponent } from './counter-increment/counter-increment.component'; 6 | import { CounterDecrementComponent } from './counter-decrement/counter-decrement.component'; 7 | import { CounterResetComponent } from './counter-reset/counter-reset.component'; 8 | import { StoreModule } from '@ngrx/store'; 9 | import { counterReducer } from './counter.reducer'; 10 | import { createCustomElement } from '@angular/elements'; 11 | 12 | @NgModule({ 13 | declarations: [CounterComponent, CounterIncrementComponent, 14 | CounterDecrementComponent, CounterResetComponent], 15 | imports: [ 16 | CommonModule, 17 | MatButtonModule, 18 | StoreModule.forRoot({ count: counterReducer }) 19 | ], 20 | entryComponents: [CounterComponent, 21 | CounterIncrementComponent, 22 | CounterDecrementComponent, 23 | CounterResetComponent] 24 | }) 25 | export class CounterModule { 26 | constructor(private injector: Injector ) { 27 | const CounterElement = createCustomElement(CounterComponent, { injector }); 28 | // Register the custom element with the browser. 29 | customElements.define('counter-element', CounterElement); 30 | 31 | const CounterIncrementElement = createCustomElement(CounterIncrementComponent, { injector }); 32 | customElements.define('counter-increment', CounterIncrementElement); 33 | const CounterDecrementElement = createCustomElement(CounterDecrementComponent, { injector }); 34 | customElements.define('counter-decrement', CounterDecrementElement); 35 | const CounterResetElement = createCustomElement(CounterResetComponent, { injector }); 36 | customElements.define('counter-reset', CounterResetElement); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /projects/my-counter/src/lib/counter.reducer.ts: -------------------------------------------------------------------------------- 1 | import { Action } from '@ngrx/store'; 2 | import { ActionTypes } from './counter.actions'; 3 | 4 | export const initialState = 0; 5 | 6 | export function counterReducer(state = initialState, action: Action) { 7 | switch (action.type) { 8 | case ActionTypes.Increment: 9 | return state + 1; 10 | 11 | case ActionTypes.Decrement: 12 | return state - 1; 13 | 14 | case ActionTypes.Reset: 15 | return 0; 16 | 17 | default: 18 | return state; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /projects/my-counter/src/public-api.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Public API Surface of my-counter 3 | */ 4 | 5 | export * from './lib/counter.actions'; 6 | export * from './lib/counter.component'; 7 | export * from './lib/counter.module'; 8 | export * from './lib/counter.reducer'; 9 | export * from './lib/counter-decrement/counter-decrement.component'; 10 | export * from './lib/counter-increment/counter-increment.component'; 11 | export * from './lib/counter-reset/counter-reset.component'; 12 | -------------------------------------------------------------------------------- /projects/my-counter/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'core-js/es7/reflect'; 4 | import 'zone.js/dist/zone'; 5 | import 'zone.js/dist/zone-testing'; 6 | import { getTestBed } from '@angular/core/testing'; 7 | import { 8 | BrowserDynamicTestingModule, 9 | platformBrowserDynamicTesting 10 | } from '@angular/platform-browser-dynamic/testing'; 11 | 12 | declare const require: any; 13 | 14 | // First, initialize the Angular testing environment. 15 | getTestBed().initTestEnvironment( 16 | BrowserDynamicTestingModule, 17 | platformBrowserDynamicTesting() 18 | ); 19 | // Then we find all the tests. 20 | const context = require.context('./', true, /\.spec\.ts$/); 21 | // And load the modules. 22 | context.keys().map(context); 23 | -------------------------------------------------------------------------------- /projects/my-counter/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/lib", 5 | "target": "es2015", 6 | "module": "es2015", 7 | "moduleResolution": "node", 8 | "declaration": true, 9 | "sourceMap": true, 10 | "inlineSources": true, 11 | "emitDecoratorMetadata": true, 12 | "experimentalDecorators": true, 13 | "importHelpers": true, 14 | "types": [], 15 | "lib": [ 16 | "dom", 17 | "es2018" 18 | ] 19 | }, 20 | "angularCompilerOptions": { 21 | "annotateForClosureCompiler": true, 22 | "skipTemplateCodegen": true, 23 | "strictMetadataEmit": true, 24 | "fullTemplateTypeCheck": true, 25 | "strictInjectionParameters": true, 26 | "enableResourceInlining": true 27 | }, 28 | "exclude": [ 29 | "src/test.ts", 30 | "**/*.spec.ts" 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /projects/my-counter/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts" 12 | ], 13 | "include": [ 14 | "**/*.spec.ts", 15 | "**/*.d.ts" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /projects/my-counter/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "lib", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "lib", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "module": "es2015", 9 | "moduleResolution": "node", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "importHelpers": true, 13 | "target": "es5", 14 | "typeRoots": [ 15 | "node_modules/@types" 16 | ], 17 | "lib": [ 18 | "es2018", 19 | "dom" 20 | ], 21 | "paths": { 22 | "my-counter": [ 23 | "dist/my-counter" 24 | ], 25 | "my-counter/*": [ 26 | "dist/my-counter/*" 27 | ] 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rulesDirectory": [ 4 | "codelyzer" 5 | ], 6 | "rules": { 7 | "array-type": false, 8 | "arrow-parens": false, 9 | "deprecation": { 10 | "severity": "warn" 11 | }, 12 | "import-blacklist": [ 13 | true, 14 | "rxjs/Rx" 15 | ], 16 | "interface-name": false, 17 | "max-classes-per-file": false, 18 | "max-line-length": [ 19 | true, 20 | 140 21 | ], 22 | "member-access": false, 23 | "member-ordering": [ 24 | true, 25 | { 26 | "order": [ 27 | "static-field", 28 | "instance-field", 29 | "static-method", 30 | "instance-method" 31 | ] 32 | } 33 | ], 34 | "no-consecutive-blank-lines": false, 35 | "no-console": [ 36 | true, 37 | "debug", 38 | "info", 39 | "time", 40 | "timeEnd", 41 | "trace" 42 | ], 43 | "no-empty": false, 44 | "no-inferrable-types": [ 45 | true, 46 | "ignore-params" 47 | ], 48 | "no-non-null-assertion": true, 49 | "no-redundant-jsdoc": true, 50 | "no-switch-case-fall-through": true, 51 | "no-use-before-declare": true, 52 | "no-var-requires": false, 53 | "object-literal-key-quotes": [ 54 | true, 55 | "as-needed" 56 | ], 57 | "object-literal-sort-keys": false, 58 | "ordered-imports": false, 59 | "quotemark": [ 60 | true, 61 | "single" 62 | ], 63 | "trailing-comma": false, 64 | "no-output-on-prefix": true, 65 | "use-input-property-decorator": true, 66 | "use-output-property-decorator": true, 67 | "use-host-property-decorator": true, 68 | "no-input-rename": true, 69 | "no-output-rename": true, 70 | "use-life-cycle-interface": true, 71 | "use-pipe-transform-interface": true, 72 | "component-class-suffix": true, 73 | "directive-class-suffix": true 74 | } 75 | } 76 | --------------------------------------------------------------------------------