"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/legacy-cli/e2e/utils/registry.ts" between
angular-cli-12.1.2.tar.gz and angular-cli-12.1.3.tar.gz

About: Angular CLI is a command line interface for Angular.

registry.ts  (angular-cli-12.1.2):registry.ts  (angular-cli-12.1.3)
skipping to change at line 22 skipping to change at line 22
join(__dirname, '../../', withAuthentication ? 'verdaccio_auth.yaml' : 'verd accio.yaml'), join(__dirname, '../../', withAuthentication ? 'verdaccio_auth.yaml' : 'verd accio.yaml'),
join(registryPath, 'verdaccio.yaml'), join(registryPath, 'verdaccio.yaml'),
); );
return spawn('node', [require.resolve('verdaccio/bin/verdaccio'), '-c', './ver daccio.yaml'], { return spawn('node', [require.resolve('verdaccio/bin/verdaccio'), '-c', './ver daccio.yaml'], {
cwd: registryPath, cwd: registryPath,
stdio: 'inherit', stdio: 'inherit',
}); });
} }
// Token was generated using `echo -n 'testing:s3cret' | openssl base64`.
const VALID_TOKEN = `dGVzdGluZzpzM2NyZXQ=`;
const SECURE_REGISTRY = `//localhost:4876/`;
export function createNpmConfigForAuthentication( export function createNpmConfigForAuthentication(
/** /**
* When true, the authentication token will be scoped to the registry URL. * When true, the authentication token will be scoped to the registry URL.
* @example * @example
* ```ini * ```ini
* //localhost:4876/:_auth="dGVzdGluZzpzM2NyZXQ=" * //localhost:4876/:_auth="dGVzdGluZzpzM2NyZXQ="
* ``` * ```
* *
* When false, the authentication will be added as seperate key. * When false, the authentication will be added as seperate key.
* @example * @example
* ```ini * ```ini
* _auth="dGVzdGluZzpzM2NyZXQ="` * _auth="dGVzdGluZzpzM2NyZXQ="`
* ``` * ```
*/ */
scopedAuthentication: boolean, scopedAuthentication: boolean,
/** When true, an incorrect token is used. Use this to validate authentication failures. */ /** When true, an incorrect token is used. Use this to validate authentication failures. */
invalidToken = false, invalidToken = false,
): Promise<void> { ): Promise<void> {
// Token was generated using `echo -n 'testing:s3cret' | openssl base64`. const token = invalidToken ? `invalid=` : VALID_TOKEN;
const token = invalidToken ? `invalid=` : `dGVzdGluZzpzM2NyZXQ=`; const registry = SECURE_REGISTRY;
const registry = `//localhost:4876/`;
return writeFile( return writeFile(
'.npmrc', '.npmrc',
scopedAuthentication scopedAuthentication
? ` ? `
${registry}:_auth="${token}" ${registry}:_auth="${token}"
registry=http:${registry} registry=http:${registry}
` `
: ` : `
_auth="${token}" _auth="${token}"
registry=http:${registry} registry=http:${registry}
`, `,
); );
} }
export function setNpmEnvVarsForAuthentication(
/** When true, an incorrect token is used. Use this to validate authentication
failures. */
invalidToken = false,
/** When true, `YARN_REGISTRY` is used instead of `NPM_CONFIG_REGISTRY`. */
useYarnEnvVariable = false,
): void {
delete process.env['YARN_REGISTRY'];
delete process.env['NPM_CONFIG_REGISTRY'];
const registryKey = useYarnEnvVariable ? 'YARN_REGISTRY' : 'NPM_CONFIG_REGISTR
Y';
process.env[registryKey] = `http:${SECURE_REGISTRY}`;
process.env['NPM_CONFIG__AUTH'] = invalidToken ? `invalid=` : VALID_TOKEN;
// Needed for verdaccio when used with yarn
// https://verdaccio.org/docs/en/cli-registry#yarn
process.env['NPM_CONFIG_ALWAYS_AUTH'] = 'true';
}
 End of changes. 3 change blocks. 
3 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)