feat(js): add location none to verdaccio executor (#17319)
This commit is contained in:
parent
646f79f4d2
commit
72b0f55605
@ -13,7 +13,7 @@
|
||||
"type": "string",
|
||||
"description": "Location option for npm config",
|
||||
"default": "user",
|
||||
"enum": ["global", "user", "project"]
|
||||
"enum": ["global", "user", "project", "none"]
|
||||
},
|
||||
"storage": {
|
||||
"type": "string",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
export interface VerdaccioExecutorSchema {
|
||||
location?: string;
|
||||
location: 'global' | 'user' | 'project' | 'none';
|
||||
storage?: string;
|
||||
port: number;
|
||||
config?: string;
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
"type": "string",
|
||||
"description": "Location option for npm config",
|
||||
"default": "user",
|
||||
"enum": ["global", "user", "project"]
|
||||
"enum": ["global", "user", "project", "none"]
|
||||
},
|
||||
"storage": {
|
||||
"type": "string",
|
||||
|
||||
@ -25,7 +25,8 @@ export async function verdaccioExecutor(
|
||||
if (options.clear && options.storage && existsSync(options.storage)) {
|
||||
removeSync(options.storage);
|
||||
}
|
||||
const cleanupFunctions = [setupNpm(options), setupYarn(options)];
|
||||
const cleanupFunctions =
|
||||
options.location === 'none' ? [] : [setupNpm(options), setupYarn(options)];
|
||||
|
||||
const processExitListener = (signal?: number | NodeJS.Signals) => {
|
||||
if (childProcess) {
|
||||
@ -148,6 +149,9 @@ function setupNpm(options: VerdaccioExecutorSchema) {
|
||||
} else {
|
||||
execSync(`npm config delete registry --location ${options.location}`);
|
||||
}
|
||||
execSync(
|
||||
`npm config delete //localhost:${options.port}/:_authToken --location ${options.location}`
|
||||
);
|
||||
} catch (e) {
|
||||
throw new Error(`Failed to reset npm registry: ${e.message}`);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user