-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for publishing + edge releases
- Loading branch information
Showing
8 changed files
with
85 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { Options } from "execa"; | ||
|
||
export async function execCommand( | ||
cmd: string, | ||
args: string[], | ||
options?: Options<string> | ||
) { | ||
const { execa } = await import("execa"); | ||
const res = await execa(cmd, args, options); | ||
return res.stdout; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { resolve } from "pathe"; | ||
import { readPackageJSON, writePackageJSON } from "pkg-types"; | ||
import { ChangelogConfig } from "./config"; | ||
|
||
export async function usePkg(config: ChangelogConfig) { | ||
const pkgPath = resolve(config.cwd, "package.json"); | ||
const pkg = await readPackageJSON(pkgPath); | ||
|
||
return { | ||
pkg, | ||
writePkg: () => writePackageJSON(pkgPath, pkg), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ChangelogConfig } from "./config"; | ||
import { execCommand } from "./exec"; | ||
|
||
export async function publishNpmPackage(config: ChangelogConfig) { | ||
const args = ["publish"]; | ||
|
||
if (config.edge && (!config.edgePackage || config.edgeTag)) { | ||
args.push("--tag", config.edgeTag ?? "edge"); | ||
} | ||
|
||
return await execCommand("npm", args); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters