488 Commits

Author SHA1 Message Date
--get
25b6e616df fix(schematics): remove duplicate schematics dep after ng-add 2018-10-03 20:01:19 -04:00
Cristian Martinez
08c994a74c style(schematics): add empty line after imports
fix #614
2018-10-03 20:00:07 -04:00
Jason Jean
9b8755a327 feat(schematics): add schematics for node apps 2018-10-01 20:31:39 -04:00
skydever
039c1510d9 fix(schematics): clean outDir to avoid blueprint leaks 2018-09-28 13:19:00 -04:00
--get
c9d3f97b9f feat(schematics): update @angular/cli to 6.2.3 and ngrx 6.1.0 2018-09-28 13:14:45 -04:00
--get
ac7cc3b113 tests(schematic): add back unit tests for ng-add 2018-09-28 12:01:56 -04:00
ben
efe38c47a7 fix(ngrx): add store typing
This adds the `<%= className%>PartialState` used to type the store from the
`DataPersistence` methods.
This adds the `XXX_FEATURE_KEY` to the `xxx.reducer.ts` file too.

close #748
2018-09-28 12:01:34 -04:00
ben
e63e787704 fix(schematics): use ngrx pipe select operator
This update the way the Facade select a slice of the Store using the
select operator through the pipe, contrary to the `.select()` which is
now deprecated.
2018-09-28 12:01:19 -04:00
--get
4ed154d11d fix(schematics): update jest-preset-angular to 6.0.1 2018-09-21 06:55:54 -04:00
skydever
97b773789b fix(schematics): remove polyfill.ts from tsconfig.spec.json (jest-project) 2018-09-19 13:16:35 -04:00
Jason Jean
f19810a890 fix(schematics): remove tsconfig.spec.json linting for non-karma apps (#766) 2018-09-17 09:55:39 -04:00
Jason Jean
d6ff7244c7 feat(schematics): allow generation of app with jest unit testing (#764)
This PR requires https://github.com/nrwl/nx/pull/758

## Current Behavior

The option to generate an application with a unit-test-runner of jest is not available

## Expected Behavior

User is able to generate an application which uses jest to run unit tests via:
```sh
ng g jest
ng g app jest-app --unit-test-runner jest
ng test jest-app
```
2018-09-14 11:59:49 -04:00
Thomas Skalnik
9fd399348f fix(schematics): do not modify tests when skipTests is set 2018-09-14 11:59:30 -04:00
Jason Jean
f960d5aba2 fix(schematics): normalize paths passed to offsetFromRoot (#758) 2018-09-14 11:07:34 -04:00
Hernan Magrini
5ccaef93d4 feat(schematics): add SCSS/CSS support via Prettier 2018-08-29 13:36:06 -04:00
Jason Jean
5a547ccadd feat(schematics): add schematics for jest 2018-08-29 11:44:39 -04:00
--get
e608211f46 fix(schematics): fix migration version 2018-08-29 08:08:03 -04:00
ben
84686d94c4 fix(command-line): format split in chunks patterns
The format command now splits all the array containing all the urls and patterns given, in smaller chunks arrays, executing the command on each chunks. This prevent to have too long argument on the command for the terminal, which can lead to error on specific OS. The chaining of command is transparent for the user.

close #511
2018-08-23 12:29:52 -04:00
ben
f93d8e3d36 fix(command-line): add ng command test on affected parallel
When running the affected command with the `--parallel` option, `npm-run-all` is used to achieve the parallel execution of the desired tasks. Because of the use of `npm-run-all`, the `ng` command should be visible and declared as script command in the `package.json` of your project.

This adds a verification before runing the command with the `--parallel` option to make sure the `package.json` has the `ng: "ng"` command in the `scripts` section.

close #700
2018-08-23 11:24:55 -04:00
ben
9c10fa7db2 build(package.json): run prettier before commit
This adds a hook to the git command to run prettier on the staged files, before committing. Prettier
has now more broad and general rules with excluded folder and more files to correct.
2018-08-23 09:59:04 -04:00
Jason Jean
0788a81322 feat(builders): introduce builders package and jest builder 2018-08-22 11:13:54 -04:00
Victor Savkin
c57832dfda fix(schematics): pin the version of the cli 2018-08-21 16:04:20 -04:00
ben
f2cea959b1 chore(schematics): remove console.log 2018-08-21 07:10:30 -04:00
Jason Jean
b97d30536e build: copy license from root into each dist 2018-08-20 11:39:49 -04:00
Jason Jean
0a1423a732 fix(schematics): support migrating projects with root != name from 1.7 2018-08-20 11:39:27 -04:00
ben
cca6b9f03b fix(schematics): set lib npmScope when publishable
Update the lib's `package.json` name with the right prefix, when generating a lib
with the `publishable` option set to 'true'.

close #677
2018-08-20 11:37:54 -04:00
ben
22c9fb5c3b fix(schematics): speed up the dry-run command
Currently the `dry-run` command speed is on an average of:
* `ng g app app_name --dry-run`: 7099.051ms to 7207.579ms;
* `ng g lib lib_name --dry-run`: 4015.622ms to 3881.893ms;

This is due to too many files in the tree. While performing the transformation required
by the schematic, the tree inclues files in the _node_modules, .git, .idea, .vscode_ folders.
These files are not needed and impact the performance of the commandline.

This add a filter function on the tree, before anything is moved. With that filter function
the average speed is:
* `ng g app app_name --dry-run`: 1420.826ms to 1435.487ms;
* `ng g lib lib_name --dry-run`: 1382.279ms to 1413.042ms;

close #706
2018-08-20 11:36:50 -04:00
Thomas Burleson
1d108d6921 update(schematics): ngrx facade needs correct store type
When injecting a store reference, the store state should be an inline type
based on the feature key that was registered with `StoreModule.forFeature(...)`.

Consider the facade generated for feature 'cars':

```ts
StoreModule.forFeature('cars', carsReducer, { initialState: carsInitialState })
```

```ts
@Injectable()
export class CarsFacade {
  constructor( private store: Store<{cars: CarsState}> ) { }
}
```
2018-08-15 17:39:37 -04:00
Jimmy Reichley
d779d2bcc1 feat(schematics): allow nx projects to specify implicitDependencies
implicitDependencies between files and projects are already able to be
specified in nx.json, so this adds the ability to specify implicitDependencies
between one project and (multiple) others.

By extension, this also enables a more flexible e2e suite naming
convention than was previously supported.

Closes #665
2018-08-15 17:39:14 -04:00
ben
b1b0207496 fix(schematics): support app gen with inline-template
This adds the support to generate an application with the `inline-template` flag activated.
Two new utils added: `getDecoratorPropertyValueNode` & `replaceNodeValue`.
Add some tests ensure to test the two ways of generating template, using `templateUrls` and `inlineTemplate`.
Tests are unising the flag `inlineTemplate`.

close #519
2018-08-15 13:51:41 -04:00
Jason Jean
ba5777735f fix(schematics): set typescript version consistent with angular cli 2018-08-13 20:13:13 -04:00
Steven
7d8ec2cefd fix(schematics): use correct action type for LoadError
The `LoadError` action was mapped to the `Load<%= className %>` action type rather than `<%= className %>LoadError`.
2018-08-13 20:12:45 -04:00
Jason Jean
84636913d7 fix(schematics): update version in legacy migration to 6.2.0 2018-08-13 20:12:05 -04:00
Jason Jean
63e0b49ccf fix(schematics): remove karma.conf.ts from tsconfigs 2018-08-13 20:11:22 -04:00
Jason Jean
aca8aa1e8d fix(schematics): fix devkit version for ng-new 2018-08-13 20:09:05 -04:00
Jason Jean
6560db75f7 feat(schematics): add install task for ngrx schematics 2018-08-13 20:08:35 -04:00
Jason Jean
edba67f728 fix(schematics): update other @angular framework packages when updating 2018-08-13 16:10:57 -04:00
Jason Jean
7bb583234b fix(schematics): do not use tsconfig updates from angular lib schematic 2018-08-04 08:39:13 -04:00
Jason Jean
b5550d367c fix(schematics): set versions consistent with cli 6.1.2 2018-08-04 08:37:43 -04:00
Thomas Burleson
8334c200a7 fix(schematics): library schematic properly removes extra files
Angular CLI now supports `host.delete()`. `updateProject()` now properly removes
the library generated service and component files.

>  Earlier workarounds using `unlink()` were not working.

Refs #650.
2018-08-03 17:01:19 -04:00
Victor Savkin
bdcb0a703f fix(schematics): update create-nx-workspace to ues the right version of the cli 2018-08-03 16:15:55 -04:00
Victor Savkin
bff43776b5 fix(build): relax peerDependencies to enable seamless upgrade 2018-08-02 15:32:37 -04:00
Victor Savkin
d3362e06c8 feat(schematics): add the packageManager property to ngNew 2018-08-02 13:39:20 -04:00
Jason Jean
205e7ad7ef feat(schematics): support @angular/cli@6.1.1 2018-08-02 13:39:19 -04:00
Mitko Tschimev
1f7d5477a4 fix(schematics): check touchedFile path against the project files 2018-08-02 13:39:00 -04:00
Thomas Burleson
57d6b0bd93 feat(ngrx): add support for NgRx Facade classes
Add support to generate NgRx facade classes when the command `--facade` boolean option
is used.

```console
ng g ngrx <feature> --facade
```

> Note this will not generate facades for existing ngrx features; this option
is currently only available for *new* ngrx scaffolding.

* Add code generators for `<feature>.facade.ts` + `<feature>.facade.spec.ts`

Fixes #629. Fixes #638.

use entity
2018-07-29 13:42:44 -04:00
Thomas Burleson
aa1b7766c5 fix(ngrx): fix lint issues in schematic templates
The ngrx schematic templates have some minor lint errors that manfiest in new ngrx generated code.

*  In the ngrx e2e tests, add check for tsLint errors in the generated code
*  Fix lint issues for the upgrade-module and associated tests.
2018-07-29 11:30:04 -04:00
swseverance
e1984fa40e fix(schematics): update devDependencies (#637)
* Move @ngrx/store-devtools and ngrx-store-freeze' to devDependencies
2018-07-22 12:30:31 -05:00
Thomas Burleson
04e99b06ae fix(schematics): ngrx schematics should generate enhanced ngrx files
@nrwl/schematics no longer uses the @ngrx/schematics to generate NgRx feature files.
*  `ngrx/files/__directory__` templates are used
*  Templates replicate the simple outputs generated from @ngrx/schematics:feature
*  Templates add significant Nx enhancements.

The following standard files will be scaffolded:
* `<feature>.actions.ts`
* `<feature>.effects.ts` + `<feature>.effects.spec.ts`
* `<feature>.reducer.ts` + `<feature>.reducer.spec.ts`

The following new files will also be scaffolded:
* `<feature>.selectors.ts` +  `<feature>.selectors.spec.ts`

Changes include:

* Change the action/enums to generate a trio of enums for each *feature*: `Load<Feature>`, `<Feature>Loaded`, and `<Feature>LoadError`
* Add code generators for `<feature>.selectors.ts`
* Add code generators for unit and integration testing `*.spec.ts` files
* Update the public barrel [`index.ts`] when adding ngrx to a library
* Use `StoreModule.forFeature()` when adding ngrx feature (without using the `--root` option)
* Use the Effect to respond tp `load<Feature>$` and dispatch `<Feature>Loaded` or `<Feature>LoadError`
* Update the Action to export `<feature>Actions` map of all action classes
* fix `ng-add.test.ts` tests for latest Angular CLI scaffolding
* fix `application.spec.ts` expect fails

Fixes #472,  Fixes #618,  Fixes #317,  Fixes #561, Refs #380.
2018-07-21 21:13:48 -04:00
--get
a55412caae fix(schematics): fix breaking cli by installing globally via yarn 2018-07-20 12:03:14 -04:00