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

style: format code with dotnet-format, Prettier and StandardJS #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions Scripts/ts/delete-github-package-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
* License: MIT (https://opensource.org/licenses/MIT)
*/

import process from 'process';
import process from "process";
import { deletePackageVersionAsync } from "./github-cli.js";
import { PackageType, toPackageType, toSemVer } from './github-cli-types.js';
import yargs from 'yargs/yargs';
import { hideBin } from 'yargs/helpers';
import { PackageType, toPackageType, toSemVer } from "./github-cli-types.js";
import yargs from "yargs/yargs";
import { hideBin } from "yargs/helpers";
import { SemVer } from "semver";
// const argv = yargs(hideBin(process.argv));

const getArg = function (...marker: string[]): string | undefined {
for (let i = 0; i < marker.length; i++) {
var pos = process.argv.findIndex(arg => arg.endsWith(marker[i]));
var pos = process.argv.findIndex((arg) => arg.endsWith(marker[i]));

Check warning on line 23 in Scripts/ts/delete-github-package-version.ts

View check run for this annotation

codefactor.io / CodeFactor

Scripts/ts/delete-github-package-version.ts#L23

Unexpected var, use let or const instead. (no-var)
if (pos > -1 && pos < process.argv.length - 1) {
return process.argv[pos + 1];
}
Expand All @@ -29,7 +29,6 @@
};

const main = async () => {

// console.log(`yargs: ${JSON.stringify(yargs)}`);

// console.log(`argv: ${JSON.stringify(argv)}`);
Expand Down Expand Up @@ -62,7 +61,9 @@
const packageType = toPackageType(getArg("t", "type", "package-type"));
const token = getArg("token", "k");

console.log(`Args: org: ${orgId}, packageId: ${packageId}, version: ${version}, packageType: ${packageType}, token: ${token}`);
console.log(
`Args: org: ${orgId}, packageId: ${packageId}, version: ${version}, packageType: ${packageType}, token: ${token}`,
);

if (orgId === undefined) {
throw new Error("Organization is required");
Expand All @@ -84,7 +85,13 @@
throw new Error("GitHub API token is required");
}

await deletePackageVersionAsync(orgId, packageId, version, packageType, token);
await deletePackageVersionAsync(
orgId,
packageId,
version,
packageType,
token,
);
};

console.log(`main: ${main}`);
Expand Down
83 changes: 45 additions & 38 deletions Scripts/ts/github-cli-types.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,45 @@
/*
* github-cli-types.ts
*
* Created: 2022-11-27-05:39:27
* Modified: 2022-12-05-04:14:47
*
* Author: David G. Moore, Jr. <[email protected]>
*
* Copyright © 2022-2023 David G. Moore, Jr., All Rights Reserved
* License: MIT (https://opensource.org/licenses/MIT)
*/
import { SemVer } from "semver";

export interface PackageVersion {
id: number;
name: string;
package_html_url: string;
url: string;
created_at: string;
updated_at: string;
visibility: string;
package_type: PackageType;
downloads_count: number;
description: string;
html_url: string;
license: string;
}

export interface ApiMessage {
message: string;
documentation_url: string;
}

export type PackageType = "nuget" | "npm" | "docker" | "maven" | "rubygems" | "container";


export const toSemVer = (stringVer: string | undefined) => new SemVer(stringVer ?? "0.0.0");
export const toPackageType = (stringType: string | undefined) => stringType as PackageType;
/*
* github-cli-types.ts
*
* Created: 2022-11-27-05:39:27
* Modified: 2022-12-05-04:14:47
*
* Author: David G. Moore, Jr. <[email protected]>
*
* Copyright © 2022-2023 David G. Moore, Jr., All Rights Reserved
* License: MIT (https://opensource.org/licenses/MIT)
*/
import { SemVer } from "semver";

export interface PackageVersion {
id: number;
name: string;
package_html_url: string;
url: string;
created_at: string;
updated_at: string;
visibility: string;
package_type: PackageType;
downloads_count: number;
description: string;
html_url: string;
license: string;
}

export interface ApiMessage {
message: string;
documentation_url: string;
}

export type PackageType =
| "nuget"
| "npm"
| "docker"
| "maven"
| "rubygems"
| "container";

export const toSemVer = (stringVer: string | undefined) =>
new SemVer(stringVer ?? "0.0.0");
export const toPackageType = (stringType: string | undefined) =>
stringType as PackageType;
Loading