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

change(developer): use full github url in kmc copy parameters #12754

Merged

Conversation

mcdurdin
Copy link
Member

@mcdurdin mcdurdin commented Dec 2, 2024

@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Dec 2, 2024

User Test Results

Test specification and instructions

User tests are not required

Comment on lines 227 to 228
ref.path = '/'
};
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
ref.path = '/'
};
ref.path = '/';
}

const parts = source.split(':');
const id = parts[1];
const parts = CLOUD_URI.exec(source) ?? KEYMANCOM_CLOUD_URI.exec(source);
const id: string = parts.groups.id;
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
const id: string = parts.groups.id;
if(!parts) {
throw new Error('Expected CLOUD_URI or KEYMANCOM_CLOUD_URI to match');
}
const id: string = parts.groups.id;

Comment on lines +700 to +704
/** @internal */
public unitTestEndPoints = {
getGithubSourceProject: this.getGitHubSourceProject.bind(this),
getCloudSourceProject: this.getCloudSourceProject.bind(this)
};
Copy link
Member Author

Choose a reason for hiding this comment

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

This pattern allows us to expose private functions for unit testing without breaking encapsulation. We use a similar pattern for global functions in a module, where we don't want to export them directly.

@markcsinclair fyi.

https://github.com/keymanapp/keyman/wiki/Unit-Tests#typescript

@mcdurdin mcdurdin marked this pull request as ready for review December 3, 2024 01:04
@darcywong00 darcywong00 self-assigned this Dec 3, 2024
Copy link
Contributor

@darcywong00 darcywong00 left a comment

Choose a reason for hiding this comment

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

lgtm

Comment on lines 18 to 20
const KEYMANCOM_CLOUD_URI = /^(?:http(?:s)?:\/\/)?keyman\.com\/keyboards\/(?<id>[a-z0-9_.-]+)/i;
const CLOUD_URI = /^cloud:(?<id>.+)$/i;

Copy link
Contributor

Choose a reason for hiding this comment

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

It's only a few lines, but since GitHubUrls got refactored, thoughts on pulling these into a separate cloud-uri.ts file? (along with some comments about the regexes)

const parts = source.split(':');
const id = parts[1];
const parts = CLOUD_URI.exec(source) ?? KEYMANCOM_CLOUD_URI.exec(source);
const id: string = parts.groups.id;

const isModel = /^[^.]+\.[^.]+\.[^.]+$/.test(id);
Copy link
Contributor

Choose a reason for hiding this comment

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

Would one of the regexes work?

// const MODEL_ID_PATTERN_PROJECT = /^[a-z_][a-z0-9_]*\.[a-z_][a-z0-9_-]*\.[a-z_][a-z0-9_]*\.model\.kpj$/;

Copy link
Member Author

Choose a reason for hiding this comment

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

no, because those regexes all have .model. in them. We could build a shared regex I guess but I am not really keen on more refactoring for it.

github:keymanapp/keyboards:release/k/khmer_angkor/khmer_angkor.kpj
github:keymanapp/keyboards:/release/k/khmer_angkor/khmer_angkor.kpj`
);
// 0x0011 unused
Copy link
Contributor

Choose a reason for hiding this comment

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

Noting this PR removes ERROR_InvalidGitHubSource.
Will https://help.keyman.com/developer/18.0/reference/messages/km0b011 automatically disappear in the sync?

Copy link
Member Author

Choose a reason for hiding this comment

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

It should do, we'll see when we deploy?

@mcdurdin
Copy link
Member Author

mcdurdin commented Dec 4, 2024

NOTE: I will need to cherry-pick this to master as it is currently targeting epic/shared-fonts which may not land in 18.0 -- but we don't want the kmc copy parameters going out to release as they are.

…es-from-remotes-2' into change/developer/12746-kmc-copy-full-gh-url
… into change/developer/12746-kmc-copy-full-gh-url
Base automatically changed from feat/developer/kmc-package-source-files-from-remotes-2 to epic/shared-fonts December 5, 2024 07:31
@mcdurdin mcdurdin merged commit 3945b39 into epic/shared-fonts Dec 5, 2024
5 of 6 checks passed
@mcdurdin mcdurdin deleted the change/developer/12746-kmc-copy-full-gh-url branch December 5, 2024 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

change(developer): update kmc-copy to use full GitHub URLs rather than github: prefix
3 participants