Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
d5382d3e6f | |||
a0e2122208 | |||
8836085300 | |||
86463358d8 | |||
46b284799f | |||
37fd9d0351 | |||
39ba0b9d81 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@ __tests__/runner/*
|
|||||||
# actions requires a node_modules dir https://github.com/actions/toolkit/blob/master/docs/javascript-action.md#publish-a-releasesv1-action
|
# actions requires a node_modules dir https://github.com/actions/toolkit/blob/master/docs/javascript-action.md#publish-a-releasesv1-action
|
||||||
# but its recommended not to check these in https://github.com/actions/toolkit/blob/master/docs/action-versioning.md#recommendations
|
# but its recommended not to check these in https://github.com/actions/toolkit/blob/master/docs/action-versioning.md#recommendations
|
||||||
node_modules
|
node_modules
|
||||||
|
coverage
|
||||||
|
@ -1 +1 @@
|
|||||||
nodejs 20.15.1
|
nodejs 24.2.0
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
## 2.3.0
|
||||||
|
|
||||||
|
* Migrate from jest to vitest
|
||||||
|
* Replace `mime` with `mime-types`
|
||||||
|
* Bump to use node 24
|
||||||
|
* Dependency updates
|
||||||
|
|
||||||
## 2.2.2
|
## 2.2.2
|
||||||
|
|
||||||
## What's Changed
|
## What's Changed
|
||||||
|
@ -7,6 +7,8 @@ import {
|
|||||||
findTagFromReleases,
|
findTagFromReleases,
|
||||||
} from "../src/github";
|
} from "../src/github";
|
||||||
|
|
||||||
|
import { describe, it } from "vitest";
|
||||||
|
|
||||||
describe("github", () => {
|
describe("github", () => {
|
||||||
describe("mimeOrDefault", () => {
|
describe("mimeOrDefault", () => {
|
||||||
it("returns a specific mime for common path", async () => {
|
it("returns a specific mime for common path", async () => {
|
||||||
|
@ -10,6 +10,8 @@ import {
|
|||||||
} from "../src/util";
|
} from "../src/util";
|
||||||
import * as assert from "assert";
|
import * as assert from "assert";
|
||||||
|
|
||||||
|
import { describe, it, expect } from "vitest";
|
||||||
|
|
||||||
describe("util", () => {
|
describe("util", () => {
|
||||||
describe("uploadUrl", () => {
|
describe("uploadUrl", () => {
|
||||||
it("strips template", () => {
|
it("strips template", () => {
|
||||||
|
19
dist/index.js
vendored
19
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -1,16 +0,0 @@
|
|||||||
import type { JestConfigWithTsJest } from 'ts-jest';
|
|
||||||
|
|
||||||
const config: JestConfigWithTsJest = {
|
|
||||||
preset: 'ts-jest/presets/default-esm',
|
|
||||||
clearMocks: true,
|
|
||||||
moduleFileExtensions: ['js', 'ts'],
|
|
||||||
testEnvironment: 'node',
|
|
||||||
testMatch: ['**/*.test.ts'],
|
|
||||||
testRunner: 'jest-circus/runner',
|
|
||||||
transform: {
|
|
||||||
'^.+\\.ts$': 'ts-jest',
|
|
||||||
},
|
|
||||||
verbose: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default config;
|
|
5158
package-lock.json
generated
5158
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
27
package.json
27
package.json
@ -5,9 +5,10 @@
|
|||||||
"description": "GitHub Action for creating GitHub Releases",
|
"description": "GitHub Action for creating GitHub Releases",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ncc build src/main.ts --minify",
|
"build": "ncc build src/main.ts --minify --target es2022",
|
||||||
"build-debug": "ncc build src/main.ts --v8-cache --source-map",
|
"build-debug": "ncc build src/main.ts --v8-cache --source-map",
|
||||||
"test": "jest",
|
"typecheck": "tsc --noEmit",
|
||||||
|
"test": "vitest --coverage",
|
||||||
"fmt": "prettier --write \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
"fmt": "prettier --write \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
||||||
"fmtcheck": "prettier --check \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
"fmtcheck": "prettier --check \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
||||||
"updatetag": "git tag -d v2 && git push origin :v2 && git tag -a v2 -m '' && git push origin v2"
|
"updatetag": "git tag -d v2 && git push origin :v2 && git tag -a v2 -m '' && git push origin v2"
|
||||||
@ -22,24 +23,22 @@
|
|||||||
"author": "softprops",
|
"author": "softprops",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^1.11.1",
|
||||||
"@actions/github": "^6.0.0",
|
"@actions/github": "^6.0.1",
|
||||||
"@octokit/plugin-retry": "^7.2.1",
|
"@octokit/plugin-retry": "^8.0.1",
|
||||||
"@octokit/plugin-throttling": "^10.0.0",
|
"@octokit/plugin-throttling": "^11.0.1",
|
||||||
"glob": "^11.0.1",
|
"glob": "^11.0.2",
|
||||||
"mime": "^3.0.0"
|
"mime-types": "^3.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/glob": "^8.1.0",
|
"@types/glob": "^8.1.0",
|
||||||
"@types/jest": "^29.5.14",
|
"@types/mime-types": "^3.0.1",
|
||||||
"@types/mime": "^3.0.1",
|
"@types/node": "^22.15.21",
|
||||||
"@types/node": "^22.14.1",
|
|
||||||
"@vercel/ncc": "^0.38.3",
|
"@vercel/ncc": "^0.38.3",
|
||||||
"jest": "^29.3.1",
|
"@vitest/coverage-v8": "^3.1.4",
|
||||||
"jest-circus": "^29.3.1",
|
|
||||||
"prettier": "3.5.3",
|
"prettier": "3.5.3",
|
||||||
"ts-jest": "^29.3.2",
|
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"typescript-formatter": "^7.2.2"
|
"typescript-formatter": "^7.2.2",
|
||||||
|
"vitest": "^3.1.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import { GitHub } from "@actions/github/lib/utils";
|
|||||||
import { Config, isTag, releaseBody, alignAssetName } from "./util";
|
import { Config, isTag, releaseBody, alignAssetName } from "./util";
|
||||||
import { statSync } from "fs";
|
import { statSync } from "fs";
|
||||||
import { open } from "fs/promises";
|
import { open } from "fs/promises";
|
||||||
import { getType } from "mime";
|
import { lookup } from "mime-types";
|
||||||
import { basename } from "path";
|
import { basename } from "path";
|
||||||
|
|
||||||
type GitHub = InstanceType<typeof GitHub>;
|
type GitHub = InstanceType<typeof GitHub>;
|
||||||
@ -149,7 +149,7 @@ export const asset = (path: string): ReleaseAsset => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const mimeOrDefault = (path: string): string => {
|
export const mimeOrDefault = (path: string): string => {
|
||||||
return getType(path) || "application/octet-stream";
|
return lookup(path) || "application/octet-stream";
|
||||||
};
|
};
|
||||||
|
|
||||||
export const upload = async (
|
export const upload = async (
|
||||||
@ -188,7 +188,7 @@ export const upload = async (
|
|||||||
"content-type": mime,
|
"content-type": mime,
|
||||||
authorization: `token ${config.github_token}`,
|
authorization: `token ${config.github_token}`,
|
||||||
},
|
},
|
||||||
data: fh.readableWebStream({ type: "bytes" }),
|
data: fh.readableWebStream(),
|
||||||
});
|
});
|
||||||
const json = resp.data;
|
const json = resp.data;
|
||||||
if (resp.status !== 201) {
|
if (resp.status !== 201) {
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
"useUnknownInCatchVariables": false,
|
"useUnknownInCatchVariables": false,
|
||||||
/* Basic Options */
|
/* Basic Options */
|
||||||
// "incremental": true, /* Enable incremental compilation */
|
// "incremental": true, /* Enable incremental compilation */
|
||||||
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
"target": "es2022",
|
||||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
"module": "NodeNext",
|
||||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||||
// "checkJs": true, /* Report errors in .js files. */
|
// "checkJs": true, /* Report errors in .js files. */
|
||||||
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||||
@ -25,6 +25,7 @@
|
|||||||
/* Strict Type-Checking Options */
|
/* Strict Type-Checking Options */
|
||||||
"strict": true, /* Enable all strict type-checking options. */
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
|
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||||
|
"skipLibCheck": true,
|
||||||
// "strictNullChecks": true, /* Enable strict null checks. */
|
// "strictNullChecks": true, /* Enable strict null checks. */
|
||||||
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||||
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
||||||
@ -44,7 +45,7 @@
|
|||||||
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||||
// "typeRoots": [], /* List of folders to include type definitions from. */
|
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||||
// "types": [], /* Type declaration files to be included in compilation. */
|
"types": ["vitest/globals"],
|
||||||
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||||
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||||
@ -60,5 +61,5 @@
|
|||||||
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "**/*.test.ts", "jest.config.ts"]
|
"exclude": ["node_modules", "**/*.test.ts", "vitest.config.ts"]
|
||||||
}
|
}
|
||||||
|
11
vitest.config.ts
Normal file
11
vitest.config.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { defineConfig } from 'vitest/config';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
test: {
|
||||||
|
environment: 'node',
|
||||||
|
coverage: {
|
||||||
|
reporter: ['text', 'lcov'],
|
||||||
|
},
|
||||||
|
include: ['__tests__/**/*.ts'],
|
||||||
|
},
|
||||||
|
});
|
Reference in New Issue
Block a user