@lerna-lite/publish 1.16.1 → 1.16.2
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/dist/index.d.ts +3 -3
- package/dist/index.js +6 -6
- package/dist/lib/create-temp-licenses.d.ts +7 -7
- package/dist/lib/create-temp-licenses.js +30 -30
- package/dist/lib/fetch-config.d.ts +10 -10
- package/dist/lib/fetch-config.js +19 -19
- package/dist/lib/get-current-sha.d.ts +6 -6
- package/dist/lib/get-current-sha.js +17 -17
- package/dist/lib/get-current-tags.d.ts +8 -8
- package/dist/lib/get-current-tags.js +32 -32
- package/dist/lib/get-npm-username.d.ts +7 -7
- package/dist/lib/get-npm-username.js +52 -52
- package/dist/lib/get-packages-without-license.d.ts +8 -8
- package/dist/lib/get-packages-without-license.js +20 -20
- package/dist/lib/get-packed.d.ts +3 -3
- package/dist/lib/get-packed.js +63 -63
- package/dist/lib/get-profile-data.d.ts +7 -7
- package/dist/lib/get-profile-data.js +20 -20
- package/dist/lib/get-tagged-packages.d.ts +9 -9
- package/dist/lib/get-tagged-packages.js +26 -26
- package/dist/lib/get-two-factor-auth-required.d.ts +7 -7
- package/dist/lib/get-two-factor-auth-required.js +42 -42
- package/dist/lib/get-unpublished-packages.d.ts +8 -8
- package/dist/lib/get-unpublished-packages.js +34 -34
- package/dist/lib/get-whoami.d.ts +11 -11
- package/dist/lib/get-whoami.js +18 -18
- package/dist/lib/git-checkout.d.ts +10 -10
- package/dist/lib/git-checkout.js +18 -18
- package/dist/lib/index.d.ts +19 -19
- package/dist/lib/index.js +22 -22
- package/dist/lib/log-packed.d.ts +5 -5
- package/dist/lib/log-packed.js +70 -70
- package/dist/lib/npm-dist-tag.d.ts +33 -33
- package/dist/lib/npm-dist-tag.js +137 -137
- package/dist/lib/npm-publish.d.ts +11 -11
- package/dist/lib/npm-publish.js +93 -93
- package/dist/lib/override-publish-config.d.ts +6 -6
- package/dist/lib/override-publish-config.js +43 -43
- package/dist/lib/pack-directory.d.ts +9 -9
- package/dist/lib/pack-directory.js +67 -67
- package/dist/lib/remove-temp-licenses.d.ts +6 -6
- package/dist/lib/remove-temp-licenses.js +17 -17
- package/dist/lib/verify-npm-package-access.d.ts +9 -9
- package/dist/lib/verify-npm-package-access.js +53 -53
- package/dist/models/index.d.ts +34 -34
- package/dist/models/index.js +2 -2
- package/dist/publish-command.d.ts +74 -74
- package/dist/publish-command.js +781 -781
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './lib';
|
|
2
|
-
export * from './models';
|
|
3
|
-
export * from './publish-command';
|
|
1
|
+
export * from './lib';
|
|
2
|
+
export * from './models';
|
|
3
|
+
export * from './publish-command';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./lib"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./models"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./publish-command"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./lib"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./models"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./publish-command"), exports);
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Package } from '@lerna-lite/core';
|
|
2
|
-
/**
|
|
3
|
-
* Create temporary license files.
|
|
4
|
-
* @param {string} srcLicensePath
|
|
5
|
-
* @param {Packages[]} packagesToBeLicensed
|
|
6
|
-
*/
|
|
7
|
-
export declare function createTempLicenses(srcLicensePath: string, packagesToBeLicensed: Package[]): Promise<any>;
|
|
1
|
+
import { Package } from '@lerna-lite/core';
|
|
2
|
+
/**
|
|
3
|
+
* Create temporary license files.
|
|
4
|
+
* @param {string} srcLicensePath
|
|
5
|
+
* @param {Packages[]} packagesToBeLicensed
|
|
6
|
+
*/
|
|
7
|
+
export declare function createTempLicenses(srcLicensePath: string, packagesToBeLicensed: Package[]): Promise<any>;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createTempLicenses = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
const p_map_1 = tslib_1.__importDefault(require("p-map"));
|
|
8
|
-
/**
|
|
9
|
-
* Create temporary license files.
|
|
10
|
-
* @param {string} srcLicensePath
|
|
11
|
-
* @param {Packages[]} packagesToBeLicensed
|
|
12
|
-
*/
|
|
13
|
-
function createTempLicenses(srcLicensePath, packagesToBeLicensed) {
|
|
14
|
-
if (!srcLicensePath || !packagesToBeLicensed.length) {
|
|
15
|
-
return Promise.resolve();
|
|
16
|
-
}
|
|
17
|
-
// license file might have an extension, so let's allow it
|
|
18
|
-
const licenseFileName = path_1.default.basename(srcLicensePath);
|
|
19
|
-
const options = {
|
|
20
|
-
// make an effort to keep package contents stable over time
|
|
21
|
-
preserveTimestamps: process.arch !== 'ia32',
|
|
22
|
-
// (give up on 32-bit architecture to avoid fs-extra warning)
|
|
23
|
-
};
|
|
24
|
-
// store target path for removal later
|
|
25
|
-
packagesToBeLicensed.forEach((pkg) => {
|
|
26
|
-
pkg.licensePath = path_1.default.join(pkg.contents, licenseFileName);
|
|
27
|
-
});
|
|
28
|
-
return (0, p_map_1.default)(packagesToBeLicensed, (pkg) => fs_extra_1.default.copy(srcLicensePath, pkg.licensePath, options));
|
|
29
|
-
}
|
|
30
|
-
exports.createTempLicenses = createTempLicenses;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTempLicenses = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
+
const p_map_1 = tslib_1.__importDefault(require("p-map"));
|
|
8
|
+
/**
|
|
9
|
+
* Create temporary license files.
|
|
10
|
+
* @param {string} srcLicensePath
|
|
11
|
+
* @param {Packages[]} packagesToBeLicensed
|
|
12
|
+
*/
|
|
13
|
+
function createTempLicenses(srcLicensePath, packagesToBeLicensed) {
|
|
14
|
+
if (!srcLicensePath || !packagesToBeLicensed.length) {
|
|
15
|
+
return Promise.resolve();
|
|
16
|
+
}
|
|
17
|
+
// license file might have an extension, so let's allow it
|
|
18
|
+
const licenseFileName = path_1.default.basename(srcLicensePath);
|
|
19
|
+
const options = {
|
|
20
|
+
// make an effort to keep package contents stable over time
|
|
21
|
+
preserveTimestamps: process.arch !== 'ia32',
|
|
22
|
+
// (give up on 32-bit architecture to avoid fs-extra warning)
|
|
23
|
+
};
|
|
24
|
+
// store target path for removal later
|
|
25
|
+
packagesToBeLicensed.forEach((pkg) => {
|
|
26
|
+
pkg.licensePath = path_1.default.join(pkg.contents, licenseFileName);
|
|
27
|
+
});
|
|
28
|
+
return (0, p_map_1.default)(packagesToBeLicensed, (pkg) => fs_extra_1.default.copy(srcLicensePath, pkg.licensePath, options));
|
|
29
|
+
}
|
|
30
|
+
exports.createTempLicenses = createTempLicenses;
|
|
31
31
|
//# sourceMappingURL=create-temp-licenses.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { FetchConfig } from '@lerna-lite/core';
|
|
2
|
-
/**
|
|
3
|
-
* Create a merged options object suitable for npm-registry-fetch.
|
|
4
|
-
* @param {{ [key: string]: unknown }} options
|
|
5
|
-
* @param {Partial<FetchConfig>} [extra]
|
|
6
|
-
* @returns {FetchConfig}
|
|
7
|
-
*/
|
|
8
|
-
export declare function getFetchConfig(options?: {
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}, extra?: Partial<FetchConfig>): FetchConfig;
|
|
1
|
+
import { FetchConfig } from '@lerna-lite/core';
|
|
2
|
+
/**
|
|
3
|
+
* Create a merged options object suitable for npm-registry-fetch.
|
|
4
|
+
* @param {{ [key: string]: unknown }} options
|
|
5
|
+
* @param {Partial<FetchConfig>} [extra]
|
|
6
|
+
* @returns {FetchConfig}
|
|
7
|
+
*/
|
|
8
|
+
export declare function getFetchConfig(options?: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}, extra?: Partial<FetchConfig>): FetchConfig;
|
package/dist/lib/fetch-config.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFetchConfig = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const npmlog_1 = tslib_1.__importDefault(require("npmlog"));
|
|
6
|
-
/**
|
|
7
|
-
* Create a merged options object suitable for npm-registry-fetch.
|
|
8
|
-
* @param {{ [key: string]: unknown }} options
|
|
9
|
-
* @param {Partial<FetchConfig>} [extra]
|
|
10
|
-
* @returns {FetchConfig}
|
|
11
|
-
*/
|
|
12
|
-
function getFetchConfig(options, extra) {
|
|
13
|
-
return {
|
|
14
|
-
log: npmlog_1.default,
|
|
15
|
-
...options,
|
|
16
|
-
...extra,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
exports.getFetchConfig = getFetchConfig;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFetchConfig = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const npmlog_1 = tslib_1.__importDefault(require("npmlog"));
|
|
6
|
+
/**
|
|
7
|
+
* Create a merged options object suitable for npm-registry-fetch.
|
|
8
|
+
* @param {{ [key: string]: unknown }} options
|
|
9
|
+
* @param {Partial<FetchConfig>} [extra]
|
|
10
|
+
* @returns {FetchConfig}
|
|
11
|
+
*/
|
|
12
|
+
function getFetchConfig(options, extra) {
|
|
13
|
+
return {
|
|
14
|
+
log: npmlog_1.default,
|
|
15
|
+
...options,
|
|
16
|
+
...extra,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
exports.getFetchConfig = getFetchConfig;
|
|
20
20
|
//# sourceMappingURL=fetch-config.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ExecOpts } from '@lerna-lite/core';
|
|
2
|
-
/**
|
|
3
|
-
* Retrieve current SHA from git.
|
|
4
|
-
* @param {import("@lerna/child-process").ExecOpts} opts
|
|
5
|
-
*/
|
|
6
|
-
export declare function getCurrentSHA(opts: ExecOpts, dryRun?: boolean): string;
|
|
1
|
+
import { ExecOpts } from '@lerna-lite/core';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieve current SHA from git.
|
|
4
|
+
* @param {import("@lerna/child-process").ExecOpts} opts
|
|
5
|
+
*/
|
|
6
|
+
export declare function getCurrentSHA(opts: ExecOpts, dryRun?: boolean): string;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCurrentSHA = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const npmlog_1 = tslib_1.__importDefault(require("npmlog"));
|
|
6
|
-
const core_1 = require("@lerna-lite/core");
|
|
7
|
-
/**
|
|
8
|
-
* Retrieve current SHA from git.
|
|
9
|
-
* @param {import("@lerna/child-process").ExecOpts} opts
|
|
10
|
-
*/
|
|
11
|
-
function getCurrentSHA(opts, dryRun = false) {
|
|
12
|
-
npmlog_1.default.silly('getCurrentSHA', '');
|
|
13
|
-
const sha = (0, core_1.execSync)('git', ['rev-parse', 'HEAD'], opts, dryRun);
|
|
14
|
-
npmlog_1.default.verbose('getCurrentSHA', sha);
|
|
15
|
-
return sha;
|
|
16
|
-
}
|
|
17
|
-
exports.getCurrentSHA = getCurrentSHA;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCurrentSHA = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const npmlog_1 = tslib_1.__importDefault(require("npmlog"));
|
|
6
|
+
const core_1 = require("@lerna-lite/core");
|
|
7
|
+
/**
|
|
8
|
+
* Retrieve current SHA from git.
|
|
9
|
+
* @param {import("@lerna/child-process").ExecOpts} opts
|
|
10
|
+
*/
|
|
11
|
+
function getCurrentSHA(opts, dryRun = false) {
|
|
12
|
+
npmlog_1.default.silly('getCurrentSHA', '');
|
|
13
|
+
const sha = (0, core_1.execSync)('git', ['rev-parse', 'HEAD'], opts, dryRun);
|
|
14
|
+
npmlog_1.default.verbose('getCurrentSHA', sha);
|
|
15
|
+
return sha;
|
|
16
|
+
}
|
|
17
|
+
exports.getCurrentSHA = getCurrentSHA;
|
|
18
18
|
//# sourceMappingURL=get-current-sha.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ExecOpts } from '@lerna-lite/core';
|
|
2
|
-
/**
|
|
3
|
-
* Retrieve a list of git tags pointing to the current HEAD that match the provided pattern.
|
|
4
|
-
* @param {import("@lerna/child-process").ExecOpts} execOpts
|
|
5
|
-
* @param {string} matchingPattern
|
|
6
|
-
* @returns {string[]}
|
|
7
|
-
*/
|
|
8
|
-
export declare function getCurrentTags(execOpts: ExecOpts, matchingPattern: string, dryRun?: boolean): Promise<string[]>;
|
|
1
|
+
import { ExecOpts } from '@lerna-lite/core';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieve a list of git tags pointing to the current HEAD that match the provided pattern.
|
|
4
|
+
* @param {import("@lerna/child-process").ExecOpts} execOpts
|
|
5
|
+
* @param {string} matchingPattern
|
|
6
|
+
* @returns {string[]}
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCurrentTags(execOpts: ExecOpts, matchingPattern: string, dryRun?: boolean): Promise<string[]>;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCurrentTags = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const npmlog_1 = tslib_1.__importDefault(require("npmlog"));
|
|
6
|
-
const npm_package_arg_1 = tslib_1.__importDefault(require("npm-package-arg"));
|
|
7
|
-
const core_1 = require("@lerna-lite/core");
|
|
8
|
-
/**
|
|
9
|
-
* Retrieve a list of git tags pointing to the current HEAD that match the provided pattern.
|
|
10
|
-
* @param {import("@lerna/child-process").ExecOpts} execOpts
|
|
11
|
-
* @param {string} matchingPattern
|
|
12
|
-
* @returns {string[]}
|
|
13
|
-
*/
|
|
14
|
-
function getCurrentTags(execOpts, matchingPattern, dryRun = false) {
|
|
15
|
-
npmlog_1.default.silly('getCurrentTags', 'matching %j', matchingPattern);
|
|
16
|
-
const opts = Object.assign({}, execOpts, {
|
|
17
|
-
// don't reject due to non-zero exit code when there are no results
|
|
18
|
-
reject: false,
|
|
19
|
-
});
|
|
20
|
-
return (0, core_1.exec)('git', ['tag', '--sort', 'version:refname', '--points-at', 'HEAD', '--list', matchingPattern], opts, dryRun).then((result) => {
|
|
21
|
-
const lines = result.stdout.split('\n').filter(Boolean);
|
|
22
|
-
if (matchingPattern === '*@*') {
|
|
23
|
-
// independent mode does not respect tagVersionPrefix,
|
|
24
|
-
// but embeds the package name in the tag "prefix"
|
|
25
|
-
return lines.map((tag) => (0, npm_package_arg_1.default)(tag).name);
|
|
26
|
-
}
|
|
27
|
-
// "fixed" mode can have a custom tagVersionPrefix,
|
|
28
|
-
// but it doesn't really matter as it is not used to extract package names
|
|
29
|
-
return lines;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
exports.getCurrentTags = getCurrentTags;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCurrentTags = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const npmlog_1 = tslib_1.__importDefault(require("npmlog"));
|
|
6
|
+
const npm_package_arg_1 = tslib_1.__importDefault(require("npm-package-arg"));
|
|
7
|
+
const core_1 = require("@lerna-lite/core");
|
|
8
|
+
/**
|
|
9
|
+
* Retrieve a list of git tags pointing to the current HEAD that match the provided pattern.
|
|
10
|
+
* @param {import("@lerna/child-process").ExecOpts} execOpts
|
|
11
|
+
* @param {string} matchingPattern
|
|
12
|
+
* @returns {string[]}
|
|
13
|
+
*/
|
|
14
|
+
function getCurrentTags(execOpts, matchingPattern, dryRun = false) {
|
|
15
|
+
npmlog_1.default.silly('getCurrentTags', 'matching %j', matchingPattern);
|
|
16
|
+
const opts = Object.assign({}, execOpts, {
|
|
17
|
+
// don't reject due to non-zero exit code when there are no results
|
|
18
|
+
reject: false,
|
|
19
|
+
});
|
|
20
|
+
return (0, core_1.exec)('git', ['tag', '--sort', 'version:refname', '--points-at', 'HEAD', '--list', matchingPattern], opts, dryRun).then((result) => {
|
|
21
|
+
const lines = result.stdout.split('\n').filter(Boolean);
|
|
22
|
+
if (matchingPattern === '*@*') {
|
|
23
|
+
// independent mode does not respect tagVersionPrefix,
|
|
24
|
+
// but embeds the package name in the tag "prefix"
|
|
25
|
+
return lines.map((tag) => (0, npm_package_arg_1.default)(tag).name);
|
|
26
|
+
}
|
|
27
|
+
// "fixed" mode can have a custom tagVersionPrefix,
|
|
28
|
+
// but it doesn't really matter as it is not used to extract package names
|
|
29
|
+
return lines;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
exports.getCurrentTags = getCurrentTags;
|
|
33
33
|
//# sourceMappingURL=get-current-tags.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FetchConfig } from '@lerna-lite/core';
|
|
2
|
-
/**
|
|
3
|
-
* Retrieve username of logged-in user.
|
|
4
|
-
* @param {import("./fetch-config").FetchConfig} options
|
|
5
|
-
* @returns {Promise<string>}
|
|
6
|
-
*/
|
|
7
|
-
export declare function getNpmUsername(options: FetchConfig): Promise<string | undefined>;
|
|
1
|
+
import { FetchConfig } from '@lerna-lite/core';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieve username of logged-in user.
|
|
4
|
+
* @param {import("./fetch-config").FetchConfig} options
|
|
5
|
+
* @returns {Promise<string>}
|
|
6
|
+
*/
|
|
7
|
+
export declare function getNpmUsername(options: FetchConfig): Promise<string | undefined>;
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getNpmUsername = void 0;
|
|
4
|
-
const fetch_config_1 = require("./fetch-config");
|
|
5
|
-
const get_profile_data_1 = require("./get-profile-data");
|
|
6
|
-
const get_whoami_1 = require("./get-whoami");
|
|
7
|
-
const core_1 = require("@lerna-lite/core");
|
|
8
|
-
/**
|
|
9
|
-
* Retrieve username of logged-in user.
|
|
10
|
-
* @param {import("./fetch-config").FetchConfig} options
|
|
11
|
-
* @returns {Promise<string>}
|
|
12
|
-
*/
|
|
13
|
-
function getNpmUsername(options) {
|
|
14
|
-
const opts = (0, fetch_config_1.getFetchConfig)(options, {
|
|
15
|
-
// don't wait forever for third-party failures to be dealt with
|
|
16
|
-
fetchRetries: 0,
|
|
17
|
-
});
|
|
18
|
-
opts.log.info('', 'Verifying npm credentials');
|
|
19
|
-
return (0, get_profile_data_1.getProfileData)(opts)
|
|
20
|
-
.catch((err) => {
|
|
21
|
-
// Many third-party registries do not implement the user endpoint
|
|
22
|
-
// Legacy npm Enterprise returns E500 instead of E404
|
|
23
|
-
if (err.code === 'E500' || err.code === 'E404') {
|
|
24
|
-
return (0, get_whoami_1.getWhoAmI)(opts);
|
|
25
|
-
}
|
|
26
|
-
// re-throw 401 Unauthorized (and all other unexpected errors)
|
|
27
|
-
throw err;
|
|
28
|
-
})
|
|
29
|
-
.then(success, failure);
|
|
30
|
-
function success(result) {
|
|
31
|
-
opts.log.silly('get npm username', 'received %j', result);
|
|
32
|
-
if (!result.username) {
|
|
33
|
-
throw new core_1.ValidationError('ENEEDAUTH', 'You must be logged in to publish packages. Use `npm login` and try again.');
|
|
34
|
-
}
|
|
35
|
-
return result.username;
|
|
36
|
-
}
|
|
37
|
-
// catch request errors, not auth expired errors
|
|
38
|
-
function failure(err) {
|
|
39
|
-
// Log the error cleanly to stderr
|
|
40
|
-
opts.log.pause();
|
|
41
|
-
console.error(err.message); // eslint-disable-line no-console
|
|
42
|
-
opts.log.resume();
|
|
43
|
-
if (opts.registry === 'https://registry.npmjs.org/') {
|
|
44
|
-
if (err.code === 'E403') {
|
|
45
|
-
throw new core_1.ValidationError('ENEEDAUTH', 'Access verification failed. Ensure that your npm access token has both read and write access, or remove the verifyAccess option to skip this verification. Note that npm automation tokens do NOT have read access (https://docs.npmjs.com/creating-and-viewing-access-tokens).');
|
|
46
|
-
}
|
|
47
|
-
throw new core_1.ValidationError('EWHOAMI', 'Authentication error. Use `npm whoami` to troubleshoot.');
|
|
48
|
-
}
|
|
49
|
-
opts.log.warn('EWHOAMI', 'Unable to determine npm username from third-party registry, this command will likely fail soon!');
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.getNpmUsername = getNpmUsername;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNpmUsername = void 0;
|
|
4
|
+
const fetch_config_1 = require("./fetch-config");
|
|
5
|
+
const get_profile_data_1 = require("./get-profile-data");
|
|
6
|
+
const get_whoami_1 = require("./get-whoami");
|
|
7
|
+
const core_1 = require("@lerna-lite/core");
|
|
8
|
+
/**
|
|
9
|
+
* Retrieve username of logged-in user.
|
|
10
|
+
* @param {import("./fetch-config").FetchConfig} options
|
|
11
|
+
* @returns {Promise<string>}
|
|
12
|
+
*/
|
|
13
|
+
function getNpmUsername(options) {
|
|
14
|
+
const opts = (0, fetch_config_1.getFetchConfig)(options, {
|
|
15
|
+
// don't wait forever for third-party failures to be dealt with
|
|
16
|
+
fetchRetries: 0,
|
|
17
|
+
});
|
|
18
|
+
opts.log.info('', 'Verifying npm credentials');
|
|
19
|
+
return (0, get_profile_data_1.getProfileData)(opts)
|
|
20
|
+
.catch((err) => {
|
|
21
|
+
// Many third-party registries do not implement the user endpoint
|
|
22
|
+
// Legacy npm Enterprise returns E500 instead of E404
|
|
23
|
+
if (err.code === 'E500' || err.code === 'E404') {
|
|
24
|
+
return (0, get_whoami_1.getWhoAmI)(opts);
|
|
25
|
+
}
|
|
26
|
+
// re-throw 401 Unauthorized (and all other unexpected errors)
|
|
27
|
+
throw err;
|
|
28
|
+
})
|
|
29
|
+
.then(success, failure);
|
|
30
|
+
function success(result) {
|
|
31
|
+
opts.log.silly('get npm username', 'received %j', result);
|
|
32
|
+
if (!result.username) {
|
|
33
|
+
throw new core_1.ValidationError('ENEEDAUTH', 'You must be logged in to publish packages. Use `npm login` and try again.');
|
|
34
|
+
}
|
|
35
|
+
return result.username;
|
|
36
|
+
}
|
|
37
|
+
// catch request errors, not auth expired errors
|
|
38
|
+
function failure(err) {
|
|
39
|
+
// Log the error cleanly to stderr
|
|
40
|
+
opts.log.pause();
|
|
41
|
+
console.error(err.message); // eslint-disable-line no-console
|
|
42
|
+
opts.log.resume();
|
|
43
|
+
if (opts.registry === 'https://registry.npmjs.org/') {
|
|
44
|
+
if (err.code === 'E403') {
|
|
45
|
+
throw new core_1.ValidationError('ENEEDAUTH', 'Access verification failed. Ensure that your npm access token has both read and write access, or remove the verifyAccess option to skip this verification. Note that npm automation tokens do NOT have read access (https://docs.npmjs.com/creating-and-viewing-access-tokens).');
|
|
46
|
+
}
|
|
47
|
+
throw new core_1.ValidationError('EWHOAMI', 'Authentication error. Use `npm whoami` to troubleshoot.');
|
|
48
|
+
}
|
|
49
|
+
opts.log.warn('EWHOAMI', 'Unable to determine npm username from third-party registry, this command will likely fail soon!');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.getNpmUsername = getNpmUsername;
|
|
53
53
|
//# sourceMappingURL=get-npm-username.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Package, Project } from '@lerna-lite/core';
|
|
2
|
-
/**
|
|
3
|
-
* Retrieve a list of packages that lack a license file.
|
|
4
|
-
* @param {Project} project
|
|
5
|
-
* @param {Package[]} packagesToPublish
|
|
6
|
-
* @returns {Package[]}
|
|
7
|
-
*/
|
|
8
|
-
export declare function getPackagesWithoutLicense(project: Project, packagesToPublish: Package[]): Promise<Package[]>;
|
|
1
|
+
import { Package, Project } from '@lerna-lite/core';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieve a list of packages that lack a license file.
|
|
4
|
+
* @param {Project} project
|
|
5
|
+
* @param {Package[]} packagesToPublish
|
|
6
|
+
* @returns {Package[]}
|
|
7
|
+
*/
|
|
8
|
+
export declare function getPackagesWithoutLicense(project: Project, packagesToPublish: Package[]): Promise<Package[]>;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPackagesWithoutLicense = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
-
/**
|
|
7
|
-
* Retrieve a list of packages that lack a license file.
|
|
8
|
-
* @param {Project} project
|
|
9
|
-
* @param {Package[]} packagesToPublish
|
|
10
|
-
* @returns {Package[]}
|
|
11
|
-
*/
|
|
12
|
-
function getPackagesWithoutLicense(project, packagesToPublish) {
|
|
13
|
-
return project.getPackageLicensePaths().then((licensePaths) => {
|
|
14
|
-
// this assumes any existing license is a sibling of package.json, which is pretty safe
|
|
15
|
-
// it also dedupes package locations, since we don't care about duplicate license files
|
|
16
|
-
const licensed = new Set(licensePaths.map((lp) => path_1.default.dirname(lp)));
|
|
17
|
-
return packagesToPublish.filter((pkg) => !licensed.has(pkg.location));
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
exports.getPackagesWithoutLicense = getPackagesWithoutLicense;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPackagesWithoutLicense = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
+
/**
|
|
7
|
+
* Retrieve a list of packages that lack a license file.
|
|
8
|
+
* @param {Project} project
|
|
9
|
+
* @param {Package[]} packagesToPublish
|
|
10
|
+
* @returns {Package[]}
|
|
11
|
+
*/
|
|
12
|
+
function getPackagesWithoutLicense(project, packagesToPublish) {
|
|
13
|
+
return project.getPackageLicensePaths().then((licensePaths) => {
|
|
14
|
+
// this assumes any existing license is a sibling of package.json, which is pretty safe
|
|
15
|
+
// it also dedupes package locations, since we don't care about duplicate license files
|
|
16
|
+
const licensed = new Set(licensePaths.map((lp) => path_1.default.dirname(lp)));
|
|
17
|
+
return packagesToPublish.filter((pkg) => !licensed.has(pkg.location));
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
exports.getPackagesWithoutLicense = getPackagesWithoutLicense;
|
|
21
21
|
//# sourceMappingURL=get-packages-without-license.js.map
|
package/dist/lib/get-packed.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Package } from '@lerna-lite/core';
|
|
2
|
-
import { Tarball } from '../models';
|
|
3
|
-
export declare function getPacked(pkg: Package, tarFilePath: string): Promise<Tarball>;
|
|
1
|
+
import { Package } from '@lerna-lite/core';
|
|
2
|
+
import { Tarball } from '../models';
|
|
3
|
+
export declare function getPacked(pkg: Package, tarFilePath: string): Promise<Tarball>;
|
package/dist/lib/get-packed.js
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPacked = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
const ssri_1 = tslib_1.__importDefault(require("ssri"));
|
|
8
|
-
const tar_1 = tslib_1.__importDefault(require("tar"));
|
|
9
|
-
function getPacked(pkg, tarFilePath) {
|
|
10
|
-
const bundledWanted = new Set(/* pkg.bundleDependencies || pkg.bundledDependencies || */ []);
|
|
11
|
-
const bundled = new Set();
|
|
12
|
-
const files = [];
|
|
13
|
-
let totalEntries = 0;
|
|
14
|
-
let totalEntrySize = 0;
|
|
15
|
-
return tar_1.default
|
|
16
|
-
.list({
|
|
17
|
-
file: tarFilePath,
|
|
18
|
-
onentry(entry) {
|
|
19
|
-
totalEntries += 1;
|
|
20
|
-
totalEntrySize += entry.size;
|
|
21
|
-
const p = entry.path;
|
|
22
|
-
/* istanbul ignore if */
|
|
23
|
-
if (p.startsWith('package/node_modules/')) {
|
|
24
|
-
const name = p.match(/^package\/node_modules\/((?:@[^/]+\/)?[^/]+)/)[1];
|
|
25
|
-
if (bundledWanted.has(name)) {
|
|
26
|
-
bundled.add(name);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
files.push({
|
|
31
|
-
path: entry.path.replace(/^package\//, ''),
|
|
32
|
-
size: entry.size,
|
|
33
|
-
mode: entry.mode,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
strip: 1,
|
|
38
|
-
})
|
|
39
|
-
.then(() => Promise.all([
|
|
40
|
-
fs_extra_1.default.stat(tarFilePath),
|
|
41
|
-
ssri_1.default.fromStream(fs_extra_1.default.createReadStream(tarFilePath), {
|
|
42
|
-
algorithms: ['sha1', 'sha512'],
|
|
43
|
-
}),
|
|
44
|
-
]))
|
|
45
|
-
.then(([{ size }, { sha1, sha512 }]) => {
|
|
46
|
-
const shasum = sha1[0].hexDigest();
|
|
47
|
-
return {
|
|
48
|
-
id: `${pkg.name}@${pkg.version}`,
|
|
49
|
-
name: pkg.name,
|
|
50
|
-
version: pkg.version,
|
|
51
|
-
size,
|
|
52
|
-
unpackedSize: totalEntrySize,
|
|
53
|
-
shasum,
|
|
54
|
-
integrity: ssri_1.default.parse(sha512[0]),
|
|
55
|
-
filename: path_1.default.basename(tarFilePath),
|
|
56
|
-
files,
|
|
57
|
-
entryCount: totalEntries,
|
|
58
|
-
bundled: Array.from(bundled),
|
|
59
|
-
tarFilePath,
|
|
60
|
-
};
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
exports.getPacked = getPacked;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPacked = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
+
const ssri_1 = tslib_1.__importDefault(require("ssri"));
|
|
8
|
+
const tar_1 = tslib_1.__importDefault(require("tar"));
|
|
9
|
+
function getPacked(pkg, tarFilePath) {
|
|
10
|
+
const bundledWanted = new Set(/* pkg.bundleDependencies || pkg.bundledDependencies || */ []);
|
|
11
|
+
const bundled = new Set();
|
|
12
|
+
const files = [];
|
|
13
|
+
let totalEntries = 0;
|
|
14
|
+
let totalEntrySize = 0;
|
|
15
|
+
return tar_1.default
|
|
16
|
+
.list({
|
|
17
|
+
file: tarFilePath,
|
|
18
|
+
onentry(entry) {
|
|
19
|
+
totalEntries += 1;
|
|
20
|
+
totalEntrySize += entry.size;
|
|
21
|
+
const p = entry.path;
|
|
22
|
+
/* istanbul ignore if */
|
|
23
|
+
if (p.startsWith('package/node_modules/')) {
|
|
24
|
+
const name = p.match(/^package\/node_modules\/((?:@[^/]+\/)?[^/]+)/)[1];
|
|
25
|
+
if (bundledWanted.has(name)) {
|
|
26
|
+
bundled.add(name);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
files.push({
|
|
31
|
+
path: entry.path.replace(/^package\//, ''),
|
|
32
|
+
size: entry.size,
|
|
33
|
+
mode: entry.mode,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
strip: 1,
|
|
38
|
+
})
|
|
39
|
+
.then(() => Promise.all([
|
|
40
|
+
fs_extra_1.default.stat(tarFilePath),
|
|
41
|
+
ssri_1.default.fromStream(fs_extra_1.default.createReadStream(tarFilePath), {
|
|
42
|
+
algorithms: ['sha1', 'sha512'],
|
|
43
|
+
}),
|
|
44
|
+
]))
|
|
45
|
+
.then(([{ size }, { sha1, sha512 }]) => {
|
|
46
|
+
const shasum = sha1[0].hexDigest();
|
|
47
|
+
return {
|
|
48
|
+
id: `${pkg.name}@${pkg.version}`,
|
|
49
|
+
name: pkg.name,
|
|
50
|
+
version: pkg.version,
|
|
51
|
+
size,
|
|
52
|
+
unpackedSize: totalEntrySize,
|
|
53
|
+
shasum,
|
|
54
|
+
integrity: ssri_1.default.parse(sha512[0]),
|
|
55
|
+
filename: path_1.default.basename(tarFilePath),
|
|
56
|
+
files,
|
|
57
|
+
entryCount: totalEntries,
|
|
58
|
+
bundled: Array.from(bundled),
|
|
59
|
+
tarFilePath,
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
exports.getPacked = getPacked;
|
|
64
64
|
//# sourceMappingURL=get-packed.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FetchConfig, ProfileData } from '@lerna-lite/core';
|
|
2
|
-
/**
|
|
3
|
-
* Retrieve profile data of logged-in user.
|
|
4
|
-
* @param {import("./fetch-config").FetchConfig} opts
|
|
5
|
-
* @returns {Promise<ProfileData>}
|
|
6
|
-
*/
|
|
7
|
-
export declare function getProfileData(opts: FetchConfig): Promise<ProfileData>;
|
|
1
|
+
import { FetchConfig, ProfileData } from '@lerna-lite/core';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieve profile data of logged-in user.
|
|
4
|
+
* @param {import("./fetch-config").FetchConfig} opts
|
|
5
|
+
* @returns {Promise<ProfileData>}
|
|
6
|
+
*/
|
|
7
|
+
export declare function getProfileData(opts: FetchConfig): Promise<ProfileData>;
|