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(store): 🔥 introduce createStore function #174

Merged
merged 4 commits into from
Feb 23, 2022

Conversation

DmitryEfimenko
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[x] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[x] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Store can be created in two steps:

const { state, config } = createState(withProps<AuthProps>({ user: null }));
const authStore = new Store({ state, name: 'auth', config });

Issue Number: N/A

What is the new behavior?

  • Store can be created in one step:

    const store = createStore({ name: 'auth' }, withProps<AuthProps>({ user: null }));
  • The Elf CLI is updated to generate files using this approach.

  • READMEs and docs, and demos are updated to use this approach

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

  • Updated package.json scripts affected:test and affected:lint to have --base=master instead of --base=dev
    • When I forked the repo, it didn't create a "dev" branch., but instead created "master". Not sure if it's a Github change or not.
    • Without this change running tests would throw an error

@@ -57,10 +57,6 @@ export default class Repo extends Command {
...options,
template: globalConfig.cli?.repoTemplate ?? 'functions',
idKey: globalConfig.cli?.idKey ?? DEFAULT_ID_KEY,
inlineStoreInClass:
Copy link
Member

Choose a reason for hiding this comment

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

revert please

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh shoot, my bad. Reverting

@NetanelBasal NetanelBasal merged commit fbc68ff into ngneat:master Feb 23, 2022
@DmitryEfimenko DmitryEfimenko deleted the feat/create-store branch February 23, 2022 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants