Socket
Socket
Sign inDemoInstall

release-it

Package Overview
Dependencies
Maintainers
1
Versions
400
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

release-it - npm Package Compare versions

Comparing version 15.0.0-esm.3 to 15.0.0-esm.4

1

config/release-it.json

@@ -36,2 +36,3 @@ {

"releaseNotes": null,
"autoGenerate": false,
"preRelease": false,

@@ -38,0 +39,0 @@ "draft": false,

13

lib/plugin/github/GitHub.js

@@ -41,3 +41,3 @@ import fs from 'fs';

const { skipChecks, tokenRef, web, update } = this.options;
const { skipChecks, tokenRef, web, update, assets } = this.options;

@@ -53,2 +53,6 @@ if (!this.token || web) {

if (web && assets) {
this.log.warn('Assets are not included in web-based releases.');
}
if (!skipChecks) {

@@ -193,3 +197,3 @@ // If we're running on GitHub Actions, we can skip the authentication and

const { owner, project: repo } = this.getContext('repo');
const { releaseName, draft = false, preRelease = false } = this.options;
const { releaseName, draft = false, preRelease = false, autoGenerate = false } = this.options;
const { tagName } = this.config.getContext();

@@ -199,3 +203,3 @@ const { version, releaseNotes } = this.getContext();

const name = format(releaseName, this.config.getContext());
const body = releaseNotes;
const body = autoGenerate ? '' : releaseNotes || '';

@@ -209,3 +213,4 @@ return Object.assign(options, {

draft,
prerelease: isPreRelease || preRelease
prerelease: isPreRelease || preRelease,
generate_release_notes: autoGenerate
});

@@ -212,0 +217,0 @@ }

@@ -109,3 +109,7 @@ import semver from 'semver';

if (this.config.isCI && !increment) {
return semver.inc(latestVersion, 'patch');
if (isPreRelease) {
return semver.inc(latestVersion, 'prepatch', preReleaseId);
} else {
return semver.inc(latestVersion, 'patch');
}
}

@@ -112,0 +116,0 @@

{
"name": "release-it",
"version": "15.0.0-esm.3",
"version": "15.0.0-esm.4",
"description": "Generic CLI tool to automate versioning and package publishing related tasks.",

@@ -86,3 +86,3 @@ "keywords": [

"semver": "7.3.5",
"shelljs": "0.8.4",
"shelljs": "0.8.5",
"update-notifier": "5.1.0",

@@ -98,6 +98,6 @@ "url-join": "4.0.1",

"codecov": "3.8.3",
"eslint": "8.3.0",
"eslint": "8.7.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-ava": "13.1.0",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-ava": "13.2.0",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-prettier": "4.0.0",

@@ -107,5 +107,5 @@ "markdown-toc": "1.2.0",

"mock-stdio": "1.0.3",
"nock": "13.2.1",
"nock": "13.2.2",
"nyc": "15.1.0",
"prettier": "2.5.0",
"prettier": "2.5.1",
"sinon": "12.0.1",

@@ -112,0 +112,0 @@ "strip-ansi": "7.0.1"

@@ -324,2 +324,3 @@ # Release It! 🚀

- [ember-cli/ember-cli](https://github.com/ember-cli/ember-cli)
- [metalsmith/metalsmith](https://github.com/metalsmith/metalsmith)
- [react-native-paper](https://github.com/callstack/react-native-paper)

@@ -329,3 +330,3 @@ - [js-cookie/js-cookie](https://github.com/js-cookie/js-cookie)

- [mozilla/readability](https://github.com/mozilla/readability)
- [satya164/react-native-tab-view](https://github.com/satya164/react-native-tab-view)
- [redis/node-redis](https://github.com/redis/node-redis)
- [shipshapecode/shepherd](https://github.com/shipshapecode/shepherd)

@@ -335,4 +336,4 @@ - [swagger-api/swagger-ui](https://github.com/swagger-api/swagger-ui) +

- [StevenBlack/hosts](https://github.com/StevenBlack/hosts)
- [tabler](https://github.com/tabler/tabler) + [tabler-icons](https://github.com/tabler/tabler-icons)
- [youzan/vant](https://github.com/youzan/vant/search?q=release-it)
- [tabler/tabler](https://github.com/tabler/tabler) + [tabler-icons](https://github.com/tabler/tabler-icons)
- [youzan/vant](https://github.com/youzan/vant)
- [Repositories that depend on release-it](https://github.com/release-it/release-it/network/dependents)

@@ -339,0 +340,0 @@ - GitHub search for [filename:.release-it.json](https://github.com/search?q=filename%3A.release-it.json)

@@ -18,3 +18,3 @@ import test from 'ava';

const host = 'github.com';
const git = { changelog: null };
const git = { changelog: '' };
const requestErrorOptions = { request: { url: '', headers: {} }, response: { headers: {} } };

@@ -95,3 +95,3 @@

interceptCollaborator();
interceptCreate({ body: { tag_name: '2.0.2', name: 'Release 2.0.2', body: null, prerelease: true, draft: true } });
interceptCreate({ body: { tag_name: '2.0.2', name: 'Release 2.0.2', body: '', prerelease: true, draft: true } });

@@ -106,2 +106,31 @@ await runTasks(github);

test('should create auto generated release notes', async t => {
const options = {
git,
github: {
pushRepo,
tokenRef,
release: true,
releaseName: 'Release ${tagName}',
autoGenerate: true
}
};
const github = factory(GitHub, { options });
const exec = sinon.stub(github.shell, 'exec').callThrough();
exec.withArgs('git describe --tags --match=* --abbrev=0').resolves('2.0.1');
interceptAuthentication();
interceptCollaborator();
interceptCreate({
body: { tag_name: '2.0.2', name: 'Release 2.0.2', draft: false, prerelease: false, generate_release_notes: true }
});
await runTasks(github);
const { isReleased, releaseUrl } = github.getContext();
t.true(isReleased);
t.is(releaseUrl, 'https://github.com/user/repo/releases/tag/2.0.2');
exec.restore();
});
test('should update release and upload assets', async t => {

@@ -226,3 +255,3 @@ const asset = 'file1';

interceptCreate(Object.assign({ body: { tag_name: '1.0.1' } }, remote));
const options = { git: { pushRepo: 'upstream', changelog: null }, github: { tokenRef, skipChecks: true } };
const options = { git: { pushRepo: 'upstream', changelog: '' }, github: { tokenRef, skipChecks: true } };
const github = factory(GitHub, { options });

@@ -378,2 +407,3 @@ const exec = sinon.stub(github.shell, 'exec').callThrough();

const options = {
git,
github: {

@@ -380,0 +410,0 @@ pushRepo: 'git://my-custom-host.org:user/repo',

import nock from 'nock';
const interceptAuthentication = ({ api = 'https://api.github.com', username = 'john' } = {}) =>
const interceptAuthentication = ({ api = 'https://api.github.com', username = 'john' } = {}) => {
nock(api).get('/user').reply(200, {
login: username
});
};

@@ -13,3 +14,5 @@ const interceptCollaborator = ({

username = 'john'
} = {}) => nock(api).get(`/repos/${owner}/${project}/collaborators/${username}`).reply(204);
} = {}) => {
nock(api).get(`/repos/${owner}/${project}/collaborators/${username}`).reply(204);
};

@@ -22,3 +25,3 @@ const interceptListReleases = ({

tag_name
} = {}) =>
} = {}) => {
nock(api)

@@ -39,2 +42,3 @@ .get(`/repos/${owner}/${project}/releases?per_page=1&page=1`)

]);
};

@@ -46,6 +50,13 @@ const interceptCreate = ({

project = 'repo',
body: { tag_name, name = '', body = null, prerelease = false, draft = false }
} = {}) =>
body: { tag_name, name = '', body = '', prerelease = false, draft = false, generate_release_notes = false }
} = {}) => {
nock(api)
.post(`/repos/${owner}/${project}/releases`, { tag_name, name, body, prerelease, draft })
.post(`/repos/${owner}/${project}/releases`, {
tag_name,
name,
body,
prerelease,
draft,
generate_release_notes
})
.reply(() => {

@@ -60,2 +71,3 @@ const id = 1;

draft,
generate_release_notes,
upload_url: `https://uploads.${host}/repos/${owner}/${project}/releases/${id}/assets{?name,label}`,

@@ -66,2 +78,3 @@ html_url: `https://${host}/${owner}/${project}/releases/tag/${tag_name}`

});
};

@@ -73,6 +86,6 @@ const interceptUpdate = ({

project = 'repo',
body: { tag_name, name = '', body = null, prerelease = false, draft = false }
} = {}) =>
body: { tag_name, name = '', body = '', prerelease = false, draft = false, generate_release_notes = false }
} = {}) => {
nock(api)
.patch(`/repos/${owner}/${project}/releases/1`, { tag_name, name, body, draft, prerelease })
.patch(`/repos/${owner}/${project}/releases/1`, { tag_name, name, body, draft, prerelease, generate_release_notes })
.reply(200, {

@@ -85,5 +98,7 @@ id: 1,

draft,
generate_release_notes,
upload_url: `https://uploads.${host}/repos/${owner}/${project}/releases/1/assets{?name,label}`,
html_url: `https://${host}/${owner}/${project}/releases/tag/${tag_name}`
});
};

@@ -97,3 +112,3 @@ const interceptAsset = ({

body = {}
} = {}) =>
} = {}) => {
nock(`https://uploads.${host}`)

@@ -115,2 +130,3 @@ .post(`/repos/${owner}/${project}/releases/1/assets`, body)

});
};

@@ -117,0 +133,0 @@ export {

@@ -33,19 +33,10 @@ import _ from 'lodash';

const getIncrement = (plugin, { latestVersion }) => {
return (
plugin.getIncrement({
latestVersion,
increment: plugin.options.increment,
isPreRelease: false,
preReleaseId: null
}) ||
plugin.getContext('increment') ||
plugin.config.getContext('increment')
);
};
const getIncrement = plugin =>
plugin.getIncrement(plugin.options) || plugin.getContext('increment') || plugin.config.getContext('increment');
const getVersion = async (plugin, { latestVersion, increment }) => {
const getVersion = async (plugin, options) => {
const { latestVersion, increment } = options;
return (
(await plugin.getIncrementedVersionCI({ latestVersion, increment })) ||
(await plugin.getIncrementedVersion({ latestVersion, increment })) ||
(await plugin.getIncrementedVersionCI(options)) ||
(await plugin.getIncrementedVersion(options)) ||
(increment !== false ? semver.inc(latestVersion, increment || 'patch') : latestVersion)

@@ -60,8 +51,11 @@ );

const latestVersion = (await plugin.getLatestVersion()) || '1.0.0';
const changelog = (await plugin.getChangelog()) || null;
const increment = getIncrement(plugin, { latestVersion });
const changelog = (await plugin.getChangelog(latestVersion)) || null;
const increment = getIncrement(plugin);
plugin.config.setContext({ name, latestVersion, latestTag: latestVersion, changelog });
const version = await getVersion(plugin, { latestVersion, increment });
const { preRelease } = plugin.config.options;
const isPreRelease = Boolean(preRelease);
const preReleaseId = typeof preRelease === 'string' ? preRelease : null;
const version = await getVersion(plugin, { latestVersion, increment, isPreRelease, preReleaseId });

@@ -68,0 +62,0 @@ plugin.config.setContext(parseVersion(version));

@@ -151,3 +151,5 @@ import test from 'ava';

t.is(getIncrement.callCount, 1);
t.deepEqual(getIncrement.firstCall.args[0], {
t.deepEqual(getIncrement.firstCall.args[0], { increment: 'minor' });
t.is(getIncrementedVersionCI.callCount, 1);
t.deepEqual(getIncrementedVersionCI.firstCall.args[0], {
latestVersion: '1.0.0',

@@ -158,7 +160,10 @@ increment: 'minor',

});
t.is(getIncrementedVersionCI.callCount, 1);
t.deepEqual(getIncrementedVersionCI.firstCall.args[0], { latestVersion: '1.0.0', increment: 'minor' });
t.is(await incrementVersion.firstCall.returnValue, '1.1.0');
t.is(incrementVersion.callCount, 1);
t.deepEqual(incrementVersion.firstCall.args[0], { latestVersion: '1.0.0', increment: 'minor' });
t.deepEqual(incrementVersion.firstCall.args[0], {
latestVersion: '1.0.0',
increment: 'minor',
isPreRelease: false,
preReleaseId: null
});
t.is(incrementVersion.firstCall.returnValue, '1.1.0');

@@ -165,0 +170,0 @@ const { latestVersion, version, isPreRelease, preReleaseId } = v.config.getContext();

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