Skip to content

Commit 9a12517

Browse files
initial commit
0 parents  commit 9a12517

15 files changed

+4445
-0
lines changed

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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

.gitignore

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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

.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Add files here to ignore them from prettier formatting
2+
3+
/dist
4+
/coverage

.prettierrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

README.md

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Reactiveangular
2+
3+
This project was generated using [Nx](https://nx.dev).
4+
5+
<p align="center"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="450"></p>
6+
7+
🔎 **Nx is a set of Extensible Dev Tools for Monorepos.**
8+
9+
## Quick Start & Documentation
10+
11+
[Nx Documentation](https://nx.dev/angular)
12+
13+
[10-minute video showing all Nx features](https://nx.dev/angular/getting-started/what-is-nx)
14+
15+
[Interactive Tutorial](https://nx.dev/angular/tutorial/01-create-application)
16+
17+
## Adding capabilities to your workspace
18+
19+
Nx supports many plugins which add capabilities for developing different types of applications and different tools.
20+
21+
These capabilities include generating applications, libraries, etc as well as the devtools to test, and build projects as well.
22+
23+
Below are our core plugins:
24+
25+
- [Angular](https://angular.io)
26+
- `ng add @nrwl/angular`
27+
- [React](https://reactjs.org)
28+
- `ng add @nrwl/react`
29+
- Web (no framework frontends)
30+
- `ng add @nrwl/web`
31+
- [Nest](https://nestjs.com)
32+
- `ng add @nrwl/nest`
33+
- [Express](https://expressjs.com)
34+
- `ng add @nrwl/express`
35+
- [Node](https://nodejs.org)
36+
- `ng add @nrwl/node`
37+
38+
There are also many [community plugins](https://nx.dev/nx-community) you could add.
39+
40+
## Generate an application
41+
42+
Run `ng g @nrwl/angular:app my-app` to generate an application.
43+
44+
> You can use any of the plugins above to generate applications as well.
45+
46+
When using Nx, you can create multiple applications and libraries in the same workspace.
47+
48+
## Generate a library
49+
50+
Run `ng g @nrwl/angular:lib my-lib` to generate a library.
51+
52+
> You can also use any of the plugins above to generate libraries as well.
53+
54+
Libraries are sharable across libraries and applications. They can be imported from `@reactiveangular/mylib`.
55+
56+
## Development server
57+
58+
Run `ng serve my-app` for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
59+
60+
## Code scaffolding
61+
62+
Run `ng g component my-component --project=my-app` to generate a new component.
63+
64+
## Build
65+
66+
Run `ng build my-app` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
67+
68+
## Running unit tests
69+
70+
Run `ng test my-app` to execute the unit tests via [Jest](https://jestjs.io).
71+
72+
Run `nx affected:test` to execute the unit tests affected by a change.
73+
74+
## Running end-to-end tests
75+
76+
Run `ng e2e my-app` to execute the end-to-end tests via [Cypress](https://www.cypress.io).
77+
78+
Run `nx affected:e2e` to execute the end-to-end tests affected by a change.
79+
80+
## Understand your workspace
81+
82+
Run `nx dep-graph` to see a diagram of the dependencies of your projects.
83+
84+
## Further help
85+
86+
Visit the [Nx Documentation](https://nx.dev/angular) to learn more.
87+
88+
## ☁ Nx Cloud
89+
90+
### Computation Memoization in the Cloud
91+
92+
<p align="center"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-cloud-card.png"></p>
93+
94+
Nx Cloud pairs with Nx in order to enable you to build and test code more rapidly, by up to 10 times. Even teams that are new to Nx can connect to Nx Cloud and start saving time instantly.
95+
96+
Teams using Nx gain the advantage of building full-stack applications with their preferred framework alongside Nx’s advanced code generation and project dependency graph, plus a unified experience for both frontend and backend developers.
97+
98+
Visit [Nx Cloud](https://nx.app/) to learn more.

angular.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"version": 1,
3+
"projects": {},
4+
"cli": {
5+
"defaultCollection": "@nrwl/workspace"
6+
}
7+
}

apps/.gitkeep

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

decorate-angular-cli.js

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/**
2+
* This file decorate 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 symliking 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+
const { output } = require("@nrwl/workspace");
29+
30+
/**
31+
* Paths to files being patched
32+
*/
33+
const angularCLIInitPath = "node_modules/@angular/cli/lib/cli/index.js";
34+
35+
/**
36+
* Patch index.js to warn you if you invoke the undecorated Angular CLI.
37+
*/
38+
function patchAngularCLI(initPath) {
39+
const angularCLIInit = fs.readFileSync(initPath, "utf-8").toString();
40+
41+
if (!angularCLIInit.includes("NX_CLI_SET")) {
42+
fs.writeFileSync(
43+
initPath,
44+
`
45+
if (!process.env['NX_CLI_SET']) {
46+
const { output } = require('@nrwl/workspace');
47+
output.warn({ title: 'The Angular CLI was invoked instead of the Nx CLI. Use "npx ng [command]" or "nx [command]" instead.' });
48+
}
49+
${angularCLIInit}
50+
`
51+
);
52+
}
53+
}
54+
55+
/**
56+
* Symlink of ng to nx, so you can keep using `ng build/test/lint` and still
57+
* invoke the Nx CLI and get the benefits of computation caching.
58+
*/
59+
function symlinkNgCLItoNxCLI() {
60+
try {
61+
const ngPath = "./node_modules/.bin/ng";
62+
const nxPath = "./node_modules/.bin/nx";
63+
if (isWindows) {
64+
/**
65+
* This is the most reliable way to create symlink-like behavior on Windows.
66+
* Such that it works in all shells and works with npx.
67+
*/
68+
["", ".cmd", ".ps1"].forEach((ext) => {
69+
fs.writeFileSync(ngPath + ext, fs.readFileSync(nxPath + ext));
70+
});
71+
} else {
72+
// If unix-based, symlink
73+
cp.execSync(`ln -sf ./nx ${ngPath}`);
74+
}
75+
} catch (e) {
76+
output.error({
77+
title:
78+
"Unable to create a symlink from the Angular CLI to the Nx CLI:" +
79+
e.message,
80+
});
81+
throw e;
82+
}
83+
}
84+
85+
try {
86+
symlinkNgCLItoNxCLI();
87+
patchAngularCLI(angularCLIInitPath);
88+
output.log({
89+
title: "Angular CLI has been decorated to enable computation caching.",
90+
});
91+
} catch (e) {
92+
output.error({
93+
title: "Decoration of the Angular CLI did not complete successfully",
94+
});
95+
}

libs/.gitkeep

Whitespace-only changes.

nx.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"npmScope": "reactiveangular",
3+
"implicitDependencies": {
4+
"angular.json": "*",
5+
"package.json": {
6+
"dependencies": "*",
7+
"devDependencies": "*"
8+
},
9+
"tsconfig.json": "*",
10+
"tslint.json": "*",
11+
"nx.json": "*"
12+
},
13+
"tasksRunnerOptions": {
14+
"default": {
15+
"runner": "@nrwl/workspace/tasks-runners/default",
16+
"options": {
17+
"cacheableOperations": ["build", "lint", "test", "e2e"]
18+
}
19+
}
20+
},
21+
"projects": {}
22+
}

0 commit comments

Comments
 (0)