2 |
3 |
4 |
7 |
8 | Angular is an application design framework and development platform for
9 | creating efficient and sophisticated single-page apps.
10 |
11 |
12 |
16 | Tailwind CSS is a utility-first CSS framework packed with classes like
17 | flex, pt-4, text-center and rotate-90 that can be composed to build any
18 | design, directly in your markup.
19 |
20 |
21 |
22 | Nx is a smart, fast and extensible build system with first class monorepo
23 | support and powerful integrations.
24 |
25 |
26 |
2 |
3 |
4 |
7 |
8 | Angular is an application design framework and development platform for
9 | creating efficient and sophisticated single-page apps.
10 |
11 |
12 |
16 | Tailwind CSS is a utility-first CSS framework packed with classes like
17 | flex, pt-4, text-center and rotate-90 that can be composed to build any
18 | design, directly in your markup.
19 |
20 |
21 |
22 | Nx is a smart, fast and extensible build system with first class monorepo
23 | support and powerful integrations.
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/libs/lib2/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "projectType": "library",
3 | "root": "libs/lib2",
4 | "sourceRoot": "libs/lib2/src",
5 | "prefix": "angular-tailwind-nx",
6 | "targets": {
7 | "build": {
8 | "executor": "@nrwl/angular:ng-packagr-lite",
9 | "outputs": ["dist/libs/lib2"],
10 | "options": {
11 | "project": "libs/lib2/ng-package.json",
12 | "tailwindConfig": "libs/lib2/tailwind.config.js"
13 | },
14 | "configurations": {
15 | "production": {
16 | "tsConfig": "libs/lib2/tsconfig.lib.prod.json"
17 | },
18 | "development": {
19 | "tsConfig": "libs/lib2/tsconfig.lib.json"
20 | }
21 | },
22 | "defaultConfiguration": "production"
23 | },
24 | "test": {
25 | "executor": "@nrwl/jest:jest",
26 | "outputs": ["coverage/libs/lib2"],
27 | "options": {
28 | "jestConfig": "libs/lib2/jest.config.js",
29 | "passWithNoTests": true
30 | }
31 | },
32 | "lint": {
33 | "executor": "@nrwl/linter:eslint",
34 | "options": {
35 | "lintFilePatterns": ["libs/lib2/src/**/*.ts", "libs/lib2/src/**/*.html"]
36 | }
37 | }
38 | },
39 | "tags": []
40 | }
41 |
--------------------------------------------------------------------------------
/nx.json:
--------------------------------------------------------------------------------
1 | {
2 | "npmScope": "angular-tailwind-nx",
3 | "affected": {
4 | "defaultBase": "main"
5 | },
6 | "cli": {
7 | "defaultCollection": "@nrwl/angular",
8 | "packageManager": "yarn"
9 | },
10 | "implicitDependencies": {
11 | "package.json": {
12 | "dependencies": "*",
13 | "devDependencies": "*"
14 | },
15 | ".eslintrc.json": "*"
16 | },
17 | "tasksRunnerOptions": {
18 | "default": {
19 | "runner": "@nrwl/workspace/tasks-runners/default",
20 | "options": {
21 | "cacheableOperations": ["build", "lint", "test", "e2e"]
22 | }
23 | }
24 | },
25 | "targetDependencies": {
26 | "build": [
27 | {
28 | "target": "build",
29 | "projects": "dependencies"
30 | }
31 | ]
32 | },
33 | "generators": {
34 | "@nrwl/angular:application": {
35 | "style": "css",
36 | "linter": "eslint",
37 | "unitTestRunner": "jest",
38 | "e2eTestRunner": "cypress"
39 | },
40 | "@nrwl/angular:library": {
41 | "linter": "eslint",
42 | "unitTestRunner": "jest"
43 | },
44 | "@nrwl/angular:component": {
45 | "style": "css"
46 | }
47 | },
48 | "defaultProject": "app1"
49 | }
50 |
--------------------------------------------------------------------------------
/apps/app1-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 |
11 | // eslint-disable-next-line @typescript-eslint/no-namespace
12 | declare namespace Cypress {
13 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
14 | interface Chainable {
15 | login(email: string, password: string): void;
16 | }
17 | }
18 | //
19 | // -- This is a parent command --
20 | Cypress.Commands.add('login', (email, password) => {
21 | console.log('Custom command example: Login', email, password);
22 | });
23 | //
24 | // -- This is a child command --
25 | // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
26 | //
27 | //
28 | // -- This is a dual command --
29 | // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
30 | //
31 | //
32 | // -- This will overwrite an existing command --
33 | // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
34 |
--------------------------------------------------------------------------------
/apps/app2-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 |
11 | // eslint-disable-next-line @typescript-eslint/no-namespace
12 | declare namespace Cypress {
13 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
14 | interface Chainable {
15 | login(email: string, password: string): void;
16 | }
17 | }
18 | //
19 | // -- This is a parent command --
20 | Cypress.Commands.add('login', (email, password) => {
21 | console.log('Custom command example: Login', email, password);
22 | });
23 | //
24 | // -- This is a child command --
25 | // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
26 | //
27 | //
28 | // -- This is a dual command --
29 | // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
30 | //
31 | //
32 | // -- This will overwrite an existing command --
33 | // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
34 |
--------------------------------------------------------------------------------
/apps/app1/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { Lib1Module } from '@angular-tailwind-nx/lib1';
2 | import { Lib2Module } from '@angular-tailwind-nx/lib2';
3 | import { TestBed } from '@angular/core/testing';
4 | import { AppComponent } from './app.component';
5 | import { NxWelcomeComponent } from './nx-welcome.component';
6 |
7 | describe('AppComponent', () => {
8 | beforeEach(async () => {
9 | await TestBed.configureTestingModule({
10 | declarations: [AppComponent, NxWelcomeComponent],
11 | imports: [Lib1Module, Lib2Module],
12 | }).compileComponents();
13 | });
14 |
15 | it('should create the app', () => {
16 | const fixture = TestBed.createComponent(AppComponent);
17 | const app = fixture.componentInstance;
18 | expect(app).toBeTruthy();
19 | });
20 |
21 | it(`should have as title 'app1'`, () => {
22 | const fixture = TestBed.createComponent(AppComponent);
23 | const app = fixture.componentInstance;
24 | expect(app.title).toEqual('app1');
25 | });
26 |
27 | it('should render title', () => {
28 | const fixture = TestBed.createComponent(AppComponent);
29 | fixture.detectChanges();
30 | const compiled = fixture.nativeElement as HTMLElement;
31 | expect(compiled.querySelector('header')?.textContent).toContain('Tailwind CSS');
32 | });
33 | });
34 |
--------------------------------------------------------------------------------
/apps/app2/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { Lib1Module } from '@angular-tailwind-nx/lib1';
2 | import { Lib2Module } from '@angular-tailwind-nx/lib2';
3 | import { TestBed } from '@angular/core/testing';
4 | import { AppComponent } from './app.component';
5 | import { NxWelcomeComponent } from './nx-welcome.component';
6 |
7 | describe('AppComponent', () => {
8 | beforeEach(async () => {
9 | await TestBed.configureTestingModule({
10 | declarations: [AppComponent, NxWelcomeComponent],
11 | imports: [Lib1Module, Lib2Module]
12 | }).compileComponents();
13 | });
14 |
15 | it('should create the app', () => {
16 | const fixture = TestBed.createComponent(AppComponent);
17 | const app = fixture.componentInstance;
18 | expect(app).toBeTruthy();
19 | });
20 |
21 | it(`should have as title 'app2'`, () => {
22 | const fixture = TestBed.createComponent(AppComponent);
23 | const app = fixture.componentInstance;
24 | expect(app.title).toEqual('app2');
25 | });
26 |
27 | it('should render title', () => {
28 | const fixture = TestBed.createComponent(AppComponent);
29 | fixture.detectChanges();
30 | const compiled = fixture.nativeElement as HTMLElement;
31 | expect(compiled.querySelector('header')?.textContent).toContain('Tailwind CSS');
32 | });
33 | });
34 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "angular-tailwind-nx",
3 | "version": "0.0.0",
4 | "license": "MIT",
5 | "scripts": {
6 | "ng": "nx",
7 | "postinstall": "node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main",
8 | "start": "nx serve",
9 | "build": "nx build",
10 | "test": "nx test"
11 | },
12 | "private": true,
13 | "dependencies": {
14 | "@angular/animations": "13.2.6",
15 | "@angular/common": "13.2.6",
16 | "@angular/compiler": "13.2.6",
17 | "@angular/core": "13.2.6",
18 | "@angular/forms": "13.2.6",
19 | "@angular/platform-browser": "13.2.6",
20 | "@angular/platform-browser-dynamic": "13.2.6",
21 | "@angular/router": "13.2.6",
22 | "@nrwl/angular": "13.8.7",
23 | "rxjs": "~7.4.0",
24 | "tslib": "^2.0.0",
25 | "zone.js": "~0.11.4"
26 | },
27 | "devDependencies": {
28 | "@angular-devkit/build-angular": "13.2.6",
29 | "@angular-eslint/eslint-plugin": "~13.0.1",
30 | "@angular-eslint/eslint-plugin-template": "~13.0.1",
31 | "@angular-eslint/template-parser": "~13.0.1",
32 | "@angular/cli": "13.2.6",
33 | "@angular/compiler-cli": "13.2.6",
34 | "@angular/language-service": "13.2.6",
35 | "@nrwl/cli": "13.8.7",
36 | "@nrwl/cypress": "13.8.7",
37 | "@nrwl/eslint-plugin-nx": "13.8.7",
38 | "@nrwl/jest": "13.8.7",
39 | "@nrwl/linter": "13.8.7",
40 | "@nrwl/tao": "13.8.7",
41 | "@nrwl/web": "13.8.7",
42 | "@nrwl/workspace": "13.8.7",
43 | "@types/jest": "27.0.2",
44 | "@types/node": "16.11.7",
45 | "@typescript-eslint/eslint-plugin": "5.10.2",
46 | "@typescript-eslint/parser": "5.10.2",
47 | "autoprefixer": "^10.4.0",
48 | "cypress": "^9.1.0",
49 | "eslint": "8.7.0",
50 | "eslint-config-prettier": "8.1.0",
51 | "eslint-plugin-cypress": "^2.10.3",
52 | "jest": "27.2.3",
53 | "jest-preset-angular": "11.1.1",
54 | "ng-packagr": "13.2.1",
55 | "postcss": "^8.4.5",
56 | "postcss-import": "^14.0.2",
57 | "postcss-preset-env": "^6.7.0",
58 | "postcss-url": "^10.1.1",
59 | "prettier": "^2.5.1",
60 | "tailwindcss": "^3.0.2",
61 | "ts-jest": "27.0.5",
62 | "typescript": "4.5.5"
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/apps/app1/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 recent versions of Safari, Chrome (including
12 | * Opera), Edge on the desktop, and iOS and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/guide/browser-support
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /**
22 | * By default, zone.js will patch all possible macroTask and DomEvents
23 | * user can disable parts of macroTask/DomEvents patch by setting following flags
24 | * because those flags need to be set before `zone.js` being loaded, and webpack
25 | * will put import in the top of bundle, so user need to create a separate file
26 | * in this directory (for example: zone-flags.ts), and put the following flags
27 | * into that file, and then add the following code before importing zone.js.
28 | * import './zone-flags';
29 | *
30 | * The flags allowed in zone-flags.ts are listed here.
31 | *
32 | * The following flags will work for all browsers.
33 | *
34 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
35 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
36 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
37 | *
38 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
39 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
40 | *
41 | * (window as any).__Zone_enable_cross_context_check = true;
42 | *
43 | */
44 |
45 | /***************************************************************************************************
46 | * Zone JS is required by default for Angular itself.
47 | */
48 | import 'zone.js'; // Included with Angular CLI.
49 |
50 | /***************************************************************************************************
51 | * APPLICATION IMPORTS
52 | */
53 |
--------------------------------------------------------------------------------
/apps/app2/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 recent versions of Safari, Chrome (including
12 | * Opera), Edge on the desktop, and iOS and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/guide/browser-support
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /**
22 | * By default, zone.js will patch all possible macroTask and DomEvents
23 | * user can disable parts of macroTask/DomEvents patch by setting following flags
24 | * because those flags need to be set before `zone.js` being loaded, and webpack
25 | * will put import in the top of bundle, so user need to create a separate file
26 | * in this directory (for example: zone-flags.ts), and put the following flags
27 | * into that file, and then add the following code before importing zone.js.
28 | * import './zone-flags';
29 | *
30 | * The flags allowed in zone-flags.ts are listed here.
31 | *
32 | * The following flags will work for all browsers.
33 | *
34 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
35 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
36 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
37 | *
38 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
39 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
40 | *
41 | * (window as any).__Zone_enable_cross_context_check = true;
42 | *
43 | */
44 |
45 | /***************************************************************************************************
46 | * Zone JS is required by default for Angular itself.
47 | */
48 | import 'zone.js'; // Included with Angular CLI.
49 |
50 | /***************************************************************************************************
51 | * APPLICATION IMPORTS
52 | */
53 |
--------------------------------------------------------------------------------
/apps/app1/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "projectType": "application",
3 | "root": "apps/app1",
4 | "sourceRoot": "apps/app1/src",
5 | "prefix": "angular-tailwind-nx",
6 | "targets": {
7 | "build": {
8 | "executor": "@nrwl/angular:webpack-browser",
9 | "outputs": ["{options.outputPath}"],
10 | "options": {
11 | "outputPath": "dist/apps/app1",
12 | "index": "apps/app1/src/index.html",
13 | "main": "apps/app1/src/main.ts",
14 | "polyfills": "apps/app1/src/polyfills.ts",
15 | "tsConfig": "apps/app1/tsconfig.app.json",
16 | "assets": ["apps/app1/src/favicon.ico", "apps/app1/src/assets"],
17 | "styles": ["apps/app1/src/styles.css"],
18 | "scripts": []
19 | },
20 | "configurations": {
21 | "production": {
22 | "budgets": [
23 | {
24 | "type": "initial",
25 | "maximumWarning": "500kb",
26 | "maximumError": "1mb"
27 | },
28 | {
29 | "type": "anyComponentStyle",
30 | "maximumWarning": "2kb",
31 | "maximumError": "4kb"
32 | }
33 | ],
34 | "fileReplacements": [
35 | {
36 | "replace": "apps/app1/src/environments/environment.ts",
37 | "with": "apps/app1/src/environments/environment.prod.ts"
38 | }
39 | ],
40 | "outputHashing": "all"
41 | },
42 | "development": {
43 | "buildOptimizer": false,
44 | "optimization": false,
45 | "vendorChunk": true,
46 | "extractLicenses": false,
47 | "sourceMap": true,
48 | "namedChunks": true
49 | }
50 | },
51 | "defaultConfiguration": "production"
52 | },
53 | "serve": {
54 | "executor": "@nrwl/web:file-server",
55 | "configurations": {
56 | "production": {
57 | "buildTarget": "app1:build:production"
58 | },
59 | "development": {
60 | "buildTarget": "app1:build:development"
61 | }
62 | },
63 | "defaultConfiguration": "development"
64 | },
65 | "extract-i18n": {
66 | "executor": "@angular-devkit/build-angular:extract-i18n",
67 | "options": {
68 | "browserTarget": "app1:build"
69 | }
70 | },
71 | "lint": {
72 | "executor": "@nrwl/linter:eslint",
73 | "options": {
74 | "lintFilePatterns": ["apps/app1/src/**/*.ts", "apps/app1/src/**/*.html"]
75 | }
76 | },
77 | "test": {
78 | "executor": "@nrwl/jest:jest",
79 | "outputs": ["coverage/apps/app1"],
80 | "options": {
81 | "jestConfig": "apps/app1/jest.config.js",
82 | "passWithNoTests": true
83 | }
84 | }
85 | },
86 | "tags": []
87 | }
88 |
--------------------------------------------------------------------------------
/apps/app2/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "projectType": "application",
3 | "root": "apps/app2",
4 | "sourceRoot": "apps/app2/src",
5 | "prefix": "angular-tailwind-nx",
6 | "targets": {
7 | "build": {
8 | "executor": "@nrwl/angular:webpack-browser",
9 | "outputs": ["{options.outputPath}"],
10 | "options": {
11 | "outputPath": "dist/apps/app2",
12 | "index": "apps/app2/src/index.html",
13 | "main": "apps/app2/src/main.ts",
14 | "polyfills": "apps/app2/src/polyfills.ts",
15 | "tsConfig": "apps/app2/tsconfig.app.json",
16 | "assets": ["apps/app2/src/favicon.ico", "apps/app2/src/assets"],
17 | "styles": ["apps/app2/src/styles.css"],
18 | "scripts": []
19 | },
20 | "configurations": {
21 | "production": {
22 | "budgets": [
23 | {
24 | "type": "initial",
25 | "maximumWarning": "500kb",
26 | "maximumError": "1mb"
27 | },
28 | {
29 | "type": "anyComponentStyle",
30 | "maximumWarning": "2kb",
31 | "maximumError": "4kb"
32 | }
33 | ],
34 | "fileReplacements": [
35 | {
36 | "replace": "apps/app2/src/environments/environment.ts",
37 | "with": "apps/app2/src/environments/environment.prod.ts"
38 | }
39 | ],
40 | "outputHashing": "all"
41 | },
42 | "development": {
43 | "buildOptimizer": false,
44 | "optimization": false,
45 | "vendorChunk": true,
46 | "extractLicenses": false,
47 | "sourceMap": true,
48 | "namedChunks": true
49 | }
50 | },
51 | "defaultConfiguration": "production"
52 | },
53 | "serve": {
54 | "executor": "@nrwl/web:file-server",
55 | "configurations": {
56 | "production": {
57 | "buildTarget": "app2:build:production"
58 | },
59 | "development": {
60 | "buildTarget": "app2:build:development"
61 | }
62 | },
63 | "defaultConfiguration": "development"
64 | },
65 | "extract-i18n": {
66 | "executor": "@angular-devkit/build-angular:extract-i18n",
67 | "options": {
68 | "browserTarget": "app2:build"
69 | }
70 | },
71 | "lint": {
72 | "executor": "@nrwl/linter:eslint",
73 | "options": {
74 | "lintFilePatterns": ["apps/app2/src/**/*.ts", "apps/app2/src/**/*.html"]
75 | }
76 | },
77 | "test": {
78 | "executor": "@nrwl/jest:jest",
79 | "outputs": ["coverage/apps/app2"],
80 | "options": {
81 | "jestConfig": "apps/app2/jest.config.js",
82 | "passWithNoTests": true
83 | }
84 | }
85 | },
86 | "tags": []
87 | }
88 |
--------------------------------------------------------------------------------
/decorate-angular-cli.js:
--------------------------------------------------------------------------------
1 | /**
2 | * This file decorates the Angular CLI with the Nx CLI to enable features such as computation caching
3 | * and faster execution of tasks.
4 | *
5 | * It does this by:
6 | *
7 | * - Patching the Angular CLI to warn you in case you accidentally use the undecorated ng command.
8 | * - Symlinking the ng to nx command, so all commands run through the Nx CLI
9 | * - Updating the package.json postinstall script to give you control over this script
10 | *
11 | * The Nx CLI decorates the Angular CLI, so the Nx CLI is fully compatible with it.
12 | * Every command you run should work the same when using the Nx CLI, except faster.
13 | *
14 | * Because of symlinking you can still type `ng build/test/lint` in the terminal. The ng command, in this case,
15 | * will point to nx, which will perform optimizations before invoking ng. So the Angular CLI is always invoked.
16 | * The Nx CLI simply does some optimizations before invoking the Angular CLI.
17 | *
18 | * To opt out of this patch:
19 | * - Replace occurrences of nx with ng in your package.json
20 | * - Remove the script from your postinstall script in your package.json
21 | * - Delete and reinstall your node_modules
22 | */
23 |
24 | const fs = require('fs');
25 | const os = require('os');
26 | const cp = require('child_process');
27 | const isWindows = os.platform() === 'win32';
28 | let output;
29 | try {
30 | output = require('@nrwl/workspace').output;
31 | } catch (e) {
32 | console.warn('Angular CLI could not be decorated to enable computation caching. Please ensure @nrwl/workspace is installed.');
33 | process.exit(0);
34 | }
35 |
36 | /**
37 | * Symlink of ng to nx, so you can keep using `ng build/test/lint` and still
38 | * invoke the Nx CLI and get the benefits of computation caching.
39 | */
40 | function symlinkNgCLItoNxCLI() {
41 | try {
42 | const ngPath = './node_modules/.bin/ng';
43 | const nxPath = './node_modules/.bin/nx';
44 | if (isWindows) {
45 | /**
46 | * This is the most reliable way to create symlink-like behavior on Windows.
47 | * Such that it works in all shells and works with npx.
48 | */
49 | ['', '.cmd', '.ps1'].forEach(ext => {
50 | if (fs.existsSync(nxPath + ext)) fs.writeFileSync(ngPath + ext, fs.readFileSync(nxPath + ext));
51 | });
52 | } else {
53 | // If unix-based, symlink
54 | cp.execSync(`ln -sf ./nx ${ngPath}`);
55 | }
56 | }
57 | catch(e) {
58 | output.error({ title: 'Unable to create a symlink from the Angular CLI to the Nx CLI:' + e.message });
59 | throw e;
60 | }
61 | }
62 |
63 | try {
64 | symlinkNgCLItoNxCLI();
65 | require('@nrwl/cli/lib/decorate-cli').decorateCli();
66 | output.log({ title: 'Angular CLI has been decorated to enable computation caching.' });
67 | } catch(e) {
68 | output.error({ title: 'Decoration of the Angular CLI did not complete successfully' });
69 | }
70 |
--------------------------------------------------------------------------------
/libs/lib3/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "projectType": "library",
3 | "root": "libs/lib3",
4 | "sourceRoot": "libs/lib3/src",
5 | "prefix": "angular-tailwind-nx",
6 | "targets": {
7 | "build-angular": {
8 | "executor": "@nrwl/angular:package",
9 | "outputs": ["dist/libs/lib3"],
10 | "options": {
11 | "project": "libs/lib3/ng-package.json",
12 | "tailwindConfig": "libs/lib3/tailwind.config.js"
13 | },
14 | "configurations": {
15 | "production": {
16 | "tsConfig": "libs/lib3/tsconfig.lib.prod.json"
17 | },
18 | "development": {
19 | "tsConfig": "libs/lib3/tsconfig.lib.json"
20 | }
21 | },
22 | "defaultConfiguration": "production"
23 | },
24 | "build-themes": {
25 | "executor": "@nrwl/workspace:run-commands",
26 | "outputs": ["dist/libs/lib3/themes"],
27 | "configurations": {
28 | "production": {
29 | "commands": [
30 | "tailwindcss -c libs/lib3/tailwind.config.js -i ./libs/lib3/src/styles/teal.css -o ./dist/libs/lib3/themes/teal.css -m",
31 | "tailwindcss -c libs/lib3/tailwind.config.js -i ./libs/lib3/src/styles/indigo.css -o ./dist/libs/lib3/themes/indigo.css -m"
32 | ]
33 | },
34 | "development": {
35 | "commands": [
36 | "tailwindcss -c libs/lib3/tailwind.config.js -i ./libs/lib3/src/styles/teal.css -o ./dist/libs/lib3/themes/teal.css",
37 | "tailwindcss -c libs/lib3/tailwind.config.js -i ./libs/lib3/src/styles/indigo.css -o ./dist/libs/lib3/themes/indigo.css"
38 | ]
39 | }
40 | },
41 | "defaultConfiguration": "production"
42 | },
43 | "build-lib": {
44 | "executor": "@nrwl/workspace:run-commands",
45 | "outputs": ["dist/libs/lib3"],
46 | "configurations": {
47 | "production": {
48 | "commands": [
49 | "nx run lib3:build-angular:production",
50 | "nx run lib3:build-themes:production"
51 | ]
52 | },
53 | "development": {
54 | "commands": [
55 | "nx run lib3:build-angular:development",
56 | "nx run lib3:build-themes:development"
57 | ]
58 | }
59 | },
60 | "defaultConfiguration": "production"
61 | },
62 | "build": {
63 | "executor": "@nrwl/workspace:run-commands",
64 | "outputs": ["dist/libs/lib3"],
65 | "configurations": {
66 | "production": {
67 | "commands": [
68 | "node tools/scripts/remove-dir.js dist/libs/lib3",
69 | "nx run lib3:build-lib:production"
70 | ],
71 | "parallel": false
72 | },
73 | "development": {
74 | "commands": [
75 | "node tools/scripts/remove-dir.js dist/libs/lib3",
76 | "nx run lib3:build-lib:development"
77 | ],
78 | "parallel": false
79 | }
80 | },
81 | "defaultConfiguration": "production"
82 | },
83 | "test": {
84 | "executor": "@nrwl/jest:jest",
85 | "outputs": ["coverage/libs/lib3"],
86 | "options": {
87 | "jestConfig": "libs/lib3/jest.config.js",
88 | "passWithNoTests": true
89 | }
90 | },
91 | "lint": {
92 | "executor": "@nrwl/linter:eslint",
93 | "options": {
94 | "lintFilePatterns": ["libs/lib3/src/**/*.ts", "libs/lib3/src/**/*.html"]
95 | }
96 | }
97 | },
98 | "tags": []
99 | }
100 |
--------------------------------------------------------------------------------
/apps/app1/src/app/nx-welcome.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, ViewEncapsulation } from '@angular/core';
2 |
3 | /* eslint-disable */
4 |
5 | @Component({
6 | selector: 'angular-tailwind-nx-nx-welcome',
7 | template: `
8 |
15 |
430 |
# see what's been affected by changes
814 | nx affected:graph
815 |
816 | # run tests for current changes
817 | nx affected:test
818 |
819 | # run e2e tests for current changes
820 | nx affected:e2e
# see what's been affected by changes
814 | nx affected:graph
815 |
816 | # run tests for current changes
817 | nx affected:test
818 |
819 | # run e2e tests for current changes
820 | nx affected:e2e