-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement ng add for store and effects packages #1067
Conversation
# Conflicts: # modules/effects/schematics-core/index.ts # modules/effects/schematics-core/templates/store/__path__/__statePath__/index.ts # modules/entity/schematics-core/index.ts # modules/router-store/schematics-core/index.tsa # modules/schematics-core/index.ts # modules/schematics/schematics-core/index.ts # modules/schematics/src/store/files/__path__/__statePath__/index.ts # modules/schematics/src/store/files/__statePath__/index.ts # modules/store-devtools/schematics-core/index.ts # modules/store/schematics-core/index.ts
@@ -0,0 +1,18 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this file. The npm_package
already has a default tsconfig.json` to use
addPackageToPackageJson, | ||
platformVersion, | ||
parseName, | ||
} from '../../schematics-core'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the @ngrx/schematics/schematics-core
import here
appTree = createWorkspace(schematicRunner, appTree); | ||
}); | ||
|
||
it('should update package.json', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a test for the skipPackageJson
option
modules/store/package.json
Outdated
@@ -19,8 +22,11 @@ | |||
"homepage": "https://github.com/ngrx/platform#readme", | |||
"peerDependencies": { | |||
"@angular/core": "NG_VERSION", | |||
"@angular-devkit/core": "NG_DEVKIT_VERSION", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove these from the package.json
as we are treating them as implicit dependencies instead of adding additional dependencies to @ngrx/store
.prettierignore
Outdated
@@ -1,5 +1,7 @@ | |||
/dist | |||
/modules/schematics/src/*/files/* | |||
/modules/schematics-core/templates/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change templates
to files
so its consistent with schematics. If we want to change files
to templates
across the board, we'll do that in a separate PR.
@@ -0,0 +1,34 @@ | |||
package(default_visibility = ["//visibility:public"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be added to the packages
section in the modules/store/BUILD
file in the npm_package
. That way its output gets copied into the distribution.
I left some feedback. I'd rather have 2 copies of the store schematics template files, then put them into the |
Thanks for the review, will work on changes. Regarding templates, I also not sure about keeping them in core, just thought that it could be good to have the only source. |
Since its only one file, I think it will be ok to have 2 copies. |
const relativePath = buildRelativePath(modulePath, statePath); | ||
const environmentsPath = buildRelativePath( | ||
statePath, | ||
`/${options.path}/environments/environment` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addPackageToPackageJson, | ||
platformVersion, | ||
parseName, | ||
} from '@ngrx/schematics/schematics-core'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be @ngrx/store/schematics-core
modules/store/package.json
Outdated
@@ -21,6 +24,7 @@ | |||
"@angular/core": "NG_VERSION", | |||
"rxjs": "RXJS_VERSION" | |||
}, | |||
"schematics": "./schematics/collection.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add this replacement to /tools/default.bzl
Added a couple more changes, otherwise I think this is ready to implement in the other packages. |
Implementation of #920 WIP.
This is the implementation of @ngrx/store ng-add module to get feedback, cause other
ng-add
s will be done in a similar way.Done:
@ngrx/store
asdependency
topackage.json
(idea from https://github.com/angular/material2/tree/master/src/lib/schematics)ng-add
doesn't import and initializeStoreDevtoolsModule
(imho should be done nystore-devtools
ng-add)Additional code share optimizations could be performed later, after initial implementation.
Will work on other modules after gathering a feedback.