release-it
Advanced tools
Comparing version 17.6.0 to 18.0.0-next.0
@@ -5,3 +5,2 @@ import fs from 'node:fs'; | ||
import { Octokit } from '@octokit/rest'; | ||
import fetch from 'node-fetch'; | ||
import { globby } from 'globby'; | ||
@@ -181,4 +180,3 @@ import mime from 'mime-types'; | ||
request: { | ||
timeout, | ||
fetch | ||
timeout | ||
} | ||
@@ -185,0 +183,0 @@ }; |
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
import got from 'got'; | ||
import { globby } from 'globby'; | ||
import { FormData, fileFromSync } from 'node-fetch'; | ||
import _ from 'lodash'; | ||
@@ -33,18 +31,2 @@ import Release from '../GitRelease.js'; | ||
get client() { | ||
if (this._client) return this._client; | ||
const { tokenHeader } = this.options; | ||
const { baseUrl } = this.getContext(); | ||
this._client = got.extend({ | ||
prefixUrl: baseUrl, | ||
method: 'POST', | ||
headers: { | ||
'user-agent': 'webpro/release-it', | ||
[tokenHeader]: this.token | ||
}, | ||
...this.certificateAuthorityOption | ||
}); | ||
return this._client; | ||
} | ||
async init() { | ||
@@ -183,4 +165,24 @@ await super.init(); | ||
const method = (options.method || 'POST').toLowerCase(); | ||
const response = await this.client[method](endpoint, options); | ||
const body = typeof response.body === 'string' ? JSON.parse(response.body) : response.body || {}; | ||
const { tokenHeader } = this.options; | ||
const url = `${baseUrl}/${endpoint}${options.searchParams ? `?${new URLSearchParams(options.searchParams)}` : ''}`; | ||
const headers = { | ||
'user-agent': 'webpro/release-it', | ||
[tokenHeader]: this.token | ||
}; | ||
const requestOptions = { | ||
method, | ||
headers, | ||
...this.certificateAuthorityOption | ||
}; | ||
const response = await fetch( | ||
url, | ||
options.json || options.body | ||
? { | ||
...requestOptions, | ||
body: options.json ? JSON.stringify(options.json) : options.body | ||
} | ||
: requestOptions | ||
); | ||
const body = await response.json(); | ||
this.debug(body); | ||
@@ -244,3 +246,4 @@ return body; | ||
const body = new FormData(); | ||
body.set('file', fileFromSync(filePath)); | ||
const rawData = await fs.promises.readFile(filePath); | ||
body.set('file', new Blob([rawData]), name); | ||
const options = { body }; | ||
@@ -247,0 +250,0 @@ |
@@ -22,3 +22,3 @@ import inquirer from 'inquirer'; | ||
choices: 'choices' in prompt && prompt.choices(context), | ||
transformer: 'transformer' in prompt && prompt.transformer(context) | ||
transformer: 'transformer' in prompt ? prompt.transformer(context) : undefined | ||
}); | ||
@@ -25,0 +25,0 @@ |
{ | ||
"name": "release-it", | ||
"version": "17.6.0", | ||
"version": "18.0.0-next.0", | ||
"description": "Generic CLI tool to automate versioning and package publishing-related tasks.", | ||
@@ -82,11 +82,10 @@ "keywords": [ | ||
"@iarna/toml": "2.2.5", | ||
"@octokit/rest": "20.1.1", | ||
"@octokit/rest": "21.0.2", | ||
"async-retry": "1.3.3", | ||
"chalk": "5.3.0", | ||
"cosmiconfig": "9.0.0", | ||
"execa": "8.0.1", | ||
"git-url-parse": "14.0.0", | ||
"execa": "9.3.1", | ||
"git-url-parse": "15.0.0", | ||
"globby": "14.0.2", | ||
"got": "13.0.0", | ||
"inquirer": "9.3.2", | ||
"inquirer": "10.1.8", | ||
"is-ci": "3.0.1", | ||
@@ -97,10 +96,9 @@ "issue-parser": "7.0.1", | ||
"new-github-release-url": "2.0.0", | ||
"node-fetch": "3.3.2", | ||
"open": "10.1.0", | ||
"ora": "8.0.1", | ||
"os-name": "5.1.0", | ||
"os-name": "6.0.0", | ||
"proxy-agent": "6.4.0", | ||
"semver": "7.6.2", | ||
"semver": "7.6.3", | ||
"shelljs": "0.8.5", | ||
"update-notifier": "7.1.0", | ||
"update-notifier": "7.2.0", | ||
"url-join": "5.0.0", | ||
@@ -113,18 +111,18 @@ "wildcard-match": "5.1.3", | ||
"@eslint/eslintrc": "3.1.0", | ||
"@eslint/js": "9.7.0", | ||
"@octokit/request-error": "5.1.0", | ||
"@eslint/js": "9.9.1", | ||
"@octokit/request-error": "6.1.4", | ||
"@types/node": "20.14.10", | ||
"ava": "6.1.3", | ||
"eslint": "9.7.0", | ||
"eslint": "9.9.1", | ||
"eslint-config-prettier": "9.1.0", | ||
"eslint-plugin-ava": "15.0.1", | ||
"eslint-plugin-import-x": "3.0.1", | ||
"eslint-plugin-prettier": "5.1.3", | ||
"eslint-plugin-import-x": "3.1.0", | ||
"eslint-plugin-prettier": "5.2.1", | ||
"fs-monkey": "1.0.6", | ||
"globals": "15.8.0", | ||
"globals": "15.9.0", | ||
"installed-check": "9.3.0", | ||
"knip": "5.26.0", | ||
"memfs": "4.9.3", | ||
"knip": "5.27.3", | ||
"memfs": "4.11.1", | ||
"mock-stdio": "1.0.3", | ||
"nock": "13.5.4", | ||
"nock": "14.0.0-beta.8", | ||
"prettier": "3.3.3", | ||
@@ -135,3 +133,3 @@ "remark-cli": "12.0.1", | ||
"strip-ansi": "7.1.0", | ||
"typescript": "5.5.3" | ||
"typescript": "5.5.4" | ||
}, | ||
@@ -143,3 +141,3 @@ "overrides": { | ||
"engines": { | ||
"node": "^18.18.0 || ^20.9.0 || ^22.0.0" | ||
"node": "^20.9.0 || ^22.0.0" | ||
}, | ||
@@ -146,0 +144,0 @@ "remarkConfig": { |
@@ -17,3 +17,7 @@ { | ||
"requireBranch": { | ||
"type": "boolean", | ||
"oneOf": [ | ||
{ "type": "boolean", "enum": [false] }, | ||
{ "type": "string" }, | ||
{ "type": "array", "items": { "type": "string" } } | ||
], | ||
"default": false | ||
@@ -20,0 +24,0 @@ }, |
@@ -229,3 +229,2 @@ import fs from 'node:fs'; | ||
sinon.stub(gitlab, 'getLatestVersion').resolves('1.0.0'); | ||
const spy = sinon.spy(gitlab, 'client', ['get']); | ||
@@ -235,3 +234,3 @@ await runTasks(gitlab); | ||
const { isReleased, releaseUrl } = gitlab.getContext(); | ||
t.is(spy.get.callCount, 0); | ||
t.is(gitlab.log.exec.args[2][0], 'gitlab releases#uploadAssets'); | ||
@@ -241,3 +240,2 @@ t.is(gitlab.log.exec.args[3][0], 'gitlab releases#createRelease "R" (1.0.1)'); | ||
t.is(releaseUrl, `${pushRepo}/-/releases`); | ||
spy.get.restore(); | ||
}); | ||
@@ -248,3 +246,2 @@ | ||
const gitlab = factory(GitLab, { options }); | ||
const spy = sinon.spy(gitlab, 'client', ['get']); | ||
@@ -254,4 +251,2 @@ await t.notThrowsAsync(gitlab.init()); | ||
t.is(spy.get.callCount, 0); | ||
t.is(gitlab.log.exec.args.filter(entry => /checkReleaseMilestones/.test(entry[0])).length, 0); | ||
@@ -258,0 +253,0 @@ }); |
@@ -45,3 +45,3 @@ import test from 'ava'; | ||
choices: false, | ||
transformer: false, | ||
transformer: undefined, | ||
default: true | ||
@@ -48,0 +48,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24
257182
1
+ Added@inquirer/checkbox@2.5.0(transitive)
+ Added@inquirer/confirm@3.2.0(transitive)
+ Added@inquirer/core@9.2.1(transitive)
+ Added@inquirer/editor@2.2.0(transitive)
+ Added@inquirer/expand@2.3.0(transitive)
+ Added@inquirer/figures@1.0.6(transitive)
+ Added@inquirer/input@2.3.0(transitive)
+ Added@inquirer/number@1.1.0(transitive)
+ Added@inquirer/password@2.2.0(transitive)
+ Added@inquirer/prompts@5.5.0(transitive)
+ Added@inquirer/rawlist@2.3.0(transitive)
+ Added@inquirer/search@1.1.0(transitive)
+ Added@inquirer/select@2.5.0(transitive)
+ Added@inquirer/type@1.5.52.0.0(transitive)
+ Added@octokit/auth-token@5.1.1(transitive)
+ Added@octokit/core@6.1.2(transitive)
+ Added@octokit/endpoint@10.1.1(transitive)
+ Added@octokit/graphql@8.1.1(transitive)
+ Added@octokit/plugin-paginate-rest@11.3.3(transitive)
+ Added@octokit/plugin-request-log@5.3.1(transitive)
+ Added@octokit/plugin-rest-endpoint-methods@13.2.4(transitive)
+ Added@octokit/request@9.1.3(transitive)
+ Added@octokit/request-error@6.1.4(transitive)
+ Added@octokit/rest@21.0.2(transitive)
+ Added@sec-ant/readable-stream@0.4.1(transitive)
+ Added@sindresorhus/merge-streams@4.0.0(transitive)
+ Added@types/mute-stream@0.0.4(transitive)
+ Added@types/node@22.5.5(transitive)
+ Added@types/wrap-ansi@3.0.0(transitive)
+ Addedatomically@2.0.3(transitive)
+ Addedbefore-after-hook@3.0.2(transitive)
+ Addedboxen@8.0.1(transitive)
+ Addedcamelcase@8.0.0(transitive)
+ Addedconfigstore@7.0.0(transitive)
+ Addeddot-prop@9.0.0(transitive)
+ Addedexeca@9.3.1(transitive)
+ Addedfigures@6.1.0(transitive)
+ Addedget-stream@9.0.1(transitive)
+ Addedgit-url-parse@15.0.0(transitive)
+ Addedhuman-signals@8.0.0(transitive)
+ Addedinquirer@10.1.8(transitive)
+ Addedis-in-ci@1.0.0(transitive)
+ Addedis-plain-obj@4.1.0(transitive)
+ Addedis-stream@4.0.1(transitive)
+ Addedos-name@6.0.0(transitive)
+ Addedparse-ms@4.0.0(transitive)
+ Addedpretty-ms@9.1.0(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addedstrip-final-newline@4.0.0(transitive)
+ Addedstubborn-fs@1.2.5(transitive)
+ Addedtype-fest@4.26.1(transitive)
+ Addedundici-types@6.19.8(transitive)
+ Addeduniversal-user-agent@7.0.2(transitive)
+ Addedupdate-notifier@7.2.0(transitive)
+ Addedwhen-exit@2.1.3(transitive)
+ Addedwidest-line@5.0.0(transitive)
+ Addedwindows-release@6.0.1(transitive)
+ Addedwrap-ansi@9.0.0(transitive)
+ Addedyoctocolors@2.1.1(transitive)
- Removedgot@13.0.0
- Removednode-fetch@3.3.2
- Removed@inquirer/figures@1.0.5(transitive)
- Removed@octokit/auth-token@4.0.0(transitive)
- Removed@octokit/core@5.2.0(transitive)
- Removed@octokit/endpoint@9.0.5(transitive)
- Removed@octokit/graphql@7.1.0(transitive)
- Removed@octokit/plugin-paginate-rest@11.3.1(transitive)
- Removed@octokit/plugin-request-log@4.0.1(transitive)
- Removed@octokit/plugin-rest-endpoint-methods@13.2.2(transitive)
- Removed@octokit/request@8.4.0(transitive)
- Removed@octokit/request-error@5.1.0(transitive)
- Removed@octokit/rest@20.1.1(transitive)
- Removed@sindresorhus/is@5.6.0(transitive)
- Removed@szmarczak/http-timer@5.0.1(transitive)
- Removed@types/http-cache-semantics@4.0.4(transitive)
- Removedbase64-js@1.5.1(transitive)
- Removedbefore-after-hook@2.2.3(transitive)
- Removedbl@4.1.0(transitive)
- Removedboxen@7.1.1(transitive)
- Removedbuffer@5.7.1(transitive)
- Removedcacheable-lookup@7.0.0(transitive)
- Removedcacheable-request@10.2.14(transitive)
- Removedcamelcase@7.0.1(transitive)
- Removedchalk@4.1.2(transitive)
- Removedcli-cursor@3.1.0(transitive)
- Removedclone@1.0.4(transitive)
- Removedconfigstore@6.0.0(transitive)
- Removedcrypto-random-string@4.0.0(transitive)
- Removeddata-uri-to-buffer@4.0.1(transitive)
- Removeddecompress-response@6.0.0(transitive)
- Removeddefaults@1.0.4(transitive)
- Removeddefer-to-connect@2.0.1(transitive)
- Removeddeprecation@2.3.1(transitive)
- Removeddot-prop@6.0.1(transitive)
- Removedeastasianwidth@0.2.0(transitive)
- Removedemoji-regex@9.2.2(transitive)
- Removedexeca@5.1.1(transitive)
- Removedfetch-blob@3.2.0(transitive)
- Removedform-data-encoder@2.1.4(transitive)
- Removedformdata-polyfill@4.0.10(transitive)
- Removedget-stream@6.0.1(transitive)
- Removedgit-url-parse@14.0.0(transitive)
- Removedgot@13.0.0(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedhttp-cache-semantics@4.1.1(transitive)
- Removedhttp2-wrapper@2.2.1(transitive)
- Removedhuman-signals@2.1.0(transitive)
- Removedieee754@1.2.1(transitive)
- Removedimurmurhash@0.1.4(transitive)
- Removedinquirer@9.3.2(transitive)
- Removedis-in-ci@0.1.0(transitive)
- Removedis-interactive@1.0.0(transitive)
- Removedis-obj@2.0.0(transitive)
- Removedis-stream@2.0.1(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedis-unicode-supported@0.1.0(transitive)
- Removedjson-buffer@3.0.1(transitive)
- Removedkeyv@4.5.4(transitive)
- Removedlog-symbols@4.1.0(transitive)
- Removedlowercase-keys@3.0.0(transitive)
- Removedmimic-response@3.1.04.0.0(transitive)
- Removednode-domexception@1.0.0(transitive)
- Removednode-fetch@3.3.2(transitive)
- Removednormalize-url@8.0.1(transitive)
- Removednpm-run-path@4.0.1(transitive)
- Removedora@5.4.1(transitive)
- Removedos-name@5.1.0(transitive)
- Removedp-cancelable@3.0.0(transitive)
- Removedquick-lru@5.1.1(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedresolve-alpn@1.2.1(transitive)
- Removedresponselike@3.0.0(transitive)
- Removedrestore-cursor@3.1.0(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsemver@7.6.2(transitive)
- Removedstring-width@5.1.2(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedstrip-final-newline@2.0.0(transitive)
- Removedsupports-color@7.2.0(transitive)
- Removedtype-fest@1.4.0(transitive)
- Removedtypedarray-to-buffer@3.1.5(transitive)
- Removedunique-string@3.0.0(transitive)
- Removeduniversal-user-agent@6.0.1(transitive)
- Removedupdate-notifier@7.1.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedwcwidth@1.0.1(transitive)
- Removedweb-streams-polyfill@3.3.3(transitive)
- Removedwidest-line@4.0.1(transitive)
- Removedwindows-release@5.1.1(transitive)
- Removedwrap-ansi@8.1.0(transitive)
- Removedwrite-file-atomic@3.0.3(transitive)
Updated@octokit/rest@21.0.2
Updatedexeca@9.3.1
Updatedgit-url-parse@15.0.0
Updatedinquirer@10.1.8
Updatedos-name@6.0.0
Updatedsemver@7.6.3
Updatedupdate-notifier@7.2.0