fix(build): make Nx dev process WSL-friendly

- Reformat code to have LF line endings.
- Enforce LF line endings.
This commit is contained in:
Victor Savkin 2019-01-13 16:15:41 -05:00
parent c2c01f977b
commit ffd9d93019
33 changed files with 14119 additions and 14234 deletions

View File

@ -1,52 +1,52 @@
_[Please make sure you have read the submission guidelines before posting an issue](https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-issue)_
# Prerequisites
Please answer the following questions for yourself before submitting an issue.
**YOU MAY DELETE THE PREREQUISITES SECTION.**
- [ ] I am running the latest version
- [ ] I checked the documentation and found no answer
- [ ] I checked to make sure that this issue has not already been filed
- [ ] I'm reporting the issue to the correct repository (not related to Angular, AngularCLI or any dependency)
## Expected Behavior
Please describe the behavior you are expecting
## Current Behavior
What is the current behavior?
## Failure Information (for bugs)
Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
### Steps to Reproduce
Please provide detailed steps for reproducing the issue.
1. step 1
2. step 2
3. ...
### Context
Please provide any relevant information about your setup:
- version of Nx used
- version of Angular CLI used
- `angular.json` configuration
- version of Angular DevKit used
- 3rd-party libraries and their versions
- and most importantly - a use-case that fails
**A minimal reproduce scenario using allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem.**
### Failure Logs
Please include any relevant log snippets or files here.
## Other
Any other relevant information that will help us help you.
_[Please make sure you have read the submission guidelines before posting an issue](https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-issue)_
# Prerequisites
Please answer the following questions for yourself before submitting an issue.
**YOU MAY DELETE THE PREREQUISITES SECTION.**
- [ ] I am running the latest version
- [ ] I checked the documentation and found no answer
- [ ] I checked to make sure that this issue has not already been filed
- [ ] I'm reporting the issue to the correct repository (not related to Angular, AngularCLI or any dependency)
## Expected Behavior
Please describe the behavior you are expecting
## Current Behavior
What is the current behavior?
## Failure Information (for bugs)
Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
### Steps to Reproduce
Please provide detailed steps for reproducing the issue.
1. step 1
2. step 2
3. ...
### Context
Please provide any relevant information about your setup:
- version of Nx used
- version of Angular CLI used
- `angular.json` configuration
- version of Angular DevKit used
- 3rd-party libraries and their versions
- and most importantly - a use-case that fails
**A minimal reproduce scenario using allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem.**
### Failure Logs
Please include any relevant log snippets or files here.
## Other
Any other relevant information that will help us help you.

View File

@ -1,12 +1,12 @@
## Description
Description the change you would like to have.
## Suggested implementation
How do you think it can be done?
## Describe alternatives
Do you have considered any alternative?
Teachability, Documentation, Adoption, Migration Strategy...
## Description
Description the change you would like to have.
## Suggested implementation
How do you think it can be done?
## Describe alternatives
Do you have considered any alternative?
Teachability, Documentation, Adoption, Migration Strategy...

View File

@ -1,5 +1,5 @@
_[Please make sure you have read the submission guidelines before posting an PR](https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-pr)_
## Description
## Issue
_[Please make sure you have read the submission guidelines before posting an PR](https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-pr)_
## Description
## Issue

View File

@ -1,67 +1,67 @@
# Saved Responses for Nx's Issue Tracker
The following are canned responses that the Nx team should use to close issues on our issue tracker that fall into the listed resolution categories.
Since GitHub currently doesn't allow us to have a repository-wide or organization-wide list of [saved replies](https://help.github.com/articles/working-with-saved-replies/), these replies need to be maintained by individual team members. Since the responses can be modified in the future, all responses are versioned to simplify the process of keeping the responses up to date.
## Nx: Already Fixed
```
Thanks for reporting this issue. Luckily, it has already been fixed in one of the recent releases. Please update to the most recent version to resolve the problem.
If the problem persists in your application after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior. You can use `create-nx-workspace my-issue` and then `ng g app my-app` to create a new project where you reproduce the problem.
```
## Nx: Don't Understand
```
I'm sorry, but we don't understand the problem you are reporting.
Please provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior. You can use `create-nx-workspace my-issue` to create a new project where you reproduce the problem.
```
## Nx: Duplicate
```
Thanks for reporting this issue. However, this issue is a duplicate of #<ISSUE_NUMBER>. Please subscribe to that issue for future updates.
```
## Nx: Insufficient Information Provided
```
Thanks for reporting this issue. However, you didn't provide sufficient information for us to understand and reproduce the problem. Please check out [our submission guidelines](https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-an-issue) to understand why we can't act on issues that are lacking important information.
Please ensure you provide all of the required information when filling out the issue template.
```
## Nx: NPM install issue
```
This seems like a problem with your node/npm and not with Nx.
Please have a look at the [fixing npm permissions page](https://docs.npmjs.com/getting-started/fixing-npm-permissions), [common errors page](https://docs.npmjs.com/troubleshooting/common-errors), [npm issue tracker](https://github.com/npm/npm/issues), or open a new issue if the problem you are experiencing isn't known.
```
## Nx: Issue Outside of Nx
```
I'm sorry, but this issue is not caused by Nx. Please contact the author(s) of the <PROJECT NAME> project or file an issue on their issue tracker.
```
## Nx: Non-reproducible
```
I'm sorry, but we can't reproduce the problem following the instructions you provided.
Remember that we have a large number of issues to resolve, and have only a limited amount of time to reproduce your issue.
Short, explicit instructions make it much more likely we'll be able to reproduce the problem so we can fix it.
A good way to make a minimal repro is to create a new app via `create-nx-workspace my-issue` and then `ng g app my-app` and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.
```
## Nx: Obsolete
```
Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Nx version.
If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.
```
# Saved Responses for Nx's Issue Tracker
The following are canned responses that the Nx team should use to close issues on our issue tracker that fall into the listed resolution categories.
Since GitHub currently doesn't allow us to have a repository-wide or organization-wide list of [saved replies](https://help.github.com/articles/working-with-saved-replies/), these replies need to be maintained by individual team members. Since the responses can be modified in the future, all responses are versioned to simplify the process of keeping the responses up to date.
## Nx: Already Fixed
```
Thanks for reporting this issue. Luckily, it has already been fixed in one of the recent releases. Please update to the most recent version to resolve the problem.
If the problem persists in your application after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior. You can use `create-nx-workspace my-issue` and then `ng g app my-app` to create a new project where you reproduce the problem.
```
## Nx: Don't Understand
```
I'm sorry, but we don't understand the problem you are reporting.
Please provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior. You can use `create-nx-workspace my-issue` to create a new project where you reproduce the problem.
```
## Nx: Duplicate
```
Thanks for reporting this issue. However, this issue is a duplicate of #<ISSUE_NUMBER>. Please subscribe to that issue for future updates.
```
## Nx: Insufficient Information Provided
```
Thanks for reporting this issue. However, you didn't provide sufficient information for us to understand and reproduce the problem. Please check out [our submission guidelines](https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-an-issue) to understand why we can't act on issues that are lacking important information.
Please ensure you provide all of the required information when filling out the issue template.
```
## Nx: NPM install issue
```
This seems like a problem with your node/npm and not with Nx.
Please have a look at the [fixing npm permissions page](https://docs.npmjs.com/getting-started/fixing-npm-permissions), [common errors page](https://docs.npmjs.com/troubleshooting/common-errors), [npm issue tracker](https://github.com/npm/npm/issues), or open a new issue if the problem you are experiencing isn't known.
```
## Nx: Issue Outside of Nx
```
I'm sorry, but this issue is not caused by Nx. Please contact the author(s) of the <PROJECT NAME> project or file an issue on their issue tracker.
```
## Nx: Non-reproducible
```
I'm sorry, but we can't reproduce the problem following the instructions you provided.
Remember that we have a large number of issues to resolve, and have only a limited amount of time to reproduce your issue.
Short, explicit instructions make it much more likely we'll be able to reproduce the problem so we can fix it.
A good way to make a minimal repro is to create a new app via `create-nx-workspace my-issue` and then `ng g app my-app` and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.
```
## Nx: Obsolete
```
Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Nx version.
If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.
```

View File

@ -1,6 +1,6 @@
tmp
/test
/build
node_modules
/package.json
packages/schematics/src/collection/**/files/*.json
tmp
/test
/build
node_modules
/package.json
packages/schematics/src/collection/**/files/*.json

View File

@ -1,3 +1,3 @@
{
"singleQuote": true
{
"singleQuote": true
}

View File

@ -1,39 +1,39 @@
matrix:
include:
- os: linux
language: node_js
node_js: 8.9.3
dist: trusty
sudo: required
- os: windows
language: node_js
node_js: 8.9.3
before_install:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
export DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start;
fi
install:
- yarn install --network-timeout 1000000 # Timeout needed for Windows (really slow)
script:
- yarn test
- yarn e2e
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then yarn checkformat --head=$TRAVIS_PULL_REQUEST_SHA --base=$(git merge-base HEAD $TRAVIS_BRANCH); fi'
- yarn checkcommit
addons:
chrome: stable
cache:
directories:
- node_modules
notifications:
email: false
webhooks:
on_success: true
on_failure: true
on_start: true
matrix:
include:
- os: linux
language: node_js
node_js: 8.9.3
dist: trusty
sudo: required
- os: windows
language: node_js
node_js: 8.9.3
before_install:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
export DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start;
fi
install:
- yarn install --network-timeout 1000000 # Timeout needed for Windows (really slow)
script:
- yarn test
- yarn e2e
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then yarn checkformat --head=$TRAVIS_PULL_REQUEST_SHA --base=$(git merge-base HEAD $TRAVIS_BRANCH); fi'
- yarn checkcommit
addons:
chrome: stable
cache:
directories:
- node_modules
notifications:
email: false
webhooks:
on_success: true
on_failure: true
on_start: true

View File

@ -1,466 +1,466 @@
# Changelog
## Please use the [Github Releases](https://github.com/nrwl/nx/releases) page to see the changelog.
# 1.0.1
## Fixes
- **schematic:** add a migration to add tsconfig.tools.json ([c18baf0](https://github.com/nrwl/nx/commit/c18baf0))
# 1.0.0
## Fixes
- **schematics:** dep-graph visual style for affected lib ([8ca8548](https://github.com/nrwl/nx/commit/8ca8548))
- **schematics:** remove strict check for "file" option for dep-graph ([6aa6702](https://github.com/nrwl/nx/commit/6aa6702))
- **schematics:** add nxmodule forroot if not existing when generating ngrx for root ([e748e81](https://github.com/nrwl/nx/commit/e748e81))
- **schematics:** don't leak file descriptor in shared.ts/mtime ([aa1ff78](https://github.com/nrwl/nx/commit/aa1ff78)), closes [#403](https://github.com/nrwl/nx/issues/403)
- **schematics:** ignore errors when the tools directory already exists ([2a377fe](https://github.com/nrwl/nx/commit/2a377fe))
# 0.11.0
## Features
- [Support to generate visualization graph](https://github.com/nrwl/nx/commit/49525efe3e31ff93dccf68499300fe35deaac78f)
# 0.10.1
## Features
- [Add support for workspace-specific schematics](https://github.com/nrwl/nx/commit/bc559575f524aacbe3d25eb97210101e60de4526)
## Fixes
- [Extend ngrx and Angular schematics](https://github.com/nrwl/nx/commit/0c2b01bda6904e09f0c4f997ef4a98818723b795)
# 0.10.0
## Features
- [Use npm-run-all to run build in parallel](https://github.com/nrwl/nx/commit/7b63de662e3aa99a8688681f0e26518ca05ffcbc)
- [Enhance nxEnforceModuleBoundaries check to support projects tagged with multiple tags](https://github.com/nrwl/nx/commit/d416c580b5db181cedf45ed952d9b6db49bb084d)
- [Add a usage information option to create-nx-workspace ](https://github.com/nrwl/nx/commit/2746f0399d0c729ff08420f46f2c2c6b4256f6a7)
- [Add an option to pass a custom module name when creating libs](https://github.com/nrwl/nx/commit/c1ca7df014043d0e27517b26470067677c57efa3)
- [Affected support for uncommitted changes](https://github.com/nrwl/nx/commit/113b51bd330c2af058675386e482d38f170a6688)
- [Extend circular dependency check](https://github.com/nrwl/nx/commit/fff9659c3a108b613c6db89bcca4072494fbe85f)
- [Add lint checks ensuring the integrity of the workspace](https://github.com/nrwl/nx/commit/ce553b732e8ca004e1ecf53cf54bcadb6ba1f7f3)
- [Add ability to create bazel workspace](https://github.com/nrwl/nx/commit/5a26f241b1e8b8b87e2ab4da941d3d3c4c480046)
## Fixes
- [Fix the absolute import check](https://github.com/nrwl/nx/commit/de138bb26cb816b86afe6b8f14abb362cec2a20e)
- [Use yargs-parser to allow more types of arguments](https://github.com/nrwl/nx/commit/c747a4a0a066975bdbbda10234b78e3c63c3b44d)
- [Fix e2e lint config in angular cli json](https://github.com/nrwl/nx/commit/fc0bec90805217d03bf2008e9b241025cad72c05)
- [Handle undefined rulesDirectory](https://github.com/nrwl/nx/commit/8beae9fa3d6d905778dd24c5e6b27fe7c534be13)
- [Add appRoot.path for filesystem reads/writes](https://github.com/nrwl/nx/commit/809bdd4c270baf7fd883980db8d7171ebf09508e)
- [Correct docstring for affected](https://github.com/nrwl/nx/commit/6394f9e1edf5a0b1f219050dc8b1e8269d5e5c2b)
- [Update karma conf with app check](https://github.com/nrwl/nx/commit/fea4f48decdfa17feb5e020318abf2ac319d05da)
- [Fix typo in CONTIRBUTING.md](https://github.com/nrwl/nx/commit/bd50643d60b3c2a8e8ace6ceaab5834d897b4aa3)
- [Match ng lib and update versions ](https://github.com/nrwl/nx/commit/8482177b7373844d833aaad55e15a2a10d4ae116)
# 0.9.0
A large workspace contains a lot of apps and libs. Because it is so easy to share code, create new libs and depend on libs, the dependencies between the apps and libs can quickly get out of hand. We need a way to impose constraints on the dependency graph. This release adds this capability.
When creating an app or a lib, you can tag them:
```
ng g lib apilib --tags=api
ng g lib utilslib --tags=utils
ng g lib impllib --tags=impl
ng g lib untaggedlib
```
You can also pass multiple tags `ng g lib apilib --tags=one,two` or modify `.angular-cli.json` after the fact.
You can then define constraints in `tslint.json`, like this:
```
"nx-enforce-module-boundaries": [
true,
{
"allow": [],
"depConstraints": [
{ "sourceTag": "utils", "onlyDependOnLibsWithTags": ["utils"] },
{ "sourceTag": "api", "onlyDependOnLibsWithTags": ["api", "utils"] },
{ "sourceTag": "impl", "onlyDependOnLibsWithTags": ["api", "utils", "impl"] },
]
}
]
```
With this configuration in place:
- `utilslib` can depend on no libs.
- `apilib` can depend on `utilslib`
- `implib` can depend on both `utilslib` and `apilib`.
- `untaggedlib` can depend on no libs.
This gets really useful once you have multiple libs with the same tag.
You can also use wildcards, like this:
```
{ "sourceTag": "impl", "onlyDependOnLibsWithTags": ["*"] } // impl can depend on anything
{ "sourceTag": "*", "onlyDependOnLibsWithTags": ["*"] } // anything can depend on anything
```
The system goes through the constrains until it finds the first one matching the source file it's analyzing.
If we change the configuration to the following:
```
"nx-enforce-module-boundaries": [
true,
{
"allow": [],
"depConstraints": [
{ "sourceTag": "utils", "onlyDependOnLibsWithTags": ["utils"] },
{ "sourceTag": "api", "onlyDependOnLibsWithTags": ["api", "utils"] },
{ "sourceTag": "impl", "onlyDependOnLibsWithTags": ["api", "utils", "impl"] },
{ "sourceTag": "*", "onlyDependOnLibsWithTags": ["*"] },
]
}
]
```
The following will be true.
- `utilslib` can depend on no libs.
- `apilib` can depend on `utilslib`
- `implib` can depend on both `utilslib` and `apilib`.
- `untaggedlib` can depend on **all** libs.
## Features
- [Cache the dependency graph to speed up "ng lint"](https://github.com/nrwl/nx/commit/93ecf24bdadfa7ae28cf802b4f3193390858db90)
- [Add lint check for circular deps](https://github.com/nrwl/nx/commit/53175f925e804539aacba8323af159d69205ddac)
- [Add support for tagged libs](https://github.com/nrwl/nx/commit/2842cb9c387226c24c0a42a154f3c65059d730f3)
- [Show warnings about importing lazy loadable libraries](https://github.com/nrwl/nx/commit/56788ba3d1a8220455b03f0c766963ae8179ce81)
- [Allow users to set prettier config](https://github.com/nrwl/nx/commit/56a6611575fee7b111655d2223f3e30ea684d000)
- [Add store-freeze support](https://github.com/nrwl/nx/commit/e21caa0143862059d4b1089ccf3a7e3799cef0f2)
- [Extend the nrwl schematics from the angular cli schematics](https://github.com/nrwl/nx/commit/04f8e2fd4613aff4064123cacd8eb54e1da09a60)
## Fixes
- [Improve windows compatibility](https://github.com/nrwl/nx/commit/4f052bb3e60f20d0d676f283de2e2faece0dcef8)
- [Dasherize the state folder](https://github.com/nrwl/nx/commit/b17b186186ea5617b1b953f1ddd4ab05ebfa7d92)
- [Fix create-nx-workspace to respect the --directory](https://github.com/nrwl/nx/commit/da9310e9dbb4eb3294200ca72bfa70b14faec2c2)
- [Fix protractor.conf.js schema](https://github.com/nrwl/nx/commit/37cabafb35980ce8e991abc1269387b3aaaf9f25)
# 0.8.0
## Features
Nx no longer uses a patched version of the CLI--we switched to using `@angular/cli@1.7.1`. We also renamed the nx-migrate command into `update` to align with the CLI.
- [Switch to @angular/cli 1.7](https://github.com/nrwl/nx/commit/acdeb1b71c14e3bc7e5bd2bc925640ad7d0aa24d)
- [Add update, update:skip, and update:check commands](https://github.com/nrwl/nx/commit/2fb62597514f1c82e4d80d75a7d60d11229d5aa3)
## Fixes
- [Fix format:write --libs-and-apps](https://github.com/nrwl/nx/commit/feeaba1a4b8d827a71731d919740135464d6e049)
- [Change format to default to format-all when no patterns are detected](https://github.com/nrwl/nx/commit/58e99ab04d8e9505285bdcf31014f3774a6f900a)
## Cleanup
- [Remove the version property](https://github.com/nrwl/nx/commit/24063f02464b6da38e003841e04820dcc347e876)
- [Use schematic context to format the generated code](https://github.com/nrwl/nx/commit/e7481a790f5becffc46e794ec46c0835a2114319)
# 0.7.4
## Features
- [Change generate effect tests to use toBeObservable](https://github.com/nrwl/nx/commit/222efe2f2630b02f6fdb11f560c9158cd4f51d75)
## Fixes
- [Base projectPath on the full path instead of the current working directory of the process](https://github.com/nrwl/nx/commit/545f2ff13902a635b9c26854e9687790adff0616)
- [Ammend command in script errors](https://github.com/nrwl/nx/commit/9128fa8be1e31525acb6043ff87af73b6b884aaa)
# 0.7.2
## Features
- [Added a post install script that run nx-migrate:check](https://github.com/nrwl/nx/commit/93a6b4e94be4b1b591eb017e77b79c777bc23deb)
- [Updated create-nx-workspace to support yarn](https://github.com/nrwl/nx/commit/e5b247b573cef0c1cf5cc5163d030dbf514f4dff)
## Cleanup
- [Cleaned up the output of nx-migrate](https://github.com/nrwl/nx/commit/7ab14e3b26e0e91d660ad5bb454dccb21b9745cf)
# 0.7.0
## Features
- [Add nx-migrate:check and nx-migrate:skip scripts](d7ba9fdc1b9f4208db6de32184e953d00f6f064f)
# 0.7.0-beta.1
## Features
- [Switch to Angular 5.2 and CLI 1.6.5](https://github.com/nrwl/nx/commit/172c18dc9b84f7ac3019694e4a0eeeb40dd1bc26)
# 0.6.18
## Bug Fixes
- [Fixed affected: commands. Continue traversing within irrelevant PropertyAssignment nodes](https://github.com/nrwl/nx/commit/2293e28bd031efa80566228dddc202bc437c2b03)
- [Make affected and format windows-friendly](https://github.com/nrwl/nx/commit/9609fc675031bd4dca285ceb942a71d995d1ee7b)
## Cleanup
- [Clean up tslint configuration](https://github.com/nrwl/nx/commit/828e4fe75da66dc41790e55a7738192940a04cbf)
- [Add a migration updating the version of prettier](https://github.com/nrwl/nx/commit/847a249980c3505845a8c597de8e9a3d78766f8b)
# 0.6.13
## Bug Fixes
- [Avoid relative paths to node modules](https://github.com/nrwl/nx/commit/2c49c3029535a9b98216d367e9c2b77a8d40a4a4)
- [Handle the case when libraries are placed in the directory with the same name as an app](https://github.com/nrwl/nx/commit/f862ed05d18e1474156779ad1dee2e7a7c785d1d)
# 0.6.10
## Features
- [Improve error messages in the affected: and format: commands](https://github.com/nrwl/nx/commit/878784ae814ffea28796f458ff2f8b0b641996c0)
## Bug Fixes
- [Handle circular deps between apps and libs](https://github.com/nrwl/nx/commit/3531323fb5210b995b1296a198c8e76ee8bf9a07)
- [Handle projects that have similar names](https://github.com/nrwl/nx/commit/fe7032d29f4dcd66b51dbb889a1cf1751cd1d20a)
- [Update workspace to set \$schema and app name](https://github.com/nrwl/nx/commit/df5bd089b6515ea747f891bf590b46a4e00d0a92)
- [Update workspace to copy the cli file](https://github.com/nrwl/nx/commit/ddd8de3813f374a752b0e6f47deaa58c2e9f40c8)
- [Disallow importing apps](https://github.com/nrwl/nx/commit/912fc81708d381f49950255eeff746a2dfd46c7b)
# 0.6.5
## Features
This release adds the following commands:
```
npm run format:write -- SHA1 SHA2
npm run format:check -- SHA1 SHA2
```
The `format:check` command checks that the files touched between the given SHAs are formatted properly, and `format:write` formats them.
Instead of passing the two SHAs, you can also pass the list of files, like this:
```
npm run format:write -- --files="libs/mylib/index.ts,libs/mylib2/index.ts"
npm run format:check -- --files="libs/mylib/index.ts,libs/mylib2/index.ts"
```
You can add `--libs-and-apps` flag to always run the formatter on apps and libs instead of individual files.
```
npm run format:write -- SHA1 SHA2 --libs-and-apps
npm run format:check -- SHA1 SHA2 --libs-and-apps
```
Finally, you can the command on the whole repo, like this:
```
npm run format:write
npm run format:check
```
- [Add format:check and format:write commands](https://github.com/nrwl/nx/commit/826a0b1056f9000425e189bad5a5d63966c3a704)
## Bug Fixes
- [Only allow importing libs using the configured npm scope](https://github.com/nrwl/nx/commit/c836668541532e64db088ef9a984678022abb3bd)
# 0.6.0
## Features
This release adds the following commands:
```
npm run apps:affected -- SHA1 SHA2
npm run build:affected -- SHA1 SHA2
npm run e2e:affected -- SHA1 SHA2
```
The `apps:affected` prints the apps that are affected by the commits between the given SHAs. The `build:affected` builds them, and `e2e:affected` runs their e2e tests.
To be able to do that, Nx analyzes your monorepo to figure out the dependency graph or your libs and apps. Next, it looks at the files touched by the commits to figure out what apps and libs they belong to. Finally, it uses all this information to generate the list of apps that can be affected by the commits.
Instead of passing the two SHAs, you can also pass the list of files, like this:
```
npm run apps:affected -- --files="libs/mylib/index.ts,libs/mylib2/index.ts"
npm run build:affected ----files="libs/mylib/index.ts,libs/mylib2/index.ts"
npm run e2e:affected ----files="libs/mylib/index.ts,libs/mylib2/index.ts"
```
- [Add support for building and testing only the apps affected by a commit](https://github.com/nrwl/nx/commit/428762664acc5fd155dd7be630dab09101d23542)
## Bug Fixes
- [Make deep import check work for libs with same prefix](https://github.com/nrwl/nx/commit/3c55f34ca12a4d5338099586ffe9455c81a3b199)
# 0.5.3
`ng new myproj --collection=@nrwl/schematics` creates a new workspace.
For this to work `@nrwl/schematics` and `@angular/cli` have to be installed globally, and they have to be compatible. This is error prone, and it often results in hard to debug errors. And it is impossible for Nx to solve this problem because we do not control your globally installed npm modules.
That is why we provided a way to create a new workspace using a sandbox that does not depend on any global modules, like this:
```
curl -fsSL https://raw.githubusercontent.com/nrwl/nx/master/packages/install/install.sh | bash -s myprojectname
```
This works, but with one caveat: you have to have `curl` and `bash` installed, which might be a problem for a lot of windows folks. That is why starting with `0.5.3`, `@nrwl/schematics` ships with a binary that works on all platforms and creates an Nx workspace without relying on globally installed npm modules.
This is what you can do now:
```
yarn global add @nrwl/schematics # do it once
create-nx-workspace myproj
```
Some folks also reported having problems running Nx behind a firewall, in a corporate environment. We fixed them as well.
## Features
- [Replace install.sh with a more robust way of creating projects](https://github.com/nrwl/nx/commit/f91b5309bdaf764e436bd544ec4f10c84b99cb08)
- [Bump up the version of prettier](https://github.com/nrwl/nx/commit/1481d169bbb7f1fbe3df5af2bce51c4215776d93)
## Bug Fixes
- [Generate an angular-cli config without the apps array, so the CLI can error properly](https://github.com/nrwl/nx/commit/a7f06edf5914212bcefbafb1198d262e9692cfdb)
# 0.5.2
## Bug Fixes
- [Remove default prop for viewEncapsulation option flag](https://github.com/nrwl/nx/commit/b46eb1c699dd509f4be103979a5938c3f7486fb1)
- [Fix NPM link in README](https://github.com/nrwl/nx/commit/4aa42e4772522a20df384ab9a48861a8d4f7ab0f)
- [Change rxjs version to use hat](https://github.com/nrwl/nx/commit/3b1942ed830ea31269a1fb9e995efb93b182870a)
# 0.5.1
## Features
- [Disable typescript mismatch warnings](https://github.com/nrwl/nx/commit/ecb87a0dcd08f0968d77508976ce43a84f049743)
## Bug Fixes
- ["ng test" should not compile e2e tests](https://github.com/nrwl/nx/commit/ac53e9a624b01cf71f88eb412678ffc48125ff38)
- [Fix 'npm run format'](https://github.com/nrwl/nx/commit/670cd57dfa7d5bbf6b9af4e52f2c7d40081138cb)
# 0.5.0
## Features
- [Update the workspace to use Angular 5.1 and CLI 1.6](https://github.com/nrwl/nx/commit/a477bb9fc953e3b44d696945cc259119f701fb78)
# 0.4.0
## Features
- [Add support for generating nested apps and libs](https://github.com/nrwl/nx/commit/013a828d1e31f55a9b3f7c69587316890ea834d4)
- [Update NgRx schematic to allow the customization of the state folder](https://github.com/nrwl/nx/commit/a2d02652665f497be8958efc403d7a44bd831088)
## Bug Fixes
- [Only begin converting to workspace once files have been checked](https://github.com/nrwl/nx/commit/e7fd6b1e04f3f3387a91c53a7ac479fe72bdd72e)
- ["ng build" should only recompile the selected app](https://github.com/nrwl/nx/commit/550de7bb80f4d3f306c23fac70db52c98dadcd05)
## Refactoring
- [Eliminated single letter variable names in effects template](https://github.com/nrwl/nx/commit/996143cf60bac1a57629815d5756db9ce23193ab)
# 0.3.0
We want to be able to add new features to Nx without breaking existing workspaces. Say, you created an Nx Workspace using Nx 0.2.0. Then, half a year later, you decided to upgrade the version of Nx to 0.5.0. Imagine the 0.5.0 release requires you to have more information in your `.angular-cli.json`. Until now, you would have to manually go through the changelog and modify your `.angular-cli.json`. This release adds the `nx-migrate` command that does it for you. Run `npm run nx-migrate` after upgrading `@nrwl/schematics`, and it will upgrade your workspace to be 0.5.0 compatible.
## Features
- [add `allow` option to whitelist deep imports](https://github.com/nrwl/nx/commit/b3f67351fe8890e06402672e687b1789f279613b)
- [Added the nx-migrate command](https://github.com/nrwl/nx/commit/d6e66b99316181b8b67805b91cc35457c3465029)
- [Upgrade Prettier to 1.8.2](https://github.com/nrwl/nx/commit/cc2277e91be2ca49fb1588f1d8e29ef91fd12044)
- [Update readme to point to example apps using Nx](https://github.com/nrwl/nx/commit/3d53e31391d5d79a0724d099c7121edb53e8b163)
# 0.2.2
## Bug Fixes
- [Adds a schema file to allow custom properties that the default CLI distribution does not support](https://github.com/nrwl/nx/commit/7fd7594e673cf38af7668b891ed7c75b390b3330)
- [Fix issue with generating a wrong full path on windows](https://github.com/nrwl/nx/commit/11e6c055ba1211a5bee1cc73d46663985645f08e)
# 0.2.1
## New Features
- [Export jasmine-marbles getTestScheduler and time functions](https://github.com/nrwl/nx/commit/2e4613f475fc2673731540fb4724d6ba2af02aae)
- [Use fetch instead of optimisticUpdate in the generated effect classes](https://github.com/nrwl/nx/commit/c9759cc4427283422e906ed19a8a2dabcb2a656b)
## Bug Fixes
- [--routing should add RouterTestingModule](https://github.com/nrwl/nx/commit/d7fc5b56054c9a4c1fbb12845bfc0803f9a9ff86)
- [Fix wording in the documentation](https://github.com/nrwl/nx/commit/058c8995f35a9e677f88404bc9c8a2b177487080)
## Refactorings
- [Refactor Nx to use RxJS lettable operators](https://github.com/nrwl/nx/commit/715efa4b225b65be0052a1e6a88c5bdcd5a6cf38)
# 0.2.0
## New Features
### Changing Default Library Type
We changed the default library type from "simple" to "Angular". So where previously you would run:
```
ng generate lib mylib // simple TS library
ng generate lib mylib --ngmodule // an angular library
```
Now, you run:
```
ng generate lib mylib // an angular library
ng generate lib mylib --nomodule // simple ts library
```
### Generating Router Configuration
You can pass `--routing` when generating an app.
```
ng generate app myapp --routing // generate an angular app with router config
```
The generated app will have `RouterModule.forRoot` configured.
You can also pass it when generating a library, like this:
```
ng generate lib mylib --routing
```
This will set up the router module and will create an array of routes, which can be plugged into the parent module. This configuration works well for modules that aren't loaded lazily.
You can add the `--lazy` to generate a library that is loaded lazily.
```
ng generate lib mylib --routing --lazy
```
This will also register the generated library in tslint.json, so the linters will make sure the library is not loaded lazily.
Finally, you can pass `--parentModule` and the schematic will wire up the generated library in the parent router configuration.
```
ng generate lib mylib --routing --parentModule=apps/myapp/src/myapp.module.ts
ng generate lib mylib --routing --lazy --parentModule=apps/myapp/src/myapp.module.ts
```
# Changelog
## Please use the [Github Releases](https://github.com/nrwl/nx/releases) page to see the changelog.
# 1.0.1
## Fixes
- **schematic:** add a migration to add tsconfig.tools.json ([c18baf0](https://github.com/nrwl/nx/commit/c18baf0))
# 1.0.0
## Fixes
- **schematics:** dep-graph visual style for affected lib ([8ca8548](https://github.com/nrwl/nx/commit/8ca8548))
- **schematics:** remove strict check for "file" option for dep-graph ([6aa6702](https://github.com/nrwl/nx/commit/6aa6702))
- **schematics:** add nxmodule forroot if not existing when generating ngrx for root ([e748e81](https://github.com/nrwl/nx/commit/e748e81))
- **schematics:** don't leak file descriptor in shared.ts/mtime ([aa1ff78](https://github.com/nrwl/nx/commit/aa1ff78)), closes [#403](https://github.com/nrwl/nx/issues/403)
- **schematics:** ignore errors when the tools directory already exists ([2a377fe](https://github.com/nrwl/nx/commit/2a377fe))
# 0.11.0
## Features
- [Support to generate visualization graph](https://github.com/nrwl/nx/commit/49525efe3e31ff93dccf68499300fe35deaac78f)
# 0.10.1
## Features
- [Add support for workspace-specific schematics](https://github.com/nrwl/nx/commit/bc559575f524aacbe3d25eb97210101e60de4526)
## Fixes
- [Extend ngrx and Angular schematics](https://github.com/nrwl/nx/commit/0c2b01bda6904e09f0c4f997ef4a98818723b795)
# 0.10.0
## Features
- [Use npm-run-all to run build in parallel](https://github.com/nrwl/nx/commit/7b63de662e3aa99a8688681f0e26518ca05ffcbc)
- [Enhance nxEnforceModuleBoundaries check to support projects tagged with multiple tags](https://github.com/nrwl/nx/commit/d416c580b5db181cedf45ed952d9b6db49bb084d)
- [Add a usage information option to create-nx-workspace ](https://github.com/nrwl/nx/commit/2746f0399d0c729ff08420f46f2c2c6b4256f6a7)
- [Add an option to pass a custom module name when creating libs](https://github.com/nrwl/nx/commit/c1ca7df014043d0e27517b26470067677c57efa3)
- [Affected support for uncommitted changes](https://github.com/nrwl/nx/commit/113b51bd330c2af058675386e482d38f170a6688)
- [Extend circular dependency check](https://github.com/nrwl/nx/commit/fff9659c3a108b613c6db89bcca4072494fbe85f)
- [Add lint checks ensuring the integrity of the workspace](https://github.com/nrwl/nx/commit/ce553b732e8ca004e1ecf53cf54bcadb6ba1f7f3)
- [Add ability to create bazel workspace](https://github.com/nrwl/nx/commit/5a26f241b1e8b8b87e2ab4da941d3d3c4c480046)
## Fixes
- [Fix the absolute import check](https://github.com/nrwl/nx/commit/de138bb26cb816b86afe6b8f14abb362cec2a20e)
- [Use yargs-parser to allow more types of arguments](https://github.com/nrwl/nx/commit/c747a4a0a066975bdbbda10234b78e3c63c3b44d)
- [Fix e2e lint config in angular cli json](https://github.com/nrwl/nx/commit/fc0bec90805217d03bf2008e9b241025cad72c05)
- [Handle undefined rulesDirectory](https://github.com/nrwl/nx/commit/8beae9fa3d6d905778dd24c5e6b27fe7c534be13)
- [Add appRoot.path for filesystem reads/writes](https://github.com/nrwl/nx/commit/809bdd4c270baf7fd883980db8d7171ebf09508e)
- [Correct docstring for affected](https://github.com/nrwl/nx/commit/6394f9e1edf5a0b1f219050dc8b1e8269d5e5c2b)
- [Update karma conf with app check](https://github.com/nrwl/nx/commit/fea4f48decdfa17feb5e020318abf2ac319d05da)
- [Fix typo in CONTIRBUTING.md](https://github.com/nrwl/nx/commit/bd50643d60b3c2a8e8ace6ceaab5834d897b4aa3)
- [Match ng lib and update versions ](https://github.com/nrwl/nx/commit/8482177b7373844d833aaad55e15a2a10d4ae116)
# 0.9.0
A large workspace contains a lot of apps and libs. Because it is so easy to share code, create new libs and depend on libs, the dependencies between the apps and libs can quickly get out of hand. We need a way to impose constraints on the dependency graph. This release adds this capability.
When creating an app or a lib, you can tag them:
```
ng g lib apilib --tags=api
ng g lib utilslib --tags=utils
ng g lib impllib --tags=impl
ng g lib untaggedlib
```
You can also pass multiple tags `ng g lib apilib --tags=one,two` or modify `.angular-cli.json` after the fact.
You can then define constraints in `tslint.json`, like this:
```
"nx-enforce-module-boundaries": [
true,
{
"allow": [],
"depConstraints": [
{ "sourceTag": "utils", "onlyDependOnLibsWithTags": ["utils"] },
{ "sourceTag": "api", "onlyDependOnLibsWithTags": ["api", "utils"] },
{ "sourceTag": "impl", "onlyDependOnLibsWithTags": ["api", "utils", "impl"] },
]
}
]
```
With this configuration in place:
- `utilslib` can depend on no libs.
- `apilib` can depend on `utilslib`
- `implib` can depend on both `utilslib` and `apilib`.
- `untaggedlib` can depend on no libs.
This gets really useful once you have multiple libs with the same tag.
You can also use wildcards, like this:
```
{ "sourceTag": "impl", "onlyDependOnLibsWithTags": ["*"] } // impl can depend on anything
{ "sourceTag": "*", "onlyDependOnLibsWithTags": ["*"] } // anything can depend on anything
```
The system goes through the constrains until it finds the first one matching the source file it's analyzing.
If we change the configuration to the following:
```
"nx-enforce-module-boundaries": [
true,
{
"allow": [],
"depConstraints": [
{ "sourceTag": "utils", "onlyDependOnLibsWithTags": ["utils"] },
{ "sourceTag": "api", "onlyDependOnLibsWithTags": ["api", "utils"] },
{ "sourceTag": "impl", "onlyDependOnLibsWithTags": ["api", "utils", "impl"] },
{ "sourceTag": "*", "onlyDependOnLibsWithTags": ["*"] },
]
}
]
```
The following will be true.
- `utilslib` can depend on no libs.
- `apilib` can depend on `utilslib`
- `implib` can depend on both `utilslib` and `apilib`.
- `untaggedlib` can depend on **all** libs.
## Features
- [Cache the dependency graph to speed up "ng lint"](https://github.com/nrwl/nx/commit/93ecf24bdadfa7ae28cf802b4f3193390858db90)
- [Add lint check for circular deps](https://github.com/nrwl/nx/commit/53175f925e804539aacba8323af159d69205ddac)
- [Add support for tagged libs](https://github.com/nrwl/nx/commit/2842cb9c387226c24c0a42a154f3c65059d730f3)
- [Show warnings about importing lazy loadable libraries](https://github.com/nrwl/nx/commit/56788ba3d1a8220455b03f0c766963ae8179ce81)
- [Allow users to set prettier config](https://github.com/nrwl/nx/commit/56a6611575fee7b111655d2223f3e30ea684d000)
- [Add store-freeze support](https://github.com/nrwl/nx/commit/e21caa0143862059d4b1089ccf3a7e3799cef0f2)
- [Extend the nrwl schematics from the angular cli schematics](https://github.com/nrwl/nx/commit/04f8e2fd4613aff4064123cacd8eb54e1da09a60)
## Fixes
- [Improve windows compatibility](https://github.com/nrwl/nx/commit/4f052bb3e60f20d0d676f283de2e2faece0dcef8)
- [Dasherize the state folder](https://github.com/nrwl/nx/commit/b17b186186ea5617b1b953f1ddd4ab05ebfa7d92)
- [Fix create-nx-workspace to respect the --directory](https://github.com/nrwl/nx/commit/da9310e9dbb4eb3294200ca72bfa70b14faec2c2)
- [Fix protractor.conf.js schema](https://github.com/nrwl/nx/commit/37cabafb35980ce8e991abc1269387b3aaaf9f25)
# 0.8.0
## Features
Nx no longer uses a patched version of the CLI--we switched to using `@angular/cli@1.7.1`. We also renamed the nx-migrate command into `update` to align with the CLI.
- [Switch to @angular/cli 1.7](https://github.com/nrwl/nx/commit/acdeb1b71c14e3bc7e5bd2bc925640ad7d0aa24d)
- [Add update, update:skip, and update:check commands](https://github.com/nrwl/nx/commit/2fb62597514f1c82e4d80d75a7d60d11229d5aa3)
## Fixes
- [Fix format:write --libs-and-apps](https://github.com/nrwl/nx/commit/feeaba1a4b8d827a71731d919740135464d6e049)
- [Change format to default to format-all when no patterns are detected](https://github.com/nrwl/nx/commit/58e99ab04d8e9505285bdcf31014f3774a6f900a)
## Cleanup
- [Remove the version property](https://github.com/nrwl/nx/commit/24063f02464b6da38e003841e04820dcc347e876)
- [Use schematic context to format the generated code](https://github.com/nrwl/nx/commit/e7481a790f5becffc46e794ec46c0835a2114319)
# 0.7.4
## Features
- [Change generate effect tests to use toBeObservable](https://github.com/nrwl/nx/commit/222efe2f2630b02f6fdb11f560c9158cd4f51d75)
## Fixes
- [Base projectPath on the full path instead of the current working directory of the process](https://github.com/nrwl/nx/commit/545f2ff13902a635b9c26854e9687790adff0616)
- [Ammend command in script errors](https://github.com/nrwl/nx/commit/9128fa8be1e31525acb6043ff87af73b6b884aaa)
# 0.7.2
## Features
- [Added a post install script that run nx-migrate:check](https://github.com/nrwl/nx/commit/93a6b4e94be4b1b591eb017e77b79c777bc23deb)
- [Updated create-nx-workspace to support yarn](https://github.com/nrwl/nx/commit/e5b247b573cef0c1cf5cc5163d030dbf514f4dff)
## Cleanup
- [Cleaned up the output of nx-migrate](https://github.com/nrwl/nx/commit/7ab14e3b26e0e91d660ad5bb454dccb21b9745cf)
# 0.7.0
## Features
- [Add nx-migrate:check and nx-migrate:skip scripts](d7ba9fdc1b9f4208db6de32184e953d00f6f064f)
# 0.7.0-beta.1
## Features
- [Switch to Angular 5.2 and CLI 1.6.5](https://github.com/nrwl/nx/commit/172c18dc9b84f7ac3019694e4a0eeeb40dd1bc26)
# 0.6.18
## Bug Fixes
- [Fixed affected: commands. Continue traversing within irrelevant PropertyAssignment nodes](https://github.com/nrwl/nx/commit/2293e28bd031efa80566228dddc202bc437c2b03)
- [Make affected and format windows-friendly](https://github.com/nrwl/nx/commit/9609fc675031bd4dca285ceb942a71d995d1ee7b)
## Cleanup
- [Clean up tslint configuration](https://github.com/nrwl/nx/commit/828e4fe75da66dc41790e55a7738192940a04cbf)
- [Add a migration updating the version of prettier](https://github.com/nrwl/nx/commit/847a249980c3505845a8c597de8e9a3d78766f8b)
# 0.6.13
## Bug Fixes
- [Avoid relative paths to node modules](https://github.com/nrwl/nx/commit/2c49c3029535a9b98216d367e9c2b77a8d40a4a4)
- [Handle the case when libraries are placed in the directory with the same name as an app](https://github.com/nrwl/nx/commit/f862ed05d18e1474156779ad1dee2e7a7c785d1d)
# 0.6.10
## Features
- [Improve error messages in the affected: and format: commands](https://github.com/nrwl/nx/commit/878784ae814ffea28796f458ff2f8b0b641996c0)
## Bug Fixes
- [Handle circular deps between apps and libs](https://github.com/nrwl/nx/commit/3531323fb5210b995b1296a198c8e76ee8bf9a07)
- [Handle projects that have similar names](https://github.com/nrwl/nx/commit/fe7032d29f4dcd66b51dbb889a1cf1751cd1d20a)
- [Update workspace to set \$schema and app name](https://github.com/nrwl/nx/commit/df5bd089b6515ea747f891bf590b46a4e00d0a92)
- [Update workspace to copy the cli file](https://github.com/nrwl/nx/commit/ddd8de3813f374a752b0e6f47deaa58c2e9f40c8)
- [Disallow importing apps](https://github.com/nrwl/nx/commit/912fc81708d381f49950255eeff746a2dfd46c7b)
# 0.6.5
## Features
This release adds the following commands:
```
npm run format:write -- SHA1 SHA2
npm run format:check -- SHA1 SHA2
```
The `format:check` command checks that the files touched between the given SHAs are formatted properly, and `format:write` formats them.
Instead of passing the two SHAs, you can also pass the list of files, like this:
```
npm run format:write -- --files="libs/mylib/index.ts,libs/mylib2/index.ts"
npm run format:check -- --files="libs/mylib/index.ts,libs/mylib2/index.ts"
```
You can add `--libs-and-apps` flag to always run the formatter on apps and libs instead of individual files.
```
npm run format:write -- SHA1 SHA2 --libs-and-apps
npm run format:check -- SHA1 SHA2 --libs-and-apps
```
Finally, you can the command on the whole repo, like this:
```
npm run format:write
npm run format:check
```
- [Add format:check and format:write commands](https://github.com/nrwl/nx/commit/826a0b1056f9000425e189bad5a5d63966c3a704)
## Bug Fixes
- [Only allow importing libs using the configured npm scope](https://github.com/nrwl/nx/commit/c836668541532e64db088ef9a984678022abb3bd)
# 0.6.0
## Features
This release adds the following commands:
```
npm run apps:affected -- SHA1 SHA2
npm run build:affected -- SHA1 SHA2
npm run e2e:affected -- SHA1 SHA2
```
The `apps:affected` prints the apps that are affected by the commits between the given SHAs. The `build:affected` builds them, and `e2e:affected` runs their e2e tests.
To be able to do that, Nx analyzes your monorepo to figure out the dependency graph or your libs and apps. Next, it looks at the files touched by the commits to figure out what apps and libs they belong to. Finally, it uses all this information to generate the list of apps that can be affected by the commits.
Instead of passing the two SHAs, you can also pass the list of files, like this:
```
npm run apps:affected -- --files="libs/mylib/index.ts,libs/mylib2/index.ts"
npm run build:affected ----files="libs/mylib/index.ts,libs/mylib2/index.ts"
npm run e2e:affected ----files="libs/mylib/index.ts,libs/mylib2/index.ts"
```
- [Add support for building and testing only the apps affected by a commit](https://github.com/nrwl/nx/commit/428762664acc5fd155dd7be630dab09101d23542)
## Bug Fixes
- [Make deep import check work for libs with same prefix](https://github.com/nrwl/nx/commit/3c55f34ca12a4d5338099586ffe9455c81a3b199)
# 0.5.3
`ng new myproj --collection=@nrwl/schematics` creates a new workspace.
For this to work `@nrwl/schematics` and `@angular/cli` have to be installed globally, and they have to be compatible. This is error prone, and it often results in hard to debug errors. And it is impossible for Nx to solve this problem because we do not control your globally installed npm modules.
That is why we provided a way to create a new workspace using a sandbox that does not depend on any global modules, like this:
```
curl -fsSL https://raw.githubusercontent.com/nrwl/nx/master/packages/install/install.sh | bash -s myprojectname
```
This works, but with one caveat: you have to have `curl` and `bash` installed, which might be a problem for a lot of windows folks. That is why starting with `0.5.3`, `@nrwl/schematics` ships with a binary that works on all platforms and creates an Nx workspace without relying on globally installed npm modules.
This is what you can do now:
```
yarn global add @nrwl/schematics # do it once
create-nx-workspace myproj
```
Some folks also reported having problems running Nx behind a firewall, in a corporate environment. We fixed them as well.
## Features
- [Replace install.sh with a more robust way of creating projects](https://github.com/nrwl/nx/commit/f91b5309bdaf764e436bd544ec4f10c84b99cb08)
- [Bump up the version of prettier](https://github.com/nrwl/nx/commit/1481d169bbb7f1fbe3df5af2bce51c4215776d93)
## Bug Fixes
- [Generate an angular-cli config without the apps array, so the CLI can error properly](https://github.com/nrwl/nx/commit/a7f06edf5914212bcefbafb1198d262e9692cfdb)
# 0.5.2
## Bug Fixes
- [Remove default prop for viewEncapsulation option flag](https://github.com/nrwl/nx/commit/b46eb1c699dd509f4be103979a5938c3f7486fb1)
- [Fix NPM link in README](https://github.com/nrwl/nx/commit/4aa42e4772522a20df384ab9a48861a8d4f7ab0f)
- [Change rxjs version to use hat](https://github.com/nrwl/nx/commit/3b1942ed830ea31269a1fb9e995efb93b182870a)
# 0.5.1
## Features
- [Disable typescript mismatch warnings](https://github.com/nrwl/nx/commit/ecb87a0dcd08f0968d77508976ce43a84f049743)
## Bug Fixes
- ["ng test" should not compile e2e tests](https://github.com/nrwl/nx/commit/ac53e9a624b01cf71f88eb412678ffc48125ff38)
- [Fix 'npm run format'](https://github.com/nrwl/nx/commit/670cd57dfa7d5bbf6b9af4e52f2c7d40081138cb)
# 0.5.0
## Features
- [Update the workspace to use Angular 5.1 and CLI 1.6](https://github.com/nrwl/nx/commit/a477bb9fc953e3b44d696945cc259119f701fb78)
# 0.4.0
## Features
- [Add support for generating nested apps and libs](https://github.com/nrwl/nx/commit/013a828d1e31f55a9b3f7c69587316890ea834d4)
- [Update NgRx schematic to allow the customization of the state folder](https://github.com/nrwl/nx/commit/a2d02652665f497be8958efc403d7a44bd831088)
## Bug Fixes
- [Only begin converting to workspace once files have been checked](https://github.com/nrwl/nx/commit/e7fd6b1e04f3f3387a91c53a7ac479fe72bdd72e)
- ["ng build" should only recompile the selected app](https://github.com/nrwl/nx/commit/550de7bb80f4d3f306c23fac70db52c98dadcd05)
## Refactoring
- [Eliminated single letter variable names in effects template](https://github.com/nrwl/nx/commit/996143cf60bac1a57629815d5756db9ce23193ab)
# 0.3.0
We want to be able to add new features to Nx without breaking existing workspaces. Say, you created an Nx Workspace using Nx 0.2.0. Then, half a year later, you decided to upgrade the version of Nx to 0.5.0. Imagine the 0.5.0 release requires you to have more information in your `.angular-cli.json`. Until now, you would have to manually go through the changelog and modify your `.angular-cli.json`. This release adds the `nx-migrate` command that does it for you. Run `npm run nx-migrate` after upgrading `@nrwl/schematics`, and it will upgrade your workspace to be 0.5.0 compatible.
## Features
- [add `allow` option to whitelist deep imports](https://github.com/nrwl/nx/commit/b3f67351fe8890e06402672e687b1789f279613b)
- [Added the nx-migrate command](https://github.com/nrwl/nx/commit/d6e66b99316181b8b67805b91cc35457c3465029)
- [Upgrade Prettier to 1.8.2](https://github.com/nrwl/nx/commit/cc2277e91be2ca49fb1588f1d8e29ef91fd12044)
- [Update readme to point to example apps using Nx](https://github.com/nrwl/nx/commit/3d53e31391d5d79a0724d099c7121edb53e8b163)
# 0.2.2
## Bug Fixes
- [Adds a schema file to allow custom properties that the default CLI distribution does not support](https://github.com/nrwl/nx/commit/7fd7594e673cf38af7668b891ed7c75b390b3330)
- [Fix issue with generating a wrong full path on windows](https://github.com/nrwl/nx/commit/11e6c055ba1211a5bee1cc73d46663985645f08e)
# 0.2.1
## New Features
- [Export jasmine-marbles getTestScheduler and time functions](https://github.com/nrwl/nx/commit/2e4613f475fc2673731540fb4724d6ba2af02aae)
- [Use fetch instead of optimisticUpdate in the generated effect classes](https://github.com/nrwl/nx/commit/c9759cc4427283422e906ed19a8a2dabcb2a656b)
## Bug Fixes
- [--routing should add RouterTestingModule](https://github.com/nrwl/nx/commit/d7fc5b56054c9a4c1fbb12845bfc0803f9a9ff86)
- [Fix wording in the documentation](https://github.com/nrwl/nx/commit/058c8995f35a9e677f88404bc9c8a2b177487080)
## Refactorings
- [Refactor Nx to use RxJS lettable operators](https://github.com/nrwl/nx/commit/715efa4b225b65be0052a1e6a88c5bdcd5a6cf38)
# 0.2.0
## New Features
### Changing Default Library Type
We changed the default library type from "simple" to "Angular". So where previously you would run:
```
ng generate lib mylib // simple TS library
ng generate lib mylib --ngmodule // an angular library
```
Now, you run:
```
ng generate lib mylib // an angular library
ng generate lib mylib --nomodule // simple ts library
```
### Generating Router Configuration
You can pass `--routing` when generating an app.
```
ng generate app myapp --routing // generate an angular app with router config
```
The generated app will have `RouterModule.forRoot` configured.
You can also pass it when generating a library, like this:
```
ng generate lib mylib --routing
```
This will set up the router module and will create an array of routes, which can be plugged into the parent module. This configuration works well for modules that aren't loaded lazily.
You can add the `--lazy` to generate a library that is loaded lazily.
```
ng generate lib mylib --routing --lazy
```
This will also register the generated library in tslint.json, so the linters will make sure the library is not loaded lazily.
Finally, you can pass `--parentModule` and the schematic will wire up the generated library in the parent router configuration.
```
ng generate lib mylib --routing --parentModule=apps/myapp/src/myapp.module.ts
ng generate lib mylib --routing --lazy --parentModule=apps/myapp/src/myapp.module.ts
```

View File

@ -1,134 +1,141 @@
# Contributing to Nx
We would love for you to contribute to Nx! Read this document to see how to do it.
## Got a Question?
We are trying to keep GitHub issues for bug reports and feature requests. Stack Overflow is a much better place to ask general questions about how to use Nx.
## Found an Issue?
If you find a bug in the source code or a mistake in the documentation, you can help us by [submitting an issue](https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#submit-issue) to [our GitHub Repository](https://github.com/nrwl/nx). Even better, you can [submit a Pull Request](https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#submit-pr) with a fix.
## Building the Project
After cloning the project run: `yarn`.
After that run `yarn build` to build the `bazel`, `nx`, and `schematics` packages.
After that run `yarn linknpm`.
### Running Unit Tests
To make sure your changes do not break any unit tests, run the following:
```bash
yarn test
```
You can also run `yarn test:schematics` and `yarn test:nx` to test the schematics and nx packages individually.
If you need to test only the **collection/ngrx.spec.ts** test [for example], you can use an optional `$1` argument as follows:
```bash
yarn test:schematics schematics/src/collection/ngrx/ngrx
```
### Running E2E Tests
To make sure you changes do not break any unit tests, run the following:
```bash
yarn e2e
```
Running e2e tests can take some time, so if it often useful to run a single test. You can do it as follows:
```bash
yarn e2e affected
```
## Submission Guidelines
### <a name="submit-issue"></a> Submitting an Issue
Before you submit an issue, please search the issue tracker, maybe an issue for your problem already exists and the discussion might inform you of workarounds readily available.
We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce and confirm it. Having a reproducible scenario gives us wealth of important information without going back & forth to you with additional questions like:
- version of Nx used
- version of Angular CLI used
- `angular.json` configuration
- version of Angular DevKit used
- 3rd-party libraries and their versions
- and most importantly - a use-case that fails
A minimal reproduce scenario using allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem.
We will be insisting on a minimal reproduce scenario in order to save maintainers time and ultimately be able to fix more bugs. Interestingly, from our experience users often find coding problems themselves while preparing a minimal repository. We understand that sometimes it might be hard to extract essentials bits of code from a larger code-base but we really need to isolate the problem before we can fix it.
You can file new issues by filling out our [issue form](https://github.com/nrwl/nx/issues/new).
### <a name="submit-pr"></a> Submitting a PR
Please follow the following guidelines:
- Make sure unit tests pass
- Make sure e2e tests pass
- Make sure you run `yarn format`
- Update your commit message to follow the guidelines below
#### Commit Message Guidelines
Commit message should follow the following format:
```
type(scope): subject
BLANK LINE
body
```
##### Type
The type must be one of the following:
- build
- feat
- fix
- refactor
- style
- docs
- test
##### Scope
The scope must be one of the following:
- bazel
- nx
- schematics
##### Subject
The subject must contain a description of the change.
#### Example
```
feat(schematics): add an option to generate lazy-loadable modules
`ng generate lib mylib --lazy` provisions the mylib project in tslint.json
```
#### Commitizen
To simplify and automate the process of commiting with this format,
**Nx is a [Commitizen](https://github.com/commitizen/cz-cli) friendly repository**, just do `git add` and execute `yarn commit`.
## Migrations
Nx allows users to automatically upgrade to the newest version of the package. If you are introducing a change that would require the users to upgrade their workspace, add a migration to `packages/schematics/migrations`.
Migrations are named in the following fashion: `YYYYMMDD-name.ts` (e.g., 20171129-change-schema.ts).
The `yarn nx-migrate` command will run all the migrations after the one encoded in .angular-cli.json.
# Contributing to Nx
We would love for you to contribute to Nx! Read this document to see how to do it.
## Got a Question?
We are trying to keep GitHub issues for bug reports and feature requests. Stack Overflow is a much better place to ask general questions about how to use Nx.
## Found an Issue?
If you find a bug in the source code or a mistake in the documentation, you can help us by [submitting an issue](https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#submit-issue) to [our GitHub Repository](https://github.com/nrwl/nx). Even better, you can [submit a Pull Request](https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#submit-pr) with a fix.
## Building the Project
After cloning the project run: `yarn`.
After that run `yarn build` to build the `bazel`, `nx`, and `schematics` packages.
After that run `yarn linknpm`.
### Running Unit Tests
To make sure your changes do not break any unit tests, run the following:
```bash
yarn test
```
You can also run `yarn test:schematics` and `yarn test:nx` to test the schematics and nx packages individually.
If you need to test only the **collection/ngrx.spec.ts** test [for example], you can use an optional `$1` argument as follows:
```bash
yarn test:schematics schematics/src/collection/ngrx/ngrx
```
### Running E2E Tests
To make sure you changes do not break any unit tests, run the following:
```bash
yarn e2e
```
Running e2e tests can take some time, so if it often useful to run a single test. You can do it as follows:
```bash
yarn e2e affected
```
### Developing on Windows
To build Nx on Windows, you need to use WSL.
- Run `yarn install` in WSL. Yarn will compile several dependencies. If you don't run `install` in WSL, they will be compiled for Windows.
- Run `yarn test:scheamtics` and other commands in WSL.
## Submission Guidelines
### <a name="submit-issue"></a> Submitting an Issue
Before you submit an issue, please search the issue tracker, maybe an issue for your problem already exists and the discussion might inform you of workarounds readily available.
We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce and confirm it. Having a reproducible scenario gives us wealth of important information without going back & forth to you with additional questions like:
- version of Nx used
- version of Angular CLI used
- `angular.json` configuration
- version of Angular DevKit used
- 3rd-party libraries and their versions
- and most importantly - a use-case that fails
A minimal reproduce scenario using allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem.
We will be insisting on a minimal reproduce scenario in order to save maintainers time and ultimately be able to fix more bugs. Interestingly, from our experience users often find coding problems themselves while preparing a minimal repository. We understand that sometimes it might be hard to extract essentials bits of code from a larger code-base but we really need to isolate the problem before we can fix it.
You can file new issues by filling out our [issue form](https://github.com/nrwl/nx/issues/new).
### <a name="submit-pr"></a> Submitting a PR
Please follow the following guidelines:
- Make sure unit tests pass
- Make sure e2e tests pass
- Make sure you run `yarn format`
- Update your commit message to follow the guidelines below
#### Commit Message Guidelines
Commit message should follow the following format:
```
type(scope): subject
BLANK LINE
body
```
##### Type
The type must be one of the following:
- build
- feat
- fix
- refactor
- style
- docs
- test
##### Scope
The scope must be one of the following:
- bazel
- nx
- schematics
##### Subject
The subject must contain a description of the change.
#### Example
```
feat(schematics): add an option to generate lazy-loadable modules
`ng generate lib mylib --lazy` provisions the mylib project in tslint.json
```
#### Commitizen
To simplify and automate the process of commiting with this format,
**Nx is a [Commitizen](https://github.com/commitizen/cz-cli) friendly repository**, just do `git add` and execute `yarn commit`.
## Migrations
Nx allows users to automatically upgrade to the newest version of the package. If you are introducing a change that would require the users to upgrade their workspace, add a migration to `packages/schematics/migrations`.
Migrations are named in the following fashion: `YYYYMMDD-name.ts` (e.g., 20171129-change-schema.ts).
The `yarn nx-migrate` command will run all the migrations after the one encoded in .angular-cli.json.

44
LICENSE
View File

@ -1,22 +1,22 @@
(The MIT License)
Copyright (c) 2018 Narwhal Technologies Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
(The MIT License)
Copyright (c) 2018 Narwhal Technologies Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -4,11 +4,28 @@
<div align="center">
[![Build Status](https://travis-ci.org/nrwl/nx.svg?branch=master)](https://travis-ci.org/nrwl/nx)
[![License](https://img.shields.io/npm/l/@nrwl/schematics.svg?style=flat-square)]()
[![NPM Version](https://badge.fury.io/js/%40nrwl%2Fnx.svg)](https://www.npmjs.com/@nrwl/nx)
[![NPM Downloads](https://img.shields.io/npm/dt/@nrwl/schematics.svg?style=flat-square)](https://www.npmjs.com/@nrwl/nx)
[![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)]()
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
</div>
<hr>
# What is Nx?
🔎 **Nx is an open source toolkit for enterprise Angular applications**, which is b
<hr>
# What is Nx?
🔎 **Nx is an open source toolkit for enterprise Angular applications**, which is based on our experienc
# What is Nx?
🔎 **Nx is an open source toolkit for enterprise Angular applications**, which is based on our experience wo
</div>
@ -52,7 +69,9 @@ In other words, small organizations can often get by with informal ad-hoc proces
An Nx workspace is an Angular CLI project that has been enhanced to be enterprise ready. Being an Angular CLI project means it will be handy to have the Angular CLI installed globally, which can be done via npm or yarn as well.
```
npm install -g @angular/cli
After you have installed the Angular CLI, install `@nrwl/schematics`.
`
```
> Note: If you do not have the Angular CLI installed globally you may not be able to use ng from the terminal to run CLI commands within the project. But the package.json file comes with npm scripts to run ng commands, so you can run npm start to ng serve and you can run npm run ng <command> to run any of the ng commands.
@ -60,19 +79,27 @@ npm install -g @angular/cli
After you have installed the Angular CLI, install `@nrwl/schematics`.
```
npm install -g @nrwl/schematics
```
cre
```
After installing it you can create a new Nx workspace by running:
```
create-nx-workspace myworkspacename
```
ng
```
You can also add Nx capabilities to an existing CLI project by running:
```
ng add @nrwl/schematics
## Quick Start & Documentation
#
```
You are good to go!
@ -91,8 +118,10 @@ You are good to go!
### Talks
- [Angular at Large Organizations](https://www.youtube.com/watch?v=piQ0EZhtus0)
- [Nx: The New Way to Build Enterprise Angular Apps](https://www.youtube.com/watch?v=xo-1SDmvM8Y)
- # Podcasts and Shows
- [ngAir 140: Nx for Enterprise Angular Development](
- - [ngAir 140: Nx for Enterprise Angular Development](https://www.youtube.com/watch?v=qYNiOKDno_
- [Supercharging the Angular CLI](https://www.youtube.com/watch?v=bMkKz8AedHc)
- [Hands on Full Stack development with Nx and Bazel](https://www.youtube.com/watch?v=1KDDIhcQORM)
@ -103,16 +132,18 @@ You are good to go!
## Misc
- [nx-examples](https://github.com/nrwl/nx-examples) repo has branches for different nx comments to display expected behavior and example app and libraries. Check out the branch (workspace, ngrx...) to see what gets created for you. More info on readme.
- [xplat - Cross-platform tools for Nx workspaces](https://nstudio.io/xplat/)
- you want to file a bug or submit a PR, read up on repo has branches for different nx comments to display expected behavior and example app and libraries. Check out the branch (workspace, ngrx...) to see what gets created for you. More info on readme.
- ## Core Team
| Victor Savkin
## Want to help?
If you want to file a bug or submit a PR, read up on our [guidelines for contributing](https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md).
If you want to file a bug or submit a PR, read up on our ----------------------- | -----------------------------------------------------------.
## Core Team
| Victor Savkin | Jason Jean | Benjamin Cabanes |
| ------------------------------------------------------------------------------ | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| ![Victor Savkin](https://github.com/nrwl/nx/blob/master/static/victor_pic.jpg) | ![Jason Jean](https://github.com/nrwl/nx/blob/master/static/jason_pic.jpg) | ![Benjamin Cabanes](https://github.com/nrwl/nx/blob/master/static/ben_pic.jpg) |
| [vsavkin](https://github.com/vsavkin) | [FrozenPandaz](https://github.com/FrozenPandaz) | [bcabanes](https://github.com/bcabanes) |
| | | |

View File

@ -1,73 +1,73 @@
module.exports = function(config) {
const webpackConfig = {
node: {
fs: 'empty',
global: true,
crypto: 'empty',
tls: 'empty',
net: 'empty',
process: true,
module: false,
clearImmediate: false,
setImmediate: false
}
};
config.set({
basePath: '.',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [{ pattern: 'build/test.js', watched: false }],
// list of files to exclude
exclude: [],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'build/test.js': ['webpack']
},
reporters: ['dots'],
webpack: webpackConfig,
webpackMiddleware: {
stats: 'errors-only'
},
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-webpack')
],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},
browsers: process.env.TRAVIS ? ['Chrome_travis_ci'] : ['Chrome'],
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
});
};
module.exports = function(config) {
const webpackConfig = {
node: {
fs: 'empty',
global: true,
crypto: 'empty',
tls: 'empty',
net: 'empty',
process: true,
module: false,
clearImmediate: false,
setImmediate: false
}
};
config.set({
basePath: '.',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [{ pattern: 'build/test.js', watched: false }],
// list of files to exclude
exclude: [],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'build/test.js': ['webpack']
},
reporters: ['dots'],
webpack: webpackConfig,
webpackMiddleware: {
stats: 'errors-only'
},
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-webpack')
],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},
browsers: process.env.TRAVIS ? ['Chrome_travis_ci'] : ['Chrome'],
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
});
};

View File

@ -9,14 +9,14 @@
"commit": "git-cz",
"checkcommit": "node ./scripts/commit-lint.js",
"e2e": "./scripts/e2e.sh",
"format": "prettier \"**/*.{ts,js,json,css,scss,md}\" \"!**/{__name__,__directory__}/**\" --write",
"format": "./scripts/format.sh",
"linknpm": "./scripts/link.sh",
"nx-release": "./scripts/nx-release.js",
"copy": "./scripts/copy.sh",
"test:schematics": "yarn linknpm fast && ./scripts/test_schematics.sh",
"test:nx": "yarn linknpm fast && ./scripts/test_nx.sh",
"test": "yarn linknpm fast && ./scripts/test_nx.sh && ./scripts/test_schematics.sh",
"checkformat": "prettier \"**/*.{ts,js,json,css,scss}\" \"!**/{__name__,__directory__}/**\" --list-different"
"checkformat": "./scripts/check_format.sh"
},
"devDependencies": {
"@angular-devkit/architect": "~0.11.0",
@ -69,7 +69,6 @@
"karma-jasmine": "~1.1.1",
"karma-webpack": "2.0.4",
"license-webpack-plugin": "^1.4.0",
"lint-staged": "^7.2.2",
"ng-packagr": "4.3.1",
"npm-run-all": "^4.1.5",
"opn": "^5.3.0",
@ -101,17 +100,6 @@
"collection/.*/files"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"**/*.{ts,js,json,css,md}": [
"prettier --write",
"git add"
]
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"

View File

@ -1,18 +1,17 @@
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';
import { Tree, VirtualTree } from '@angular-devkit/schematics';
import { createEmptyWorkspace } from '../../utils/testing-utils';
import {
createEmptyWorkspace,
runSchematic,
schematicRunner
} from '../../utils/testing-utils';
import { getFileContent } from '@schematics/angular/utility/test';
import * as stripJsonComments from 'strip-json-comments';
import { readJsonInTree, updateJsonInTree } from '../../utils/ast-utils';
import { NxJson } from '../../command-line/shared';
describe('app', () => {
const schematicRunner = new SchematicTestRunner(
'@nrwl/schematics',
path.join(__dirname, '../../collection.json')
);
let appTree: Tree;
beforeEach(() => {
@ -22,9 +21,7 @@ describe('app', () => {
describe('not nested', () => {
it('should update angular.json', async () => {
const tree = await schematicRunner
.runSchematicAsync('app', { name: 'myApp' }, appTree)
.toPromise();
const tree = await runSchematic('app', { name: 'myApp' }, appTree);
const angularJson = readJsonInTree(tree, '/angular.json');
expect(angularJson.projects['my-app'].root).toEqual('apps/my-app/');
@ -34,9 +31,11 @@ describe('app', () => {
});
it('should update nx.json', async () => {
const tree = await schematicRunner
.runSchematicAsync('app', { name: 'myApp', tags: 'one,two' }, appTree)
.toPromise();
const tree = await runSchematic(
'app',
{ name: 'myApp', tags: 'one,two' },
appTree
);
const nxJson = readJsonInTree<NxJson>(tree, '/nx.json');
expect(nxJson).toEqual({
npmScope: 'proj',
@ -52,9 +51,7 @@ describe('app', () => {
});
it('should generate files', async () => {
const tree = await schematicRunner
.runSchematicAsync('app', { name: 'myApp' }, appTree)
.toPromise();
const tree = await runSchematic('app', { name: 'myApp' }, appTree);
expect(tree.exists(`apps/my-app/karma.conf.js`)).toBeTruthy();
expect(tree.exists('apps/my-app/src/main.ts')).toBeTruthy();
expect(tree.exists('apps/my-app/src/app/app.module.ts')).toBeTruthy();
@ -93,12 +90,12 @@ describe('app', () => {
});
it('should default the prefix to npmScope', async () => {
const noPrefix = await schematicRunner
.runSchematicAsync('app', { name: 'myApp' }, appTree)
.toPromise();
const withPrefix = await schematicRunner
.runSchematicAsync('app', { name: 'myApp', prefix: 'custom' }, appTree)
.toPromise();
const noPrefix = await runSchematic('app', { name: 'myApp' }, appTree);
const withPrefix = await runSchematic(
'app',
{ name: 'myApp', prefix: 'custom' },
appTree
);
// Testing without prefix
@ -134,10 +131,7 @@ describe('app', () => {
)
.toPromise();
const result = await schematicRunner
.runSchematicAsync('app', { name: 'myApp' }, appTree)
.toPromise();
const result = await runSchematic('app', { name: 'myApp' }, appTree);
expect(result.exists('apps/my-app/src/main.ts')).toEqual(true);
expect(result.exists('apps/my-app-e2e/protractor.conf.js')).toEqual(true);
});
@ -145,13 +139,11 @@ describe('app', () => {
describe('nested', () => {
it('should update angular.json', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'app',
{ name: 'myApp', directory: 'myDir' },
appTree
)
.toPromise();
const tree = await runSchematic(
'app',
{ name: 'myApp', directory: 'myDir' },
appTree
);
const angularJson = readJsonInTree(tree, '/angular.json');
expect(angularJson.projects['my-dir-my-app'].root).toEqual(
@ -163,13 +155,11 @@ describe('app', () => {
});
it('should update nx.json', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'app',
{ name: 'myApp', directory: 'myDir', tags: 'one,two' },
appTree
)
.toPromise();
const tree = await runSchematic(
'app',
{ name: 'myApp', directory: 'myDir', tags: 'one,two' },
appTree
);
const nxJson = readJsonInTree<NxJson>(tree, '/nx.json');
expect(nxJson).toEqual({
npmScope: 'proj',
@ -191,13 +181,11 @@ describe('app', () => {
expect(lookupFn(config)).toEqual(expectedValue);
};
const tree = await schematicRunner
.runSchematicAsync(
'app',
{ name: 'myApp', directory: 'myDir' },
appTree
)
.toPromise();
const tree = await runSchematic(
'app',
{ name: 'myApp', directory: 'myDir' },
appTree
);
const appModulePath = 'apps/my-dir/my-app/src/app/app.module.ts';
expect(getFileContent(tree, appModulePath)).toContain('class AppModule');
@ -245,9 +233,11 @@ describe('app', () => {
});
it('should import NgModule', async () => {
const tree = await schematicRunner
.runSchematicAsync('app', { name: 'myApp', directory: 'myDir' }, appTree)
.toPromise();
const tree = await runSchematic(
'app',
{ name: 'myApp', directory: 'myDir' },
appTree
);
expect(
getFileContent(tree, 'apps/my-dir/my-app/src/app/app.module.ts')
).toContain('NxModule.forRoot()');
@ -255,13 +245,11 @@ describe('app', () => {
describe('routing', () => {
it('should include RouterTestingModule', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'app',
{ name: 'myApp', directory: 'myDir', routing: true },
appTree
)
.toPromise();
const tree = await runSchematic(
'app',
{ name: 'myApp', directory: 'myDir', routing: true },
appTree
);
expect(
getFileContent(tree, 'apps/my-dir/my-app/src/app/app.module.ts')
).toContain('RouterModule.forRoot');
@ -271,13 +259,11 @@ describe('app', () => {
});
it('should not modify tests when --skip-tests is set', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'app',
{ name: 'myApp', directory: 'myDir', routing: true, skipTests: true },
appTree
)
.toPromise();
const tree = await runSchematic(
'app',
{ name: 'myApp', directory: 'myDir', routing: true, skipTests: true },
appTree
);
expect(
tree.exists('apps/my-dir/my-app/src/app/app.component.spec.ts')
).toBeFalsy();
@ -286,13 +272,11 @@ describe('app', () => {
describe('template generation mode', () => {
it('should create Nx specific `app.component.html` template', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'app',
{ name: 'myApp', directory: 'myDir' },
appTree
)
.toPromise();
const tree = await runSchematic(
'app',
{ name: 'myApp', directory: 'myDir' },
appTree
);
expect(
getFileContent(tree, 'apps/my-dir/my-app/src/app/app.component.html')
).toBeTruthy();
@ -302,13 +286,11 @@ describe('app', () => {
});
it("should update `template`'s property of AppComponent with Nx content", async () => {
const tree = await schematicRunner
.runSchematicAsync(
'app',
{ name: 'myApp', directory: 'myDir', inlineTemplate: true },
appTree
)
.toPromise();
const tree = await runSchematic(
'app',
{ name: 'myApp', directory: 'myDir', inlineTemplate: true },
appTree
);
expect(
getFileContent(tree, 'apps/my-dir/my-app/src/app/app.component.ts')
).toContain('This is an Angular CLI app built with Nrwl Nx!');
@ -317,19 +299,22 @@ describe('app', () => {
describe('--style scss', () => {
it('should generate scss styles', async () => {
const result = await schematicRunner
.runSchematicAsync('app', { name: 'myApp', style: 'scss' }, appTree)
.toPromise();
const result = await runSchematic(
'app',
{ name: 'myApp', style: 'scss' },
appTree
);
expect(result.exists('apps/my-app/src/app/app.component.scss')).toEqual(
true
);
});
it('should set it as default', async () => {
const result = await schematicRunner
.runSchematicAsync('app', { name: 'myApp', style: 'scss' }, appTree)
.toPromise();
const result = await runSchematic(
'app',
{ name: 'myApp', style: 'scss' },
appTree
);
const angularJson = readJsonInTree(result, 'angular.json');
expect(angularJson.projects['my-app'].schematics).toEqual({
@ -342,13 +327,11 @@ describe('app', () => {
describe('--unit-test-runner jest', () => {
it('should generate a jest config', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'app',
{ name: 'myApp', unitTestRunner: 'jest' },
appTree
)
.toPromise();
const tree = await runSchematic(
'app',
{ name: 'myApp', unitTestRunner: 'jest' },
appTree
);
expect(tree.exists('apps/my-app/src/test.ts')).toBeFalsy();
expect(tree.exists('apps/my-app/src/test-setup.ts')).toBeTruthy();
expect(tree.exists('apps/my-app/tsconfig.spec.json')).toBeTruthy();
@ -379,13 +362,11 @@ describe('app', () => {
describe('--unit-test-runner none', () => {
it('should not generate test configuration', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'app',
{ name: 'myApp', unitTestRunner: 'none' },
appTree
)
.toPromise();
const tree = await runSchematic(
'app',
{ name: 'myApp', unitTestRunner: 'none' },
appTree
);
expect(tree.exists('apps/my-app/src/test-setup.ts')).toBeFalsy();
expect(tree.exists('apps/my-app/src/test.ts')).toBeFalsy();
expect(tree.exists('apps/my-app/tsconfig.spec.json')).toBeFalsy();
@ -401,13 +382,11 @@ describe('app', () => {
describe('--e2e-test-runner none', () => {
it('should not generate test configuration', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'app',
{ name: 'myApp', e2eTestRunner: 'none' },
appTree
)
.toPromise();
const tree = await runSchematic(
'app',
{ name: 'myApp', e2eTestRunner: 'none' },
appTree
);
expect(tree.exists('apps/my-app-e2e')).toBeFalsy();
const angularJson = readJsonInTree(tree, 'angular.json');
expect(angularJson.projects['my-app-e2e']).toBeUndefined();
@ -416,10 +395,7 @@ describe('app', () => {
describe('replaceAppNameWithPath', () => {
it('should protect `angular.json` commands and properties', async () => {
const tree = await schematicRunner
.runSchematicAsync('app', { name: 'ui' }, appTree)
.toPromise();
const tree = await runSchematic('app', { name: 'ui' }, appTree);
const angularJson = readJsonInTree(tree, 'angular.json');
expect(angularJson.projects['ui']).toBeDefined();
expect(
@ -428,10 +404,11 @@ describe('app', () => {
});
it('should protect `angular.json` sensible properties value to be renamed', async () => {
const tree = await schematicRunner
.runSchematicAsync('app', { name: 'ui', prefix: 'ui' }, appTree)
.toPromise();
const tree = await runSchematic(
'app',
{ name: 'ui', prefix: 'ui' },
appTree
);
const angularJson = readJsonInTree(tree, 'angular.json');
expect(angularJson.projects['ui'].prefix).toEqual('ui');
});

View File

@ -1,15 +1,13 @@
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import { Tree, VirtualTree } from '@angular-devkit/schematics';
import { createEmptyWorkspace } from '@nrwl/schematics/src/utils/testing-utils';
import {
createEmptyWorkspace,
runSchematic
} from '@nrwl/schematics/src/utils/testing-utils';
import { readJsonInTree } from '@nrwl/schematics/src/utils/ast-utils';
import * as path from 'path';
describe('schematic:cypress-project', () => {
const schematicRunner = new SchematicTestRunner(
'@nrwl/schematics',
path.join(__dirname, '../../collection.json')
);
let appTree: Tree;
beforeEach(() => {
@ -19,13 +17,11 @@ describe('schematic:cypress-project', () => {
describe('generate app --e2e-test-runner=cypress', () => {
it('should not contain any protractor files', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'application',
{ name: 'myApp', e2eTestRunner: 'cypress' },
appTree
)
.toPromise();
const tree = await runSchematic(
'application',
{ name: 'myApp', e2eTestRunner: 'cypress' },
appTree
);
expect(
tree.exists('apps/my-app-e2e/protractor.e2e.json')
@ -41,13 +37,11 @@ describe('schematic:cypress-project', () => {
});
it('should generate files', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'application',
{ name: 'myApp', e2eTestRunner: 'cypress' },
appTree
)
.toPromise();
const tree = await runSchematic(
'application',
{ name: 'myApp', e2eTestRunner: 'cypress' },
appTree
);
expect(tree.exists('apps/my-app-e2e/cypress.json')).toBeTruthy();
expect(tree.exists('apps/my-app-e2e/tsconfig.e2e.json')).toBeTruthy();
@ -67,13 +61,11 @@ describe('schematic:cypress-project', () => {
});
it('should add dependencies into `package.json` file', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'application',
{ name: 'myApp', e2eTestRunner: 'cypress' },
appTree
)
.toPromise();
const tree = await runSchematic(
'application',
{ name: 'myApp', e2eTestRunner: 'cypress' },
appTree
);
const packageJson = readJsonInTree(tree, 'package.json');
expect(packageJson.devDependencies.cypress).toBeDefined();
@ -81,13 +73,11 @@ describe('schematic:cypress-project', () => {
});
it('should add update `angular.json` file', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'application',
{ name: 'myApp', e2eTestRunner: 'cypress' },
appTree
)
.toPromise();
const tree = await runSchematic(
'application',
{ name: 'myApp', e2eTestRunner: 'cypress' },
appTree
);
const angularJson = readJsonInTree(tree, 'angular.json');
const project = angularJson.projects['my-app-e2e'];
@ -100,13 +90,11 @@ describe('schematic:cypress-project', () => {
});
it('should set right path names in `cypress.json`', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'application',
{ name: 'myApp', e2eTestRunner: 'cypress' },
appTree
)
.toPromise();
const tree = await runSchematic(
'application',
{ name: 'myApp', e2eTestRunner: 'cypress' },
appTree
);
const cypressJson = readJsonInTree(tree, 'apps/my-app-e2e/cypress.json');
expect(cypressJson).toEqual({
@ -123,13 +111,11 @@ describe('schematic:cypress-project', () => {
});
it('should set right path names in `tsconfig.e2e.json`', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'application',
{ name: 'myApp', e2eTestRunner: 'cypress' },
appTree
)
.toPromise();
const tree = await runSchematic(
'application',
{ name: 'myApp', e2eTestRunner: 'cypress' },
appTree
);
const tsconfigJson = readJsonInTree(
tree,
'apps/my-app-e2e/tsconfig.e2e.json'
@ -144,13 +130,11 @@ describe('schematic:cypress-project', () => {
describe('generate app --e2e-test-runner=cypress --directory=my-dir', () => {
it('should set right path names in `cypress.json`', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'application',
{ name: 'myApp', e2eTestRunner: 'cypress', directory: 'my-dir' },
appTree
)
.toPromise();
const tree = await runSchematic(
'application',
{ name: 'myApp', e2eTestRunner: 'cypress', directory: 'my-dir' },
appTree
);
const cypressJson = readJsonInTree(
tree,
'apps/my-dir/my-app-e2e/cypress.json'
@ -174,13 +158,11 @@ describe('schematic:cypress-project', () => {
});
it('should set right path names in `tsconfig.e2e.json`', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'application',
{ name: 'myApp', e2eTestRunner: 'cypress', directory: 'my-dir' },
appTree
)
.toPromise();
const tree = await runSchematic(
'application',
{ name: 'myApp', e2eTestRunner: 'cypress', directory: 'my-dir' },
appTree
);
const tsconfigJson = readJsonInTree(
tree,
'apps/my-dir/my-app-e2e/tsconfig.e2e.json'

View File

@ -1,16 +1,15 @@
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';
import { Tree, VirtualTree } from '@angular-devkit/schematics';
import { createApp, createEmptyWorkspace } from '../../utils/testing-utils';
import {
createApp,
createEmptyWorkspace,
runSchematic
} from '../../utils/testing-utils';
import { getFileContent } from '@schematics/angular/utility/test';
import { readJsonInTree } from '../../utils/ast-utils';
describe('downgrade-module', () => {
const schematicRunner = new SchematicTestRunner(
'@nrwl/schematics',
path.join(__dirname, '../../collection.json')
);
let appTree: Tree;
beforeEach(() => {
@ -20,16 +19,14 @@ describe('downgrade-module', () => {
});
it('should update main.ts', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'downgrade-module',
{
name: 'legacy',
project: 'myapp'
},
appTree
)
.toPromise();
const tree = await runSchematic(
'downgrade-module',
{
name: 'legacy',
project: 'myapp'
},
appTree
);
const main = getFileContent(tree, '/apps/myapp/src/main.ts');
expect(main).toContain('downgradeModule(bootstrapAngular)');
@ -40,16 +37,14 @@ describe('downgrade-module', () => {
});
it('should update module', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'downgrade-module',
{
name: 'legacy',
project: 'myapp'
},
appTree
)
.toPromise();
const tree = await runSchematic(
'downgrade-module',
{
name: 'legacy',
project: 'myapp'
},
appTree
);
const appModule = getFileContent(tree, 'apps/myapp/src/app/app.module.ts');
expect(appModule).not.toContain('bootstrap:');
@ -67,16 +62,14 @@ describe('downgrade-module', () => {
})
);
const tree = await schematicRunner
.runSchematicAsync(
'downgrade-module',
{
name: 'legacy',
project: 'myapp'
},
appTree
)
.toPromise();
const tree = await runSchematic(
'downgrade-module',
{
name: 'legacy',
project: 'myapp'
},
appTree
);
const packageJson = readJsonInTree(tree, '/package.json');
expect(packageJson.dependencies['@angular/upgrade']).toEqual('4.4.4');
@ -93,34 +86,30 @@ describe('downgrade-module', () => {
})
);
const tree = await schematicRunner
.runSchematicAsync(
'downgrade-module',
{
name: 'legacy',
skipPackageJson: true,
project: 'myapp'
},
appTree
)
.toPromise();
const tree = await runSchematic(
'downgrade-module',
{
name: 'legacy',
skipPackageJson: true,
project: 'myapp'
},
appTree
);
const packageJson = readJsonInTree(tree, 'package.json');
expect(packageJson.dependencies['@angular/upgrade']).not.toBeDefined();
});
it('should support custom angularJsImport', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'downgrade-module',
{
name: 'legacy',
angularJsImport: 'legacy-app',
project: 'myapp'
},
appTree
)
.toPromise();
const tree = await runSchematic(
'downgrade-module',
{
name: 'legacy',
angularJsImport: 'legacy-app',
project: 'myapp'
},
appTree
);
const main = getFileContent(tree, '/apps/myapp/src/main.ts');
expect(main).toContain(`import 'legacy-app';`);

View File

@ -1,57 +1,46 @@
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';
import { Tree, VirtualTree } from '@angular-devkit/schematics';
import { createEmptyWorkspace } from '../../utils/testing-utils';
import { createEmptyWorkspace, runSchematic } from '../../utils/testing-utils';
import { readJsonInTree } from '@nrwl/schematics/src/utils/ast-utils';
describe('lib', () => {
const schematicRunner = new SchematicTestRunner(
'@nrwl/schematics',
path.join(__dirname, '../../collection.json')
);
let appTree: Tree;
beforeEach(async () => {
appTree = new VirtualTree();
appTree = createEmptyWorkspace(appTree);
appTree = await schematicRunner
.runSchematicAsync(
'lib',
{
name: 'lib1',
unitTestRunner: 'none'
},
appTree
)
.toPromise();
appTree = await runSchematic(
'lib',
{
name: 'lib1',
unitTestRunner: 'none'
},
appTree
);
});
it('should generate files', async () => {
const resultTree = await schematicRunner
.runSchematicAsync(
'jest-project',
{
project: 'lib1'
},
appTree
)
.toPromise();
const resultTree = await runSchematic(
'jest-project',
{
project: 'lib1'
},
appTree
);
expect(resultTree.exists('/libs/lib1/src/test-setup.ts')).toBeTruthy();
expect(resultTree.exists('/libs/lib1/jest.config.js')).toBeTruthy();
expect(resultTree.exists('/libs/lib1/tsconfig.spec.json')).toBeTruthy();
});
it('should alter angular.json', async () => {
const resultTree = await schematicRunner
.runSchematicAsync(
'jest-project',
{
project: 'lib1'
},
appTree
)
.toPromise();
const resultTree = await runSchematic(
'jest-project',
{
project: 'lib1'
},
appTree
);
const angularJson = readJsonInTree(resultTree, 'angular.json');
expect(angularJson.projects.lib1.architect.test).toEqual({
builder: '@nrwl/builders:jest',
@ -67,15 +56,13 @@ describe('lib', () => {
});
it('should create a jest.config.js', async () => {
const resultTree = await schematicRunner
.runSchematicAsync(
'jest-project',
{
project: 'lib1'
},
appTree
)
.toPromise();
const resultTree = await runSchematic(
'jest-project',
{
project: 'lib1'
},
appTree
);
expect(resultTree.readContent('libs/lib1/jest.config.js'))
.toBe(`module.exports = {
name: 'lib1',
@ -86,30 +73,26 @@ describe('lib', () => {
});
it('should update the local tsconfig.json', async () => {
const resultTree = await schematicRunner
.runSchematicAsync(
'jest-project',
{
project: 'lib1'
},
appTree
)
.toPromise();
const resultTree = await runSchematic(
'jest-project',
{
project: 'lib1'
},
appTree
);
const tsConfig = readJsonInTree(resultTree, 'libs/lib1/tsconfig.json');
expect(tsConfig.compilerOptions.types).toContain('jest');
expect(tsConfig.compilerOptions.types).toContain('node');
});
it('should create a tsconfig.spec.json', async () => {
const resultTree = await schematicRunner
.runSchematicAsync(
'jest-project',
{
project: 'lib1'
},
appTree
)
.toPromise();
const resultTree = await runSchematic(
'jest-project',
{
project: 'lib1'
},
appTree
);
const tsConfig = readJsonInTree(resultTree, 'libs/lib1/tsconfig.spec.json');
expect(tsConfig).toEqual({
extends: './tsconfig.json',
@ -125,30 +108,26 @@ describe('lib', () => {
describe('--skip-setup-file', () => {
it('should generate src/test-setup.ts', async () => {
const resultTree = await schematicRunner
.runSchematicAsync(
'jest-project',
{
project: 'lib1',
skipSetupFile: true
},
appTree
)
.toPromise();
const resultTree = await runSchematic(
'jest-project',
{
project: 'lib1',
skipSetupFile: true
},
appTree
);
expect(resultTree.exists('src/test-setup.ts')).toBeFalsy();
});
it('should not list the setup file in angular.json', async () => {
const resultTree = await schematicRunner
.runSchematicAsync(
'jest-project',
{
project: 'lib1',
skipSetupFile: true
},
appTree
)
.toPromise();
const resultTree = await runSchematic(
'jest-project',
{
project: 'lib1',
skipSetupFile: true
},
appTree
);
const angularJson = readJsonInTree(resultTree, 'angular.json');
expect(
angularJson.projects.lib1.architect.test.options.setupFile
@ -156,16 +135,14 @@ describe('lib', () => {
});
it('should not list the setup file in tsconfig.spec.json', async () => {
const resultTree = await schematicRunner
.runSchematicAsync(
'jest-project',
{
project: 'lib1',
skipSetupFile: true
},
appTree
)
.toPromise();
const resultTree = await runSchematic(
'jest-project',
{
project: 'lib1',
skipSetupFile: true
},
appTree
);
const tsConfig = readJsonInTree(
resultTree,
'libs/lib1/tsconfig.spec.json'

View File

@ -1,15 +1,14 @@
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';
import { Tree, VirtualTree } from '@angular-devkit/schematics';
import { createEmptyWorkspace, createLib } from '../../utils/testing-utils';
import {
createEmptyWorkspace,
createLib,
runSchematic
} from '../../utils/testing-utils';
import { readJsonInTree } from '@nrwl/schematics/src/utils/ast-utils';
describe('lib', () => {
const schematicRunner = new SchematicTestRunner(
'@nrwl/schematics',
path.join(__dirname, '../../collection.json')
);
let appTree: Tree;
beforeEach(() => {
@ -17,13 +16,13 @@ describe('lib', () => {
appTree = createEmptyWorkspace(appTree);
});
it('should generate files', () => {
const resultTree = schematicRunner.runSchematic('jest', {}, appTree);
it('should generate files', async () => {
const resultTree = await runSchematic('jest', {}, appTree);
expect(resultTree.exists('jest.config.js')).toBeTruthy();
});
it('should add dependencies', () => {
const resultTree = schematicRunner.runSchematic('jest', {}, appTree);
it('should add dependencies', async () => {
const resultTree = await runSchematic('jest', {}, appTree);
const packageJson = readJsonInTree(resultTree, 'package.json');
expect(packageJson.devDependencies.jest).toBeDefined();
expect(packageJson.devDependencies['@nrwl/builders']).toBeDefined();

View File

@ -1,18 +1,17 @@
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';
import { Tree, VirtualTree } from '@angular-devkit/schematics';
import { createApp, createEmptyWorkspace } from '../../utils/testing-utils';
import {
createApp,
createEmptyWorkspace,
runSchematic
} from '../../utils/testing-utils';
import { getFileContent } from '@schematics/angular/utility/test';
import * as stripJsonComments from 'strip-json-comments';
import { readJsonInTree } from '../../utils/ast-utils';
import { NxJson } from '../../command-line/shared';
describe('lib', () => {
const schematicRunner = new SchematicTestRunner(
'@nrwl/schematics',
path.join(__dirname, '../../collection.json')
);
let appTree: Tree;
beforeEach(() => {
@ -22,9 +21,11 @@ describe('lib', () => {
describe('not nested', () => {
it('should update ng-package.json', async () => {
const publishableTree = await schematicRunner
.runSchematicAsync('lib', { name: 'myLib', publishable: true }, appTree)
.toPromise();
const publishableTree = await runSchematic(
'lib',
{ name: 'myLib', publishable: true },
appTree
);
let ngPackage = readJsonInTree(
publishableTree,
'libs/my-lib/ng-package.json'
@ -34,45 +35,47 @@ describe('lib', () => {
});
it('should not update package.json by default', async () => {
const tree = await schematicRunner
.runSchematicAsync('lib', { name: 'myLib' }, appTree)
.toPromise();
const tree = await runSchematic('lib', { name: 'myLib' }, appTree);
const packageJson = readJsonInTree(tree, '/package.json');
expect(packageJson.devDependencies['ng-packagr']).toBeUndefined();
});
it('should update package.json when publishable', async () => {
const tree = await schematicRunner
.runSchematicAsync('lib', { name: 'myLib', publishable: true }, appTree)
.toPromise();
const tree = await runSchematic(
'lib',
{ name: 'myLib', publishable: true },
appTree
);
const packageJson = readJsonInTree(tree, '/package.json');
expect(packageJson.devDependencies['ng-packagr']).toBeDefined();
});
it("should update npmScope of lib's package.json when publishable", async () => {
const tree = await schematicRunner
.runSchematicAsync('lib', { name: 'myLib', publishable: true }, appTree)
.toPromise();
const tree = await runSchematic(
'lib',
{ name: 'myLib', publishable: true },
appTree
);
const packageJson = readJsonInTree(tree, '/libs/my-lib/package.json');
expect(packageJson.name).toEqual('@proj/my-lib');
});
it("should update npmScope of lib's package.json when publishable", async () => {
const tree = await schematicRunner
.runSchematicAsync(
'lib',
{ name: 'myLib', publishable: true, prefix: 'lib' },
appTree
)
.toPromise();
const tree = await runSchematic(
'lib',
{ name: 'myLib', publishable: true, prefix: 'lib' },
appTree
);
const packageJson = readJsonInTree(tree, '/libs/my-lib/package.json');
expect(packageJson.name).toEqual('@proj/my-lib');
});
it('should update angular.json', async () => {
const tree = await schematicRunner
.runSchematicAsync('lib', { name: 'myLib', publishable: true }, appTree)
.toPromise();
const tree = await runSchematic(
'lib',
{ name: 'myLib', publishable: true },
appTree
);
const angularJson = readJsonInTree(tree, '/angular.json');
expect(angularJson.projects['my-lib'].root).toEqual('libs/my-lib');
@ -80,13 +83,11 @@ describe('lib', () => {
});
it('should remove "build" target from angular.json when a library is not publishable', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'lib',
{ name: 'myLib', publishable: false },
appTree
)
.toPromise();
const tree = await runSchematic(
'lib',
{ name: 'myLib', publishable: false },
appTree
);
const angularJson = readJsonInTree(tree, '/angular.json');
expect(angularJson.projects['my-lib'].root).toEqual('libs/my-lib');
@ -94,9 +95,11 @@ describe('lib', () => {
});
it('should update nx.json', async () => {
const tree = await schematicRunner
.runSchematicAsync('lib', { name: 'myLib', tags: 'one,two' }, appTree)
.toPromise();
const tree = await runSchematic(
'lib',
{ name: 'myLib', tags: 'one,two' },
appTree
);
const nxJson = readJsonInTree<NxJson>(tree, '/nx.json');
expect(nxJson).toEqual({
npmScope: 'proj',
@ -109,9 +112,7 @@ describe('lib', () => {
});
it('should update root tsconfig.json', async () => {
const tree = await schematicRunner
.runSchematicAsync('lib', { name: 'myLib' }, appTree)
.toPromise();
const tree = await runSchematic('lib', { name: 'myLib' }, appTree);
const tsconfigJson = readJsonInTree(tree, '/tsconfig.json');
expect(tsconfigJson.compilerOptions.paths['@proj/my-lib']).toEqual([
'libs/my-lib/src/index.ts'
@ -119,10 +120,7 @@ describe('lib', () => {
});
it('should create a local tsconfig.json', async () => {
const tree = await schematicRunner
.runSchematicAsync('lib', { name: 'myLib' }, appTree)
.toPromise();
const tree = await runSchematic('lib', { name: 'myLib' }, appTree);
const tsconfigJson = readJsonInTree(tree, 'libs/my-lib/tsconfig.json');
expect(tsconfigJson).toEqual({
extends: '../../tsconfig.json',
@ -134,10 +132,7 @@ describe('lib', () => {
});
it('should extend the local tsconfig.json with tsconfig.spec.json', async () => {
const tree = await schematicRunner
.runSchematicAsync('lib', { name: 'myLib' }, appTree)
.toPromise();
const tree = await runSchematic('lib', { name: 'myLib' }, appTree);
const tsconfigJson = readJsonInTree(
tree,
'libs/my-lib/tsconfig.spec.json'
@ -146,10 +141,7 @@ describe('lib', () => {
});
it('should extend the local tsconfig.json with tsconfig.lib.json', async () => {
const tree = await schematicRunner
.runSchematicAsync('lib', { name: 'myLib' }, appTree)
.toPromise();
const tree = await runSchematic('lib', { name: 'myLib' }, appTree);
const tsconfigJson = readJsonInTree(
tree,
'libs/my-lib/tsconfig.lib.json'
@ -158,9 +150,7 @@ describe('lib', () => {
});
it('should generate files', async () => {
const tree = await schematicRunner
.runSchematicAsync('lib', { name: 'myLib' }, appTree)
.toPromise();
const tree = await runSchematic('lib', { name: 'myLib' }, appTree);
expect(tree.exists(`libs/my-lib/karma.conf.js`)).toBeTruthy();
expect(tree.exists('libs/my-lib/src/index.ts')).toBeTruthy();
expect(tree.exists('libs/my-lib/src/lib/my-lib.module.ts')).toBeTruthy();
@ -176,13 +166,11 @@ describe('lib', () => {
tree.exists('libs/my-lib/src/lib/my-lib.service.spec.ts')
).toBeFalsy();
const tree2 = await schematicRunner
.runSchematicAsync(
'lib',
{ name: 'myLib2', simpleModuleName: true },
tree
)
.toPromise();
const tree2 = await runSchematic(
'lib',
{ name: 'myLib2', simpleModuleName: true },
tree
);
expect(tree2.exists(`libs/my-lib2/karma.conf.js`)).toBeTruthy();
expect(tree2.exists('libs/my-lib2/src/index.ts')).toBeTruthy();
expect(
@ -204,9 +192,11 @@ describe('lib', () => {
});
it('should not generate a module for --module false', async () => {
const tree = await schematicRunner
.runSchematicAsync('lib', { name: 'myLib', module: false }, appTree)
.toPromise();
const tree = await runSchematic(
'lib',
{ name: 'myLib', module: false },
appTree
);
expect(tree.exists('libs/my-lib/src/lib/my-lib.module.ts')).toEqual(
false
);
@ -217,17 +207,17 @@ describe('lib', () => {
});
it('should default the prefix to npmScope', async () => {
const noPrefix = await schematicRunner
.runSchematicAsync('lib', { name: 'myLib' }, appTree)
.toPromise();
const noPrefix = await runSchematic('lib', { name: 'myLib' }, appTree);
expect(
JSON.parse(noPrefix.read('angular.json').toString()).projects['my-lib']
.prefix
).toEqual('proj');
const withPrefix = await schematicRunner
.runSchematicAsync('lib', { name: 'myLib', prefix: 'custom' }, appTree)
.toPromise();
const withPrefix = await runSchematic(
'lib',
{ name: 'myLib', prefix: 'custom' },
appTree
);
expect(
JSON.parse(withPrefix.read('angular.json').toString()).projects[
'my-lib'
@ -238,13 +228,11 @@ describe('lib', () => {
describe('nested', () => {
it('should update nx.json', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'lib',
{ name: 'myLib', directory: 'myDir', tags: 'one' },
appTree
)
.toPromise();
const tree = await runSchematic(
'lib',
{ name: 'myLib', directory: 'myDir', tags: 'one' },
appTree
);
const nxJson = readJsonInTree<NxJson>(tree, '/nx.json');
expect(nxJson).toEqual({
npmScope: 'proj',
@ -255,18 +243,16 @@ describe('lib', () => {
}
});
const tree2 = await schematicRunner
.runSchematicAsync(
'lib',
{
name: 'myLib2',
directory: 'myDir',
tags: 'one,two',
simpleModuleName: true
},
tree
)
.toPromise();
const tree2 = await runSchematic(
'lib',
{
name: 'myLib2',
directory: 'myDir',
tags: 'one,two',
simpleModuleName: true
},
tree
);
const nxJson2 = readJsonInTree<NxJson>(tree2, '/nx.json');
expect(nxJson2).toEqual({
npmScope: 'proj',
@ -282,13 +268,11 @@ describe('lib', () => {
});
it('should generate files', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'lib',
{ name: 'myLib', directory: 'myDir' },
appTree
)
.toPromise();
const tree = await runSchematic(
'lib',
{ name: 'myLib', directory: 'myDir' },
appTree
);
expect(tree.exists(`libs/my-dir/my-lib/karma.conf.js`)).toBeTruthy();
expect(tree.exists('libs/my-dir/my-lib/src/index.ts')).toBeTruthy();
expect(
@ -308,13 +292,11 @@ describe('lib', () => {
tree.exists('libs/my-dir/my-lib/src/lib/my-lib.service.spec.ts')
).toBeFalsy();
const tree2 = await schematicRunner
.runSchematicAsync(
'lib',
{ name: 'myLib2', directory: 'myDir', simpleModuleName: true },
tree
)
.toPromise();
const tree2 = await runSchematic(
'lib',
{ name: 'myLib2', directory: 'myDir', simpleModuleName: true },
tree
);
expect(tree2.exists(`libs/my-dir/my-lib2/karma.conf.js`)).toBeTruthy();
expect(tree2.exists('libs/my-dir/my-lib2/src/index.ts')).toBeTruthy();
expect(
@ -336,13 +318,11 @@ describe('lib', () => {
});
it('should update ng-package.json', async () => {
const publishableTree = await schematicRunner
.runSchematicAsync(
'lib',
{ name: 'myLib', directory: 'myDir', publishable: true },
appTree
)
.toPromise();
const publishableTree = await runSchematic(
'lib',
{ name: 'myLib', directory: 'myDir', publishable: true },
appTree
);
let ngPackage = readJsonInTree(
publishableTree,
@ -352,13 +332,11 @@ describe('lib', () => {
});
it('should update angular.json', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'lib',
{ name: 'myLib', directory: 'myDir' },
appTree
)
.toPromise();
const tree = await runSchematic(
'lib',
{ name: 'myLib', directory: 'myDir' },
appTree
);
const angularJson = readJsonInTree(tree, '/angular.json');
expect(angularJson.projects['my-dir-my-lib'].root).toEqual(
@ -367,13 +345,11 @@ describe('lib', () => {
});
it('should update tsconfig.json', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'lib',
{ name: 'myLib', directory: 'myDir' },
appTree
)
.toPromise();
const tree = await runSchematic(
'lib',
{ name: 'myLib', directory: 'myDir' },
appTree
);
const tsconfigJson = readJsonInTree(tree, '/tsconfig.json');
expect(tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']).toEqual(
['libs/my-dir/my-lib/src/index.ts']
@ -384,13 +360,11 @@ describe('lib', () => {
});
it('should create a local tsconfig.json', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'lib',
{ name: 'myLib', directory: 'myDir' },
appTree
)
.toPromise();
const tree = await runSchematic(
'lib',
{ name: 'myLib', directory: 'myDir' },
appTree
);
const tsconfigJson = readJsonInTree(
tree,
@ -406,13 +380,11 @@ describe('lib', () => {
});
it('should not generate a module for --module false', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'lib',
{ name: 'myLib', directory: 'myDir', module: false },
appTree
)
.toPromise();
const tree = await runSchematic(
'lib',
{ name: 'myLib', directory: 'myDir', module: false },
appTree
);
expect(
tree.exists('libs/my-dir/my-lib/src/lib/my-dir-my-lib.module.ts')
).toEqual(false);
@ -426,9 +398,7 @@ describe('lib', () => {
describe('router', () => {
it('should error when lazy is set without routing', async () => {
try {
await schematicRunner
.runSchematicAsync('lib', { name: 'myLib', lazy: true }, appTree)
.toPromise();
await runSchematic('lib', { name: 'myLib', lazy: true }, appTree);
fail();
} catch (e) {
expect(e.message).toEqual('routing must be set');
@ -437,13 +407,11 @@ describe('lib', () => {
describe('lazy', () => {
it('should add RouterModule.forChild', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'lib',
{ name: 'myLib', directory: 'myDir', routing: true, lazy: true },
appTree
)
.toPromise();
const tree = await runSchematic(
'lib',
{ name: 'myLib', directory: 'myDir', routing: true, lazy: true },
appTree
);
expect(
tree.exists('libs/my-dir/my-lib/src/lib/my-dir-my-lib.module.ts')
@ -455,19 +423,17 @@ describe('lib', () => {
)
).toContain('RouterModule.forChild');
const tree2 = await schematicRunner
.runSchematicAsync(
'lib',
{
name: 'myLib2',
directory: 'myDir',
routing: true,
lazy: true,
simpleModuleName: true
},
tree
)
.toPromise();
const tree2 = await runSchematic(
'lib',
{
name: 'myLib2',
directory: 'myDir',
routing: true,
lazy: true,
simpleModuleName: true
},
tree
);
expect(
tree2.exists('libs/my-dir/my-lib2/src/lib/my-lib2.module.ts')
@ -479,28 +445,25 @@ describe('lib', () => {
it('should update the parent module', async () => {
appTree = createApp(appTree, 'myapp');
const tree = await schematicRunner
.runSchematicAsync(
'lib',
{
name: 'myLib',
directory: 'myDir',
routing: true,
lazy: true,
parentModule: 'apps/myapp/src/app/app.module.ts'
},
appTree
)
.toPromise();
const tree = await runSchematic(
'lib',
{
name: 'myLib',
directory: 'myDir',
routing: true,
lazy: true,
parentModule: 'apps/myapp/src/app/app.module.ts'
},
appTree
);
const moduleContents = getFileContent(
tree,
'apps/myapp/src/app/app.module.ts'
);
expect(moduleContents).toContain('RouterModule.forRoot([');
expect(moduleContents).toContain(`{
path: 'my-dir-my-lib',
loadChildren: '@proj/my-dir/my-lib#MyDirMyLibModule'
}`);
expect(moduleContents).toContain(
`{path: 'my-dir-my-lib', loadChildren: '@proj/my-dir/my-lib#MyDirMyLibModule'}`
);
const tsConfigAppJson = JSON.parse(
stripJsonComments(
@ -512,32 +475,31 @@ describe('lib', () => {
'../../libs/my-dir/my-lib/src/index.ts'
]);
const tree2 = await schematicRunner
.runSchematicAsync(
'lib',
{
name: 'myLib2',
directory: 'myDir',
routing: true,
lazy: true,
parentModule: 'apps/myapp/src/app/app.module.ts'
},
tree
)
.toPromise();
const tree2 = await runSchematic(
'lib',
{
name: 'myLib2',
directory: 'myDir',
routing: true,
lazy: true,
parentModule: 'apps/myapp/src/app/app.module.ts'
},
tree
);
const moduleContents2 = getFileContent(
tree2,
'apps/myapp/src/app/app.module.ts'
);
expect(moduleContents2).toContain('RouterModule.forRoot([');
expect(moduleContents2).toContain(`{
path: 'my-dir-my-lib',
loadChildren: '@proj/my-dir/my-lib#MyDirMyLibModule'
}`);
expect(moduleContents2).toContain(`{
path: 'my-dir-my-lib2',
loadChildren: '@proj/my-dir/my-lib2#MyDirMyLib2Module'
}`);
expect(moduleContents2).toContain(
`{path: 'my-dir-my-lib', loadChildren: '@proj/my-dir/my-lib#MyDirMyLibModule'}`
);
expect(moduleContents2).toContain(
`{path: 'my-dir-my-lib', loadChildren: '@proj/my-dir/my-lib#MyDirMyLibModule'}`
);
expect(moduleContents2).toContain(
`{path: 'my-dir-my-lib2', loadChildren: '@proj/my-dir/my-lib2#MyDirMyLib2Module'}`
);
const tsConfigAppJson2 = JSON.parse(
stripJsonComments(
@ -550,35 +512,31 @@ describe('lib', () => {
'../../libs/my-dir/my-lib2/src/index.ts'
]);
const tree3 = await schematicRunner
.runSchematicAsync(
'lib',
{
name: 'myLib3',
directory: 'myDir',
routing: true,
lazy: true,
parentModule: 'apps/myapp/src/app/app.module.ts',
simpleModuleName: true
},
tree2
)
.toPromise();
const tree3 = await runSchematic(
'lib',
{
name: 'myLib3',
directory: 'myDir',
routing: true,
lazy: true,
parentModule: 'apps/myapp/src/app/app.module.ts',
simpleModuleName: true
},
tree2
);
const moduleContents3 = getFileContent(
tree3,
'apps/myapp/src/app/app.module.ts'
);
expect(moduleContents3).toContain('RouterModule.forRoot([');
expect(moduleContents3).toContain(`{
path: 'my-dir-my-lib',
loadChildren: '@proj/my-dir/my-lib#MyDirMyLibModule'
}`);
expect(moduleContents3).toContain(`{
path: 'my-dir-my-lib2',
loadChildren: '@proj/my-dir/my-lib2#MyDirMyLib2Module'
}`);
expect(moduleContents3).toContain(
`{ path: 'my-lib3', loadChildren: '@proj/my-dir/my-lib3#MyLib3Module' }`
`{path: 'my-dir-my-lib', loadChildren: '@proj/my-dir/my-lib#MyDirMyLibModule'}`
);
expect(moduleContents3).toContain(
`{path: 'my-dir-my-lib2', loadChildren: '@proj/my-dir/my-lib2#MyDirMyLib2Module'}`
);
expect(moduleContents3).toContain(
`{path: 'my-lib3', loadChildren: '@proj/my-dir/my-lib3#MyLib3Module'}`
);
const tsConfigAppJson3 = JSON.parse(
@ -597,13 +555,11 @@ describe('lib', () => {
describe('eager', () => {
it('should add RouterModule and define an array of routes', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'lib',
{ name: 'myLib', directory: 'myDir', routing: true },
appTree
)
.toPromise();
const tree = await runSchematic(
'lib',
{ name: 'myLib', directory: 'myDir', routing: true },
appTree
);
expect(
tree.exists('libs/my-dir/my-lib/src/lib/my-dir-my-lib.module.ts')
).toBeTruthy();
@ -620,18 +576,16 @@ describe('lib', () => {
)
).toContain('const myDirMyLibRoutes: Route[] = ');
const tree2 = await schematicRunner
.runSchematicAsync(
'lib',
{
name: 'myLib2',
directory: 'myDir',
routing: true,
simpleModuleName: true
},
tree
)
.toPromise();
const tree2 = await runSchematic(
'lib',
{
name: 'myLib2',
directory: 'myDir',
routing: true,
simpleModuleName: true
},
tree
);
expect(
tree2.exists('libs/my-dir/my-lib2/src/lib/my-lib2.module.ts')
).toBeTruthy();
@ -645,77 +599,71 @@ describe('lib', () => {
it('should update the parent module', async () => {
appTree = createApp(appTree, 'myapp');
const tree = await schematicRunner
.runSchematicAsync(
'lib',
{
name: 'myLib',
directory: 'myDir',
routing: true,
parentModule: 'apps/myapp/src/app/app.module.ts'
},
appTree
)
.toPromise();
const tree = await runSchematic(
'lib',
{
name: 'myLib',
directory: 'myDir',
routing: true,
parentModule: 'apps/myapp/src/app/app.module.ts'
},
appTree
);
const moduleContents = getFileContent(
tree,
'apps/myapp/src/app/app.module.ts'
);
expect(moduleContents).toContain('RouterModule.forRoot([');
expect(moduleContents).toContain(
"{ path: 'my-dir-my-lib', children: myDirMyLibRoutes }"
"{path: 'my-dir-my-lib', children: myDirMyLibRoutes}"
);
const tree2 = await schematicRunner
.runSchematicAsync(
'lib',
{
name: 'myLib2',
directory: 'myDir',
routing: true,
parentModule: 'apps/myapp/src/app/app.module.ts'
},
tree
)
.toPromise();
const tree2 = await runSchematic(
'lib',
{
name: 'myLib2',
directory: 'myDir',
routing: true,
parentModule: 'apps/myapp/src/app/app.module.ts'
},
tree
);
const moduleContents2 = getFileContent(
tree2,
'apps/myapp/src/app/app.module.ts'
);
expect(moduleContents2).toContain('RouterModule.forRoot([');
expect(moduleContents2).toContain(
"{ path: 'my-dir-my-lib', children: myDirMyLibRoutes }"
"{path: 'my-dir-my-lib', children: myDirMyLibRoutes}"
);
expect(moduleContents2).toContain(
"{ path: 'my-dir-my-lib2', children: myDirMyLib2Routes }"
"{path: 'my-dir-my-lib2', children: myDirMyLib2Routes}"
);
const tree3 = await schematicRunner
.runSchematicAsync(
'lib',
{
name: 'myLib3',
directory: 'myDir',
routing: true,
parentModule: 'apps/myapp/src/app/app.module.ts',
simpleModuleName: true
},
tree2
)
.toPromise();
const tree3 = await runSchematic(
'lib',
{
name: 'myLib3',
directory: 'myDir',
routing: true,
parentModule: 'apps/myapp/src/app/app.module.ts',
simpleModuleName: true
},
tree2
);
const moduleContents3 = getFileContent(
tree3,
'apps/myapp/src/app/app.module.ts'
);
expect(moduleContents3).toContain('RouterModule.forRoot([');
expect(moduleContents3).toContain(
"{ path: 'my-dir-my-lib', children: myDirMyLibRoutes }"
"{path: 'my-dir-my-lib', children: myDirMyLibRoutes}"
);
expect(moduleContents3).toContain(
"{ path: 'my-dir-my-lib2', children: myDirMyLib2Routes }"
"{path: 'my-dir-my-lib2', children: myDirMyLib2Routes}"
);
expect(moduleContents3).toContain(
"{ path: 'my-lib3', children: myLib3Routes }"
"{path: 'my-lib3', children: myLib3Routes}"
);
});
});
@ -723,9 +671,11 @@ describe('lib', () => {
describe('--style scss', () => {
it('should set it as default', async () => {
const result = await schematicRunner
.runSchematicAsync('lib', { name: 'myLib', style: 'scss' }, appTree)
.toPromise();
const result = await runSchematic(
'lib',
{ name: 'myLib', style: 'scss' },
appTree
);
const angularJson = readJsonInTree(result, 'angular.json');
@ -739,13 +689,11 @@ describe('lib', () => {
describe('--unit-test-runner jest', () => {
it('should generate jest configuration', async () => {
const resultTree = await schematicRunner
.runSchematicAsync(
'lib',
{ name: 'myLib', unitTestRunner: 'jest' },
appTree
)
.toPromise();
const resultTree = await runSchematic(
'lib',
{ name: 'myLib', unitTestRunner: 'jest' },
appTree
);
expect(resultTree.exists('libs/my-lib/src/test.ts')).toBeFalsy();
expect(resultTree.exists('libs/my-lib/src/test-setup.ts')).toBeTruthy();
expect(resultTree.exists('libs/my-lib/tsconfig.spec.json')).toBeTruthy();
@ -763,26 +711,22 @@ describe('lib', () => {
});
it('should skip the setup file if no module is generated', async () => {
const resultTree = await schematicRunner
.runSchematicAsync(
'lib',
{ name: 'myLib', unitTestRunner: 'jest', module: false },
appTree
)
.toPromise();
const resultTree = await runSchematic(
'lib',
{ name: 'myLib', unitTestRunner: 'jest', module: false },
appTree
);
expect(resultTree.exists('libs/my-lib/src/test-setup.ts')).toBeFalsy();
});
});
describe('--unit-test-runner none', () => {
it('should not generate test configuration', async () => {
const resultTree = await schematicRunner
.runSchematicAsync(
'lib',
{ name: 'myLib', unitTestRunner: 'none' },
appTree
)
.toPromise();
const resultTree = await runSchematic(
'lib',
{ name: 'myLib', unitTestRunner: 'none' },
appTree
);
expect(
resultTree.exists('libs/my-lib/src/lib/my-lib.module.spec.ts')
).toBeFalsy();

View File

@ -1,13 +1,9 @@
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';
import { Tree, VirtualTree } from '@angular-devkit/schematics';
import { schematicRunner } from '@nrwl/schematics/src/utils/testing-utils';
describe('workspace', () => {
const schematicRunner = new SchematicTestRunner(
'@nrwl/schematics',
path.join(__dirname, '../../collection.json')
);
let appTree: Tree;
beforeEach(() => {

View File

@ -14,15 +14,11 @@ import {
createEmptyWorkspace,
AppConfig,
getLibConfig,
getAppConfig
getAppConfig,
runSchematic
} from '../../utils/testing-utils';
describe('ngrx', () => {
const schematicRunner = new SchematicTestRunner(
'@nrwl/schematics',
path.join(__dirname, '../../collection.json')
);
let appTree: Tree;
beforeEach(() => {
@ -32,17 +28,15 @@ describe('ngrx', () => {
});
it('should add empty root', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'ngrx',
{
name: 'state',
module: 'apps/myapp/src/app/app.module.ts',
onlyEmptyRoot: true
},
appTree
)
.toPromise();
const tree = await runSchematic(
'ngrx',
{
name: 'state',
module: 'apps/myapp/src/app/app.module.ts',
onlyEmptyRoot: true
},
appTree
);
const appModule = getFileContent(tree, '/apps/myapp/src/app/app.module.ts');
expect(
@ -51,23 +45,21 @@ describe('ngrx', () => {
expect(appModule).toContain('StoreModule.forRoot(');
expect(appModule).toContain(
'{ metaReducers: !environment.production ? [storeFreeze] : [] }'
'{ metaReducers : !environment.production ? [storeFreeze] : [] }'
);
expect(appModule).toContain('EffectsModule.forRoot');
});
it('should add root', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'ngrx',
{
name: 'app',
module: 'apps/myapp/src/app/app.module.ts',
root: true
},
appTree
)
.toPromise();
const tree = await runSchematic(
'ngrx',
{
name: 'app',
module: 'apps/myapp/src/app/app.module.ts',
root: true
},
appTree
);
[
'/apps/myapp/src/app/+state/app.actions.ts',
@ -96,22 +88,20 @@ describe('ngrx', () => {
expect(appModule).toContain('!environment.production ? [storeFreeze] : []');
expect(appModule).toContain('app: appReducer');
expect(appModule).toContain('initialState: { app: appInitialState }');
expect(appModule).toContain('initialState : { app : appInitialState }');
});
it('should add facade to root', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'ngrx',
{
name: 'app',
module: 'apps/myapp/src/app/app.module.ts',
root: true,
facade: true
},
appTree
)
.toPromise();
const tree = await runSchematic(
'ngrx',
{
name: 'app',
module: 'apps/myapp/src/app/app.module.ts',
root: true,
facade: true
},
appTree
);
const appModule = getFileContent(tree, '/apps/myapp/src/app/app.module.ts');
@ -125,7 +115,7 @@ describe('ngrx', () => {
expect(appModule).toContain('providers: [AppFacade]');
expect(appModule).toContain('app: appReducer');
expect(appModule).toContain('initialState: { app: appInitialState }');
expect(appModule).toContain('initialState : { app : appInitialState }');
[
'/apps/myapp/src/app/+state/app.actions.ts',
@ -144,17 +134,15 @@ describe('ngrx', () => {
it('should not add RouterStoreModule only if the module does not reference the router', async () => {
const newTree = createApp(appTree, 'myapp-norouter', false);
const tree = await schematicRunner
.runSchematicAsync(
'ngrx',
{
name: 'app',
module: 'apps/myapp-norouter/src/app/app.module.ts',
root: true
},
newTree
)
.toPromise();
const tree = await runSchematic(
'ngrx',
{
name: 'app',
module: 'apps/myapp-norouter/src/app/app.module.ts',
root: true
},
newTree
);
const appModule = getFileContent(
tree,
'/apps/myapp-norouter/src/app/app.module.ts'
@ -163,16 +151,14 @@ describe('ngrx', () => {
});
it('should add feature', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'ngrx',
{
name: 'state',
module: 'apps/myapp/src/app/app.module.ts'
},
appTree
)
.toPromise();
const tree = await runSchematic(
'ngrx',
{
name: 'state',
module: 'apps/myapp/src/app/app.module.ts'
},
appTree
);
const appModule = getFileContent(tree, '/apps/myapp/src/app/app.module.ts');
expect(appModule).toContain('StoreModule.forFeature');
@ -189,17 +175,15 @@ describe('ngrx', () => {
});
it('should add with custom directoryName', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'ngrx',
{
name: 'state',
module: 'apps/myapp/src/app/app.module.ts',
directory: 'myCustomState'
},
appTree
)
.toPromise();
const tree = await runSchematic(
'ngrx',
{
name: 'state',
module: 'apps/myapp/src/app/app.module.ts',
directory: 'myCustomState'
},
appTree
);
const appModule = getFileContent(tree, '/apps/myapp/src/app/app.module.ts');
expect(appModule).toContain('StoreModule.forFeature');
@ -214,18 +198,16 @@ describe('ngrx', () => {
});
it('should only add files', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'ngrx',
{
name: 'state',
module: 'apps/myapp/src/app/app.module.ts',
onlyAddFiles: true,
facade: true
},
appTree
)
.toPromise();
const tree = await runSchematic(
'ngrx',
{
name: 'state',
module: 'apps/myapp/src/app/app.module.ts',
onlyAddFiles: true,
facade: true
},
appTree
);
const appModule = getFileContent(tree, '/apps/myapp/src/app/app.module.ts');
expect(appModule).not.toContain('StoreModule');
@ -247,16 +229,14 @@ describe('ngrx', () => {
});
it('should update package.json', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'ngrx',
{
name: 'state',
module: 'apps/myapp/src/app/app.module.ts'
},
appTree
)
.toPromise();
const tree = await runSchematic(
'ngrx',
{
name: 'state',
module: 'apps/myapp/src/app/app.module.ts'
},
appTree
);
const packageJson = readJsonInTree(tree, 'package.json');
expect(packageJson.dependencies['@ngrx/store']).toBeDefined();
@ -268,16 +248,14 @@ describe('ngrx', () => {
it('should error when no module is provided', async () => {
try {
await schematicRunner
.runSchematicAsync(
'ngrx',
{
name: 'state',
module: ''
},
appTree
)
.toPromise();
await runSchematic(
'ngrx',
{
name: 'state',
module: ''
},
appTree
);
fail();
} catch (e) {
expect(e.message).toEqual('The required --module option must be passed');
@ -286,16 +264,14 @@ describe('ngrx', () => {
it('should error the module could not be found', async () => {
try {
await schematicRunner
.runSchematicAsync(
'ngrx',
{
name: 'state',
module: 'does-not-exist.ts'
},
appTree
)
.toPromise();
await runSchematic(
'ngrx',
{
name: 'state',
module: 'does-not-exist.ts'
},
appTree
);
} catch (e) {
expect(e.message).toEqual('Path does not exist: does-not-exist.ts');
}
@ -347,9 +323,9 @@ describe('ngrx', () => {
expect(content).toContain('UsersActionTypes');
expect(content).toContain("LoadUsers = '[Users] Load Users'");
expect(content).toContain("UsersLoaded = '[Users] Users Loaded'");
expect(content).toContain("UsersLoadError = '[Users] Users Load Error'");
expect(content).toContain(`LoadUsers = "[Users] Load Users"`);
expect(content).toContain(`UsersLoaded = "[Users] Users Loaded"`);
expect(content).toContain(`UsersLoadError = "[Users] Users Load Error"`);
expect(content).toContain('class LoadUsers implements Action');
expect(content).toContain('class UsersLoaded implements Action');
@ -422,12 +398,7 @@ describe('ngrx', () => {
[
`import { DataPersistence } from \'@nrwl/nx\'`,
`import {
LoadUsers,
UsersLoaded,
UsersLoadError,
UsersActionTypes
} from \'./users.actions\';`,
`import { LoadUsers, UsersLoaded, UsersLoadError, UsersActionTypes } from './users.actions';`,
`loadUsers$`,
`run: (action: LoadUsers, state: UsersPartialState)`,
`return new UsersLoaded([])`,
@ -457,17 +428,15 @@ describe('ngrx', () => {
it('should update the barrel API with exports for ngrx facade, selector, and reducer', async () => {
appTree = createLib(appTree, 'flights');
let libConfig = getLibConfig();
let tree = await schematicRunner
.runSchematicAsync(
'ngrx',
{
name: 'super-users',
module: libConfig.module,
facade: true
},
appTree
)
.toPromise();
let tree = await runSchematic(
'ngrx',
{
name: 'super-users',
module: libConfig.module,
facade: true
},
appTree
);
const barrel = tree.readContent(libConfig.barrel);
expect(barrel).toContain(
@ -478,17 +447,15 @@ describe('ngrx', () => {
it('should not update the barrel API with a facade', async () => {
appTree = createLib(appTree, 'flights');
let libConfig = getLibConfig();
let tree = await schematicRunner
.runSchematicAsync(
'ngrx',
{
name: 'super-users',
module: libConfig.module,
facade: false
},
appTree
)
.toPromise();
let tree = await runSchematic(
'ngrx',
{
name: 'super-users',
module: libConfig.module,
facade: false
},
appTree
);
const barrel = tree.readContent(libConfig.barrel);
expect(barrel).not.toContain(
@ -498,16 +465,14 @@ describe('ngrx', () => {
it('should produce proper tests for the ngrx reducer for a name with a dash', async () => {
const appConfig = getAppConfig();
const tree = await schematicRunner
.runSchematicAsync(
'ngrx',
{
name: 'super-users',
module: appConfig.appModule
},
appTree
)
.toPromise();
const tree = await runSchematic(
'ngrx',
{
name: 'super-users',
module: appConfig.appModule
},
appTree
);
const statePath = `${findModuleParent(appConfig.appModule)}/+state`;
const contents = tree.readContent(
@ -526,16 +491,14 @@ describe('ngrx', () => {
featureName: string = 'user',
withFacade = false
): Promise<UnitTestTree> {
return await schematicRunner
.runSchematicAsync(
'ngrx',
{
name: featureName,
module: appConfig.appModule,
facade: withFacade
},
appTree
)
.toPromise();
return await runSchematic(
'ngrx',
{
name: featureName,
module: appConfig.appModule,
facade: withFacade
},
appTree
);
}
});

View File

@ -1,18 +1,16 @@
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';
import { Tree, VirtualTree } from '@angular-devkit/schematics';
import { createEmptyWorkspace } from '../../utils/testing-utils';
import {
createEmptyWorkspace,
schematicRunner
} from '../../utils/testing-utils';
import { getFileContent } from '@schematics/angular/utility/test';
import * as stripJsonComments from 'strip-json-comments';
import { readJsonInTree } from '../../utils/ast-utils';
import { NxJson } from '../../command-line/shared';
describe('node-app', () => {
const schematicRunner = new SchematicTestRunner(
'@nrwl/schematics',
path.join(__dirname, '../../collection.json')
);
let appTree: Tree;
beforeEach(() => {

View File

@ -1,16 +1,15 @@
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';
import { Tree, VirtualTree } from '@angular-devkit/schematics';
import { createApp, createEmptyWorkspace } from '../../utils/testing-utils';
import {
createApp,
createEmptyWorkspace,
runSchematic
} from '../../utils/testing-utils';
import { getFileContent } from '@schematics/angular/utility/test';
import { readJsonInTree } from '../../utils/ast-utils';
describe('upgrade-module', () => {
const schematicRunner = new SchematicTestRunner(
'@nrwl/schematics',
path.join(__dirname, '../../collection.json')
);
let appTree: Tree;
beforeEach(() => {
@ -20,16 +19,14 @@ describe('upgrade-module', () => {
});
it('should update the bootstrap logic', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'upgrade-module',
{
name: 'legacy',
project: 'myapp'
},
appTree
)
.toPromise();
const tree = await runSchematic(
'upgrade-module',
{
name: 'legacy',
project: 'myapp'
},
appTree
);
const appModule = getFileContent(tree, '/apps/myapp/src/app/app.module.ts');
expect(appModule).toContain(
@ -53,16 +50,14 @@ describe('upgrade-module', () => {
})
);
const tree = await schematicRunner
.runSchematicAsync(
'upgrade-module',
{
name: 'legacy',
project: 'myapp'
},
appTree
)
.toPromise();
const tree = await runSchematic(
'upgrade-module',
{
name: 'legacy',
project: 'myapp'
},
appTree
);
const packageJson = readJsonInTree(tree, '/package.json');
expect(packageJson.dependencies['@angular/upgrade']).toEqual('4.4.4');
@ -79,51 +74,45 @@ describe('upgrade-module', () => {
})
);
const tree = await schematicRunner
.runSchematicAsync(
'upgrade-module',
{
name: 'legacy',
skipPackageJson: true,
project: 'myapp'
},
appTree
)
.toPromise();
const tree = await runSchematic(
'upgrade-module',
{
name: 'legacy',
skipPackageJson: true,
project: 'myapp'
},
appTree
);
const packageJson = readJsonInTree(tree, '/package.json');
expect(packageJson.dependencies['@angular/upgrade']).not.toBeDefined();
});
it('should add router configuration when --router=true', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'upgrade-module',
{
name: 'legacy',
router: true,
project: 'myapp'
},
appTree
)
.toPromise();
const tree = await runSchematic(
'upgrade-module',
{
name: 'legacy',
router: true,
project: 'myapp'
},
appTree
);
const legacySetup = getFileContent(tree, '/apps/myapp/src/legacy-setup.ts');
expect(legacySetup).toContain(`setUpLocationSync`);
});
it('should support custom angularJsImport', async () => {
const tree = await schematicRunner
.runSchematicAsync(
'upgrade-module',
{
name: 'legacy',
angularJsImport: 'legacy-app',
project: 'myapp'
},
appTree
)
.toPromise();
const tree = await runSchematic(
'upgrade-module',
{
name: 'legacy',
angularJsImport: 'legacy-app',
project: 'myapp'
},
appTree
);
const legacySetup = getFileContent(tree, '/apps/myapp/src/legacy-setup.ts');
expect(legacySetup).toContain(`import 'legacy-app';`);

View File

@ -1,14 +1,9 @@
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';
import { Tree, VirtualTree } from '@angular-devkit/schematics';
import { createEmptyWorkspace } from '../../utils/testing-utils';
import { createEmptyWorkspace, runSchematic } from '../../utils/testing-utils';
describe('workspace-schematic', () => {
const schematicRunner = new SchematicTestRunner(
'@nrwl/schematics',
path.join(__dirname, '../../collection.json')
);
let appTree: Tree;
beforeEach(() => {
@ -17,9 +12,11 @@ describe('workspace-schematic', () => {
});
it('should generate files', async () => {
const tree = await schematicRunner
.runSchematicAsync('workspace-schematic', { name: 'custom' }, appTree)
.toPromise();
const tree = await runSchematic(
'workspace-schematic',
{ name: 'custom' },
appTree
);
expect(tree.exists('tools/schematics/custom/index.ts')).toBeTruthy();
expect(tree.exists('tools/schematics/custom/schema.json')).toBeTruthy();
});

View File

@ -8,8 +8,8 @@ import {
} from '@angular-devkit/schematics';
import { format, resolveConfig, getFileInfo } from 'prettier';
import * as appRoot from 'app-root-path';
import { from } from 'rxjs';
import { filter, map, mergeMap } from 'rxjs/operators';
import { from, Observable } from 'rxjs';
import { concatMap, delay, filter, map, mergeMap } from 'rxjs/operators';
export function formatFiles(
options: { skipFormat: boolean } = { skipFormat: false }

View File

@ -1,6 +1,11 @@
import { Tree } from '@angular-devkit/schematics';
import { names } from './name-utils';
import { NxJson } from '../command-line/shared';
import {
SchematicTestRunner,
UnitTestTree
} from '@angular-devkit/schematics/testing';
import * as path from 'path';
export interface AppConfig {
appName: string; // name of app
@ -22,6 +27,21 @@ export function getLibConfig(): LibConfig {
return libConfig;
}
export const schematicRunner = new SchematicTestRunner(
'@nrwl/schematics',
path.join(__dirname, '../collection.json')
);
export function runSchematic(
name: string,
options: any,
tree: Tree
): Promise<UnitTestTree> {
return schematicRunner
.runSchematicAsync(name, { ...options, skipFormat: true }, tree)
.toPromise();
}
export function createEmptyWorkspace(tree: Tree): Tree {
tree.create(
'/angular.json',

17
scripts/check_format.sh Normal file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
echo "Checking prettier"
prettier "**/*.{ts,js,json,css,scss}" "!**/{__name__,__directory__}/**" --list-different
PRETTIER_STATUS=$?
echo "Checking CRLF"
find scripts -type f -exec file "{}" ";" | grep CRLF
SCRIPTS_STATUS=$?
find packages -type f -exec file "{}" ";" | grep CRLF
PACKAGES_STATUS=$?
if [[ $PRETTIER_STATUS -eq 1 || $SCRIPTS_STATUS -eq 0 || $PACKAGES_STATUS -eq 0 ]]; then
echo "Please run yarn format";
exit 1;
fi

View File

@ -9,3 +9,5 @@ if [ -n "$1" ]; then
else
jest --maxWorkers=1 ./build/e2e/schematics
fi

8
scripts/format.sh Normal file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
echo "Prettier"
prettier "**/*.{ts,js,json,css,scss,md}" "!**/{__name__,__directory__}/**" --write
echo "Line endings"
find packages -type f -print0 | xargs -0 dos2unix
find scripts -type f -print0 | xargs -0 dos2unix

View File

@ -3,9 +3,11 @@
if [ "$1" = "fast" ]; then
./scripts/build_for_test.sh
fi
if [ "$1" != "fast" ]; then
./scripts/build.sh
fi
rm -rf node_modules/@nrwl
cp -r build/packages node_modules/@nrwl

58
test.ts
View File

@ -1,29 +1,29 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
declare const require: any;
// Prevent Karma from running prematurely.
declare const __karma__: any;
__karma__.loaded = function() {};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
const context = (<any>require).context('./packages/nx', true, /\.spec\.js$/);
// And load the modules.
context.keys().map(context);
// Finally, start Karma to run the tests.
__karma__.start();
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
declare const require: any;
// Prevent Karma from running prematurely.
declare const __karma__: any;
__karma__.loaded = function() {};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
const context = (<any>require).context('./packages/nx', true, /\.spec\.js$/);
// And load the modules.
context.keys().map(context);
// Finally, start Karma to run the tests.
__karma__.start();

View File

@ -1,31 +1,30 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"outDir": "build",
"typeRoots": ["node_modules/@types"],
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"skipLibCheck": true,
"lib": ["es2017"],
"declaration": true,
"baseUrl": ".",
"paths": {
"@nrwl/schematics": ["./packages/schematics"],
"@nrwl/schematics/*": ["./packages/schematics/*"]
}
},
"exclude": [
"tmp",
"build",
"node_modules",
"packages/bazel",
"packages/schematics/src/*/files/**/*"
],
"angularCompilerOptions": {
"strictMetadataEmit": true,
"skipTemplateCodegen": true,
"annotationsAs": "decorators"
}
}
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"outDir": "build",
"typeRoots": ["node_modules/@types"],
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"skipLibCheck": true,
"lib": ["es2017"],
"declaration": true,
"baseUrl": ".",
"paths": {
"@nrwl/schematics": ["./packages/schematics"],
"@nrwl/schematics/*": ["./packages/schematics/*"]
}
},
"exclude": [
"tmp",
"build",
"packages/bazel",
"packages/schematics/src/*/files/**/*"
],
"angularCompilerOptions": {
"strictMetadataEmit": true,
"skipTemplateCodegen": true,
"annotationsAs": "decorators"
}
}

24750
yarn.lock

File diff suppressed because it is too large Load Diff