Skip to content

Commit 40eecab

Browse files
authored
refactor (#8)
* refactor: esm * refactor: named export * chore: code owners
1 parent 9044798 commit 40eecab

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @hextion

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default tseslint.config(
1414
globals: globals.node,
1515
parserOptions: {
1616
projectService: {
17-
allowDefaultProject: ["*.mjs", "scripts/*.cjs"],
17+
allowDefaultProject: ["*.mjs", "scripts/*.mjs"],
1818
},
1919
tsconfigRootDir: import.meta.dirname,
2020
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "dist/index.js",
66
"scripts": {
77
"build": "ncc build src/index.ts -o dist --transpile-only --minify",
8-
"release": "npm run build && node scripts/release.cjs",
8+
"release": "npm run build && node scripts/release.mjs",
99
"version-package": "changeset version"
1010
},
1111
"dependencies": {

scripts/release.cjs renamed to scripts/release.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
// copied from https://github.com/changesets/action/blob/04d574e831923498156e0b2b93152878063203a3/scripts/release.ts
44

5-
const { version } = require("../package.json");
6-
const { exec, getExecOutput } = require("@actions/exec");
5+
import pkg from "../package.json" with { type: "json" };
6+
import { exec, getExecOutput } from "@actions/exec";
77

88
async function main() {
9+
const { version } = pkg;
910
const tag = `v${version}`;
1011

1112
const { exitCode, stderr } = await getExecOutput(

src/run.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import path from "node:path";
44
import * as process from "node:process";
55

66
import * as core from "@actions/core";
7-
import * as exec from "@actions/exec";
7+
import { exec, getExecOutput } from "@actions/exec";
88
import readChangesets from "@changesets/read";
99

1010
function getOptionalInput(name: string) {
@@ -30,7 +30,7 @@ export async function run() {
3030
const versionScript = core.getInput("version", { required: true });
3131
const [versionCmd, ...versionCmdArgs] = versionScript.split(/\s+/);
3232

33-
await exec.exec(versionCmd, versionCmdArgs, { cwd });
33+
await exec(versionCmd, versionCmdArgs, { cwd });
3434
});
3535

3636
await core.group("Setup .npmrc", async () => {
@@ -65,7 +65,7 @@ export async function run() {
6565
const publishedPackages = await core.group("Publishing packages", async () => {
6666
const publishScript = core.getInput("publish", { required: true });
6767
const [publishCmd, ...publishCmdArgs] = publishScript.split(/\s+/);
68-
const { stdout } = await exec.getExecOutput(publishCmd, publishCmdArgs, { cwd });
68+
const { stdout } = await getExecOutput(publishCmd, publishCmdArgs, { cwd });
6969

7070
// text from https://github.com/changesets/changesets/blob/dc83cb4dce0de726ca70593d4bef6f3f2c3d5278/packages/cli/src/commands/publish/index.ts#L91
7171
const SUCCESS_TEXT = "packages published successfully:";

0 commit comments

Comments
 (0)