update README & npm run all
This commit is contained in:
20
src/audit.ts
20
src/audit.ts
@@ -9,20 +9,16 @@ export class Audit {
|
||||
|
||||
public run(auditLevel: string, productionFlag: string): void {
|
||||
try {
|
||||
const auditOptions: Array<string> =['audit', '--audit-level', auditLevel];
|
||||
|
||||
if(productionFlag === 'true') {
|
||||
auditOptions.push('--production');
|
||||
const auditOptions: Array<string> = ['audit', '--audit-level', auditLevel]
|
||||
|
||||
if (productionFlag === 'true') {
|
||||
auditOptions.push('--production')
|
||||
}
|
||||
|
||||
const result: SpawnSyncReturns<string> = spawnSync(
|
||||
'npm',
|
||||
auditOptions,
|
||||
{
|
||||
encoding: 'utf-8',
|
||||
maxBuffer: SPAWN_PROCESS_BUFFER_SIZE
|
||||
}
|
||||
)
|
||||
const result: SpawnSyncReturns<string> = spawnSync('npm', auditOptions, {
|
||||
encoding: 'utf-8',
|
||||
maxBuffer: SPAWN_PROCESS_BUFFER_SIZE
|
||||
})
|
||||
|
||||
if (result.error) {
|
||||
throw result.error
|
||||
|
||||
@@ -25,7 +25,7 @@ export async function run(): Promise<void> {
|
||||
throw new Error('Invalid input: audit_level')
|
||||
}
|
||||
|
||||
const productionFlag = core.getInput('production_flag', {required: false});
|
||||
const productionFlag = core.getInput('production_flag', {required: false})
|
||||
if (!['true', 'false'].includes(productionFlag)) {
|
||||
throw new Error('Invalid input: production_flag')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user