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: generate-from-ts #85

Merged
merged 10 commits into from
May 14, 2024
Merged

feat: generate-from-ts #85

merged 10 commits into from
May 14, 2024

Conversation

mshanemc
Copy link
Contributor

@mshanemc mshanemc commented May 6, 2024

What does this PR do?

"single-source-of-type"

start generating sfdx-project.json, (not scratchDef file) schema from TS types
export those same types for other packages (ex: sfdx-core, packaging) to use
compile TS on build

What issues does this PR fix or reference?

@W-13565856@
https://github.com/forcedotcom/sfdx-core/issues/489
while here, we might as well fix #75


QA via use: forcedotcom/sfdx-core#1066

@@ -1,36 +0,0 @@
name: manual release
Copy link
Contributor Author

Choose a reason for hiding this comment

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

create github release will do this for you

@@ -1,412 +1,146 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

there's a lot of diffs for this file. The valid/invalid tests are passing so it's probably reasonably close.

@@ -1,6 +1,23 @@
#!/usr/bin/env node

const exec = require("child_process").execSync;
const fs = require("fs");
/**
* Dummy build script to satisfy Github Actions build requirement for running unit tests.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment can be removed correct?

/**
* Dummy build script to satisfy Github Actions build requirement for running unit tests.
*/
console.log("compiling");
exec(`yarn tsc -p . --pretty`);
console.log(`generating schema from TS files`);
Copy link
Member

Choose a reason for hiding this comment

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

NIT: template strings without variables or need

Copy link
Contributor

@gbockus-sf gbockus-sf left a comment

Choose a reason for hiding this comment

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

LGTM. I'll ping IDEx and see if anyone is available to give it a quick QE in VSCode.

Copy link

@peternhale peternhale left a comment

Choose a reason for hiding this comment

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

@mshanemc changes seem reasonable to me and I see there is a PR open against core as well. Are there any functional changes expected due to the changes here and in core?

I post a question.

}
]
},
"alias-147831185-257-1138-147831185-0-1202": {

Choose a reason for hiding this comment

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

@mshanemc this is a funky name. What's its purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's an artifact of the schema generator because the type is intentionally circular (metadataTypes have a children property which contains metadataTypes).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Valid files before should still be valid. I think there were some things that should have been valid that weren't (ex: a property the packaging plugin/library knew about but the schema didn't account for).

And once used, this change should also add some things to SfdxProject(Json) that it was currently missing.

Copy link
Member

@WillieRuemmele WillieRuemmele left a comment

Choose a reason for hiding this comment

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

Core PR not required
everything here looks good
consumers will get updates and improvements as they update/need

@WillieRuemmele WillieRuemmele merged commit 91c169c into main May 14, 2024
11 checks passed
@WillieRuemmele WillieRuemmele deleted the sm/generate-from-ts branch May 14, 2024 17:05
@iowillhoit iowillhoit mentioned this pull request May 14, 2024
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.

PushPackageDirectoriesSequentially is incorrectly flagged as not allowed.
4 participants