(name: string)
| 53 | } |
| 54 | |
| 55 | export function publishScript(name: string) { |
| 56 | const onCatch = (error: any) => { |
| 57 | if (booleanEnv(process.env.PRINT_ERRORS, false)) { |
| 58 | console.error(error) |
| 59 | } |
| 60 | } |
| 61 | return async () => { |
| 62 | const args = [...cliArgs.original] |
| 63 | if (args.length < 2) return |
| 64 | const command = args.shift() |
| 65 | const argument = args.shift() |
| 66 | if (command === 'publish') { |
| 67 | if (argument === 'dry') { |
| 68 | try { |
| 69 | const {stdout, stderr} = await execa( |
| 70 | 'npm', |
| 71 | ['publish', '--dry-run', '--tag', 'next'], |
| 72 | { |
| 73 | cwd: `${process.cwd()}/npm/${name}`, |
| 74 | env: process.env, |
| 75 | }, |
| 76 | ) |
| 77 | console.log(stdout) |
| 78 | console.error(stderr) |
| 79 | } catch (error) { |
| 80 | onCatch(error) |
| 81 | } |
| 82 | } else if (argument === 'next') { |
| 83 | try { |
| 84 | const {stdout, stderr} = await execa( |
| 85 | 'npm', |
| 86 | ['publish', '--tag', 'next'], |
| 87 | { |
| 88 | cwd: `${process.cwd()}/npm/${name}`, |
| 89 | env: process.env, |
| 90 | }, |
| 91 | ) |
| 92 | console.log(stdout) |
| 93 | console.error(stderr) |
| 94 | } catch (error) { |
| 95 | onCatch(error) |
| 96 | } |
| 97 | } else if (argument === 'latest') { |
| 98 | try { |
| 99 | const {stdout, stderr} = await execa( |
| 100 | 'npm', |
| 101 | ['publish', '--tag', 'latest'], |
| 102 | { |
| 103 | cwd: `${process.cwd()}/npm/${name}`, |
| 104 | env: process.env, |
| 105 | }, |
| 106 | ) |
| 107 | console.log(stdout) |
| 108 | console.error(stderr) |
| 109 | } catch (error) { |
| 110 | onCatch(error) |
| 111 | } |
| 112 | } |
no test coverage detected
searching dependent graphs…