├── .editorconfig ├── .github └── FUNDING.yml ├── .gitignore ├── .prettierignore ├── .prettierrc ├── .vscode └── extensions.json ├── README.md ├── angular.json ├── apps ├── .gitkeep ├── tiny-app-e2e │ ├── cypress.json │ ├── src │ │ ├── fixtures │ │ │ └── example.json │ │ ├── integration │ │ │ └── app.spec.ts │ │ ├── plugins │ │ │ └── index.js │ │ └── support │ │ │ ├── app.po.ts │ │ │ ├── commands.ts │ │ │ └── index.ts │ ├── tsconfig.e2e.json │ ├── tsconfig.json │ └── tslint.json └── tiny-app │ ├── browserslist │ ├── jest.config.js │ ├── src │ ├── app │ │ ├── app.component.html │ │ ├── app.component.scss │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ └── core.module.ts │ ├── index.html │ ├── main.ts │ ├── polyfills.ts │ └── test-setup.ts │ ├── tsconfig.app.json │ ├── tsconfig.json │ ├── tsconfig.spec.json │ └── tslint.json ├── jest.config.js ├── libs ├── .gitkeep └── shared │ ├── assets │ ├── README.md │ └── src │ │ ├── assets │ │ ├── fonts │ │ │ └── .gitkeep │ │ ├── icons │ │ │ └── .gitkeep │ │ └── images │ │ │ ├── .gitkeep │ │ │ └── nx-logo-white.svg │ │ └── favicon.ico │ ├── data-access │ ├── README.md │ ├── jest.config.js │ ├── src │ │ ├── index.ts │ │ ├── lib │ │ │ ├── reducers │ │ │ │ ├── debug.ts │ │ │ │ └── index.ts │ │ │ ├── shared-data-access.module.spec.ts │ │ │ └── shared-data-access.module.ts │ │ └── test-setup.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ ├── tsconfig.lib.prod.json │ ├── tsconfig.spec.json │ └── tslint.json │ ├── environments │ ├── README.md │ ├── jest.config.js │ ├── src │ │ ├── index.ts │ │ ├── lib │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ └── test-setup.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ ├── tsconfig.lib.prod.json │ ├── tsconfig.spec.json │ └── tslint.json │ └── styles │ ├── README.md │ └── src │ ├── index.scss │ └── lib │ └── _global.scss ├── nx.json ├── package.json ├── tools ├── schematics │ └── .gitkeep └── tsconfig.tools.json ├── tsconfig.json ├── tslint.json └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://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 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: LayZeeDK 2 | -------------------------------------------------------------------------------- /.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 | 8 | # dependencies 9 | /node_modules 10 | 11 | # IDEs and editors 12 | /.idea 13 | .project 14 | .classpath 15 | .c9/ 16 | *.launch 17 | .settings/ 18 | *.sublime-workspace 19 | 20 | # IDE - VSCode 21 | .vscode/* 22 | !.vscode/settings.json 23 | !.vscode/tasks.json 24 | !.vscode/launch.json 25 | !.vscode/extensions.json 26 | 27 | # misc 28 | /.sass-cache 29 | /connect.lock 30 | /coverage 31 | /libpeerconnection.log 32 | npm-debug.log 33 | yarn-error.log 34 | testem.log 35 | /typings 36 | 37 | # System Files 38 | .DS_Store 39 | Thumbs.db 40 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Add files here to ignore them from prettier formatting 2 | 3 | /dist 4 | /coverage 5 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true 3 | } 4 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "nrwl.angular-console", 4 | "angular.ng-template", 5 | "ms-vscode.vscode-typescript-tslint-plugin", 6 | "esbenp.prettier-vscode" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tiny Angular application project in an Nx workspace. 2 | 1. `npx create-nx-workspace workspace --cli=angular --preset=angular --appName=tiny-app --style=scss` 3 | 2. `nx update @angular/cli @angular/core` 4 | 5 | ## Assets workspace library 6 | 1. `nx generate library assets --directory=shared --tags="scope:shared,type:assets" --style=scss` 7 | 2. Remove the architect targets (`lint` and `test`) of the `shared-assets` project in `angular.json`: 8 | ```json 9 | { 10 | "projects": { 11 | "shared-assets": { 12 | "architect": {} 13 | } 14 | } 15 | } 16 | ``` 17 | 3. `npx rimraf ./apps/tiny-app/src/assets ./libs/shared/assets/*.js ./libs/shared/assets/*.json ./libs/shared/assets/src/*.* ./libs/shared/assets/src/lib` 18 | 4. `"# shared-assets" > ./libs/shared/assets/README.md` 19 | 5. `npx mkdirp ./libs/shared/assets/src/assets/fonts ./libs/shared/assets/src/assets/icons ./libs/shared/assets/src/assets/images` 20 | 6. 21 | ```bash 22 | "" > ./libs/shared/assets/src/assets/fonts/.gitkeep 23 | "" > ./libs/shared/assets/src/assets/icons/.gitkeep 24 | "" > ./libs/shared/assets/src/assets/images/.gitkeep 25 | ``` 26 | 7. `mv ./apps/tiny-app/src/favicon.ico ./libs/shared/assets/src` 27 | 8. In the `build` architect target of the `tiny-app` project in `angular.json`, replace the `assets` option with these two entries: 28 | ```json 29 | { 30 | "projects": { 31 | "tiny-app": { 32 | "architect": { 33 | "build": { 34 | "options": { 35 | "assets": [ 36 | { 37 | "glob": "favicon.ico", 38 | "input": "libs/shared/assets/src", 39 | "output": "" 40 | }, 41 | { 42 | "glob": "**/*", 43 | "input": "libs/shared/assets/src/assets", 44 | "output": "assets" 45 | } 46 | ] 47 | } 48 | } 49 | } 50 | } 51 | } 52 | } 53 | ``` 54 | 9. `npx -p wget-improved nwget https://nx.dev/assets/images/nx-logo-white.svg -O ./libs/shared/assets/src/assets/images/nx-logo-white.svg` 55 | 10. In `app.component.html`, replace the `src` attribute of the logo image element with `"/assets/images/nx-logo-white.svg"`. 56 | 57 | ## Styles workspace library 58 | 1. `nx generate library styles --directory=shared --tags="scope:shared,type:styles" --style=scss` 59 | 2. Remove the architect targets (`lint` and `test`) of the `shared-styles` project in `angular.json`: 60 | ```json 61 | { 62 | "projects": { 63 | "shared-styles": { 64 | "architect": {} 65 | } 66 | } 67 | } 68 | ``` 69 | 3. `npx rimraf ./libs/shared/styles/*.js ./libs/shared/styles/*.json ./libs/shared/styles/src/*.* ./libs/shared/styles/src/lib/*.*` 70 | 4. `"# shared-styles" > ./libs/shared/styles/README.md` 71 | 5. `mv ./apps/tiny-app/src/styles.scss ./libs/shared/styles/src/lib/_global.scss` 72 | 6. `"@import './lib/global';" > ./libs/shared/styles/src/index.scss` 73 | 7. In the `build` architect target of the `tiny-app` project in `angular.json`, replace the `styles` option with this entry: 74 | ```json 75 | { 76 | "projects": { 77 | "tiny-app": { 78 | "architect": { 79 | "build": { 80 | "options": { 81 | "styles": [ 82 | "libs/shared/styles/src/index.scss" 83 | ] 84 | } 85 | } 86 | } 87 | } 88 | } 89 | } 90 | ``` 91 | 92 | ## Environments workspace library 93 | 1. `nx generate library environments --directory=shared --tags="scope:shared,type:environments" --style=scss` 94 | 2. `npx rimraf ./libs/shared/environments/src/lib/*.*` 95 | 3. `mv ./apps/tiny-app/src/environments/*.* ./libs/shared/environments/src/lib` 96 | 4. `"export * from './lib/environment';" > ./libs/shared/environments/src/index.ts` 97 | 5. `npx rimraf ./apps/tiny-app/src/environments` 98 | 6. In the `build` architect target of the `tiny-app` project in `angular.json`, replace the `fileReplacements` option in the `production` configuration with this entry: 99 | ```json 100 | { 101 | "projects": { 102 | "tiny-app": { 103 | "architect": { 104 | "build": { 105 | "configurations": { 106 | "production": { 107 | "fileReplacements": [ 108 | { 109 | "replace": "libs/shared/environments/src/lib/environment.ts", 110 | "with": "libs/shared/environments/src/lib/environment.prod.ts" 111 | } 112 | ] 113 | } 114 | } 115 | } 116 | } 117 | } 118 | } 119 | } 120 | ``` 121 | 7. In `main.ts`, replace the environment import statement with the following: 122 | ```typescript 123 | import { environment } from '@workspace/shared/environments'; 124 | ``` 125 | 126 | ## Configure Nx workspace 127 | 1. Add these two `implicitDependencies` entries to the `tiny-app` project in `nx.json`: 128 | ```json 129 | { 130 | "projects": { 131 | "tiny-app": { 132 | "implicitDependencies": [ 133 | "shared-assets", 134 | "shared-styles" 135 | ] 136 | } 137 | } 138 | } 139 | ``` 140 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "projects": { 4 | "tiny-app": { 5 | "projectType": "application", 6 | "schematics": {}, 7 | "root": "apps/tiny-app", 8 | "sourceRoot": "apps/tiny-app/src", 9 | "prefix": "workspace", 10 | "architect": { 11 | "build": { 12 | "builder": "@angular-devkit/build-angular:browser", 13 | "options": { 14 | "outputPath": "dist/apps/tiny-app", 15 | "index": "apps/tiny-app/src/index.html", 16 | "main": "apps/tiny-app/src/main.ts", 17 | "polyfills": "apps/tiny-app/src/polyfills.ts", 18 | "tsConfig": "apps/tiny-app/tsconfig.app.json", 19 | "aot": true, 20 | "assets": [ 21 | { 22 | "glob": "favicon.ico", 23 | "input": "libs/shared/assets/src", 24 | "output": "" 25 | }, 26 | { 27 | "glob": "**/*", 28 | "input": "libs/shared/assets/src/assets", 29 | "output": "assets" 30 | } 31 | ], 32 | "styles": ["libs/shared/styles/src/index.scss"], 33 | "scripts": [] 34 | }, 35 | "configurations": { 36 | "production": { 37 | "fileReplacements": [ 38 | { 39 | "replace": "libs/shared/environments/src/lib/environment.ts", 40 | "with": "libs/shared/environments/src/lib/environment.prod.ts" 41 | } 42 | ], 43 | "optimization": true, 44 | "outputHashing": "all", 45 | "sourceMap": false, 46 | "extractCss": true, 47 | "namedChunks": false, 48 | "extractLicenses": true, 49 | "vendorChunk": false, 50 | "buildOptimizer": true, 51 | "budgets": [ 52 | { 53 | "type": "initial", 54 | "maximumWarning": "2mb", 55 | "maximumError": "5mb" 56 | }, 57 | { 58 | "type": "anyComponentStyle", 59 | "maximumWarning": "6kb", 60 | "maximumError": "10kb" 61 | } 62 | ] 63 | } 64 | } 65 | }, 66 | "serve": { 67 | "builder": "@angular-devkit/build-angular:dev-server", 68 | "options": { 69 | "browserTarget": "tiny-app:build" 70 | }, 71 | "configurations": { 72 | "production": { 73 | "browserTarget": "tiny-app:build:production" 74 | } 75 | } 76 | }, 77 | "extract-i18n": { 78 | "builder": "@angular-devkit/build-angular:extract-i18n", 79 | "options": { 80 | "browserTarget": "tiny-app:build" 81 | } 82 | }, 83 | "lint": { 84 | "builder": "@angular-devkit/build-angular:tslint", 85 | "options": { 86 | "tsConfig": [ 87 | "apps/tiny-app/tsconfig.app.json", 88 | "apps/tiny-app/tsconfig.spec.json" 89 | ], 90 | "exclude": ["**/node_modules/**", "!apps/tiny-app/**"] 91 | } 92 | }, 93 | "test": { 94 | "builder": "@nrwl/jest:jest", 95 | "options": { 96 | "jestConfig": "apps/tiny-app/jest.config.js", 97 | "tsConfig": "apps/tiny-app/tsconfig.spec.json", 98 | "passWithNoTests": true, 99 | "setupFile": "apps/tiny-app/src/test-setup.ts" 100 | } 101 | } 102 | } 103 | }, 104 | "tiny-app-e2e": { 105 | "root": "apps/tiny-app-e2e", 106 | "sourceRoot": "apps/tiny-app-e2e/src", 107 | "projectType": "application", 108 | "architect": { 109 | "e2e": { 110 | "builder": "@nrwl/cypress:cypress", 111 | "options": { 112 | "cypressConfig": "apps/tiny-app-e2e/cypress.json", 113 | "tsConfig": "apps/tiny-app-e2e/tsconfig.e2e.json", 114 | "devServerTarget": "tiny-app:serve" 115 | }, 116 | "configurations": { 117 | "production": { 118 | "devServerTarget": "tiny-app:serve:production" 119 | } 120 | } 121 | }, 122 | "lint": { 123 | "builder": "@angular-devkit/build-angular:tslint", 124 | "options": { 125 | "tsConfig": ["apps/tiny-app-e2e/tsconfig.e2e.json"], 126 | "exclude": ["**/node_modules/**", "!apps/tiny-app-e2e/**"] 127 | } 128 | } 129 | } 130 | }, 131 | "shared-assets": { 132 | "projectType": "library", 133 | "root": "libs/shared/assets", 134 | "sourceRoot": "libs/shared/assets/src", 135 | "prefix": "workspace", 136 | "architect": {}, 137 | "schematics": {} 138 | }, 139 | "shared-styles": { 140 | "projectType": "library", 141 | "root": "libs/shared/styles", 142 | "sourceRoot": "libs/shared/styles/src", 143 | "prefix": "workspace", 144 | "architect": {}, 145 | "schematics": {} 146 | }, 147 | "shared-environments": { 148 | "projectType": "library", 149 | "root": "libs/shared/environments", 150 | "sourceRoot": "libs/shared/environments/src", 151 | "prefix": "workspace", 152 | "architect": { 153 | "lint": { 154 | "builder": "@angular-devkit/build-angular:tslint", 155 | "options": { 156 | "tsConfig": [ 157 | "libs/shared/environments/tsconfig.lib.json", 158 | "libs/shared/environments/tsconfig.spec.json" 159 | ], 160 | "exclude": ["**/node_modules/**", "!libs/shared/environments/**"] 161 | } 162 | }, 163 | "test": { 164 | "builder": "@nrwl/jest:jest", 165 | "options": { 166 | "jestConfig": "libs/shared/environments/jest.config.js", 167 | "tsConfig": "libs/shared/environments/tsconfig.spec.json", 168 | "passWithNoTests": true, 169 | "setupFile": "libs/shared/environments/src/test-setup.ts" 170 | } 171 | } 172 | }, 173 | "schematics": { 174 | "@nrwl/angular:component": { 175 | "styleext": "scss" 176 | } 177 | } 178 | }, 179 | "shared-data-access": { 180 | "projectType": "library", 181 | "root": "libs/shared/data-access", 182 | "sourceRoot": "libs/shared/data-access/src", 183 | "prefix": "workspace", 184 | "architect": { 185 | "lint": { 186 | "builder": "@angular-devkit/build-angular:tslint", 187 | "options": { 188 | "tsConfig": [ 189 | "libs/shared/data-access/tsconfig.lib.json", 190 | "libs/shared/data-access/tsconfig.spec.json" 191 | ], 192 | "exclude": ["**/node_modules/**", "!libs/shared/data-access/**"] 193 | } 194 | }, 195 | "test": { 196 | "builder": "@nrwl/jest:jest", 197 | "options": { 198 | "jestConfig": "libs/shared/data-access/jest.config.js", 199 | "tsConfig": "libs/shared/data-access/tsconfig.spec.json", 200 | "passWithNoTests": true, 201 | "setupFile": "libs/shared/data-access/src/test-setup.ts" 202 | } 203 | } 204 | }, 205 | "schematics": { 206 | "@nrwl/angular:component": { 207 | "styleext": "scss" 208 | } 209 | } 210 | } 211 | }, 212 | "cli": { 213 | "defaultCollection": "@nrwl/angular" 214 | }, 215 | "schematics": { 216 | "@nrwl/angular:application": { 217 | "unitTestRunner": "jest", 218 | "e2eTestRunner": "cypress" 219 | }, 220 | "@nrwl/angular:component": { 221 | "styleext": "scss" 222 | }, 223 | "@nrwl/angular:library": { 224 | "unitTestRunner": "jest" 225 | } 226 | }, 227 | "defaultProject": "tiny-app" 228 | } 229 | -------------------------------------------------------------------------------- /apps/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /apps/tiny-app-e2e/cypress.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileServerFolder": ".", 3 | "fixturesFolder": "./src/fixtures", 4 | "integrationFolder": "./src/integration", 5 | "modifyObstructiveCode": false, 6 | "pluginsFile": "./src/plugins/index", 7 | "supportFile": "./src/support/index.ts", 8 | "video": true, 9 | "videosFolder": "../../dist/cypress/apps/tiny-app-e2e/videos", 10 | "screenshotsFolder": "../../dist/cypress/apps/tiny-app-e2e/screenshots", 11 | "chromeWebSecurity": false 12 | } 13 | -------------------------------------------------------------------------------- /apps/tiny-app-e2e/src/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io" 4 | } 5 | -------------------------------------------------------------------------------- /apps/tiny-app-e2e/src/integration/app.spec.ts: -------------------------------------------------------------------------------- 1 | import { getGreeting } from '../support/app.po'; 2 | 3 | describe('tiny-app', () => { 4 | beforeEach(() => cy.visit('/')); 5 | 6 | it('should display welcome message', () => { 7 | // Custom command example, see `../support/commands.ts` file 8 | cy.login('my-email@something.com', 'myPassword'); 9 | 10 | // Function helper example, see `../support/app.po.ts` file 11 | getGreeting().contains('Welcome to tiny-app!'); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /apps/tiny-app-e2e/src/plugins/index.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example plugins/index.js can be used to load plugins 3 | // 4 | // You can change the location of this file or turn off loading 5 | // the plugins file with the 'pluginsFile' configuration option. 6 | // 7 | // You can read more here: 8 | // https://on.cypress.io/plugins-guide 9 | // *********************************************************** 10 | 11 | // This function is called when a project is opened or re-opened (e.g. due to 12 | // the project's config changing) 13 | 14 | const { preprocessTypescript } = require('@nrwl/cypress/plugins/preprocessor'); 15 | 16 | module.exports = (on, config) => { 17 | // `on` is used to hook into various events Cypress emits 18 | // `config` is the resolved Cypress config 19 | 20 | // Preprocess Typescript file using Nx helper 21 | on('file:preprocessor', preprocessTypescript(config)); 22 | }; 23 | -------------------------------------------------------------------------------- /apps/tiny-app-e2e/src/support/app.po.ts: -------------------------------------------------------------------------------- 1 | export const getGreeting = () => cy.get('h1'); 2 | -------------------------------------------------------------------------------- /apps/tiny-app-e2e/src/support/commands.ts: -------------------------------------------------------------------------------- 1 | // *********************************************** 2 | // This example commands.js shows you how to 3 | // create various custom commands and overwrite 4 | // existing commands. 5 | // 6 | // For more comprehensive examples of custom 7 | // commands please read more here: 8 | // https://on.cypress.io/custom-commands 9 | // *********************************************** 10 | // eslint-disable-next-line @typescript-eslint/no-namespace 11 | declare namespace Cypress { 12 | interface Chainable { 13 | login(email: string, password: string): void; 14 | } 15 | } 16 | // 17 | // -- This is a parent command -- 18 | Cypress.Commands.add('login', (email, password) => { 19 | console.log('Custom command example: Login', email, password); 20 | }); 21 | // 22 | // -- This is a child command -- 23 | // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) 24 | // 25 | // 26 | // -- This is a dual command -- 27 | // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) 28 | // 29 | // 30 | // -- This will overwrite an existing command -- 31 | // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) 32 | -------------------------------------------------------------------------------- /apps/tiny-app-e2e/src/support/index.ts: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/index.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands'; 18 | -------------------------------------------------------------------------------- /apps/tiny-app-e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "sourceMap": false, 5 | "outDir": "../../dist/out-tsc" 6 | }, 7 | "include": ["src/**/*.ts", "src/**/*.js"] 8 | } 9 | -------------------------------------------------------------------------------- /apps/tiny-app-e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "types": ["cypress", "node"] 5 | }, 6 | "include": ["**/*.ts", "**/*.js"] 7 | } 8 | -------------------------------------------------------------------------------- /apps/tiny-app-e2e/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tslint.json", 3 | "linterOptions": { "exclude": ["!**/*"] }, 4 | "rules": {} 5 | } 6 | -------------------------------------------------------------------------------- /apps/tiny-app/browserslist: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # You can see what browsers were selected by your queries by running: 6 | # npx browserslist 7 | 8 | > 0.5% 9 | last 2 versions 10 | Firefox ESR 11 | not dead 12 | not IE 9-11 # For IE 9-11 support, remove 'not'. -------------------------------------------------------------------------------- /apps/tiny-app/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: 'tiny-app', 3 | preset: '../../jest.config.js', 4 | coverageDirectory: '../../coverage/apps/tiny-app', 5 | snapshotSerializers: [ 6 | 'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js', 7 | 'jest-preset-angular/build/AngularSnapshotSerializer.js', 8 | 'jest-preset-angular/build/HTMLCommentSerializer.js' 9 | ] 10 | }; 11 | -------------------------------------------------------------------------------- /apps/tiny-app/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 | Nx logo 7 |

Welcome to {{ title }}!

8 |
9 |
10 |

Resources & Tools

11 |

12 | Thank you for using and showing some ♥ for Nx. 13 |

14 | 38 |

39 | Here are some links to help you get started. 40 |

41 | 77 |

Next Steps

78 |

Here are some things you can do with Nx.

79 |
80 | Add UI library 81 |
 82 | # Generate UI lib
 83 | ng g @nrwl/angular:lib ui
 84 | 
 85 | # Add a component
 86 | ng g @nrwl/angular:component xyz --project ui
88 |
89 |
90 | View dependency graph 91 |
nx dep-graph
92 |
93 |
94 | Run affected commands 95 |
 96 | # see what's been affected by changes
 97 | ng affected:dep-graph
 98 | 
 99 | # run tests for current changes
100 | ng affected:test
101 | 
102 | # run e2e tests for current changes
103 | ng affected:e2e
104 | 
106 |
107 |
108 | -------------------------------------------------------------------------------- /apps/tiny-app/src/app/app.component.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Remove template code below 3 | */ 4 | :host { 5 | display: block; 6 | font-family: sans-serif; 7 | min-width: 300px; 8 | max-width: 600px; 9 | margin: 50px auto; 10 | } 11 | 12 | .gutter-left { 13 | margin-left: 9px; 14 | } 15 | 16 | .col-span-2 { 17 | grid-column: span 2; 18 | } 19 | 20 | .flex { 21 | display: flex; 22 | align-items: center; 23 | justify-content: center; 24 | } 25 | 26 | header { 27 | background-color: #143055; 28 | color: white; 29 | padding: 5px; 30 | border-radius: 3px; 31 | } 32 | 33 | main { 34 | padding: 0 36px; 35 | } 36 | 37 | p { 38 | text-align: center; 39 | } 40 | 41 | h1 { 42 | text-align: center; 43 | margin-left: 18px; 44 | font-size: 24px; 45 | } 46 | 47 | h2 { 48 | text-align: center; 49 | font-size: 20px; 50 | margin: 40px 0 10px 0; 51 | } 52 | 53 | .resources { 54 | text-align: center; 55 | list-style: none; 56 | padding: 0; 57 | display: grid; 58 | grid-gap: 9px; 59 | grid-template-columns: 1fr 1fr; 60 | } 61 | 62 | .resource { 63 | color: #0094ba; 64 | height: 36px; 65 | background-color: rgba(0, 0, 0, 0); 66 | border: 1px solid rgba(0, 0, 0, 0.12); 67 | border-radius: 4px; 68 | padding: 3px 9px; 69 | text-decoration: none; 70 | } 71 | 72 | .resource:hover { 73 | background-color: rgba(68, 138, 255, 0.04); 74 | } 75 | 76 | pre { 77 | padding: 9px; 78 | border-radius: 4px; 79 | background-color: black; 80 | color: #eee; 81 | } 82 | 83 | details { 84 | border-radius: 4px; 85 | color: #333; 86 | background-color: rgba(0, 0, 0, 0); 87 | border: 1px solid rgba(0, 0, 0, 0.12); 88 | padding: 3px 9px; 89 | margin-bottom: 9px; 90 | } 91 | 92 | summary { 93 | cursor: pointer; 94 | outline: none; 95 | height: 36px; 96 | line-height: 36px; 97 | } 98 | 99 | .github-star-container { 100 | margin-top: 12px; 101 | line-height: 20px; 102 | } 103 | 104 | .github-star-container a { 105 | display: flex; 106 | align-items: center; 107 | text-decoration: none; 108 | color: #333; 109 | } 110 | 111 | .github-star-badge { 112 | color: #24292e; 113 | display: flex; 114 | align-items: center; 115 | font-size: 12px; 116 | padding: 3px 10px; 117 | border: 1px solid rgba(27, 31, 35, 0.2); 118 | border-radius: 3px; 119 | background-image: linear-gradient(-180deg, #fafbfc, #eff3f6 90%); 120 | margin-left: 4px; 121 | font-weight: 600; 122 | } 123 | 124 | .github-star-badge:hover { 125 | background-image: linear-gradient(-180deg, #f0f3f6, #e6ebf1 90%); 126 | border-color: rgba(27, 31, 35, 0.35); 127 | background-position: -0.5em; 128 | } 129 | .github-star-badge .material-icons { 130 | height: 16px; 131 | width: 16px; 132 | margin-right: 4px; 133 | } 134 | -------------------------------------------------------------------------------- /apps/tiny-app/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: [AppComponent] 8 | }).compileComponents(); 9 | })); 10 | 11 | it('should create the app', () => { 12 | const fixture = TestBed.createComponent(AppComponent); 13 | const app = fixture.componentInstance; 14 | expect(app).toBeTruthy(); 15 | }); 16 | 17 | it(`should have as title 'tiny-app'`, () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app.title).toEqual('tiny-app'); 21 | }); 22 | 23 | it('should render title', () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | fixture.detectChanges(); 26 | const compiled = fixture.nativeElement; 27 | expect(compiled.querySelector('h1').textContent).toContain( 28 | 'Welcome to tiny-app!' 29 | ); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /apps/tiny-app/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'workspace-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.scss'] 7 | }) 8 | export class AppComponent { 9 | title = 'tiny-app'; 10 | } 11 | -------------------------------------------------------------------------------- /apps/tiny-app/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | 4 | import { AppComponent } from './app.component'; 5 | import { CoreModule } from './core.module'; 6 | 7 | @NgModule({ 8 | bootstrap: [AppComponent], 9 | declarations: [AppComponent], 10 | imports: [ 11 | BrowserModule, 12 | CoreModule, 13 | ], 14 | }) 15 | export class AppModule {} 16 | -------------------------------------------------------------------------------- /apps/tiny-app/src/app/core.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { SharedDataAccessModule } from '@workspace/shared/data-access'; 3 | 4 | @NgModule({ 5 | imports: [ 6 | SharedDataAccessModule.forRoot(), 7 | ], 8 | }) 9 | export class CoreModule {} 10 | -------------------------------------------------------------------------------- /apps/tiny-app/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TinyApp 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /apps/tiny-app/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | import { environment } from '@workspace/shared/environments'; 4 | 5 | import { AppModule } from './app/app.module'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic() 12 | .bootstrapModule(AppModule) 13 | .catch(err => console.error(err)); 14 | -------------------------------------------------------------------------------- /apps/tiny-app/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__UNPATCHED_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 | * APPLICATION IMPORTS 62 | */ 63 | -------------------------------------------------------------------------------- /apps/tiny-app/src/test-setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular'; 2 | -------------------------------------------------------------------------------- /apps/tiny-app/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "types": [] 6 | }, 7 | "files": ["src/main.ts", "src/polyfills.ts"] 8 | } 9 | -------------------------------------------------------------------------------- /apps/tiny-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "types": ["node", "jest"] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /apps/tiny-app/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "files": ["src/test-setup.ts"], 9 | "include": ["**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /apps/tiny-app/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tslint.json", 3 | "rules": { 4 | "directive-selector": [true, "attribute", "workspace", "camelCase"], 5 | "component-selector": [true, "element", "workspace", "kebab-case"] 6 | }, 7 | "linterOptions": { 8 | "exclude": ["!**/*"] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'], 3 | transform: { 4 | '^.+\\.(ts|js|html)$': 'ts-jest' 5 | }, 6 | resolver: '@nrwl/jest/plugins/resolver', 7 | moduleFileExtensions: ['ts', 'js', 'html'], 8 | coverageReporters: ['html'] 9 | }; 10 | -------------------------------------------------------------------------------- /libs/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LayZeeDK/nx-tiny-app-project/a594bba96d5363c43753716f658fbd9ff7f98e3a/libs/.gitkeep -------------------------------------------------------------------------------- /libs/shared/assets/README.md: -------------------------------------------------------------------------------- 1 | # shared-assets 2 | -------------------------------------------------------------------------------- /libs/shared/assets/src/assets/fonts/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /libs/shared/assets/src/assets/icons/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /libs/shared/assets/src/assets/images/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /libs/shared/assets/src/assets/images/nx-logo-white.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /libs/shared/assets/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LayZeeDK/nx-tiny-app-project/a594bba96d5363c43753716f658fbd9ff7f98e3a/libs/shared/assets/src/favicon.ico -------------------------------------------------------------------------------- /libs/shared/data-access/README.md: -------------------------------------------------------------------------------- 1 | # shared-data-access 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Running unit tests 6 | 7 | Run `nx test shared-data-access` to execute the unit tests. 8 | -------------------------------------------------------------------------------- /libs/shared/data-access/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: 'shared-data-access', 3 | preset: '../../../jest.config.js', 4 | coverageDirectory: '../../../coverage/libs/shared/data-access', 5 | snapshotSerializers: [ 6 | 'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js', 7 | 'jest-preset-angular/build/AngularSnapshotSerializer.js', 8 | 'jest-preset-angular/build/HTMLCommentSerializer.js' 9 | ] 10 | }; 11 | -------------------------------------------------------------------------------- /libs/shared/data-access/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/shared-data-access.module'; 2 | -------------------------------------------------------------------------------- /libs/shared/data-access/src/lib/reducers/debug.ts: -------------------------------------------------------------------------------- 1 | import { ActionReducer } from '@ngrx/store'; 2 | 3 | export function debug(reducer: ActionReducer): ActionReducer { 4 | return (state, action) => { 5 | console.log('state', state); 6 | console.log('action', action); 7 | 8 | return reducer(state, action); 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /libs/shared/data-access/src/lib/reducers/index.ts: -------------------------------------------------------------------------------- 1 | import { ActionReducerMap, MetaReducer } from '@ngrx/store'; 2 | import { environment } from '@workspace/shared/environments'; 3 | 4 | import { debug } from './debug'; 5 | 6 | export interface State {} 7 | 8 | export const reducers: ActionReducerMap = {}; 9 | 10 | export const metaReducers: MetaReducer[] = 11 | !environment.production ? [debug] : []; 12 | -------------------------------------------------------------------------------- /libs/shared/data-access/src/lib/shared-data-access.module.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, TestBed } from '@angular/core/testing'; 2 | import { SharedDataAccessModule } from './shared-data-access.module'; 3 | 4 | describe('SharedDataAccessModule', () => { 5 | beforeEach(async(() => { 6 | TestBed.configureTestingModule({ 7 | imports: [SharedDataAccessModule] 8 | }).compileComponents(); 9 | })); 10 | 11 | it('should create', () => { 12 | expect(SharedDataAccessModule).toBeDefined(); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /libs/shared/data-access/src/lib/shared-data-access.module.ts: -------------------------------------------------------------------------------- 1 | import { ModuleWithProviders, NgModule } from '@angular/core'; 2 | import { StoreModule } from '@ngrx/store'; 3 | import { StoreDevtoolsModule } from '@ngrx/store-devtools'; 4 | import { environment } from '@workspace/shared/environments'; 5 | 6 | import { metaReducers, reducers } from './reducers'; 7 | 8 | @NgModule({ 9 | imports: [ 10 | StoreModule.forRoot(reducers, { 11 | metaReducers, 12 | }), 13 | StoreDevtoolsModule.instrument({ 14 | logOnly: environment.production, 15 | maxAge: 25, 16 | }), 17 | ], 18 | }) 19 | export class SharedDataAccessRootModule {} 20 | 21 | @NgModule({}) 22 | export class SharedDataAccessModule { 23 | static forRoot(): ModuleWithProviders { 24 | return { 25 | ngModule: SharedDataAccessRootModule, 26 | }; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /libs/shared/data-access/src/test-setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular'; 2 | -------------------------------------------------------------------------------- /libs/shared/data-access/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "types": ["node", "jest"] 5 | }, 6 | "include": ["**/*.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /libs/shared/data-access/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "target": "es2015", 6 | "declaration": true, 7 | "inlineSources": true, 8 | "types": [], 9 | "lib": ["dom", "es2018"] 10 | }, 11 | "angularCompilerOptions": { 12 | "skipTemplateCodegen": true, 13 | "strictMetadataEmit": true, 14 | "enableResourceInlining": true 15 | }, 16 | "exclude": ["src/test-setup.ts", "**/*.spec.ts"] 17 | } 18 | -------------------------------------------------------------------------------- /libs/shared/data-access/tsconfig.lib.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.lib.json", 3 | "angularCompilerOptions": { 4 | "enableIvy": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /libs/shared/data-access/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "files": ["src/test-setup.ts"], 9 | "include": ["**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /libs/shared/data-access/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tslint.json", 3 | "rules": { 4 | "directive-selector": [true, "attribute", "workspace", "camelCase"], 5 | "component-selector": [true, "element", "workspace", "kebab-case"] 6 | }, 7 | "linterOptions": { 8 | "exclude": ["!**/*"] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /libs/shared/environments/README.md: -------------------------------------------------------------------------------- 1 | # shared-environments 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Running unit tests 6 | 7 | Run `nx test shared-environments` to execute the unit tests. 8 | -------------------------------------------------------------------------------- /libs/shared/environments/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: 'shared-environments', 3 | preset: '../../../jest.config.js', 4 | coverageDirectory: '../../../coverage/libs/shared/environments', 5 | snapshotSerializers: [ 6 | 'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js', 7 | 'jest-preset-angular/build/AngularSnapshotSerializer.js', 8 | 'jest-preset-angular/build/HTMLCommentSerializer.js' 9 | ] 10 | }; 11 | -------------------------------------------------------------------------------- /libs/shared/environments/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/environment'; 2 | -------------------------------------------------------------------------------- /libs/shared/environments/src/lib/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /libs/shared/environments/src/lib/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 | -------------------------------------------------------------------------------- /libs/shared/environments/src/test-setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular'; 2 | -------------------------------------------------------------------------------- /libs/shared/environments/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "types": ["node", "jest"] 5 | }, 6 | "include": ["**/*.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /libs/shared/environments/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "target": "es2015", 6 | "declaration": true, 7 | "inlineSources": true, 8 | "types": [], 9 | "lib": ["dom", "es2018"] 10 | }, 11 | "angularCompilerOptions": { 12 | "skipTemplateCodegen": true, 13 | "strictMetadataEmit": true, 14 | "enableResourceInlining": true 15 | }, 16 | "exclude": ["src/test-setup.ts", "**/*.spec.ts"] 17 | } 18 | -------------------------------------------------------------------------------- /libs/shared/environments/tsconfig.lib.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.lib.json", 3 | "angularCompilerOptions": { 4 | "enableIvy": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /libs/shared/environments/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "files": ["src/test-setup.ts"], 9 | "include": ["**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /libs/shared/environments/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tslint.json", 3 | "rules": { 4 | "directive-selector": [true, "attribute", "workspace", "camelCase"], 5 | "component-selector": [true, "element", "workspace", "kebab-case"] 6 | }, 7 | "linterOptions": { 8 | "exclude": ["!**/*"] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /libs/shared/styles/README.md: -------------------------------------------------------------------------------- 1 | # shared-styles 2 | -------------------------------------------------------------------------------- /libs/shared/styles/src/index.scss: -------------------------------------------------------------------------------- 1 | @import './lib/global'; 2 | -------------------------------------------------------------------------------- /libs/shared/styles/src/lib/_global.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /nx.json: -------------------------------------------------------------------------------- 1 | { 2 | "npmScope": "workspace", 3 | "implicitDependencies": { 4 | "angular.json": "*", 5 | "package.json": { 6 | "dependencies": "*", 7 | "devDependencies": "*" 8 | }, 9 | "tsconfig.json": "*", 10 | "tslint.json": "*", 11 | "nx.json": "*" 12 | }, 13 | "projects": { 14 | "tiny-app": { 15 | "tags": ["scope:tiny", "type:app"], 16 | "implicitDependencies": ["shared-assets", "shared-styles"] 17 | }, 18 | "tiny-app-e2e": { 19 | "tags": [], 20 | "implicitDependencies": ["tiny-app"] 21 | }, 22 | "shared-assets": { 23 | "tags": ["scope:shared", "type:assets"] 24 | }, 25 | "shared-styles": { 26 | "tags": ["scope:shared", "type:styles"] 27 | }, 28 | "shared-environments": { 29 | "tags": ["scope:shared", "type:environments"] 30 | }, 31 | "shared-data-access": { 32 | "tags": ["scope:shared", "type:data-access"] 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "workspace", 3 | "version": "0.0.0", 4 | "license": "MIT", 5 | "scripts": { 6 | "ng": "ng", 7 | "nx": "nx", 8 | "start": "ng serve", 9 | "build": "ng build", 10 | "test": "ng test", 11 | "lint": "nx workspace-lint && ng lint", 12 | "e2e": "ng e2e", 13 | "affected:apps": "nx affected:apps", 14 | "affected:libs": "nx affected:libs", 15 | "affected:build": "nx affected:build", 16 | "affected:e2e": "nx affected:e2e", 17 | "affected:test": "nx affected:test", 18 | "affected:lint": "nx affected:lint", 19 | "affected:dep-graph": "nx affected:dep-graph", 20 | "affected": "nx affected", 21 | "format": "nx format:write", 22 | "format:write": "nx format:write", 23 | "format:check": "nx format:check", 24 | "update": "ng update @nrwl/workspace", 25 | "workspace-schematic": "nx workspace-schematic", 26 | "dep-graph": "nx dep-graph", 27 | "help": "nx help", 28 | "postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points" 29 | }, 30 | "private": true, 31 | "dependencies": { 32 | "@angular/animations": "9.0.7", 33 | "@angular/common": "9.0.7", 34 | "@angular/compiler": "9.0.7", 35 | "@angular/core": "9.0.7", 36 | "@angular/forms": "9.0.7", 37 | "@angular/platform-browser": "9.0.7", 38 | "@angular/platform-browser-dynamic": "9.0.7", 39 | "@angular/router": "9.0.7", 40 | "@ngrx/store": "^9.0.0", 41 | "@ngrx/store-devtools": "^9.0.0", 42 | "@nrwl/angular": "9.1.2", 43 | "core-js": "^2.5.4", 44 | "rxjs": "~6.5.0", 45 | "zone.js": "^0.10.2" 46 | }, 47 | "devDependencies": { 48 | "@angular-devkit/build-angular": "0.900.7", 49 | "@angular/cli": "9.0.7", 50 | "@angular/compiler-cli": "9.0.7", 51 | "@angular/language-service": "9.0.7", 52 | "@nrwl/cypress": "9.1.2", 53 | "@nrwl/jest": "9.1.2", 54 | "@nrwl/workspace": "9.1.2", 55 | "@types/jest": "24.9.1", 56 | "@types/node": "~8.9.4", 57 | "codelyzer": "~5.0.1", 58 | "cypress": "^4.1.0", 59 | "dotenv": "6.2.0", 60 | "eslint": "6.8.0", 61 | "jest": "24.9.0", 62 | "jest-preset-angular": "8.0.0", 63 | "prettier": "1.19.1", 64 | "ts-jest": "24.0.0", 65 | "ts-node": "~7.0.0", 66 | "tslint": "~6.0.0", 67 | "typescript": "~3.7.4" 68 | } 69 | } -------------------------------------------------------------------------------- /tools/schematics/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LayZeeDK/nx-tiny-app-project/a594bba96d5363c43753716f658fbd9ff7f98e3a/tools/schematics/.gitkeep -------------------------------------------------------------------------------- /tools/tsconfig.tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../dist/out-tsc/tools", 5 | "rootDir": ".", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": ["node"] 9 | }, 10 | "include": ["**/*.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "rootDir": ".", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "importHelpers": true, 11 | "target": "es2015", 12 | "module": "esnext", 13 | "typeRoots": ["node_modules/@types"], 14 | "lib": ["es2017", "dom"], 15 | "skipLibCheck": true, 16 | "skipDefaultLibCheck": true, 17 | "baseUrl": ".", 18 | "paths": { 19 | "@workspace/shared/assets": ["libs/shared/assets/src/index.ts"], 20 | "@workspace/shared/styles": ["libs/shared/styles/src/index.ts"], 21 | "@workspace/shared/environments": [ 22 | "libs/shared/environments/src/index.ts" 23 | ], 24 | "@workspace/shared/data-access": ["libs/shared/data-access/src/index.ts"] 25 | } 26 | }, 27 | "exclude": ["node_modules", "tmp"] 28 | } 29 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/@nrwl/workspace/src/tslint", 4 | "node_modules/codelyzer" 5 | ], 6 | "linterOptions": { 7 | "exclude": ["**/*"] 8 | }, 9 | "rules": { 10 | "arrow-return-shorthand": true, 11 | "callable-types": true, 12 | "class-name": true, 13 | "deprecation": { 14 | "severity": "warn" 15 | }, 16 | "forin": true, 17 | "import-blacklist": [true, "rxjs/Rx"], 18 | "interface-over-type-literal": true, 19 | "member-access": false, 20 | "member-ordering": [ 21 | true, 22 | { 23 | "order": [ 24 | "static-field", 25 | "instance-field", 26 | "static-method", 27 | "instance-method" 28 | ] 29 | } 30 | ], 31 | "no-arg": true, 32 | "no-bitwise": true, 33 | "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], 34 | "no-construct": true, 35 | "no-debugger": true, 36 | "no-duplicate-super": true, 37 | "no-empty": false, 38 | "no-empty-interface": true, 39 | "no-eval": true, 40 | "no-inferrable-types": [true, "ignore-params"], 41 | "no-misused-new": true, 42 | "no-non-null-assertion": true, 43 | "no-shadowed-variable": true, 44 | "no-string-literal": false, 45 | "no-string-throw": true, 46 | "no-switch-case-fall-through": true, 47 | "no-unnecessary-initializer": true, 48 | "no-unused-expression": true, 49 | "no-var-keyword": true, 50 | "object-literal-sort-keys": false, 51 | "prefer-const": true, 52 | "radix": true, 53 | "triple-equals": [true, "allow-null-check"], 54 | "unified-signatures": true, 55 | "variable-name": false, 56 | "nx-enforce-module-boundaries": [ 57 | true, 58 | { 59 | "enforceBuildableLibDependency": true, 60 | "allow": [], 61 | "depConstraints": [ 62 | { 63 | "sourceTag": "*", 64 | "onlyDependOnLibsWithTags": ["*"] 65 | } 66 | ] 67 | } 68 | ], 69 | "directive-selector": [true, "attribute", "app", "camelCase"], 70 | "component-selector": [true, "element", "app", "kebab-case"], 71 | "no-conflicting-lifecycle": true, 72 | "no-host-metadata-property": true, 73 | "no-input-rename": true, 74 | "no-inputs-metadata-property": true, 75 | "no-output-native": true, 76 | "no-output-on-prefix": true, 77 | "no-output-rename": true, 78 | "no-outputs-metadata-property": true, 79 | "template-banana-in-box": true, 80 | "template-no-negated-async": true, 81 | "use-lifecycle-interface": true, 82 | "use-pipe-transform-interface": true 83 | } 84 | } 85 | --------------------------------------------------------------------------------