mirror of
https://github.com/pnpm/action-setup.git
synced 2026-07-08 17:43:45 +08:00
Compare commits
4 Commits
refactor-r
...
8aea7c7d41
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8aea7c7d41 | ||
|
|
2502eaa221 | ||
|
|
f6cc97e7f4 | ||
|
|
0bc9da32cd |
@@ -24,7 +24,7 @@ inputs:
|
||||
required: false
|
||||
default: 'pnpm-lock.yaml'
|
||||
package_json_file:
|
||||
description: File path to the package.json to read "packageManager" configuration. This path must be relative to the repository root (GITHUB_WORKSPACE).
|
||||
description: File path to the package.json to read "packageManager" configuration
|
||||
required: false
|
||||
default: 'package.json'
|
||||
standalone:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getInput, error } from '@actions/core'
|
||||
import { parse as parseYaml } from 'yaml'
|
||||
import * as yaml from 'yaml'
|
||||
import { z, ZodError } from 'zod'
|
||||
|
||||
const RunInstallSchema = z.object({
|
||||
@@ -20,7 +20,7 @@ export type RunInstall = z.infer<typeof RunInstallSchema>
|
||||
|
||||
export function parseRunInstall(inputName: string): RunInstall[] {
|
||||
const input = getInput(inputName, { required: true })
|
||||
const parsedInput: unknown = parseYaml(input)
|
||||
const parsedInput: unknown = yaml.parse(input)
|
||||
|
||||
try {
|
||||
const result: RunInstallInput = RunInstallInputSchema.parse(parsedInput)
|
||||
|
||||
@@ -6,7 +6,7 @@ import path from 'path'
|
||||
import { execPath } from 'process'
|
||||
import util from 'util'
|
||||
import { Inputs } from '../inputs'
|
||||
import { parse as parseYaml } from 'yaml'
|
||||
import YAML from 'yaml'
|
||||
|
||||
export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
||||
const { version, dest, packageJsonFile, standalone } = inputs
|
||||
@@ -63,7 +63,7 @@ async function readTarget(opts: {
|
||||
try {
|
||||
const content = readFileSync(path.join(GITHUB_WORKSPACE, packageJsonFile), 'utf8');
|
||||
({ packageManager } = packageJsonFile.endsWith(".yaml")
|
||||
? parseYaml(content, { merge: true })
|
||||
? YAML.parse(content, { merge: true })
|
||||
: JSON.parse(content)
|
||||
)
|
||||
} catch (error: unknown) {
|
||||
|
||||
Reference in New Issue
Block a user