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