feat(supported-version): add user-defined kind (#28)

`kind` is a new input property for the `supported-version` action which
allows one to define what specific versions of Magento they support.

Currently, `kind` supports `latest`, `currently-supported`, and `custom`. See the
README for `supported-version` if you want more specifics
This commit is contained in:
Damien Retzinger
2022-08-05 17:36:38 -04:00
committed by GitHub
parent 97b4223c0c
commit 664360ede2
22 changed files with 7289 additions and 115 deletions
@@ -0,0 +1,11 @@
import { isValidKind } from "./compute-kind";
describe('isValidKind', () => {
it('returns `true` if its a valid kind', () => {
expect(isValidKind("latest")).toBe(true);
});
it('returns `false` if it is not a valid kind', () => {
expect(isValidKind("taco")).toBe(false);
})
})
@@ -0,0 +1,21 @@
/**
* Acceptable arguments for version `kind`
*/
export const KNOWN_KINDS = {
'currently-supported': true,
'latest': true,
'custom': true,
}
export const isValidKind = (kind: string): boolean => {
return kind in KNOWN_KINDS;
};
export const validateOrError = (kind: string): true => {
if(isValidKind(kind)){
return true;
}
else {
throw new Error(`Invalid kind provided, supported kinds are: ${Object.keys(KNOWN_KINDS).join(', ')}`);
}
}
@@ -0,0 +1,9 @@
[
"magento/project-community-edition:>=2.3 <2.4",
"magento/project-community-edition:>=2.4.0 <2.4.1",
"magento/project-community-edition:>=2.4.1 <2.4.2",
"magento/project-community-edition:>=2.4.2 <2.4.3",
"magento/project-community-edition:>=2.4.3 <2.4.4",
"magento/project-community-edition:>=2.4.4 <2.4.5",
"magento/project-community-edition"
]
+3
View File
@@ -0,0 +1,3 @@
[
"magento/project-community-edition"
]