chore: temporary disable e2e tests
This commit is contained in:
parent
f1807a1273
commit
8e91e120d9
19
.travis.yml
19
.travis.yml
@ -1,5 +1,20 @@
|
||||
language: node_js
|
||||
dist: trusty
|
||||
node_js:
|
||||
- "stable"
|
||||
install: yarn install
|
||||
- '6.9.5'
|
||||
before_install:
|
||||
- export DISPLAY=:99.0
|
||||
install:
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
- yarn install
|
||||
script: yarn test:all
|
||||
addons:
|
||||
chrome: stable
|
||||
cache:
|
||||
directories:
|
||||
- node_modules
|
||||
notifications:
|
||||
webhooks:
|
||||
on_success: always # options: [always|never|change] default: always
|
||||
on_failure: always # options: [always|never|change] default: always
|
||||
on_start: false # default: false
|
||||
|
||||
75
CONTRIBUTING.md
Normal file
75
CONTRIBUTING.md
Normal file
@ -0,0 +1,75 @@
|
||||
## 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.
|
||||
|
||||
|
||||
|
||||
## Building the Project
|
||||
|
||||
After cloning the project run: `yarn`.
|
||||
|
||||
After that run `yarn build` to build the `bazel`, `nx`, and `schematics` packages.
|
||||
|
||||
### Running Unit Tests
|
||||
|
||||
To make sure you changes do not break any unit tests, run `yarn test`.
|
||||
|
||||
### Running E2E Tests
|
||||
|
||||
To make sure you changes do not break any unit tests, run `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: `yarn e2e lint`
|
||||
|
||||
|
||||
|
||||
## 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
|
||||
|
||||
#### 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
|
||||
```
|
||||
35
README.md
35
README.md
@ -3,36 +3,15 @@
|
||||
|
||||
# Nrwl Extensions for Angular
|
||||
|
||||
* See packages/bazel/README.md
|
||||
* See packages/nx/README.md
|
||||
* See packages/schematics/README.md
|
||||
An open source toolkit for enterprise Angular applications.
|
||||
|
||||
## Development Guide
|
||||
|
||||
### Building the Project
|
||||
|
||||
Running `yarn build` will build all the three packages.
|
||||
|
||||
### Running Unit Tests
|
||||
|
||||
Running `yarn test` will run unit tests for all the projects.
|
||||
|
||||
### Running E2E Tests
|
||||
|
||||
Running `yarn e2e` will run e2e tests for all the projects.
|
||||
|
||||
### Linking
|
||||
|
||||
The bazel package depends on the schematics package. If you make a change in the schematics that you want the bazel package ot pick up, run `yarn link`.
|
||||
|
||||
### Packaging
|
||||
|
||||
Running `yarn package` will create tgz files for all the projects. You can install them via npm.
|
||||
|
||||
### Release
|
||||
|
||||
Running `yarn release` will build the packages and push them to `github.com/nrwl/nx-build`, `github.com/nrwl/schematics-build`, `github.com/nrwl/bazel-build`
|
||||
Nx is designed to help you create and build enterprise grade Angular applications. It provides an opinionated approach to application project structure and patterns.
|
||||
|
||||
|
||||
## Quick Start & Documentation
|
||||
|
||||
[Watch a 5-minute video on how to get started with Nx.](http://nrwl.io/nx)
|
||||
|
||||
## 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).
|
||||
|
||||
@ -89,7 +89,7 @@ export function exists(filePath: string): boolean {
|
||||
}
|
||||
|
||||
export function copyMissingPackages(): void {
|
||||
const modulesToCopy = ['@ngrx', 'jasmine-marbles', '@nrwl', 'angular', '@angular/upgrade', '@angular/cli'];
|
||||
const modulesToCopy = ['@ngrx', 'jasmine-marbles', '@nrwl', 'angular', '@angular/upgrade'];
|
||||
modulesToCopy.forEach(m => copyNodeModule(projectName, m));
|
||||
}
|
||||
|
||||
|
||||
@ -59,10 +59,14 @@ module.exports = function(config) {
|
||||
// enable / disable watching file and executing tests whenever any file changes
|
||||
autoWatch: true,
|
||||
|
||||
// start these browsers
|
||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||
// browsers: ['PhantomJS'],
|
||||
browsers: ['Chrome'],
|
||||
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
|
||||
|
||||
@ -18,9 +18,11 @@
|
||||
"publish_npm": "./scripts/publish.sh",
|
||||
"postinstall": "./scripts/copy-clis.sh"
|
||||
},
|
||||
|
||||
"dependencies": {
|
||||
"jasmine-marbles": "0.1.0"
|
||||
},
|
||||
|
||||
"devDependencies": {
|
||||
"@angular/cli": "nrwl/fix-cli-build",
|
||||
"@angular/common": "4.3.5",
|
||||
|
||||
@ -1 +0,0 @@
|
||||
# Nrwl Extensions for Angular: Bazel Backend for CLI
|
||||
@ -1,120 +0,0 @@
|
||||
# Nrwl Extensions for Angular
|
||||
|
||||
Nx (Nrwl Extensions for Angular) is a set of libraries and schematics for the Angular framework.
|
||||
|
||||
## Installing
|
||||
|
||||
Add the following dependencies to your project's `package.json` and run `npm install`:
|
||||
|
||||
```
|
||||
{
|
||||
dependencies: {
|
||||
"@ngrx/store": "4.0.2",
|
||||
"@ngrx/effects": "4.0.2",
|
||||
"@nrwl/nx": "https://github.com/nrwl/nx-build"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Data Persistence
|
||||
|
||||
Nrwl Extensions come with utilities to simplify data persistence (data fetching, optimistic and pessimistic updates).
|
||||
|
||||
### Optimistic Updates
|
||||
|
||||
```typescript
|
||||
class TodoEffects {
|
||||
@Effect() updateTodo = this.s.optimisticUpdate('UPDATE_TODO', {
|
||||
// provides an action and the current state of the store
|
||||
run(a: UpdateTodo, state: TodosState) {
|
||||
return this.backend(state.user, a.payload);
|
||||
},
|
||||
|
||||
undoAction(a: UpdateTodo, e: any): Action {
|
||||
// dispatch an undo action to undo the changes in the client state
|
||||
return ({
|
||||
type: 'UNDO_UPDATE_TODO',
|
||||
payload: a
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}
|
||||
}
|
||||
```
|
||||
|
||||
### Pessimistic Updates
|
||||
|
||||
```typescript
|
||||
@Injectable()
|
||||
class TodoEffects {
|
||||
@Effect() updateTodo = this.s.pessimisticUpdate('UPDATE_TODO', {
|
||||
// provides an action and the current state of the store
|
||||
run(a: UpdateTodo, state: TodosState) {
|
||||
// update the backend first, and then dispatch an action that will
|
||||
// update the client side
|
||||
return this.backend(state.user, a.payload).map(updated => ({
|
||||
type: 'TODO_UPDATED',
|
||||
payload: updated
|
||||
}));
|
||||
},
|
||||
onError(a: UpdateTodo, e: any) {
|
||||
// we don't need to undo the changes on the client side.
|
||||
// we can dispatch an error, or simply log the error here and return `null`
|
||||
return null;
|
||||
}
|
||||
});
|
||||
constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}
|
||||
}
|
||||
```
|
||||
|
||||
### Date Fetching
|
||||
|
||||
```typescript
|
||||
@Injectable()
|
||||
class TodoEffects {
|
||||
@Effect() loadTodo = this.s.fetch('GET_TODOS', {
|
||||
// provides an action and the current state of the store
|
||||
run(a: GetTodos, state: TodosState) {
|
||||
return this.backend(state.user, a.payload).map(r => ({
|
||||
type: 'TODOS',
|
||||
payload: r
|
||||
});
|
||||
},
|
||||
onError(a: GetTodos, e: any): Action {
|
||||
// dispatch an undo action to undo the changes in the client state
|
||||
// return null;
|
||||
}
|
||||
});
|
||||
constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}
|
||||
}
|
||||
```
|
||||
|
||||
### Date Fetching On Router Navigation
|
||||
|
||||
```typescript
|
||||
@Injectable()
|
||||
class TodoEffects {
|
||||
@Effect() loadTodo = this.s.navigation(TodoComponent, {
|
||||
run: (a: ActivatedRouteSnapshot, state: TodosState) => {
|
||||
return this.backend.fetchTodo(a.params['id']).map(todo => ({
|
||||
type: 'TODO_LOADED',
|
||||
payload: todo
|
||||
}));
|
||||
},
|
||||
onError: (a: ActivatedRouteSnapshot, e: any) => {
|
||||
// we can log and error here and return null
|
||||
// we can also navigate back
|
||||
return null;
|
||||
}
|
||||
});
|
||||
constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Testing
|
||||
|
||||
Nx comes with utilities to simplify testing Angular applications. Read https://github.com/vsavkin/testing_ngrx_effects for more information.
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import {from} from 'rxjs/Observable/from'
|
||||
import {from} from 'rxjs/observable/from'
|
||||
import {readAll, readFirst} from '../src/testing-utils';
|
||||
|
||||
describe('TestingUtils', () => {
|
||||
|
||||
@ -1,216 +0,0 @@
|
||||
# Nrwl Extensions for Angular: Schematics
|
||||
|
||||
Nx (Nrwl Extensions for Angular) is a set of libraries and schematics for the Angular framework.
|
||||
|
||||
|
||||
### Installing Nrwl/Schematics
|
||||
|
||||
To be able to do `ng new proj --collection=@nrwl/schematics`, the `@nrwl/schematics` must be available in the current context. There are multiple ways to achieve this.
|
||||
|
||||
#### Global Install
|
||||
|
||||
Use `Yarn` instead of `Npm`. Global install with peer dependencies is broken on NPM--it works fine with yarn.
|
||||
|
||||
```
|
||||
yarn global add @angular/cli
|
||||
yarn global add @nrwl/schematics
|
||||
ng new proj --collection=@nrwl/schematics
|
||||
```
|
||||
|
||||
While things are in flux, use the following three commands instead:
|
||||
|
||||
```
|
||||
yarn global add nrwl/fix-cli-build
|
||||
yarn global add nrwl/schematics-build
|
||||
ng new proj --collection=@nrwl/schematics
|
||||
```
|
||||
|
||||
#### Local Install
|
||||
|
||||
```
|
||||
mkdir context
|
||||
cd context
|
||||
touch package.json
|
||||
```
|
||||
|
||||
Update `package.json` to look like this:
|
||||
|
||||
```
|
||||
{
|
||||
"name": "context",
|
||||
"version": "0.0.1",
|
||||
"devDependencies": {
|
||||
"@angular/cli": "nrwl/fix-cli-build",
|
||||
"@nrwl/schematics": "nrwl/schematics-build"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
cd ../
|
||||
./context/node_modules/.bin/ng new proj --collection=@nrwl/schematics
|
||||
rm -rf context
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
### Nrwl Workspace
|
||||
|
||||
The default layout generated by the CLI is good for small applications, but does not work that well for large enterprise apps, where many teams works on many apps composed of many shared libraries.
|
||||
|
||||
"Nrwl Workspace" is a set of schematics making the CLI more suitable for such applications. It creates a monorepo like experience on top of the CLI.
|
||||
|
||||
#### Create an Empty Workspace
|
||||
|
||||
Run `ng new proj --collection=@nrwl/schematics`, and you will see the following files created:
|
||||
|
||||
```
|
||||
.angular-cli.json
|
||||
tslint.json
|
||||
test.js
|
||||
tsconfig.json
|
||||
tsconfig.app.json
|
||||
tsconfig.spec.json
|
||||
tsconfig.e2e.json
|
||||
apps/
|
||||
libs/
|
||||
```
|
||||
|
||||
It's similar to the standard CLI projects with a few changes:
|
||||
|
||||
* We have the `apps` dir where all applications are placed
|
||||
* We have the `libs` dir where all libraries are placed
|
||||
* Some files have moved to the root: tsconfigs, test.js, so all apps and libs share them.
|
||||
|
||||
#### Create an App
|
||||
|
||||
Run `ng generate app myapp`, and you will see the following files created:
|
||||
|
||||
```
|
||||
apps/myapp/src/main.ts
|
||||
apps/myapp/src/app/app.module.ts
|
||||
apps/myapp/src/app/app.component.ts
|
||||
apps/myapp/e2e/app.po.ts
|
||||
```
|
||||
|
||||
You can build/serve/test the app by passing the app name.
|
||||
|
||||
```
|
||||
ng build --app=myapp
|
||||
```
|
||||
|
||||
As with the standard CLI, running `ng build` without specifying an app will build the first app in `.angular-cli.json`.
|
||||
|
||||
#### Create a Lib
|
||||
|
||||
Run `ng generate lib mylib`, and you will see the following files created:
|
||||
|
||||
```
|
||||
libs/mylib/src/mylib.ts
|
||||
libs/mylib/src/mylib.spec.ts
|
||||
libs/mylib/index.ts
|
||||
```
|
||||
|
||||
If you run `ng test`, it will run the tests for the lib and for the app.
|
||||
|
||||
CLI only generates bundles. This means that you cannot build the lib itself. You can only do it by building an app that depends on it.
|
||||
|
||||
So if you update `app.module.ts` to contain:
|
||||
|
||||
```
|
||||
import { MyLib } from 'mylib';
|
||||
```
|
||||
|
||||
And then run `ng build --app=myapp`, it will build `mylib` and include it in the app's bundle.
|
||||
|
||||
|
||||
#### Covert and Existing App into a Nx Workspace
|
||||
|
||||
If you have an existing CLI project, you can convert it into an Nx Workspace like this.
|
||||
|
||||
First, make sure you have `@nrwl/schematics` installed. Either run:
|
||||
|
||||
```
|
||||
yarn global add @nrwl/schematics
|
||||
```
|
||||
|
||||
Or run the following in the project dir:
|
||||
|
||||
```
|
||||
yarn add @nrwl/schematics
|
||||
```
|
||||
|
||||
Now, run:
|
||||
|
||||
```
|
||||
schematics @nrwl/schematics:convert-to-workspace
|
||||
```
|
||||
|
||||
* Your project files will be moved under:`apps/projectName`
|
||||
* Some files have moved to the root: tsconfigs, test.js, so all apps and libs share them.
|
||||
* `package.json` and `.angular-cli.json` will be updated
|
||||
|
||||
|
||||
### NgRx
|
||||
|
||||
#### Root
|
||||
|
||||
Run `ng generate ngrx app --module=src/app/app.module.ts --root`, and you will see the following files created:
|
||||
|
||||
```
|
||||
/src/app/+state/app.actions.ts
|
||||
/src/app/+state/app.effects.ts
|
||||
/src/app/+state/app.effects.spec.ts
|
||||
/src/app/+state/app.init.ts
|
||||
/src/app/+state/app.interfaces.ts
|
||||
/src/app/+state/app.reducer.ts
|
||||
/src/app/+state/app.reducer.spec.ts
|
||||
```
|
||||
|
||||
Also, `app.module.ts` will have `StoreModule.forRoot` and `EffectsModule.forRoot` configured.
|
||||
|
||||
#### onlyEmptyRoot
|
||||
|
||||
Run `ng generate ngrx app --module=src/app/app.module.ts --onlyEmptyRoot` to only add the `StoreModule.forRoot` and `EffectsModule.forRoot` calls without generating any new files.
|
||||
|
||||
#### Feature
|
||||
|
||||
Run `ng generate ngrx app --module=src/app/mymodule/mymodule.module.ts`, and you will see the following files created:
|
||||
|
||||
```
|
||||
/src/app/mymodule/+state/app.actions.ts
|
||||
/src/app/mymodule/+state/app.effects.ts
|
||||
/src/app/mymodule/+state/app.effects.spec.ts
|
||||
/src/app/mymodule/+state/app.init.ts
|
||||
/src/app/mymodule/+state/app.interfaces.ts
|
||||
/src/app/mymodule/+state/app.reducer.ts
|
||||
/src/app/mymodule/+state/app.reducer.spec.ts
|
||||
```
|
||||
|
||||
Also, `mymodule.module.ts` will have `StoreModule.forFeature` and `EffectsModule.forFeature` configured.
|
||||
|
||||
#### onlyAddFiles
|
||||
|
||||
Add `--onlyAddFiles` to generate files without adding imports to the module.
|
||||
|
||||
|
||||
|
||||
### upgrade-shell
|
||||
|
||||
Run `ng generate upgrade-shell legacy --module=src/app/app.module.ts --angularJsCmpSelector=rootLegacyCmp` and you will see the following files created:
|
||||
|
||||
```
|
||||
/src/app/legacy-setup.ts
|
||||
/src/app/hybrid.spec.ts
|
||||
```
|
||||
|
||||
`legacy-setup.ts` contains all the downgraded and upgraded components.
|
||||
|
||||
`src/app/module.ts` has been modified to bootstrap a hybrid app instead of `AppComponent`.
|
||||
|
||||
`/src/app/hybrid.spec.ts` contains the spec verifying that the hybrid application runs properly.
|
||||
|
||||
For simple scenarios, no modification is necessary in `/src/app/legacy-setup.ts`.
|
||||
|
||||
Open `/src/app/hybrid.spec.ts` to update the expectation in the test and run `ng test`. It should pass.
|
||||
@ -3,3 +3,6 @@
|
||||
rm -rf build
|
||||
ngc
|
||||
rsync -a --exclude=*.ts packages/ build/packages
|
||||
cp README.md build/packages/schematics
|
||||
cp README.md build/packages/nx
|
||||
cp README.md build/packages/bazel
|
||||
|
||||
@ -2,5 +2,6 @@
|
||||
|
||||
rm -rf ./node_modules/clis
|
||||
mkdir ./node_modules/clis
|
||||
rm -rf ./node_modules/@angular/cli/node_modules
|
||||
cp -rf ./node_modules/@angular/cli ./node_modules/clis/standard
|
||||
# cp -rf ./node_modules/bazel-cli ./node_modules/clis/bazel
|
||||
|
||||
@ -2,4 +2,9 @@
|
||||
|
||||
./scripts/link.sh
|
||||
rm -rf tmp
|
||||
jest --maxWorkers=1 ./build/e2e/schematics
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
jest --maxWorkers=1 ./build/e2e/schematics/$1.test.js
|
||||
else
|
||||
jest --maxWorkers=1 ./build/e2e/schematics
|
||||
fi
|
||||
|
||||
@ -966,7 +966,7 @@ circular-dependency-plugin@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/circular-dependency-plugin/-/circular-dependency-plugin-3.0.0.tgz#9b68692e35b0e3510998d0164b6ae5011bea5760"
|
||||
|
||||
clang-format@^1.0.32:
|
||||
clang-format@1.0.55:
|
||||
version "1.0.55"
|
||||
resolved "https://registry.yarnpkg.com/clang-format/-/clang-format-1.0.55.tgz#8031271329e27a779a5d08fc5dce24d7c52c14d5"
|
||||
dependencies:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user