@lerna-lite/core 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -12
- package/dist/child-process.d.ts +62 -62
- package/dist/child-process.js +165 -165
- package/dist/command.d.ts +37 -35
- package/dist/command.js +266 -266
- package/dist/command.js.map +1 -1
- package/dist/conventional-commits/constants.d.ts +4 -4
- package/dist/conventional-commits/constants.js +12 -12
- package/dist/conventional-commits/get-changelog-config.d.ts +12 -12
- package/dist/conventional-commits/get-changelog-config.js +98 -98
- package/dist/conventional-commits/index.d.ts +6 -6
- package/dist/conventional-commits/index.js +22 -22
- package/dist/conventional-commits/make-bump-only-filter.d.ts +6 -6
- package/dist/conventional-commits/make-bump-only-filter.js +22 -22
- package/dist/conventional-commits/read-existing-changelog.d.ts +7 -7
- package/dist/conventional-commits/read-existing-changelog.js +32 -32
- package/dist/conventional-commits/recommend-version.d.ts +11 -11
- package/dist/conventional-commits/recommend-version.js +86 -86
- package/dist/conventional-commits/update-changelog.d.ts +11 -11
- package/dist/conventional-commits/update-changelog.js +83 -83
- package/dist/git-clients/GitLabClient.d.ts +8 -8
- package/dist/git-clients/GitLabClient.js +39 -39
- package/dist/git-clients/github-client.d.ts +6 -6
- package/dist/git-clients/github-client.js +40 -40
- package/dist/git-clients/gitlab-client.d.ts +6 -6
- package/dist/git-clients/gitlab-client.js +21 -21
- package/dist/git-clients/index.d.ts +2 -2
- package/dist/git-clients/index.js +18 -18
- package/dist/index.d.ts +12 -12
- package/dist/index.js +30 -30
- package/dist/models/command-options.d.ts +206 -0
- package/dist/models/command-options.js +3 -0
- package/dist/models/command-options.js.map +1 -0
- package/dist/models/index.d.ts +2 -186
- package/dist/models/index.js +18 -2
- package/dist/models/index.js.map +1 -1
- package/dist/models/interfaces.d.ts +201 -0
- package/dist/models/interfaces.js +3 -0
- package/dist/models/interfaces.js.map +1 -0
- package/dist/otplease.d.ts +14 -14
- package/dist/otplease.js +108 -108
- package/dist/package-graph/index.d.ts +2 -2
- package/dist/package-graph/index.js +18 -18
- package/dist/package-graph/lib/cyclic-package-graph-node.d.ts +42 -42
- package/dist/package-graph/lib/cyclic-package-graph-node.js +97 -97
- package/dist/package-graph/lib/index.d.ts +3 -3
- package/dist/package-graph/lib/index.js +19 -19
- package/dist/package-graph/lib/package-graph-node.d.ts +33 -33
- package/dist/package-graph/lib/package-graph-node.js +58 -58
- package/dist/package-graph/lib/report-cycles.d.ts +1 -1
- package/dist/package-graph/lib/report-cycles.js +19 -19
- package/dist/package-graph/package-graph.d.ts +79 -79
- package/dist/package-graph/package-graph.js +276 -276
- package/dist/package.d.ts +91 -85
- package/dist/package.js +282 -276
- package/dist/package.js.map +1 -1
- package/dist/project/index.d.ts +2 -2
- package/dist/project/index.js +18 -18
- package/dist/project/lib/apply-extends.d.ts +10 -10
- package/dist/project/lib/apply-extends.js +37 -37
- package/dist/project/lib/index.d.ts +3 -3
- package/dist/project/lib/index.js +19 -19
- package/dist/project/lib/make-file-finder.d.ts +3 -3
- package/dist/project/lib/make-file-finder.js +71 -71
- package/dist/project/lib/shallow-extend.d.ts +11 -11
- package/dist/project/lib/shallow-extend.js +24 -24
- package/dist/project/project.d.ts +45 -45
- package/dist/project/project.js +195 -195
- package/dist/prompt.d.ts +23 -23
- package/dist/prompt.js +75 -75
- package/dist/utils/check-working-tree.d.ts +8 -8
- package/dist/utils/check-working-tree.js +41 -41
- package/dist/utils/clean-stack.d.ts +5 -5
- package/dist/utils/clean-stack.js +18 -18
- package/dist/utils/collect-uncommitted.d.ts +18 -18
- package/dist/utils/collect-uncommitted.js +40 -40
- package/dist/utils/collect-updates/collect-updates.d.ts +11 -11
- package/dist/utils/collect-updates/collect-updates.js +82 -82
- package/dist/utils/collect-updates/index.d.ts +2 -2
- package/dist/utils/collect-updates/index.js +18 -18
- package/dist/utils/collect-updates/lib/collect-dependents.d.ts +11 -11
- package/dist/utils/collect-updates/lib/collect-dependents.js +45 -45
- package/dist/utils/collect-updates/lib/collect-packages.d.ts +13 -13
- package/dist/utils/collect-updates/lib/collect-packages.js +33 -33
- package/dist/utils/collect-updates/lib/get-packages-for-option.d.ts +5 -5
- package/dist/utils/collect-updates/lib/get-packages-for-option.js +30 -30
- package/dist/utils/collect-updates/lib/has-tags.d.ts +5 -5
- package/dist/utils/collect-updates/lib/has-tags.js +26 -26
- package/dist/utils/collect-updates/lib/index.d.ts +5 -5
- package/dist/utils/collect-updates/lib/index.js +21 -21
- package/dist/utils/collect-updates/lib/make-diff-predicate.d.ts +7 -7
- package/dist/utils/collect-updates/lib/make-diff-predicate.js +64 -64
- package/dist/utils/conf.d.ts +25 -25
- package/dist/utils/conf.js +255 -255
- package/dist/utils/defaults.d.ts +1 -1
- package/dist/utils/defaults.js +182 -182
- package/dist/utils/defaults.js.map +1 -1
- package/dist/utils/describe-ref.d.ts +37 -37
- package/dist/utils/describe-ref.js +80 -80
- package/dist/utils/env-replace.d.ts +1 -1
- package/dist/utils/env-replace.js +22 -22
- package/dist/utils/find-prefix.d.ts +2 -2
- package/dist/utils/find-prefix.js +48 -48
- package/dist/utils/index.d.ts +23 -22
- package/dist/utils/index.js +39 -38
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/log-package-error.d.ts +5 -5
- package/dist/utils/log-package-error.js +35 -35
- package/dist/utils/nerf-dart.d.ts +1 -1
- package/dist/utils/nerf-dart.js +18 -18
- package/dist/utils/npm-conf.d.ts +4 -4
- package/dist/utils/npm-conf.js +55 -55
- package/dist/utils/output.d.ts +1 -1
- package/dist/utils/output.js +13 -13
- package/dist/utils/parse-field.d.ts +1 -1
- package/dist/utils/parse-field.js +65 -65
- package/dist/utils/prerelease-id-from-version.d.ts +5 -5
- package/dist/utils/prerelease-id-from-version.js +15 -15
- package/dist/utils/pulse-till-done.d.ts +1 -1
- package/dist/utils/pulse-till-done.js +40 -40
- package/dist/utils/query-graph.d.ts +36 -36
- package/dist/utils/query-graph.js +77 -77
- package/dist/utils/query-graph.js.map +1 -1
- package/dist/utils/run-lifecycle.d.ts +10 -10
- package/dist/utils/run-lifecycle.js +131 -107
- package/dist/utils/run-lifecycle.js.map +1 -1
- package/dist/utils/run-topologically.d.ts +12 -12
- package/dist/utils/run-topologically.js +36 -36
- package/dist/utils/temp-write.d.ts +13 -0
- package/dist/utils/temp-write.js +50 -0
- package/dist/utils/temp-write.js.map +1 -0
- package/dist/utils/types.d.ts +131 -129
- package/dist/utils/types.js +138 -138
- package/dist/utils/warn-if-hanging.d.ts +1 -1
- package/dist/utils/warn-if-hanging.js +17 -17
- package/dist/utils/write-log-file.d.ts +1 -1
- package/dist/utils/write-log-file.js +32 -32
- package/dist/validation-error.d.ts +4 -4
- package/dist/validation-error.js +18 -18
- package/package.json +14 -10
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.updateChangelog = void 0;
|
|
7
|
-
const conventional_changelog_core_1 = __importDefault(require("conventional-changelog-core"));
|
|
8
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
-
const get_stream_1 = __importDefault(require("get-stream"));
|
|
10
|
-
const npmlog_1 = __importDefault(require("npmlog"));
|
|
11
|
-
const constants_1 = require("./constants");
|
|
12
|
-
const get_changelog_config_1 = require("./get-changelog-config");
|
|
13
|
-
const make_bump_only_filter_1 = require("./make-bump-only-filter");
|
|
14
|
-
const read_existing_changelog_1 = require("./read-existing-changelog");
|
|
15
|
-
/**
|
|
16
|
-
* @param {import("@lerna/package").Package} pkg
|
|
17
|
-
* @param {import("..").ChangelogType} type
|
|
18
|
-
* @param {import("..").BaseChangelogOptions & { version?: string }} commandOptions
|
|
19
|
-
*/
|
|
20
|
-
async function updateChangelog(pkg, type, updateOptions) {
|
|
21
|
-
npmlog_1.default.silly(type, 'for %s at %s', pkg.name, pkg.location);
|
|
22
|
-
const { changelogPreset, rootPath, tagPrefix = 'v', version = undefined, changelogHeaderMessage = '', changelogVersionMessage = '', } = updateOptions;
|
|
23
|
-
const config = await get_changelog_config_1.GetChangelogConfig.getChangelogConfig(changelogPreset, rootPath);
|
|
24
|
-
const options = {};
|
|
25
|
-
const context = {}; // pass as positional because cc-core's merge-config is wack
|
|
26
|
-
// cc-core mutates input :P
|
|
27
|
-
if (config.conventionalChangelog) {
|
|
28
|
-
// "new" preset API
|
|
29
|
-
options.config = Object.assign({}, config.conventionalChangelog);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
// "old" preset API
|
|
33
|
-
options.config = Object.assign({}, config);
|
|
34
|
-
}
|
|
35
|
-
// NOTE: must pass as positional argument due to weird bug in merge-config
|
|
36
|
-
const gitRawCommitsOpts = Object.assign({}, options.config.gitRawCommitsOpts);
|
|
37
|
-
if (type === 'root') {
|
|
38
|
-
context.version = version;
|
|
39
|
-
// preserve tagPrefix because cc-core can't find the currentTag otherwise
|
|
40
|
-
context.currentTag = `${tagPrefix}${version}`;
|
|
41
|
-
// root changelogs are only enabled in fixed mode, and need the proper tag prefix
|
|
42
|
-
options.tagPrefix = tagPrefix;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
// "fixed" or "independent"
|
|
46
|
-
gitRawCommitsOpts.path = pkg.location;
|
|
47
|
-
options.pkg = { path: pkg.manifestLocation };
|
|
48
|
-
if (type === 'independent') {
|
|
49
|
-
options.lernaPackage = pkg.name;
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
// only fixed mode can have a custom tag prefix
|
|
53
|
-
options.tagPrefix = tagPrefix;
|
|
54
|
-
// preserve tagPrefix because cc-core can't find the currentTag otherwise
|
|
55
|
-
context.currentTag = `${tagPrefix}${pkg.version}`;
|
|
56
|
-
context.version = pkg.version; // TODO investigate why Lerna doesn't have this line
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
// generate the markdown for the upcoming release.
|
|
60
|
-
const changelogStream = (0, conventional_changelog_core_1.default)(options, context, gitRawCommitsOpts);
|
|
61
|
-
return Promise.all([
|
|
62
|
-
get_stream_1.default(changelogStream).then((0, make_bump_only_filter_1.makeBumpOnlyFilter)(pkg)),
|
|
63
|
-
(0, read_existing_changelog_1.readExistingChangelog)(pkg),
|
|
64
|
-
]).then(([newEntry, [changelogFileLoc, changelogContents]]) => {
|
|
65
|
-
npmlog_1.default.silly(type, 'writing new entry: %j', newEntry);
|
|
66
|
-
const changelogVersion = type === 'root' ? changelogVersionMessage : '';
|
|
67
|
-
const changelogHeader = constants_1.CHANGELOG_HEADER.replace(/%s/g, type === 'root'
|
|
68
|
-
? (changelogHeaderMessage === null || changelogHeaderMessage === void 0 ? void 0 : changelogHeaderMessage.length) > 0 ? changelogHeaderMessage + constants_1.EOL : ''
|
|
69
|
-
: '');
|
|
70
|
-
const content = [changelogHeader, changelogVersion, newEntry, changelogContents]
|
|
71
|
-
.join(constants_1.BLANK_LINE)
|
|
72
|
-
.trim()
|
|
73
|
-
.replace(/[\r\n]{2,}/gm, '\n\n');
|
|
74
|
-
return fs_extra_1.default.writeFile(changelogFileLoc, content + constants_1.EOL).then(() => {
|
|
75
|
-
npmlog_1.default.verbose(type, 'wrote', changelogFileLoc);
|
|
76
|
-
return {
|
|
77
|
-
logPath: changelogFileLoc,
|
|
78
|
-
newEntry,
|
|
79
|
-
};
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
exports.updateChangelog = updateChangelog;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.updateChangelog = void 0;
|
|
7
|
+
const conventional_changelog_core_1 = __importDefault(require("conventional-changelog-core"));
|
|
8
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
+
const get_stream_1 = __importDefault(require("get-stream"));
|
|
10
|
+
const npmlog_1 = __importDefault(require("npmlog"));
|
|
11
|
+
const constants_1 = require("./constants");
|
|
12
|
+
const get_changelog_config_1 = require("./get-changelog-config");
|
|
13
|
+
const make_bump_only_filter_1 = require("./make-bump-only-filter");
|
|
14
|
+
const read_existing_changelog_1 = require("./read-existing-changelog");
|
|
15
|
+
/**
|
|
16
|
+
* @param {import("@lerna/package").Package} pkg
|
|
17
|
+
* @param {import("..").ChangelogType} type
|
|
18
|
+
* @param {import("..").BaseChangelogOptions & { version?: string }} commandOptions
|
|
19
|
+
*/
|
|
20
|
+
async function updateChangelog(pkg, type, updateOptions) {
|
|
21
|
+
npmlog_1.default.silly(type, 'for %s at %s', pkg.name, pkg.location);
|
|
22
|
+
const { changelogPreset, rootPath, tagPrefix = 'v', version = undefined, changelogHeaderMessage = '', changelogVersionMessage = '', } = updateOptions;
|
|
23
|
+
const config = await get_changelog_config_1.GetChangelogConfig.getChangelogConfig(changelogPreset, rootPath);
|
|
24
|
+
const options = {};
|
|
25
|
+
const context = {}; // pass as positional because cc-core's merge-config is wack
|
|
26
|
+
// cc-core mutates input :P
|
|
27
|
+
if (config.conventionalChangelog) {
|
|
28
|
+
// "new" preset API
|
|
29
|
+
options.config = Object.assign({}, config.conventionalChangelog);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
// "old" preset API
|
|
33
|
+
options.config = Object.assign({}, config);
|
|
34
|
+
}
|
|
35
|
+
// NOTE: must pass as positional argument due to weird bug in merge-config
|
|
36
|
+
const gitRawCommitsOpts = Object.assign({}, options.config.gitRawCommitsOpts);
|
|
37
|
+
if (type === 'root') {
|
|
38
|
+
context.version = version;
|
|
39
|
+
// preserve tagPrefix because cc-core can't find the currentTag otherwise
|
|
40
|
+
context.currentTag = `${tagPrefix}${version}`;
|
|
41
|
+
// root changelogs are only enabled in fixed mode, and need the proper tag prefix
|
|
42
|
+
options.tagPrefix = tagPrefix;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
// "fixed" or "independent"
|
|
46
|
+
gitRawCommitsOpts.path = pkg.location;
|
|
47
|
+
options.pkg = { path: pkg.manifestLocation };
|
|
48
|
+
if (type === 'independent') {
|
|
49
|
+
options.lernaPackage = pkg.name;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// only fixed mode can have a custom tag prefix
|
|
53
|
+
options.tagPrefix = tagPrefix;
|
|
54
|
+
// preserve tagPrefix because cc-core can't find the currentTag otherwise
|
|
55
|
+
context.currentTag = `${tagPrefix}${pkg.version}`;
|
|
56
|
+
context.version = pkg.version; // TODO investigate why Lerna doesn't have this line
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// generate the markdown for the upcoming release.
|
|
60
|
+
const changelogStream = (0, conventional_changelog_core_1.default)(options, context, gitRawCommitsOpts);
|
|
61
|
+
return Promise.all([
|
|
62
|
+
get_stream_1.default(changelogStream).then((0, make_bump_only_filter_1.makeBumpOnlyFilter)(pkg)),
|
|
63
|
+
(0, read_existing_changelog_1.readExistingChangelog)(pkg),
|
|
64
|
+
]).then(([newEntry, [changelogFileLoc, changelogContents]]) => {
|
|
65
|
+
npmlog_1.default.silly(type, 'writing new entry: %j', newEntry);
|
|
66
|
+
const changelogVersion = type === 'root' ? changelogVersionMessage : '';
|
|
67
|
+
const changelogHeader = constants_1.CHANGELOG_HEADER.replace(/%s/g, type === 'root'
|
|
68
|
+
? (changelogHeaderMessage === null || changelogHeaderMessage === void 0 ? void 0 : changelogHeaderMessage.length) > 0 ? changelogHeaderMessage + constants_1.EOL : ''
|
|
69
|
+
: '');
|
|
70
|
+
const content = [changelogHeader, changelogVersion, newEntry, changelogContents]
|
|
71
|
+
.join(constants_1.BLANK_LINE)
|
|
72
|
+
.trim()
|
|
73
|
+
.replace(/[\r\n]{2,}/gm, '\n\n');
|
|
74
|
+
return fs_extra_1.default.writeFile(changelogFileLoc, content + constants_1.EOL).then(() => {
|
|
75
|
+
npmlog_1.default.verbose(type, 'wrote', changelogFileLoc);
|
|
76
|
+
return {
|
|
77
|
+
logPath: changelogFileLoc,
|
|
78
|
+
newEntry,
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
exports.updateChangelog = updateChangelog;
|
|
84
84
|
//# sourceMappingURL=update-changelog.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { GitClient, GitClientRelease } from '../models';
|
|
2
|
-
export declare class GitLabClient implements GitClient {
|
|
3
|
-
baseUrl: string;
|
|
4
|
-
token: string;
|
|
5
|
-
constructor(baseUrl: string | undefined, token: string);
|
|
6
|
-
createRelease({ owner, repo, name, tag_name: tagName, body }: GitClientRelease): Promise<void>;
|
|
7
|
-
releasesUrl(namespace: string, project: string, releaseType?: string): string;
|
|
8
|
-
}
|
|
1
|
+
import { GitClient, GitClientRelease } from '../models';
|
|
2
|
+
export declare class GitLabClient implements GitClient {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
token: string;
|
|
5
|
+
constructor(baseUrl: string | undefined, token: string);
|
|
6
|
+
createRelease({ owner, repo, name, tag_name: tagName, body }: GitClientRelease): Promise<void>;
|
|
7
|
+
releasesUrl(namespace: string, project: string, releaseType?: string): string;
|
|
8
|
+
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.GitLabClient = void 0;
|
|
7
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
8
|
-
const npmlog_1 = __importDefault(require("npmlog"));
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const whatwg_url_1 = require("whatwg-url");
|
|
11
|
-
class GitLabClient {
|
|
12
|
-
constructor(baseUrl = 'https://gitlab.com/api/v4', token) {
|
|
13
|
-
this.baseUrl = baseUrl;
|
|
14
|
-
this.token = token;
|
|
15
|
-
}
|
|
16
|
-
createRelease({ owner, repo, name, tag_name: tagName, body }) {
|
|
17
|
-
const releasesUrl = this.releasesUrl(owner, repo, 'releases');
|
|
18
|
-
npmlog_1.default.silly('Requesting GitLab releases', releasesUrl);
|
|
19
|
-
return (0, node_fetch_1.default)(releasesUrl, {
|
|
20
|
-
method: 'post',
|
|
21
|
-
body: JSON.stringify({ name, tag_name: tagName, description: body }),
|
|
22
|
-
headers: {
|
|
23
|
-
'PRIVATE-TOKEN': this.token,
|
|
24
|
-
'Content-Type': 'application/json',
|
|
25
|
-
},
|
|
26
|
-
}).then(({ ok, status, statusText }) => {
|
|
27
|
-
if (!ok) {
|
|
28
|
-
npmlog_1.default.error('gitlab', `Failed to create release\nRequest returned ${status} ${statusText}`);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
npmlog_1.default.silly('gitlab', 'Created release successfully.');
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
releasesUrl(namespace, project, releaseType = 'releases') {
|
|
36
|
-
return new whatwg_url_1.URL(`${this.baseUrl}/${path_1.default.join('projects', encodeURIComponent(`${namespace}/${project}`), releaseType)}`).toString();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.GitLabClient = GitLabClient;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GitLabClient = void 0;
|
|
7
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
8
|
+
const npmlog_1 = __importDefault(require("npmlog"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const whatwg_url_1 = require("whatwg-url");
|
|
11
|
+
class GitLabClient {
|
|
12
|
+
constructor(baseUrl = 'https://gitlab.com/api/v4', token) {
|
|
13
|
+
this.baseUrl = baseUrl;
|
|
14
|
+
this.token = token;
|
|
15
|
+
}
|
|
16
|
+
createRelease({ owner, repo, name, tag_name: tagName, body }) {
|
|
17
|
+
const releasesUrl = this.releasesUrl(owner, repo, 'releases');
|
|
18
|
+
npmlog_1.default.silly('Requesting GitLab releases', releasesUrl);
|
|
19
|
+
return (0, node_fetch_1.default)(releasesUrl, {
|
|
20
|
+
method: 'post',
|
|
21
|
+
body: JSON.stringify({ name, tag_name: tagName, description: body }),
|
|
22
|
+
headers: {
|
|
23
|
+
'PRIVATE-TOKEN': this.token,
|
|
24
|
+
'Content-Type': 'application/json',
|
|
25
|
+
},
|
|
26
|
+
}).then(({ ok, status, statusText }) => {
|
|
27
|
+
if (!ok) {
|
|
28
|
+
npmlog_1.default.error('gitlab', `Failed to create release\nRequest returned ${status} ${statusText}`);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
npmlog_1.default.silly('gitlab', 'Created release successfully.');
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
releasesUrl(namespace, project, releaseType = 'releases') {
|
|
36
|
+
return new whatwg_url_1.URL(`${this.baseUrl}/${path_1.default.join('projects', encodeURIComponent(`${namespace}/${project}`), releaseType)}`).toString();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.GitLabClient = GitLabClient;
|
|
40
40
|
//# sourceMappingURL=GitLabClient.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SyncOptions } from 'execa';
|
|
2
|
-
import parseGitUrl from 'git-url-parse';
|
|
3
|
-
export declare function createGitHubClient(): import("@octokit/core").Octokit & {
|
|
4
|
-
paginate: import("@octokit/plugin-paginate-rest").PaginateInterface;
|
|
5
|
-
} & import("@octokit/plugin-rest-endpoint-methods/dist-types/generated/method-types").RestEndpointMethods & import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api;
|
|
6
|
-
export declare function parseGitRepo(remote?: string, opts?: SyncOptions<string>): parseGitUrl.GitUrl;
|
|
1
|
+
import { SyncOptions } from 'execa';
|
|
2
|
+
import parseGitUrl from 'git-url-parse';
|
|
3
|
+
export declare function createGitHubClient(): import("@octokit/core").Octokit & {
|
|
4
|
+
paginate: import("@octokit/plugin-paginate-rest").PaginateInterface;
|
|
5
|
+
} & import("@octokit/plugin-rest-endpoint-methods/dist-types/generated/method-types").RestEndpointMethods & import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api;
|
|
6
|
+
export declare function parseGitRepo(remote?: string, opts?: SyncOptions<string>): parseGitUrl.GitUrl;
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parseGitRepo = exports.createGitHubClient = void 0;
|
|
7
|
-
const rest_1 = require("@octokit/rest");
|
|
8
|
-
const git_url_parse_1 = __importDefault(require("git-url-parse"));
|
|
9
|
-
const npmlog_1 = __importDefault(require("npmlog"));
|
|
10
|
-
const child_process_1 = require("../child-process");
|
|
11
|
-
function createGitHubClient() {
|
|
12
|
-
npmlog_1.default.silly('createGitHubClient', '');
|
|
13
|
-
const { GH_TOKEN, GHE_API_URL, GHE_VERSION } = process.env;
|
|
14
|
-
if (!GH_TOKEN) {
|
|
15
|
-
throw new Error('A GH_TOKEN environment variable is required.');
|
|
16
|
-
}
|
|
17
|
-
if (GHE_VERSION) {
|
|
18
|
-
// eslint-disable-next-line
|
|
19
|
-
rest_1.Octokit.plugin(require(`@octokit/plugin-enterprise-rest/ghe-${GHE_VERSION}`));
|
|
20
|
-
}
|
|
21
|
-
const options = {
|
|
22
|
-
auth: `token ${GH_TOKEN}`,
|
|
23
|
-
};
|
|
24
|
-
if (GHE_API_URL) {
|
|
25
|
-
options.baseUrl = GHE_API_URL;
|
|
26
|
-
}
|
|
27
|
-
return new rest_1.Octokit(options);
|
|
28
|
-
}
|
|
29
|
-
exports.createGitHubClient = createGitHubClient;
|
|
30
|
-
function parseGitRepo(remote = 'origin', opts) {
|
|
31
|
-
npmlog_1.default.silly('parseGitRepo', '');
|
|
32
|
-
const args = ['config', '--get', `remote.${remote}.url`];
|
|
33
|
-
npmlog_1.default.verbose('git', args.join(' '));
|
|
34
|
-
const url = (0, child_process_1.execSync)('git', args, opts);
|
|
35
|
-
if (!url) {
|
|
36
|
-
throw new Error(`Git remote URL could not be found using "${remote}".`);
|
|
37
|
-
}
|
|
38
|
-
return (0, git_url_parse_1.default)(url);
|
|
39
|
-
}
|
|
40
|
-
exports.parseGitRepo = parseGitRepo;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseGitRepo = exports.createGitHubClient = void 0;
|
|
7
|
+
const rest_1 = require("@octokit/rest");
|
|
8
|
+
const git_url_parse_1 = __importDefault(require("git-url-parse"));
|
|
9
|
+
const npmlog_1 = __importDefault(require("npmlog"));
|
|
10
|
+
const child_process_1 = require("../child-process");
|
|
11
|
+
function createGitHubClient() {
|
|
12
|
+
npmlog_1.default.silly('createGitHubClient', '');
|
|
13
|
+
const { GH_TOKEN, GHE_API_URL, GHE_VERSION } = process.env;
|
|
14
|
+
if (!GH_TOKEN) {
|
|
15
|
+
throw new Error('A GH_TOKEN environment variable is required.');
|
|
16
|
+
}
|
|
17
|
+
if (GHE_VERSION) {
|
|
18
|
+
// eslint-disable-next-line
|
|
19
|
+
rest_1.Octokit.plugin(require(`@octokit/plugin-enterprise-rest/ghe-${GHE_VERSION}`));
|
|
20
|
+
}
|
|
21
|
+
const options = {
|
|
22
|
+
auth: `token ${GH_TOKEN}`,
|
|
23
|
+
};
|
|
24
|
+
if (GHE_API_URL) {
|
|
25
|
+
options.baseUrl = GHE_API_URL;
|
|
26
|
+
}
|
|
27
|
+
return new rest_1.Octokit(options);
|
|
28
|
+
}
|
|
29
|
+
exports.createGitHubClient = createGitHubClient;
|
|
30
|
+
function parseGitRepo(remote = 'origin', opts) {
|
|
31
|
+
npmlog_1.default.silly('parseGitRepo', '');
|
|
32
|
+
const args = ['config', '--get', `remote.${remote}.url`];
|
|
33
|
+
npmlog_1.default.verbose('git', args.join(' '));
|
|
34
|
+
const url = (0, child_process_1.execSync)('git', args, opts);
|
|
35
|
+
if (!url) {
|
|
36
|
+
throw new Error(`Git remote URL could not be found using "${remote}".`);
|
|
37
|
+
}
|
|
38
|
+
return (0, git_url_parse_1.default)(url);
|
|
39
|
+
}
|
|
40
|
+
exports.parseGitRepo = parseGitRepo;
|
|
41
41
|
//# sourceMappingURL=github-client.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare function createGitLabClient(): {
|
|
2
|
-
repos: {
|
|
3
|
-
createRelease: any;
|
|
4
|
-
};
|
|
5
|
-
};
|
|
6
|
-
export { createGitLabClient };
|
|
1
|
+
declare function createGitLabClient(): {
|
|
2
|
+
repos: {
|
|
3
|
+
createRelease: any;
|
|
4
|
+
};
|
|
5
|
+
};
|
|
6
|
+
export { createGitLabClient };
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createGitLabClient = void 0;
|
|
7
|
-
const npmlog_1 = __importDefault(require("npmlog"));
|
|
8
|
-
const GitLabClient_1 = require("./GitLabClient");
|
|
9
|
-
function OcktokitAdapter(client) {
|
|
10
|
-
return { repos: { createRelease: client.createRelease.bind(client) } };
|
|
11
|
-
}
|
|
12
|
-
function createGitLabClient() {
|
|
13
|
-
const { GL_API_URL, GL_TOKEN } = process.env;
|
|
14
|
-
npmlog_1.default.silly('Creating a GitLab client...', '');
|
|
15
|
-
if (!GL_TOKEN) {
|
|
16
|
-
throw new Error('A GL_TOKEN environment variable is required.');
|
|
17
|
-
}
|
|
18
|
-
const client = new GitLabClient_1.GitLabClient(GL_API_URL, GL_TOKEN);
|
|
19
|
-
return OcktokitAdapter(client);
|
|
20
|
-
}
|
|
21
|
-
exports.createGitLabClient = createGitLabClient;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createGitLabClient = void 0;
|
|
7
|
+
const npmlog_1 = __importDefault(require("npmlog"));
|
|
8
|
+
const GitLabClient_1 = require("./GitLabClient");
|
|
9
|
+
function OcktokitAdapter(client) {
|
|
10
|
+
return { repos: { createRelease: client.createRelease.bind(client) } };
|
|
11
|
+
}
|
|
12
|
+
function createGitLabClient() {
|
|
13
|
+
const { GL_API_URL, GL_TOKEN } = process.env;
|
|
14
|
+
npmlog_1.default.silly('Creating a GitLab client...', '');
|
|
15
|
+
if (!GL_TOKEN) {
|
|
16
|
+
throw new Error('A GL_TOKEN environment variable is required.');
|
|
17
|
+
}
|
|
18
|
+
const client = new GitLabClient_1.GitLabClient(GL_API_URL, GL_TOKEN);
|
|
19
|
+
return OcktokitAdapter(client);
|
|
20
|
+
}
|
|
21
|
+
exports.createGitLabClient = createGitLabClient;
|
|
22
22
|
//# sourceMappingURL=gitlab-client.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './github-client';
|
|
2
|
-
export * from './gitlab-client';
|
|
1
|
+
export * from './github-client';
|
|
2
|
+
export * from './gitlab-client';
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./github-client"), exports);
|
|
18
|
-
__exportStar(require("./gitlab-client"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./github-client"), exports);
|
|
18
|
+
__exportStar(require("./gitlab-client"), exports);
|
|
19
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from './conventional-commits';
|
|
2
|
-
export * from './git-clients';
|
|
3
|
-
export * from './models';
|
|
4
|
-
export * from './package-graph';
|
|
5
|
-
export * from './project';
|
|
6
|
-
export * from './utils';
|
|
7
|
-
export * from './child-process';
|
|
8
|
-
export * from './command';
|
|
9
|
-
export * from './otplease';
|
|
10
|
-
export * from './package';
|
|
11
|
-
export * from './prompt';
|
|
12
|
-
export * from './validation-error';
|
|
1
|
+
export * from './conventional-commits';
|
|
2
|
+
export * from './git-clients';
|
|
3
|
+
export * from './models';
|
|
4
|
+
export * from './package-graph';
|
|
5
|
+
export * from './project';
|
|
6
|
+
export * from './utils';
|
|
7
|
+
export * from './child-process';
|
|
8
|
+
export * from './command';
|
|
9
|
+
export * from './otplease';
|
|
10
|
+
export * from './package';
|
|
11
|
+
export * from './prompt';
|
|
12
|
+
export * from './validation-error';
|
package/dist/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
// folders
|
|
18
|
-
__exportStar(require("./conventional-commits"), exports);
|
|
19
|
-
__exportStar(require("./git-clients"), exports);
|
|
20
|
-
__exportStar(require("./models"), exports);
|
|
21
|
-
__exportStar(require("./package-graph"), exports);
|
|
22
|
-
__exportStar(require("./project"), exports);
|
|
23
|
-
__exportStar(require("./utils"), exports);
|
|
24
|
-
// files
|
|
25
|
-
__exportStar(require("./child-process"), exports);
|
|
26
|
-
__exportStar(require("./command"), exports);
|
|
27
|
-
__exportStar(require("./otplease"), exports);
|
|
28
|
-
__exportStar(require("./package"), exports);
|
|
29
|
-
__exportStar(require("./prompt"), exports);
|
|
30
|
-
__exportStar(require("./validation-error"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// folders
|
|
18
|
+
__exportStar(require("./conventional-commits"), exports);
|
|
19
|
+
__exportStar(require("./git-clients"), exports);
|
|
20
|
+
__exportStar(require("./models"), exports);
|
|
21
|
+
__exportStar(require("./package-graph"), exports);
|
|
22
|
+
__exportStar(require("./project"), exports);
|
|
23
|
+
__exportStar(require("./utils"), exports);
|
|
24
|
+
// files
|
|
25
|
+
__exportStar(require("./child-process"), exports);
|
|
26
|
+
__exportStar(require("./command"), exports);
|
|
27
|
+
__exportStar(require("./otplease"), exports);
|
|
28
|
+
__exportStar(require("./package"), exports);
|
|
29
|
+
__exportStar(require("./prompt"), exports);
|
|
30
|
+
__exportStar(require("./validation-error"), exports);
|
|
31
31
|
//# sourceMappingURL=index.js.map
|