Socket
Socket
Sign inDemoInstall

semantic-release-codeartifact

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

semantic-release-codeartifact - npm Package Compare versions

Comparing version 2.0.5 to 2.0.6

12

lib/src/get-ca-config.js

@@ -26,3 +26,3 @@ "use strict";

try {
const client = aws_sdk_v3_proxy_1.addProxyToClient(new client_codeartifact_1.CodeartifactClient({
const client = (0, aws_sdk_v3_proxy_1.addProxyToClient)(new client_codeartifact_1.CodeartifactClient({
credentials: {

@@ -47,6 +47,6 @@ accessKeyId: env.AWS_ACCESS_KEY_ID,

if (!authorizationToken) {
errors.push(get_error_1.getError('ENOAUTHTOKEN'));
errors.push((0, get_error_1.getError)('ENOAUTHTOKEN'));
}
if (!repositoryEndpoint) {
errors.push(get_error_1.getError('ENOREPOENDPOINT'));
errors.push((0, get_error_1.getError)('ENOREPOENDPOINT'));
}

@@ -61,7 +61,7 @@ if (errors.length > 0) {

throw e;
if (type_guards_1.isAWSError(e)) {
errors.push(get_error_1.getError('EAWSSDK', { message: e.message, name: e.name }));
if ((0, type_guards_1.isAWSError)(e)) {
errors.push((0, get_error_1.getError)('EAWSSDK', { message: e.message, name: e.name }));
}
else {
errors.push(get_error_1.getError('EAWSSDK', {
errors.push((0, get_error_1.getError)('EAWSSDK', {
name: 'UnknownException',

@@ -68,0 +68,0 @@ message: 'An unknown error has occured, check the logs for more details.',

@@ -20,3 +20,3 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
const errors = yield verify_ca_auth_1.verifyCodeArtifact(pluginConfig, context);
const errors = yield (0, verify_ca_auth_1.verifyCodeArtifact)(pluginConfig, context);
if (errors.length > 0) {

@@ -23,0 +23,0 @@ throw new aggregate_error_1.default(errors);

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

@@ -1,5 +0,3 @@

export declare type KnownKeys<T> = {
[K in keyof T]: string extends K ? never : number extends K ? never : K;
} extends {
[_ in keyof T]: infer U;
} ? U : never;
export declare type KnownKeys<T> = keyof {
[K in keyof T as string extends K ? never : number extends K ? never : K]: never;
};

@@ -7,3 +7,3 @@ "use strict";

typeof url2 === 'string' &&
string_1.removeTrailingSlash(url1) === string_1.removeTrailingSlash(url2);
(0, string_1.removeTrailingSlash)(url1) === (0, string_1.removeTrailingSlash)(url2);
exports.isUrlMatch = isUrlMatch;

@@ -22,10 +22,10 @@ "use strict";

const verifyCodeArtifact = (pluginConfig, context) => __awaiter(void 0, void 0, void 0, function* () {
const resolvedConfig = resolve_config_1.resolveConfig(pluginConfig, context);
const errors = verify_config_1.verifyConfig(resolvedConfig, context);
const resolvedConfig = (0, resolve_config_1.resolveConfig)(pluginConfig, context);
const errors = (0, verify_config_1.verifyConfig)(resolvedConfig, context);
if (errors.length > 0) {
throw new aggregate_error_1.default(errors);
}
const codeArtifactConfig = yield get_ca_config_1.getCodeArtifactConfig(resolvedConfig, context);
return yield verify_npm_1.verifyNpm(resolvedConfig, context, codeArtifactConfig, errors);
const codeArtifactConfig = yield (0, get_ca_config_1.getCodeArtifactConfig)(resolvedConfig, context);
return yield (0, verify_npm_1.verifyNpm)(resolvedConfig, context, codeArtifactConfig, errors);
});
exports.verifyCodeArtifact = verifyCodeArtifact;

@@ -11,18 +11,18 @@ "use strict";

if (!domain) {
errors.push(get_error_1.getError('ENODOMAINSET'));
errors.push((0, get_error_1.getError)('ENODOMAINSET'));
}
if (!repository) {
errors.push(get_error_1.getError('ENOREPOSET'));
errors.push((0, get_error_1.getError)('ENOREPOSET'));
}
if (!constants_1.SUPPORTED_TOOL_LIST.includes(tool)) {
errors.push(get_error_1.getError('EINVALIDTOOL', pluginConfig));
errors.push((0, get_error_1.getError)('EINVALIDTOOL', pluginConfig));
}
if (!env.AWS_REGION) {
errors.push(get_error_1.getError('ENOAWSREGION'));
errors.push((0, get_error_1.getError)('ENOAWSREGION'));
}
if (!env.AWS_ACCESS_KEY_ID) {
errors.push(get_error_1.getError('ENOAWSACCESSKEY'));
errors.push((0, get_error_1.getError)('ENOAWSACCESSKEY'));
}
if (!env.AWS_SECRET_ACCESS_KEY) {
errors.push(get_error_1.getError('ENOAWSSECRETKEY'));
errors.push((0, get_error_1.getError)('ENOAWSSECRETKEY'));
}

@@ -29,0 +29,0 @@ return errors;

@@ -26,9 +26,9 @@ "use strict";

const { cwd, logger } = context;
const { publishConfig = {} } = yield read_pkg_1.default({ cwd });
const npmrcPath = path_1.resolve(cwd, '.npmrc');
verify_plugins_1.verifyPlugins(pluginConfig, context, REQUIRED_PLUGINS, errors);
const { publishConfig = {} } = yield (0, read_pkg_1.default)({ cwd });
const npmrcPath = (0, path_1.resolve)(cwd, '.npmrc');
(0, verify_plugins_1.verifyPlugins)(pluginConfig, context, REQUIRED_PLUGINS, errors);
if (publishConfig.registry) {
logger.log('Validating `publishConfig.registry` from `package.json` matches CodeArtifact endpoint');
if (!url_1.isUrlMatch(publishConfig.registry, repositoryEndpoint)) {
errors.push(get_error_1.getError('EPUBLISHCONFIGMISMATCH', {
if (!(0, url_1.isUrlMatch)(publishConfig.registry, repositoryEndpoint)) {
errors.push((0, get_error_1.getError)('EPUBLISHCONFIGMISMATCH', {
repositoryEndpoint,

@@ -41,16 +41,16 @@ publishConfig,

}
if (yield fs_extra_1.pathExists(npmrcPath)) {
if (yield (0, fs_extra_1.pathExists)(npmrcPath)) {
logger.log('Validating `.npmrc` matches CodeArtifact endpoint');
const npmrc = yield fs_extra_1.readFile(npmrcPath, 'utf8');
const formattedNpmrc = npmrc_1.replaceEnvVarsInNpmrc(npmrc);
const [registry, ...otherRegistries] = npmrc_1.getRegistryFromNpmrc(formattedNpmrc);
const npmrc = yield (0, fs_extra_1.readFile)(npmrcPath, 'utf8');
const formattedNpmrc = (0, npmrc_1.replaceEnvVarsInNpmrc)(npmrc);
const [registry, ...otherRegistries] = (0, npmrc_1.getRegistryFromNpmrc)(formattedNpmrc);
// npmrc exists but no registries are listed
if (registry) {
if (otherRegistries.length) {
errors.push(get_error_1.getError('ENPMRCMULTIPLEREGISTRY', {
errors.push((0, get_error_1.getError)('ENPMRCMULTIPLEREGISTRY', {
registries: [registry, ...otherRegistries],
}));
}
if (!url_1.isUrlMatch(registry, repositoryEndpoint)) {
errors.push(get_error_1.getError('ENPMRCCONFIGMISMATCH', { repositoryEndpoint, registry }));
if (!(0, url_1.isUrlMatch)(registry, repositoryEndpoint)) {
errors.push((0, get_error_1.getError)('ENPMRCCONFIGMISMATCH', { repositoryEndpoint, registry }));
}

@@ -61,3 +61,3 @@ }

logger.log('No registry found in existing `.npmrc`, appending CodeArtifact registry');
yield fs_extra_1.appendFile(npmrcPath, `\nregistry=${repositoryEndpoint}\n//${repositoryEndpoint.replace(/(^\w+:|^)\/\//, '')}:always-auth=true\n`);
yield (0, fs_extra_1.appendFile)(npmrcPath, `\nregistry=${repositoryEndpoint}\n//${repositoryEndpoint.replace(/(^\w+:|^)\/\//, '')}:always-auth=true\n`);
}

@@ -67,3 +67,3 @@ }

// If no .npmrc exists, create one
yield fs_extra_1.writeFile(npmrcPath, `registry=${repositoryEndpoint}\n//${repositoryEndpoint.replace(/(^\w+:|^)\/\//, '')}:always-auth=true\n`);
yield (0, fs_extra_1.writeFile)(npmrcPath, `registry=${repositoryEndpoint}\n//${repositoryEndpoint.replace(/(^\w+:|^)\/\//, '')}:always-auth=true\n`);
}

@@ -70,0 +70,0 @@ logger.info('Setting process.env.NPM_TOKEN with the token retrieved from CodeArtifact');

@@ -15,3 +15,3 @@ "use strict";

logger.error('Missing plugin %s', plugin);
errors.push(get_error_1.getError('EMISSINGPLUGIN', { plugin, tool, plugins, requiredPlugins }));
errors.push((0, get_error_1.getError)('EMISSINGPLUGIN', { plugin, tool, plugins, requiredPlugins }));
}

@@ -18,0 +18,0 @@ }

@@ -17,5 +17,5 @@ "use strict";

const get_ca_config_1 = require("../src/get-ca-config");
const mockCaClient = aws_sdk_client_mock_1.mockClient(client_codeartifact_1.CodeartifactClient);
const config = dummies_1.makePluginConfig();
const context = mock_context_1.getMockContext();
const mockCaClient = (0, aws_sdk_client_mock_1.mockClient)(client_codeartifact_1.CodeartifactClient);
const config = (0, dummies_1.makePluginConfig)();
const context = (0, mock_context_1.getMockContext)();
const authorizationToken = '16b1690f-4a51-4e2f-a9d6-ff5b0ec1189f-test-auth-token';

@@ -38,3 +38,3 @@ const repositoryEndpoint = 'https://my-domain-123456789012.d.codeartifact.us-east-1.amazonaws.com/npm/my-repo/';

it('should return an object containing the auth token and repository endpoint', () => __awaiter(void 0, void 0, void 0, function* () {
const result = yield get_ca_config_1.getCodeArtifactConfig(config, context);
const result = yield (0, get_ca_config_1.getCodeArtifactConfig)(config, context);
expect(result).toEqual({ authorizationToken, repositoryEndpoint });

@@ -46,3 +46,3 @@ }));

try {
yield get_ca_config_1.getCodeArtifactConfig(config, context);
yield (0, get_ca_config_1.getCodeArtifactConfig)(config, context);
}

@@ -60,3 +60,3 @@ catch (errors) {

try {
yield get_ca_config_1.getCodeArtifactConfig(config, context);
yield (0, get_ca_config_1.getCodeArtifactConfig)(config, context);
}

@@ -78,3 +78,3 @@ catch (errors) {

try {
yield get_ca_config_1.getCodeArtifactConfig(config, context);
yield (0, get_ca_config_1.getCodeArtifactConfig)(config, context);
}

@@ -95,3 +95,3 @@ catch (errors) {

try {
yield get_ca_config_1.getCodeArtifactConfig(config, context);
yield (0, get_ca_config_1.getCodeArtifactConfig)(config, context);
}

@@ -98,0 +98,0 @@ catch (errors) {

@@ -22,7 +22,7 @@ "use strict";

jest.mock('../src/verify-ca-auth');
const mockVerifyCodeArtifact = utils_1.mocked(verify_ca_auth_1.verifyCodeArtifact);
const mockVerifyCodeArtifact = (0, utils_1.mocked)(verify_ca_auth_1.verifyCodeArtifact);
describe('index', () => {
describe('verifyConditions', () => {
const pluginConfig = dummies_1.makePluginConfig();
const mockContext = mock_context_1.getMockContext();
const pluginConfig = (0, dummies_1.makePluginConfig)();
const mockContext = (0, mock_context_1.getMockContext)();
beforeEach(() => {

@@ -35,3 +35,3 @@ jest.resetAllMocks();

]);
const fn = () => src_1.verifyConditions(pluginConfig, mockContext);
const fn = () => (0, src_1.verifyConditions)(pluginConfig, mockContext);
yield expect(fn).rejects.toThrowError();

@@ -41,3 +41,3 @@ }));

mockVerifyCodeArtifact.mockResolvedValue([]);
const result = yield src_1.verifyConditions(pluginConfig, mockContext);
const result = yield (0, src_1.verifyConditions)(pluginConfig, mockContext);
expect(result).toBeUndefined();

@@ -44,0 +44,0 @@ }));

@@ -7,4 +7,4 @@ "use strict";

const mock_context_1 = require("./mocks/mock-context");
const config = dummies_1.makePluginConfig();
const context = mock_context_1.getMockContext();
const config = (0, dummies_1.makePluginConfig)();
const context = (0, mock_context_1.getMockContext)();
const pluginConfigKeys = [

@@ -22,3 +22,3 @@ 'domain',

const existingConfigs = { a: 'a', b: 'b', c: [] };
const resolvedConfig = resolve_config_1.resolveConfig(Object.assign(Object.assign({}, config), existingConfigs), context);
const resolvedConfig = (0, resolve_config_1.resolveConfig)(Object.assign(Object.assign({}, config), existingConfigs), context);
expect(resolvedConfig).toEqual(expect.objectContaining(existingConfigs));

@@ -28,3 +28,3 @@ });

expect.assertions(pluginConfigKeys.length);
const contextWithEnv = Object.assign(Object.assign({}, mock_context_1.getMockContext()), { env: {
const contextWithEnv = Object.assign(Object.assign({}, (0, mock_context_1.getMockContext)()), { env: {
SR_CA_DOMAIN: 'env-domain',

@@ -36,3 +36,3 @@ SR_CA_DOMAIN_OWNER: 'env-domain_owner',

} });
const resolvedConfig = resolve_config_1.resolveConfig(config, contextWithEnv);
const resolvedConfig = (0, resolve_config_1.resolveConfig)(config, contextWithEnv);
for (const key of pluginConfigKeys) {

@@ -43,3 +43,3 @@ expect(resolvedConfig[key]).toEqual(config[key]);

it('should resolve enviornment variables when plugin configurations do not exist', () => {
const configWithoutOptions = Object.assign(Object.assign({}, dummies_1.makePluginConfig()), {
const configWithoutOptions = Object.assign(Object.assign({}, (0, dummies_1.makePluginConfig)()), {
// @ts-expect-error

@@ -58,4 +58,4 @@ domain: undefined, domainOwner: undefined, durationSeconds: undefined,

};
const contextWithEnv = Object.assign(Object.assign({}, mock_context_1.getMockContext()), { env });
const resolvedConfig = resolve_config_1.resolveConfig(configWithoutOptions, contextWithEnv);
const contextWithEnv = Object.assign(Object.assign({}, (0, mock_context_1.getMockContext)()), { env });
const resolvedConfig = (0, resolve_config_1.resolveConfig)(configWithoutOptions, contextWithEnv);
expect(resolvedConfig.domain).toEqual(env.SR_CA_DOMAIN);

@@ -68,3 +68,3 @@ expect(resolvedConfig.domainOwner).toEqual(env.SR_CA_DOMAIN_OWNER);

it('should resolve default values when no config options or env vars are set', () => {
const configWithoutOptions = Object.assign(Object.assign({}, dummies_1.makePluginConfig()), {
const configWithoutOptions = Object.assign(Object.assign({}, (0, dummies_1.makePluginConfig)()), {
// @ts-expect-error

@@ -76,4 +76,4 @@ domain: undefined, domainOwner: undefined, durationSeconds: undefined,

tool: undefined });
const contextWithoutEnv = Object.assign(Object.assign({}, mock_context_1.getMockContext()), { env: {} });
const resolvedConfig = resolve_config_1.resolveConfig(configWithoutOptions, contextWithoutEnv);
const contextWithoutEnv = Object.assign(Object.assign({}, (0, mock_context_1.getMockContext)()), { env: {} });
const resolvedConfig = (0, resolve_config_1.resolveConfig)(configWithoutOptions, contextWithoutEnv);
expect(resolvedConfig.tool).toEqual('');

@@ -86,4 +86,4 @@ expect(resolvedConfig.domain).toEqual('');

it('should resolve skipPluginCheck to false when value is undefined', () => {
const configWithPluginSkip = Object.assign(Object.assign({}, dummies_1.makePluginConfig()), { skipPluginCheck: undefined });
const resolvedConfig = resolve_config_1.resolveConfig(configWithPluginSkip, context);
const configWithPluginSkip = Object.assign(Object.assign({}, (0, dummies_1.makePluginConfig)()), { skipPluginCheck: undefined });
const resolvedConfig = (0, resolve_config_1.resolveConfig)(configWithPluginSkip, context);
expect(resolvedConfig.skipPluginCheck).toEqual(false);

@@ -90,0 +90,0 @@ });

@@ -26,4 +26,4 @@ "use strict";

it('should handle a single registry npmrc file', () => __awaiter(void 0, void 0, void 0, function* () {
const singleRegistry = yield fs_extra_1.readFile(`${fixtures}/.npmrc`, 'utf8');
const [registry, ...otherRegistries] = npmrc_1.getRegistryFromNpmrc(singleRegistry);
const singleRegistry = yield (0, fs_extra_1.readFile)(`${fixtures}/.npmrc`, 'utf8');
const [registry, ...otherRegistries] = (0, npmrc_1.getRegistryFromNpmrc)(singleRegistry);
expect(registry).toMatch(RE_URL);

@@ -33,4 +33,4 @@ expect(otherRegistries).toHaveLength(0);

it('should handle a scoped registry npmrc file', () => __awaiter(void 0, void 0, void 0, function* () {
const scopedRegistry = yield fs_extra_1.readFile(`${fixtures}/scoped.npmrc`, 'utf8');
const [registry, ...otherRegistries] = npmrc_1.getRegistryFromNpmrc(scopedRegistry);
const scopedRegistry = yield (0, fs_extra_1.readFile)(`${fixtures}/scoped.npmrc`, 'utf8');
const [registry, ...otherRegistries] = (0, npmrc_1.getRegistryFromNpmrc)(scopedRegistry);
expect(registry).toMatch(RE_URL);

@@ -40,3 +40,3 @@ expect(otherRegistries).toHaveLength(0);

it('should not throw when an undefined value is passed in', () => {
const registry = npmrc_1.getRegistryFromNpmrc();
const registry = (0, npmrc_1.getRegistryFromNpmrc)();
expect(registry).toEqual([]);

@@ -52,13 +52,13 @@ });

process.env.AWS_REGION = region;
const npmrc = yield fs_extra_1.readFile(`${fixtures}/envvars.npmrc`, 'utf8');
const formattedNpmrc = npmrc_1.replaceEnvVarsInNpmrc(npmrc);
const npmrc = yield (0, fs_extra_1.readFile)(`${fixtures}/envvars.npmrc`, 'utf8');
const formattedNpmrc = (0, npmrc_1.replaceEnvVarsInNpmrc)(npmrc);
expect(formattedNpmrc).toEqual(expect.stringContaining(expectedUrl));
}));
it('should return the same string if no environment variables are present', () => __awaiter(void 0, void 0, void 0, function* () {
const npmrc = yield fs_extra_1.readFile(`${fixtures}/.npmrc`, 'utf8');
const formattedNpmrc = npmrc_1.replaceEnvVarsInNpmrc(npmrc);
const npmrc = yield (0, fs_extra_1.readFile)(`${fixtures}/.npmrc`, 'utf8');
const formattedNpmrc = (0, npmrc_1.replaceEnvVarsInNpmrc)(npmrc);
expect(formattedNpmrc).toEqual(npmrc);
}));
it('should not throw when an undefined value is passed in', () => {
const formattedNpmrc = npmrc_1.replaceEnvVarsInNpmrc();
const formattedNpmrc = (0, npmrc_1.replaceEnvVarsInNpmrc)();
expect(formattedNpmrc).toEqual('');

@@ -65,0 +65,0 @@ });

@@ -7,7 +7,7 @@ "use strict";

it('should remove trailing slashes with expected inputs', () => {
expect(string_1.removeTrailingSlash('https://google.com/')).toEqual('https://google.com');
expect(string_1.removeTrailingSlash(0)).toEqual('');
expect(string_1.removeTrailingSlash('http://local/url/with/trailing/slash/')).toEqual('http://local/url/with/trailing/slash');
expect((0, string_1.removeTrailingSlash)('https://google.com/')).toEqual('https://google.com');
expect((0, string_1.removeTrailingSlash)(0)).toEqual('');
expect((0, string_1.removeTrailingSlash)('http://local/url/with/trailing/slash/')).toEqual('http://local/url/with/trailing/slash');
});
});
});

@@ -29,11 +29,11 @@ "use strict";

jest.mock('../src/verify-npm');
const mockResolveConfig = utils_1.mocked(resolve_config_1.resolveConfig, true);
const mockVerifyConfig = utils_1.mocked(verify_config_1.verifyConfig, true);
const mockGetCodeArtifactConfig = utils_1.mocked(get_ca_config_1.getCodeArtifactConfig, true);
const mockVerifyNpm = utils_1.mocked(verify_npm_1.verifyNpm, true);
const mockResolveConfig = (0, utils_1.mocked)(resolve_config_1.resolveConfig, true);
const mockVerifyConfig = (0, utils_1.mocked)(verify_config_1.verifyConfig, true);
const mockGetCodeArtifactConfig = (0, utils_1.mocked)(get_ca_config_1.getCodeArtifactConfig, true);
const mockVerifyNpm = (0, utils_1.mocked)(verify_npm_1.verifyNpm, true);
describe('verify-ca-auth', () => {
describe('verifyCodeArtifact', () => {
const config = dummies_1.makePluginConfig();
const context = mock_context_1.getMockContext();
const caConfig = dummies_1.makeCodeArtifactConfig();
const config = (0, dummies_1.makePluginConfig)();
const context = (0, mock_context_1.getMockContext)();
const caConfig = (0, dummies_1.makeCodeArtifactConfig)();
beforeEach(() => {

@@ -49,3 +49,3 @@ jest.resetAllMocks();

mockVerifyConfig.mockReturnValue([semanticReleaseError]);
const fn = () => verify_ca_auth_1.verifyCodeArtifact(config, context);
const fn = () => (0, verify_ca_auth_1.verifyCodeArtifact)(config, context);
yield expect(fn).rejects.toThrowError(aggregateError);

@@ -56,3 +56,3 @@ }));

mockResolveConfig.mockReturnValue(resolvedConfig);
yield verify_ca_auth_1.verifyCodeArtifact(resolvedConfig, context);
yield (0, verify_ca_auth_1.verifyCodeArtifact)(resolvedConfig, context);
expect(get_ca_config_1.getCodeArtifactConfig).toHaveBeenCalledWith(resolvedConfig, context);

@@ -65,3 +65,3 @@ }));

mockVerifyNpm.mockResolvedValue(errors);
const result = yield verify_ca_auth_1.verifyCodeArtifact(config, context);
const result = yield (0, verify_ca_auth_1.verifyCodeArtifact)(config, context);
expect(result).toEqual(errors);

@@ -68,0 +68,0 @@ }));

@@ -11,4 +11,4 @@ "use strict";

beforeEach(() => {
config = dummies_1.makePluginConfig();
context = mock_context_1.getMockContext();
config = (0, dummies_1.makePluginConfig)();
context = (0, mock_context_1.getMockContext)();
});

@@ -18,3 +18,3 @@ it('should return a SemanticRelease error if domain is not set', () => {

config.domain = undefined;
const [error, ...otherErrors] = verify_config_1.verifyConfig(config, context);
const [error, ...otherErrors] = (0, verify_config_1.verifyConfig)(config, context);
expect(error === null || error === void 0 ? void 0 : error.code).toEqual('ENODOMAINSET');

@@ -27,3 +27,3 @@ expect(error === null || error === void 0 ? void 0 : error.name).toEqual('SemanticReleaseError');

config.repository = undefined;
const [error, ...otherErrors] = verify_config_1.verifyConfig(config, context);
const [error, ...otherErrors] = (0, verify_config_1.verifyConfig)(config, context);
expect(error === null || error === void 0 ? void 0 : error.code).toEqual('ENOREPOSET');

@@ -35,3 +35,3 @@ expect(error === null || error === void 0 ? void 0 : error.name).toEqual('SemanticReleaseError');

config.tool = 'not-supported';
const [error, ...otherErrors] = verify_config_1.verifyConfig(config, context);
const [error, ...otherErrors] = (0, verify_config_1.verifyConfig)(config, context);
expect(error === null || error === void 0 ? void 0 : error.code).toEqual('EINVALIDTOOL');

@@ -44,3 +44,3 @@ expect(error === null || error === void 0 ? void 0 : error.name).toEqual('SemanticReleaseError');

config.tool = undefined;
const [error, ...otherErrors] = verify_config_1.verifyConfig(config, context);
const [error, ...otherErrors] = (0, verify_config_1.verifyConfig)(config, context);
expect(error === null || error === void 0 ? void 0 : error.code).toEqual('EINVALIDTOOL');

@@ -52,3 +52,3 @@ expect(error === null || error === void 0 ? void 0 : error.name).toEqual('SemanticReleaseError');

context.env.AWS_REGION = undefined;
const [error, ...otherErrors] = verify_config_1.verifyConfig(config, context);
const [error, ...otherErrors] = (0, verify_config_1.verifyConfig)(config, context);
expect(error === null || error === void 0 ? void 0 : error.code).toEqual('ENOAWSREGION');

@@ -60,3 +60,3 @@ expect(error === null || error === void 0 ? void 0 : error.name).toEqual('SemanticReleaseError');

context.env.AWS_ACCESS_KEY_ID = undefined;
const [error, ...otherErrors] = verify_config_1.verifyConfig(config, context);
const [error, ...otherErrors] = (0, verify_config_1.verifyConfig)(config, context);
expect(error === null || error === void 0 ? void 0 : error.code).toEqual('ENOAWSACCESSKEY');

@@ -68,3 +68,3 @@ expect(error === null || error === void 0 ? void 0 : error.name).toEqual('SemanticReleaseError');

context.env.AWS_SECRET_ACCESS_KEY = undefined;
const [error, ...otherErrors] = verify_config_1.verifyConfig(config, context);
const [error, ...otherErrors] = (0, verify_config_1.verifyConfig)(config, context);
expect(error === null || error === void 0 ? void 0 : error.code).toEqual('ENOAWSSECRETKEY');

@@ -71,0 +71,0 @@ expect(error === null || error === void 0 ? void 0 : error.name).toEqual('SemanticReleaseError');

@@ -22,9 +22,9 @@ "use strict";

const copyDefaultPackage = (cwd) => __awaiter(void 0, void 0, void 0, function* () {
return yield fs_extra_1.copy(`${fixtures}/package-without-registry.json`, `${cwd}/package.json`);
return yield (0, fs_extra_1.copy)(`${fixtures}/package-without-registry.json`, `${cwd}/package.json`);
});
describe('verify-npm', () => {
describe('verifyNpm', () => {
const pluginConfig = dummies_1.makePluginConfig();
const caConfig = dummies_1.makeCodeArtifactConfig();
const mockContext = mock_context_1.getMockContext();
const pluginConfig = (0, dummies_1.makePluginConfig)();
const caConfig = (0, dummies_1.makeCodeArtifactConfig)();
const mockContext = (0, mock_context_1.getMockContext)();
const PREV_ENV = process.env;

@@ -42,5 +42,5 @@ beforeEach(() => {

const missingPluginCode = 'EMISSINGPLUGIN';
yield fs_extra_1.copy(fixtures, cwd);
yield (0, fs_extra_1.copy)(fixtures, cwd);
yield copyDefaultPackage(cwd);
const [error] = yield verify_npm_1.verifyNpm(pluginConfig, contextWithoutPlugins, caConfig, []);
const [error] = yield (0, verify_npm_1.verifyNpm)(pluginConfig, contextWithoutPlugins, caConfig, []);
expect(error === null || error === void 0 ? void 0 : error.code).toEqual(missingPluginCode);

@@ -54,5 +54,5 @@ expect(error === null || error === void 0 ? void 0 : error.name).toEqual('SemanticReleaseError');

const configWithSkip = Object.assign(Object.assign({}, pluginConfig), { skipPluginCheck: true });
yield fs_extra_1.copy(fixtures, cwd);
yield (0, fs_extra_1.copy)(fixtures, cwd);
yield copyDefaultPackage(cwd);
const [error] = yield verify_npm_1.verifyNpm(configWithSkip, contextWithoutPlugins, caConfig, []);
const [error] = yield (0, verify_npm_1.verifyNpm)(configWithSkip, contextWithoutPlugins, caConfig, []);
expect(error).toBeUndefined();

@@ -64,4 +64,4 @@ }));

const mismatchPublishCode = 'EPUBLISHCONFIGMISMATCH';
yield fs_extra_1.copy(`${fixtures}/package-with-mismatch-registry.json`, `${cwd}/package.json`);
const [error, ...otherErrors] = yield verify_npm_1.verifyNpm(pluginConfig, Object.assign(Object.assign({}, mockContext), { cwd }), caConfig, []);
yield (0, fs_extra_1.copy)(`${fixtures}/package-with-mismatch-registry.json`, `${cwd}/package.json`);
const [error, ...otherErrors] = yield (0, verify_npm_1.verifyNpm)(pluginConfig, Object.assign(Object.assign({}, mockContext), { cwd }), caConfig, []);
expect(error === null || error === void 0 ? void 0 : error.code).toEqual(mismatchPublishCode);

@@ -74,4 +74,4 @@ expect(error === null || error === void 0 ? void 0 : error.name).toEqual('SemanticReleaseError');

yield tempy_1.default.directory.task((cwd) => __awaiter(void 0, void 0, void 0, function* () {
yield fs_extra_1.copy(`${fixtures}/package-with-matching-registry.json`, `${cwd}/package.json`);
const errors = yield verify_npm_1.verifyNpm(pluginConfig, Object.assign(Object.assign({}, mockContext), { cwd }), caConfig, []);
yield (0, fs_extra_1.copy)(`${fixtures}/package-with-matching-registry.json`, `${cwd}/package.json`);
const errors = yield (0, verify_npm_1.verifyNpm)(pluginConfig, Object.assign(Object.assign({}, mockContext), { cwd }), caConfig, []);
expect(errors).toHaveLength(0);

@@ -83,5 +83,5 @@ }));

const multipleRegistryCode = 'ENPMRCMULTIPLEREGISTRY';
yield fs_extra_1.copy(`${fixtures}/multiregistry.npmrc`, `${cwd}/.npmrc`);
yield (0, fs_extra_1.copy)(`${fixtures}/multiregistry.npmrc`, `${cwd}/.npmrc`);
yield copyDefaultPackage(cwd);
const [error, ...otherErrors] = yield verify_npm_1.verifyNpm(pluginConfig, Object.assign(Object.assign({}, mockContext), { cwd }), caConfig, []);
const [error, ...otherErrors] = yield (0, verify_npm_1.verifyNpm)(pluginConfig, Object.assign(Object.assign({}, mockContext), { cwd }), caConfig, []);
expect(error.code).toEqual(multipleRegistryCode);

@@ -95,8 +95,8 @@ expect(error.name).toEqual('SemanticReleaseError');

const mismatchNpmrcCode = 'ENPMRCCONFIGMISMATCH';
const caMismatchConfig = dummies_1.makeCodeArtifactConfig({
const caMismatchConfig = (0, dummies_1.makeCodeArtifactConfig)({
repositoryEndpoint: 'https://not-a-match.local/',
});
yield fs_extra_1.copy(fixtures, cwd);
yield (0, fs_extra_1.copy)(fixtures, cwd);
yield copyDefaultPackage(cwd);
const [error, ...otherErrors] = yield verify_npm_1.verifyNpm(pluginConfig, Object.assign(Object.assign({}, mockContext), { cwd }), caMismatchConfig, []);
const [error, ...otherErrors] = yield (0, verify_npm_1.verifyNpm)(pluginConfig, Object.assign(Object.assign({}, mockContext), { cwd }), caMismatchConfig, []);
expect(error === null || error === void 0 ? void 0 : error.code).toEqual(mismatchNpmrcCode);

@@ -111,5 +111,5 @@ expect(error === null || error === void 0 ? void 0 : error.name).toEqual('SemanticReleaseError');

yield tempy_1.default.directory.task((cwd) => __awaiter(void 0, void 0, void 0, function* () {
yield fs_extra_1.copy(`${fixtures}/envvars.npmrc`, `${cwd}/.npmrc`);
yield (0, fs_extra_1.copy)(`${fixtures}/envvars.npmrc`, `${cwd}/.npmrc`);
yield copyDefaultPackage(cwd);
const errors = yield verify_npm_1.verifyNpm(pluginConfig, Object.assign(Object.assign({}, mockContext), { cwd }), caConfig, []);
const errors = yield (0, verify_npm_1.verifyNpm)(pluginConfig, Object.assign(Object.assign({}, mockContext), { cwd }), caConfig, []);
expect(errors).toHaveLength(0);

@@ -122,7 +122,7 @@ }));

const npmrcContents = '//my-unrelated-registry.local/:always-auth=true\n';
const expected = yield fs_extra_1.readFile(`${fixtures}/.npmrc`, 'utf8');
const expected = yield (0, fs_extra_1.readFile)(`${fixtures}/.npmrc`, 'utf8');
yield copyDefaultPackage(cwd);
yield fs_extra_1.writeFile(npmrc, npmrcContents);
const errors = yield verify_npm_1.verifyNpm(pluginConfig, Object.assign(Object.assign({}, mockContext), { cwd }), caConfig, []);
const result = yield fs_extra_1.readFile(npmrc, 'utf8');
yield (0, fs_extra_1.writeFile)(npmrc, npmrcContents);
const errors = yield (0, verify_npm_1.verifyNpm)(pluginConfig, Object.assign(Object.assign({}, mockContext), { cwd }), caConfig, []);
const result = yield (0, fs_extra_1.readFile)(npmrc, 'utf8');
expect(result.split('\n')).toContain(expected.split('\n')[0]);

@@ -137,5 +137,5 @@ expect(errors).toHaveLength(0);

yield copyDefaultPackage(cwd);
yield fs_extra_1.writeFile(npmrc, npmrcContents);
const errors = yield verify_npm_1.verifyNpm(pluginConfig, Object.assign(Object.assign({}, mockContext), { cwd }), caConfig, []);
const result = yield fs_extra_1.readFile(npmrc, 'utf8');
yield (0, fs_extra_1.writeFile)(npmrc, npmrcContents);
const errors = yield (0, verify_npm_1.verifyNpm)(pluginConfig, Object.assign(Object.assign({}, mockContext), { cwd }), caConfig, []);
const result = yield (0, fs_extra_1.readFile)(npmrc, 'utf8');
expect(result).toEqual(npmrcContents);

@@ -147,6 +147,6 @@ expect(errors).toHaveLength(0);

yield tempy_1.default.directory.task((cwd) => __awaiter(void 0, void 0, void 0, function* () {
const expectedNpmrc = yield fs_extra_1.readFile(`${fixtures}/.npmrc`, 'utf8');
const expectedNpmrc = yield (0, fs_extra_1.readFile)(`${fixtures}/.npmrc`, 'utf8');
yield copyDefaultPackage(cwd);
yield verify_npm_1.verifyNpm(pluginConfig, Object.assign(Object.assign({}, mockContext), { cwd }), caConfig, []);
const result = yield fs_extra_1.readFile(`${cwd}/.npmrc`, 'utf8');
yield (0, verify_npm_1.verifyNpm)(pluginConfig, Object.assign(Object.assign({}, mockContext), { cwd }), caConfig, []);
const result = yield (0, fs_extra_1.readFile)(`${cwd}/.npmrc`, 'utf8');
expect(result).toEqual(expectedNpmrc);

@@ -153,0 +153,0 @@ }));

{
"name": "semantic-release-codeartifact",
"version": "2.0.5",
"version": "2.0.6",
"description": "semantic-release plugin for AWS CodeArtifact",

@@ -59,4 +59,6 @@ "main": "./lib/src/index.js",

"devDependencies": {
"@ryansonshine/commitizen": "^4.2.8",
"@ryansonshine/cz-conventional-changelog": "^3.3.4",
"@types/fs-extra": "^9.0.11",
"@types/jest": "^26.0.24",
"@types/jest": "^27.5.2",
"@types/node": "^12.20.11",

@@ -67,5 +69,4 @@ "@types/signale": "^1.4.1",

"aws-sdk-client-mock": "^0.4.0",
"codecov": "^3.8.1",
"commitizen": "^4.2.4",
"cz-conventional-changelog": "^3.3.0",
"codecov": "^3.8.3",
"conventional-changelog-conventionalcommits": "^5.0.0",
"eslint": "^7.25.0",

@@ -88,3 +89,3 @@ "eslint-config-prettier": "^8.3.0",

"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
"path": "./node_modules/@ryansonshine/cz-conventional-changelog"
}

@@ -98,4 +99,44 @@ },

"main"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"type": "build",
"scope": "deps",
"release": "patch"
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "build",
"section": "Dependencies and Other Build Updates",
"hidden": false
}
]
}
}
],
"@semantic-release/npm",
"@semantic-release/github"
]
}
}

@@ -40,2 +40,3 @@ <!-- omit in toc -->

- [Java - Gradle](#java---gradle)
- [Contributors ✨](#contributors-)

@@ -224,2 +225,23 @@ ## Install

## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://ryansonshine.com"><img src="https://avatars.githubusercontent.com/u/9534477?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ryan Sonshine</b></sub></a><br /><a href="https://github.com/ryansonshine/semantic-release-codeartifact/commits?author=ryansonshine" title="Code">💻</a></td>
<td align="center"><a href="http://jaredmcateer.com"><img src="https://avatars.githubusercontent.com/u/781540?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jared McAteer</b></sub></a><br /><a href="https://github.com/ryansonshine/semantic-release-codeartifact/issues?q=author%3Ajaredmcateer" title="Bug reports">🐛</a></td>
</tr>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
[build-img]:https://github.com/ryansonshine/semantic-release-codeartifact/actions/workflows/release.yml/badge.svg

@@ -226,0 +248,0 @@ [build-url]:https://github.com/ryansonshine/semantic-release-codeartifact/actions/workflows/release.yml

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc