-
Notifications
You must be signed in to change notification settings - Fork 1
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: 🎸 Generators dto's #71
Conversation
created script to generate all generators dto's according to angular's cli schema.json ✅ Closes: 70
☁️ Nx Cloud ReportCI is running/has finished running commands for commit aed2a08. 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 2 targetsSent with 💌 from NxCloud. |
const { readdirSync, readFileSync, writeFile } = require('fs'); | ||
const { join } = require('path'); | ||
const PATH = | ||
'/Users/idan.yadgar/angular-cli-e-square/angular-cli/packages/schematics/angular'; |
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 left by mistake?
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.
Cool!
Few questions
When is the script going to run? Are we going to run it periodically?
And how are we going to make sure that the DTO's it generates are actually correct? We need to write a lot of tests for this script.
@@ -0,0 +1,98 @@ | |||
const { readdirSync, readFileSync, writeFile } = require('fs'); |
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.
Why not make this a TS file?
function capitalize(s) { | ||
return s[0].toUpperCase() + s.slice(1); | ||
} |
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.
export it to a generic place for utils
function capitalize(s) { | ||
return s[0].toUpperCase() + s.slice(1); | ||
} |
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.
function capitalize(s) { | |
return s[0].toUpperCase() + s.slice(1); | |
} | |
function capitalize(s) { | |
return s[0].toUpperCase() + s.slice(1).toLowerCase(); | |
} |
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.
Continuing my question in your HLD, what about "workspace schematics"? (Is it possible with ng cli?), what about 3rd party schematics? how do we plan to "discover" schematics on run-time? as I understand this is a compile-time thing, we run this script before we deploy a new version.
if we do need to do this stuff in run-time, there is no point of generating DTOs, we should parse schema.json and map it to a general DTO, something like SchematicArgument[]
(maybe there's an interface from angular we can use) when the client requests for the available arguments of some schematic. I guess we can also generate the class in run-time in order to use it's class-validator features when BE receives an execute/generate command
implemented - get generators list, get generator schema, execute generator command
created script to generate all generators dto's according to angular's cli schema.json
✅ Closes: 70
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information