-
Notifications
You must be signed in to change notification settings - Fork 168
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(WIP): rebuild #491
feat(WIP): rebuild #491
Conversation
Bumps [yargs-parser](https://github.com/yargs/yargs-parser) from 20.2.9 to 21.0.1. - [Release notes](https://github.com/yargs/yargs-parser/releases) - [Changelog](https://github.com/yargs/yargs-parser/blob/main/CHANGELOG.md) - [Commits](yargs/yargs-parser@yargs-parser-v20.2.9...yargs-parser-v21.0.1) --- updated-dependencies: - dependency-name: yargs-parser dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [del-cli](https://github.com/sindresorhus/del-cli) from 3.0.1 to 4.0.1. - [Release notes](https://github.com/sindresorhus/del-cli/releases) - [Commits](sindresorhus/del-cli@v3.0.1...v4.0.1) --- updated-dependencies: - dependency-name: del-cli dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
"pack": "oclif manifest && oclif readme", | ||
"postpack": "shx rm -f oclif.manifest.json", | ||
"preunit": "npm run pack", | ||
"unit": "tap \"test/**/*.test.ts\"", |
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.
Any particular reason to go for tap here? E. g. mocha has way wider mainstream usage.
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.
tap
is used through out the whole organization. So, it would be the first priority one.
mocha
and jest
can be added, but it needs somebody effort.
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.
There is a difference between internal and external use, no? CLI is not intended to be used primarily internally.
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.
Using united test framework inside the organization (fastify
) have some advantages. Developer inside the organization do not need to learn multiple test framework.
There is a difference between internal and external use, no?
I think it would be a long discussion on test framework topic.
"shx": "^0.3.4", | ||
"tap": "^16.2.0", | ||
"ts-node": "^10.7.0", | ||
"typescript": "~4.4.0" |
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 is pretty old
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.
Fixed in ~4.4.0
just because of eslint
and ts-standard
.
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.
ts-standard seems to be barely maintained, are we sure we don't want to rely on something more actively supported? being locked into old TS is really not great
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.
ts-standard seems to be barely maintained, are we sure we don't want to rely on something more actively supported?
In here, I would like to share the same style with other packages. I am aware of ts-standard
is leak of maintaince, but it does the job right now.
Currently, I am just waiting for https://github.com/standard/eslint-config-standard-with-typescript publish.
In my projects, I bumped the typescript
version without problem. It only gives me warning of unsupported typescript
.
As a tools that will be widely used, I don't think this warning is acceptable and I will wait for the update in standard
first.
Object.assign(answer, await prompt([ | ||
{ type: 'list', name: 'language', message: 'Which language will you use?', default: 'JavaScript', choices: ['JavaScript', 'TypeScript'] }, | ||
{ type: 'list', name: 'lint', message: 'Which linter would you like to use?', default: this.questionLintDefault, choices: this.questionLintChoices }, | ||
{ type: 'list', name: 'test', message: 'Which test framework would you like to use?', default: 'tap', choices: ['tap'] } |
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.
I would default to Mocha here
|
||
if (this.shouldOverwrite) this.questionOverwriteValidate(answer.overwrite) | ||
|
||
Object.assign(answer, await prompt([ |
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.
having prettier somewhere might be helpful too
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.
standard
or eslint
already does it's job.
} | ||
if (answer.language === 'TypeScript') { | ||
scripts.test = 'tap "test/**/*.test.ts" --ts' | ||
scripts.start = 'fastify start -r ts-node/register -l info app.js' |
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.
is this supposed to be prod-ready start? should it be using ts-node then? no command to build & run?
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.
Yes, it needs build
command.
It is doubt-able the needs for running in node
directly because some of the detail for starting server is hide inside the CLI.
|
||
export function computeDependencies (_answer: any, pkg: any): { [key: string]: string } { | ||
const dependencies: any = {} | ||
dependencies['@fastify/autoload'] = pkg.dependencies['@fastify/autoload'] |
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.
does it make sense to include autoload by default? It makes following structure of the application harder. And I wonder what are the performance implications for large projects.
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.
does it make sense to include autoload by default?
For this question, I don't know. I added it just because the previous version use @fastify/autoload
.
I am the one against using @fastify/auteload
for beginner.
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.
@mcollina Thoughts? Should we drop autoload from default CLI?
"compilerOptions": { | ||
"lib": ["ESNext"], | ||
"module": "CommonJS", | ||
"target": "ES2018", |
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.
Replacing ES-version based target with Node-version based template import from TypeScript lib might be more convenient for backend
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.
The version before, it using fastify-tsconfig
and it hide all the options from user.
Using the official template face the same problem.
} | ||
|
||
export function computeDependencies (_answer: any, pkg: any): { [key: string]: string } { | ||
const dependencies: any = {} |
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.
I would add some optional, commonly used libs as well, such as fastify-dotenv, fastify-helmet, fastify-healthcheck, fastify-awilix (for DI).
|
||
await fastify.register(entryPlugin, { prefix: options.prefix }) | ||
|
||
await fastify.listen({ port: options.port, host: options.address }) |
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.
coupling server startup to app definition is not ideal. what if I need app instance for my tests (using app.inject), but I don't want the overhead of starting/stopping server?
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.
You can look at the current test
which provide the function
to create fastify
instance.
Bumps [help-me](https://github.com/mcollina/help-me) from 3.0.0 to 4.0.0. - [Release notes](https://github.com/mcollina/help-me/releases) - [Commits](https://github.com/mcollina/help-me/commits/v4.0.0) --- updated-dependencies: - dependency-name: help-me dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
is this PR going anywhere? |
Yes, I need some GitHub experts to help me on the GitHub Actions. Moreover, I need more feedback on how the template should look like. |
as far as I can see there are no checks being run in gh actions in the PR. see the checks tab, it says 0. as for the structure, my wild guess is that landing a PR with 150 changes files will be challenging |
I run it before and I see it stale forever. Then, I removed the ci files.
It is a complete rewrite. So, it will be large different anyway. |
ok. well without seeing the output of ci hard to say what might be the cause |
Here is the clean repo.
I may need some update before you can see the actual error. |
that's not a hang. the operation was canceled because another job failed https://github.com/kaka-repo/fastify-cli/runs/8204970017?check_suite_focus=true |
Here is the hanging one https://github.com/kaka-repo/fastify-cli/runs/8205522639?check_suite_focus=true |
I know it's a bit late for this given the work already done, but I'm a bit sad to see this change as the CLI was previously quite fast to install and lightweight: not trying to start a debate regarding features here, but Just sharing my maintainer experience here, but besides the bloat, added dependencies (even transitive ones) adds burden to the maintainers because of frequent updates and potential security issues. |
Hey @climba03003, @sinedied. Any updates here? Oclif would be an amazing feature! We know that oclif can be "bloated", however, the DX features it brings make it so valuable. Autocompletion of commands, ability to add plugins, cli validation and many other things that previously would have to be done manually will now be generated by oclif for us. This will drastically reduce the amount of bugs to fix and code we would have to write. |
I think we should give it another try, maybe starting a new clean PR. These utilities have proved their worth and will be well received by people migrating from other languages frameworks who use them a lot. The main problem is CI, right? |
Yes, at least from last try. It never been able to works on Github Actions. If anyone want a try or another PR. |
Should we start by increasing code coverage or focus on this feature first? |
Focus on implementation first, before caring on the test coverage. |
Replaced by #743 |
Fixes #194
This rebuild the CLI functionality from scratch using
@oclif/core
.Currently, I need some helps on the
Github Actions
. Which stale forever when I run the test.Forgenerate
command,plugin
still pending to do.start
command, I removed some of the option since it is duplicated fromexport option
.Notable Change
help
andreadme
is auto generated.options
now autoload.How to Test
npm run build
.node bin/run <command>
Checklist
npm run test
andnpm run benchmark
and the Code of conduct