Skip to content

Conversation

@kanadgupta
Copy link
Contributor

@kanadgupta kanadgupta commented Oct 20, 2023

🧰 Changes

This does a bit of quality-of-life work to consolidate our TS types and our JSON Schema definition for the api lockfile schema. We now rebuild the schema.json file every time we run npm version, similar to how we do for packageInfo.ts.

🧬 QA & Testing

Does the buildVersionedFiles.ts work as expected when you run it locally? If the TS build and all the tests pass, we should be in good shape.

}
}
},
"additionalProperties": false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this caught my attention thanks to json-schema-to-ts 👑

Comment on lines +9 to +10
"$schema": { "type": "string" },
"apis": { "type": "array", "description": "The list of installed APIs", "items": { "$ref": "#/definitions/api" } }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

prettier 🤷🏽‍♂️

"scripts": {
"attw": "attw --pack --format table-flipped",
"build": "tsc",
"build:versionedfiles": "NODE_OPTIONS=--no-warnings node --loader ts-node/esm bin/buildVersionedFiles.ts",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i don't love this file name nor its corresponding package.json script name, open to ideas here 😬

export enum SupportedLanguages {
JS = 'js',
}
export const SupportedLanguages = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can't use TS enums here anymore since we're deriving our supported languages from the JSON schema

@kanadgupta kanadgupta requested a review from erunion October 20, 2023 16:32
@kanadgupta kanadgupta added enhancement New feature or request refactor Issues about tackling technical debt labels Oct 20, 2023
@kanadgupta kanadgupta marked this pull request as ready for review October 20, 2023 16:34
@erunion erunion added this to the v7 milestone Oct 20, 2023
Copy link
Member

@erunion erunion left a comment

Choose a reason for hiding this comment

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

some very small changes but otherwise this looks great.

Base automatically changed from feat/uninstall-command to main October 20, 2023 17:12
kanadgupta and others added 5 commits October 20, 2023 12:15
Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
Co-Authored-By: Jon Ursenbach <jon@ursenba.ch>
Co-Authored-By: Jon Ursenbach <jon@ursenba.ch>
@kanadgupta kanadgupta requested a review from erunion October 20, 2023 17:27
new Option('-l, --lang <language>', 'SDK language').default(SupportedLanguages.JS).choices([SupportedLanguages.JS]),
)
.addOption(new Option('-y, --yes', 'Automatically answer "yes" to any prompts printed'))
.action(async (uri: string, options: { identifier?: string; lang: string; yes?: boolean }) => {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.action(async (uri: string, options: { identifier?: string; lang: string; yes?: boolean }) => {
.action(async (uri: string, options: { identifier?: string; lang: SupportedLanguage; yes?: boolean }) => {

let language: SupportedLanguage;
if (options.lang) {
language = options.lang as SupportedLanguages;
language = options.lang as SupportedLanguage;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
language = options.lang as SupportedLanguage;
language = options.lang;

Co-Authored-By: Jon Ursenbach <jon@ursenba.ch>
@kanadgupta kanadgupta merged commit eb76200 into main Oct 20, 2023
@kanadgupta kanadgupta deleted the refactor/use-json-schema branch October 20, 2023 17:36
@kanadgupta kanadgupta added the area:api Issues related to the `api` CLI, which builds the SDKs label Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:api Issues related to the `api` CLI, which builds the SDKs enhancement New feature or request refactor Issues about tackling technical debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants