Skip to content
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: add schematics #2032

Merged
merged 12 commits into from
Sep 15, 2023

Conversation

dmitry-stepanenko
Copy link
Contributor

@dmitry-stepanenko dmitry-stepanenko commented Jul 10, 2023

This PR is based on progress made in the following branches:
https://github.com/ngxs/store/tree/feature/schematics-2023
https://github.com/ngxs/store/tree/feature/schematics-migration

Currently, available targets:

  • actions: adds an action as file
  • ng-add: setups NGXS store with option to:
    • choose plugins to use
    • add imports to app.module.ts
  • starter-kit: creates actions and state to an existing project
  • state: create a state file with a selector
  • store: similar to above but with action handler and an action file

poloagustin and others added 7 commits April 9, 2023 20:34
…gxs#1827)

* test(store): fix jest config - update ignored patterns

- [x] exclude template files with 'spec' in file name when executing unit tests;

* fix(store): update excluded patterns in eslintignore

- [x] exclude template files from eslint check;

* fix(tslint): update tslint excludes

- [x] exclude template files form tslint check;
…ts (ngxs#1838)

* feat(ngadd): improve the ngxs ng-add schema and factory, add unit test

- [x] update the lib.config - add more available ngxs plugins;
- [x] ng-add schema - add selectable packages, add optional application project name;
- [x] ng-add factory - add selectable ngxs packages if they are not present yet;
- [x] ng-add factory - import the ngxs module in the root app module if project name is provided;
- [x] implement a basic ng-add factory unit test;
- [x] add the missing angular-devkit/schematics-cli package;
- [x] add the package commands to run existing ngxs schematics;

* Update packages/store/schematics/factories/ng-add/ng-add.factory.spec.ts

- [x] add comments matching preferred test style;

Co-authored-by: Mark Whitfeld <[email protected]>

* Update packages/store/schematics/factories/ng-add/ng-add.factory.spec.ts

- [x] add comments matching preferred test style;
- [x] tweak module import to be more typically formatted;

Co-authored-by: Mark Whitfeld <[email protected]>

* Update packages/store/schematics/factories/ng-add/ng-add.factory.ts

- [x] fix typos;

Co-authored-by: Mark Whitfeld <[email protected]>

* Update packages/store/schematics/factories/ng-add/ng-add.factory.ts

- [x] format tweaks, so that prettier has less work to do;

Co-authored-by: Mark Whitfeld <[email protected]>

* refactor(schematics): add a shared library configuration options object

Co-authored-by: Mark Whitfeld <[email protected]>
@nx-cloud
Copy link

nx-cloud bot commented Jul 10, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 0b0994e. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 3 targets

Sent with 💌 from NxCloud.

@bundlemon
Copy link

bundlemon bot commented Jul 10, 2023

BundleMon

Files updated (1)
Status Path Size Limits
fesm2015/ngxs-store.js
94.47KB (+340B +0.35%) 125KB / +0.5%
Unchanged files (2)
Status Path Size Limits
fesm2015/ngxs-store-operators.js
6.23KB 15KB / +0.5%
fesm2015/ngxs-store-internals.js
3.57KB 20KB / +0.5%

Total files change +340B +0.32%

Groups updated (3)
Status Path Size Limits
@ngxs/store(esm2015)[gzip]
./esm2015/**/*.js
180.26KB (+402B +0.22%) +1%
@ngxs/store(umd)[gzip]
./bundles/*.umd.js
36.55KB (+104B +0.28%) +1%
@ngxs/store(fesm2015)[gzip]
./fesm2015/*.js
25.02KB (+80B +0.31%) +1%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@bundlemon
Copy link

bundlemon bot commented Jul 10, 2023

BundleMon (NGXS Plugins)

Files removed (2)
Status Path Size Limits
Plugins(umd)[gzip]
router-plugin/bundles/ngxs-router-plugin-inte
rnals.umd.js
-654B +1%
Plugins(fesm2015)[gzip]
router-plugin/fesm2015/ngxs-router-plugin-int
ernals.js
-406B +1%
Files updated (7)
Status Path Size Limits
Plugins(umd)[gzip]
router-plugin/bundles/ngxs-router-plugin.umd.
js
7.41KB (+226B +3.07%) +1%
Plugins(fesm2015)[gzip]
router-plugin/fesm2015/ngxs-router-plugin.js
3.09KB (+175B +5.85%) +1%
Plugins(umd)[gzip]
form-plugin/bundles/ngxs-form-plugin.umd.js
3.44KB (+152B +4.52%) +1%
Plugins(umd)[gzip]
websocket-plugin/bundles/ngxs-websocket-plugi
n.umd.js
6.92KB (+137B +1.97%) +1%
Plugins(fesm2015)[gzip]
form-plugin/fesm2015/ngxs-form-plugin.js
2.67KB (+102B +3.87%) +1%
Plugins(fesm2015)[gzip]
websocket-plugin/fesm2015/ngxs-websocket-plug
in.js
2.59KB (+72B +2.79%) +1%
Plugins(fesm2015)[gzip]
storage-plugin/fesm2015/ngxs-storage-plugin.j
s
3.64KB (-59B -1.56%) +1%
Unchanged files (7)
Status Path Size Limits
Plugins(umd)[gzip]
storage-plugin/bundles/ngxs-storage-plugin.um
d.js
7.96KB +1%
Plugins(umd)[gzip]
hmr-plugin/bundles/ngxs-hmr-plugin.umd.js
6.89KB +1%
Plugins(umd)[gzip]
devtools-plugin/bundles/ngxs-devtools-plugin.
umd.js
2.75KB +1%
Plugins(fesm2015)[gzip]
hmr-plugin/fesm2015/ngxs-hmr-plugin.js
2.65KB +1%
Plugins(umd)[gzip]
logger-plugin/bundles/ngxs-logger-plugin.umd.
js
2.53KB +1%
Plugins(fesm2015)[gzip]
devtools-plugin/fesm2015/ngxs-devtools-plugin
.js
2.17KB +1%
Plugins(fesm2015)[gzip]
logger-plugin/fesm2015/ngxs-logger-plugin.js
2.01KB +1%

Total files change -259B -0.44%

Groups updated (3)
Status Path Size Limits
All Plugins(fesm2015)[gzip]
./-plugin/fesm2015/.js
18.82KB (-113B -0.58%) +1%
All Plugins(umd)[gzip]
./-plugin/bundles/.umd.js
37.91KB (-146B -0.37%) +1%
All Plugins(esm2015)[gzip]
./-plugin/esm2015/**/.js
108.71KB (-359B -0.32%) +1%

Final result: ❌

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@bundlemon
Copy link

bundlemon bot commented Jul 10, 2023

BundleMon (Integration Projects)

Unchanged files (1)
Status Path Size Limits
Main bundles(Gzip)
hello-world-ng15/dist-integration/main.(hash)
.js
63.95KB +1%

No change in files bundle size

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@dmitry-stepanenko dmitry-stepanenko force-pushed the feature/schematics-2023-2 branch 3 times, most recently from ffa184b to a76a75f Compare August 18, 2023 12:42
}

Object.values(LIBRARIES)
.filter(lib => options.packages?.includes(lib))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the packages option is reflected in the CLI, I was wondering if renaming it to plugins will be more consistent with this https://www.ngxs.io/plugins

@codeclimate
Copy link

codeclimate bot commented Sep 12, 2023

Code Climate has analyzed commit 0b0994e and detected 9 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 9

The test coverage on the diff in this pull request is 88.8% (50% is the threshold).

This pull request will bring the total coverage in the repository to 95.4% (-0.5% change).

View more on Code Climate.

@markwhitfeld markwhitfeld merged commit 22c3643 into ngxs:master Sep 15, 2023
8 checks passed
@markwhitfeld markwhitfeld added this to the v.18.0.0 milestone Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants