Skip to content

Add Flow type checker definition#59

Merged
azu merged 16 commits intoalmin:masterfrom
yamadayuki:yamadayuki/flow-definition
Oct 2, 2016
Merged

Add Flow type checker definition#59
azu merged 16 commits intoalmin:masterfrom
yamadayuki:yamadayuki/flow-definition

Conversation

@yamadayuki
Copy link
Copy Markdown
Member

For #55 .

Add type-definitions/almin.js.flow. It enables developers to build a large application using almin with Flow type checker. I added TodoMVC example with flow.
I use the Facebook's immutable-js as a reference to make definition directory.

@azu
Copy link
Copy Markdown
Member

azu commented Oct 1, 2016

Awesome. I'll see it lator.

I added TodoMVC example with flow.

It is difficult choice. I'm not familiar with FlowType.
Maybe, The example difficult to maintain for me.

Copy link
Copy Markdown
Member

@azu azu left a comment

Choose a reason for hiding this comment

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

Currenly, UseCaseExecutor is private class.
But, we should public this.

Store,
StoreGroup,
QueuedStoreGroup,
UseCaseExecutor,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

📝 Currently, UseCaseExecutor stay in the closet.
It means that UseCaseExecutor is under the unstable. It is potential to change.
But, I know that type definition(d.ts and flow) need to public the internal type because it can be touched from outside.

I forget correctly JSDoc typing of UseCaseExecutor.

+    onWillExecuteEachUseCase(handler: (useCase: UseCase, args: mixed) => mixed): void;
+    onDidExecuteEachUseCase(handler: (useCase: UseCase) => mixed): void;
+    onCompleteExecuteEachUseCase(handler: (useCase: UseCase) => mixed): Function;
+    execute(args: Array<mixed>): void;
+    release(): void;

are public.

+    willExecute(args: Array<mixed>): void;
+    didExecute(): void;
+    complete(): void;

are private.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Omit private function definitions and make UseCaseExecutor class unexportable as type.

@yamadayuki
Copy link
Copy Markdown
Member Author

yamadayuki commented Oct 1, 2016

Awesome. I'll see it lator.

I added TodoMVC example with flow.

It is difficult choice. I'm not familiar with FlowType.
Maybe, The example difficult to maintain for me.

Thanks for your review!
If you don't usually use Flow type, I suppose that the Flow type definition should not be bundled in this repository. I send nearly the same pull request to flow-typed repository, if it's OK with you.

@azu
Copy link
Copy Markdown
Member

azu commented Oct 2, 2016

We have three options:

Merge

    1. Merge .js.flow only and link to example
    1. Merge .js.flow and example of flow

and We want to add @yamadayuki as Collabolator.

Not Merge

@yamadayuki
Copy link
Copy Markdown
Member Author

I actually think option 1 and option 2 are nearly same. I hope to choose option 2.
I only recently knew Almin.js and CQRS, I'm not confident about implementing examples with the flow, though, I'm studying now. So I want you to get this merged. If this PR will be merged, I accept being collaborator willingly.

Concerning option 3, I suppose that the flow-typed is still unpopular among the developers who use flow type. And in the flow-typed repository, I will send pull request such as this PR, reviewers consider about the type definition to be valid. But they don't have the responsibility for a behavior of the module. So I'd rather not choose option 3.

@azu
Copy link
Copy Markdown
Member

azu commented Oct 2, 2016

@yamadayuki OK. I choose option 2.
Welcome to collaborator 🎉 (merge and will add)

Copy link
Copy Markdown
Member

@azu azu left a comment

Choose a reason for hiding this comment

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

almin/package.json use files field.
It is a whitelist for npm publishing.
Should we added type-definitions to files?

"build": "NODE_ENV=production webpack -p",
"watch": "NODE_ENV=development webpack -d -w",
"prepublish": "npm run --if-present build",
"test": "mocha"
Copy link
Copy Markdown
Member

@azu azu Oct 2, 2016

Choose a reason for hiding this comment

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

Can you add flow check script?
It means that CI always test type definition file and example code.

"scripts": {
  "test": "mocha && npm run flow"
  "flow": "flow check"
}
// via https://flowtype.org/blog/2016/08/01/Windows-Support.html

DefinitelyTyped of TypeScript has a set of d.ts and test code for d.ts.
I think that example project and flow check is instead of this.

../../src/

[libs]
../../type-definition
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

type-definitions?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sorry, I forgot to add this correction.. Fixed.

@yamadayuki
Copy link
Copy Markdown
Member Author

almin/package.json use files field.
It is a whitelist for npm publishing.
Should we added type-definitions to files?

OK.

"webpack-dev-server": "^2.0.0-beta"
},
"bin": {
"flow": "./node_modules/.bin/flow"
Copy link
Copy Markdown
Member

@azu azu Oct 2, 2016

Choose a reason for hiding this comment

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

I belive that it is not necessary.
"bin" field is for publishing
https://docs.npmjs.com/files/package.json#bin

npm run-script automatically add $(npm bin) path to PATH enviroment variable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

npm run-script automatically add $(npm bin) path to PATH enviroment variable

I misunderstanding about this. Remove it. Thank you for your advice.

@azu azu merged commit e0e1e34 into almin:master Oct 2, 2016
@yamadayuki yamadayuki deleted the yamadayuki/flow-definition branch October 2, 2016 13:41
@yamadayuki
Copy link
Copy Markdown
Member Author

@azu Thank you anyway! Sorry for my a lot of flaws.

@azu
Copy link
Copy Markdown
Member

azu commented Oct 2, 2016

@yamadayuki No problem! Thanks for PR.

I've released https://github.com/almin/almin/releases/tag/0.9.0 and added @yamadayuki as collaborator 🎉

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.

2 participants