@lerna-lite/publish 1.2.0 → 1.5.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.
Files changed (52) hide show
  1. package/README.md +45 -20
  2. package/dist/index.d.ts +3 -3
  3. package/dist/index.js +19 -19
  4. package/dist/lib/create-temp-licenses.d.ts +7 -7
  5. package/dist/lib/create-temp-licenses.js +32 -32
  6. package/dist/lib/fetch-config.d.ts +10 -10
  7. package/dist/lib/fetch-config.js +21 -21
  8. package/dist/lib/get-current-sha.d.ts +6 -6
  9. package/dist/lib/get-current-sha.js +19 -19
  10. package/dist/lib/get-current-tags.d.ts +8 -8
  11. package/dist/lib/get-current-tags.js +35 -35
  12. package/dist/lib/get-npm-username.d.ts +7 -7
  13. package/dist/lib/get-npm-username.js +49 -49
  14. package/dist/lib/get-packages-without-license.d.ts +8 -8
  15. package/dist/lib/get-packages-without-license.js +23 -23
  16. package/dist/lib/get-packed.d.ts +3 -2
  17. package/dist/lib/get-packed.js +65 -65
  18. package/dist/lib/get-packed.js.map +1 -1
  19. package/dist/lib/get-profile-data.d.ts +7 -7
  20. package/dist/lib/get-profile-data.js +22 -22
  21. package/dist/lib/get-tagged-packages.d.ts +9 -9
  22. package/dist/lib/get-tagged-packages.js +29 -29
  23. package/dist/lib/get-two-factor-auth-required.d.ts +7 -7
  24. package/dist/lib/get-two-factor-auth-required.js +42 -42
  25. package/dist/lib/get-unpublished-packages.d.ts +8 -8
  26. package/dist/lib/get-unpublished-packages.js +36 -36
  27. package/dist/lib/get-whoami.d.ts +11 -11
  28. package/dist/lib/get-whoami.js +20 -20
  29. package/dist/lib/git-checkout.d.ts +10 -10
  30. package/dist/lib/git-checkout.js +20 -20
  31. package/dist/lib/index.d.ts +19 -19
  32. package/dist/lib/index.js +35 -35
  33. package/dist/lib/log-packed.d.ts +5 -2
  34. package/dist/lib/log-packed.js +71 -67
  35. package/dist/lib/log-packed.js.map +1 -1
  36. package/dist/lib/npm-dist-tag.d.ts +33 -33
  37. package/dist/lib/npm-dist-tag.js +139 -139
  38. package/dist/lib/npm-publish.d.ts +10 -10
  39. package/dist/lib/npm-publish.js +102 -102
  40. package/dist/lib/pack-directory.d.ts +8 -8
  41. package/dist/lib/pack-directory.js +66 -67
  42. package/dist/lib/pack-directory.js.map +1 -1
  43. package/dist/lib/remove-temp-licenses.d.ts +6 -6
  44. package/dist/lib/remove-temp-licenses.js +19 -19
  45. package/dist/lib/verify-npm-package-access.d.ts +9 -9
  46. package/dist/lib/verify-npm-package-access.js +55 -55
  47. package/dist/models/index.d.ts +32 -32
  48. package/dist/models/index.js +2 -2
  49. package/dist/publish-command.d.ts +64 -64
  50. package/dist/publish-command.js +642 -641
  51. package/dist/publish-command.js.map +1 -1
  52. package/package.json +10 -11
package/README.md CHANGED
@@ -1,10 +1,9 @@
1
1
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
2
- [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
3
- [![npm](https://img.shields.io/npm/v/@lerna-lite/publish.svg?color=forest)](https://www.npmjs.com/package/@lerna-lite/publish)
4
2
  [![npm](https://img.shields.io/npm/dy/@lerna-lite/publish?color=forest)](https://www.npmjs.com/package/@lerna-lite/publish)
5
- [![Actions Status](https://github.com/ghiscoding/lerna-lite/workflows/CI%20Build/badge.svg)](https://github.com/ghiscoding/lerna-lite/actions)
3
+ [![npm](https://img.shields.io/npm/v/@lerna-lite/publish.svg?logo=npm&logoColor=fff&label=npm)](https://www.npmjs.com/package/@lerna-lite/publish)
6
4
 
7
5
  # @lerna-lite/publish
6
+
8
7
  ## (`lerna publish`) - Publish command ☁️
9
8
 
10
9
  Lerna-Lite Publish command, publish package(s) in the current project
@@ -12,6 +11,7 @@ Lerna-Lite Publish command, publish package(s) in the current project
12
11
  ---
13
12
 
14
13
  ## Installation
14
+
15
15
  ```sh
16
16
  # simple install or install it globally with -g
17
17
  npm install @lerna-lite/cli -D -W
@@ -65,11 +65,11 @@ This is useful when a previous `lerna publish` failed to publish all packages to
65
65
  ## Options
66
66
 
67
67
  `lerna publish` supports all of the options provided by [`lerna version`](https://github.com/lerna/lerna/tree/main/commands/version#options) in addition to the following:
68
+
68
69
  - [`@lerna/publish`](#lernapublish)
69
70
  - [Positionals](#positionals)
70
71
  - [semver `--bump from-git`](#semver--bump-from-git)
71
72
  - [semver `--bump from-package`](#semver--bump-from-package)
72
- - [`workspace:` protocol](#workspace-protocol)
73
73
  - [Options](#options)
74
74
  - [`--canary`](#--canary)
75
75
  - [`--contents <dir>`](#--contents-dir)
@@ -90,6 +90,9 @@ This is useful when a previous `lerna publish` failed to publish all packages to
90
90
  - [`--tag-version-prefix`](#--tag-version-prefix)
91
91
  - [`--temp-tag`](#--temp-tag)
92
92
  - [`--yes`](#--yes)
93
+ - [`workspace:` protocol](#workspace-protocol)
94
+ - [`--workspace-strict-match (default)`](#with---workspace-strict-match-default)
95
+ - [`--no-workspace-strict-match`](#with---no-workspace-strict-match-deprecated)
93
96
 
94
97
  ### `--canary`
95
98
 
@@ -416,34 +419,56 @@ lerna will run [npm lifecycle scripts](https://docs.npmjs.com/cli/v8/using-npm/s
416
419
  10. Run `postpublish` lifecycle in root
417
420
  11. Update temporary dist-tag to latest, if [enabled](#--temp-tag)
418
421
 
422
+ # `workspace:` protocol
419
423
 
420
- ## `workspace:` protocol
421
- The `workspace:` protocol (yarn/pnpm), is also supported by Lerna-Lite. When publishing, we will replace any `workspace:` dependency by:
424
+ The `workspace:` protocol ([pnpm workspace](https://pnpm.io/workspaces), [yarn workspace](https://yarnpkg.com/features/workspaces#workspace-ranges-workspace)) is also supported by Lerna-Lite. When publishing, it will replace any `workspace:` dependency by:
422
425
 
423
426
  - the corresponding version in the target workspace (if you use `workspace:*`, `workspace:~`, or `workspace:^`)
424
427
  - the associated semver range (for any other range type)
425
428
 
426
429
  So for example, if we have `foo`, `bar`, `qar`, `zoo` in the workspace and they all are at version `1.5.0` (before publishing), the following:
430
+
427
431
  ```json
428
432
  {
429
- "dependencies": {
430
- "foo": "workspace:*",
431
- "bar": "workspace:~",
432
- "qar": "workspace:^",
433
- "zoo": "workspace:^1.5.0"
434
- }
433
+ "dependencies": {
434
+ "foo": "workspace:*",
435
+ "bar": "workspace:~",
436
+ "qar": "workspace:^",
437
+ "zoo": "workspace:^1.5.0"
438
+ }
439
+ }
440
+ ```
441
+
442
+ #### with `--workspace-strict-match` (default)
443
+
444
+ When using strict match (default), it will be transformed and publish with the following:
445
+
446
+ _this is the default and is usually what most user will want to use since it will strictly adhere to pnpm/yarn workspace protocol._
447
+
448
+ ```json
449
+ {
450
+ "dependencies": {
451
+ "foo": "1.5.0",
452
+ "bar": "~1.5.0",
453
+ "qar": "^1.5.0",
454
+ "zoo": "^1.5.0"
455
+ }
435
456
  }
436
457
  ```
437
458
 
438
- Will be transformed and publish the following:
459
+ #### with `--no-workspace-strict-match` (deprecated)
460
+
461
+ When strict match is disabled, it will be transformed and publish with the following:
462
+
463
+ _you would rarely want to disable the strict match, in fact it will be removed from the code in future release, this flag was created for the sole purpose of making it compatible with previous Lerna-Lite version `1.2.0`. When disabled, in most cases Lerna will assume that the caret (^) is needed unless the option [--exact](https://github.com/ghiscoding/lerna-lite/tree/main/packages/version#--exact) is provided and by doing so is not strictly following pnpm/yarn workspace protocol and is not recommended for that reason._
464
+
439
465
  ```json
440
466
  {
441
- "dependencies": {
442
- "foo": "^1.5.0",
443
- "bar": "~1.5.0",
444
- "qar": "^1.5.0",
445
- "zoo": "^1.5.0"
446
- }
467
+ "dependencies": {
468
+ "foo": "^1.5.0",
469
+ "bar": "^1.5.0",
470
+ "qar": "^1.5.0",
471
+ "zoo": "^1.5.0"
472
+ }
447
473
  }
448
474
  ```
449
- **NOTE:** you might have noticed that `foo` is at `^1.5.0` instead of `1.5.0` and that is expected because Lerna automatically adds the caret `^` when not specified, unless the [version --exact](https://github.com/ghiscoding/lerna-lite/tree/main/packages/version#--exact) option is provided.
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,20 +1,20 @@
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("./lib"), exports);
18
- __exportStar(require("./models"), exports);
19
- __exportStar(require("./publish-command"), 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("./lib"), exports);
18
+ __exportStar(require("./models"), exports);
19
+ __exportStar(require("./publish-command"), exports);
20
20
  //# 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,33 +1,33 @@
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.createTempLicenses = void 0;
7
- const fs_extra_1 = __importDefault(require("fs-extra"));
8
- const path_1 = __importDefault(require("path"));
9
- const p_map_1 = __importDefault(require("p-map"));
10
- /**
11
- * Create temporary license files.
12
- * @param {string} srcLicensePath
13
- * @param {Packages[]} packagesToBeLicensed
14
- */
15
- function createTempLicenses(srcLicensePath, packagesToBeLicensed) {
16
- if (!srcLicensePath || !packagesToBeLicensed.length) {
17
- return Promise.resolve();
18
- }
19
- // license file might have an extension, so let's allow it
20
- const licenseFileName = path_1.default.basename(srcLicensePath);
21
- const options = {
22
- // make an effort to keep package contents stable over time
23
- preserveTimestamps: process.arch !== 'ia32',
24
- // (give up on 32-bit architecture to avoid fs-extra warning)
25
- };
26
- // store target path for removal later
27
- packagesToBeLicensed.forEach((pkg) => {
28
- pkg.licensePath = path_1.default.join(pkg.contents, licenseFileName);
29
- });
30
- return (0, p_map_1.default)(packagesToBeLicensed, (pkg) => fs_extra_1.default.copy(srcLicensePath, pkg.licensePath, options));
31
- }
32
- exports.createTempLicenses = createTempLicenses;
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.createTempLicenses = void 0;
7
+ const fs_extra_1 = __importDefault(require("fs-extra"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const p_map_1 = __importDefault(require("p-map"));
10
+ /**
11
+ * Create temporary license files.
12
+ * @param {string} srcLicensePath
13
+ * @param {Packages[]} packagesToBeLicensed
14
+ */
15
+ function createTempLicenses(srcLicensePath, packagesToBeLicensed) {
16
+ if (!srcLicensePath || !packagesToBeLicensed.length) {
17
+ return Promise.resolve();
18
+ }
19
+ // license file might have an extension, so let's allow it
20
+ const licenseFileName = path_1.default.basename(srcLicensePath);
21
+ const options = {
22
+ // make an effort to keep package contents stable over time
23
+ preserveTimestamps: process.arch !== 'ia32',
24
+ // (give up on 32-bit architecture to avoid fs-extra warning)
25
+ };
26
+ // store target path for removal later
27
+ packagesToBeLicensed.forEach((pkg) => {
28
+ pkg.licensePath = path_1.default.join(pkg.contents, licenseFileName);
29
+ });
30
+ return (0, p_map_1.default)(packagesToBeLicensed, (pkg) => fs_extra_1.default.copy(srcLicensePath, pkg.licensePath, options));
31
+ }
32
+ exports.createTempLicenses = createTempLicenses;
33
33
  //# 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;
@@ -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.getFetchConfig = void 0;
7
- const npmlog_1 = __importDefault(require("npmlog"));
8
- /**
9
- * Create a merged options object suitable for npm-registry-fetch.
10
- * @param {{ [key: string]: unknown }} options
11
- * @param {Partial<FetchConfig>} [extra]
12
- * @returns {FetchConfig}
13
- */
14
- function getFetchConfig(options, extra) {
15
- return {
16
- log: npmlog_1.default,
17
- ...options,
18
- ...extra,
19
- };
20
- }
21
- exports.getFetchConfig = getFetchConfig;
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.getFetchConfig = void 0;
7
+ const npmlog_1 = __importDefault(require("npmlog"));
8
+ /**
9
+ * Create a merged options object suitable for npm-registry-fetch.
10
+ * @param {{ [key: string]: unknown }} options
11
+ * @param {Partial<FetchConfig>} [extra]
12
+ * @returns {FetchConfig}
13
+ */
14
+ function getFetchConfig(options, extra) {
15
+ return {
16
+ log: npmlog_1.default,
17
+ ...options,
18
+ ...extra,
19
+ };
20
+ }
21
+ exports.getFetchConfig = getFetchConfig;
22
22
  //# 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, gitDryRun?: 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, gitDryRun?: boolean): string;
@@ -1,20 +1,20 @@
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.getCurrentSHA = void 0;
7
- const npmlog_1 = __importDefault(require("npmlog"));
8
- const core_1 = require("@lerna-lite/core");
9
- /**
10
- * Retrieve current SHA from git.
11
- * @param {import("@lerna/child-process").ExecOpts} opts
12
- */
13
- function getCurrentSHA(opts, gitDryRun = false) {
14
- npmlog_1.default.silly('getCurrentSHA', '');
15
- const sha = (0, core_1.execSync)('git', ['rev-parse', 'HEAD'], opts, gitDryRun);
16
- npmlog_1.default.verbose('getCurrentSHA', sha);
17
- return sha;
18
- }
19
- exports.getCurrentSHA = getCurrentSHA;
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.getCurrentSHA = void 0;
7
+ const npmlog_1 = __importDefault(require("npmlog"));
8
+ const core_1 = require("@lerna-lite/core");
9
+ /**
10
+ * Retrieve current SHA from git.
11
+ * @param {import("@lerna/child-process").ExecOpts} opts
12
+ */
13
+ function getCurrentSHA(opts, gitDryRun = false) {
14
+ npmlog_1.default.silly('getCurrentSHA', '');
15
+ const sha = (0, core_1.execSync)('git', ['rev-parse', 'HEAD'], opts, gitDryRun);
16
+ npmlog_1.default.verbose('getCurrentSHA', sha);
17
+ return sha;
18
+ }
19
+ exports.getCurrentSHA = getCurrentSHA;
20
20
  //# 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, gitDryRun?: 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, gitDryRun?: boolean): Promise<string[]>;
@@ -1,36 +1,36 @@
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.getCurrentTags = void 0;
7
- const npmlog_1 = __importDefault(require("npmlog"));
8
- const npm_package_arg_1 = __importDefault(require("npm-package-arg"));
9
- const core_1 = require("@lerna-lite/core");
10
- /**
11
- * Retrieve a list of git tags pointing to the current HEAD that match the provided pattern.
12
- * @param {import("@lerna/child-process").ExecOpts} execOpts
13
- * @param {string} matchingPattern
14
- * @returns {string[]}
15
- */
16
- function getCurrentTags(execOpts, matchingPattern, gitDryRun = false) {
17
- npmlog_1.default.silly('getCurrentTags', 'matching %j', matchingPattern);
18
- const opts = Object.assign({}, execOpts, {
19
- // don't reject due to non-zero exit code when there are no results
20
- reject: false,
21
- });
22
- return (0, core_1.exec)('git', ['tag', '--sort', 'version:refname', '--points-at', 'HEAD', '--list', matchingPattern], opts, gitDryRun)
23
- .then((result) => {
24
- const lines = result.stdout.split('\n').filter(Boolean);
25
- if (matchingPattern === '*@*') {
26
- // independent mode does not respect tagVersionPrefix,
27
- // but embeds the package name in the tag "prefix"
28
- return lines.map((tag) => (0, npm_package_arg_1.default)(tag).name);
29
- }
30
- // "fixed" mode can have a custom tagVersionPrefix,
31
- // but it doesn't really matter as it is not used to extract package names
32
- return lines;
33
- });
34
- }
35
- exports.getCurrentTags = getCurrentTags;
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.getCurrentTags = void 0;
7
+ const npmlog_1 = __importDefault(require("npmlog"));
8
+ const npm_package_arg_1 = __importDefault(require("npm-package-arg"));
9
+ const core_1 = require("@lerna-lite/core");
10
+ /**
11
+ * Retrieve a list of git tags pointing to the current HEAD that match the provided pattern.
12
+ * @param {import("@lerna/child-process").ExecOpts} execOpts
13
+ * @param {string} matchingPattern
14
+ * @returns {string[]}
15
+ */
16
+ function getCurrentTags(execOpts, matchingPattern, gitDryRun = false) {
17
+ npmlog_1.default.silly('getCurrentTags', 'matching %j', matchingPattern);
18
+ const opts = Object.assign({}, execOpts, {
19
+ // don't reject due to non-zero exit code when there are no results
20
+ reject: false,
21
+ });
22
+ return (0, core_1.exec)('git', ['tag', '--sort', 'version:refname', '--points-at', 'HEAD', '--list', matchingPattern], opts, gitDryRun)
23
+ .then((result) => {
24
+ const lines = result.stdout.split('\n').filter(Boolean);
25
+ if (matchingPattern === '*@*') {
26
+ // independent mode does not respect tagVersionPrefix,
27
+ // but embeds the package name in the tag "prefix"
28
+ return lines.map((tag) => (0, npm_package_arg_1.default)(tag).name);
29
+ }
30
+ // "fixed" mode can have a custom tagVersionPrefix,
31
+ // but it doesn't really matter as it is not used to extract package names
32
+ return lines;
33
+ });
34
+ }
35
+ exports.getCurrentTags = getCurrentTags;
36
36
  //# 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,50 +1,50 @@
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
- throw new core_1.ValidationError('EWHOAMI', 'Authentication error. Use `npm whoami` to troubleshoot.');
45
- }
46
- opts.log.warn('EWHOAMI', 'Unable to determine npm username from third-party registry, this command will likely fail soon!');
47
- }
48
- }
49
- 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
+ throw new core_1.ValidationError('EWHOAMI', 'Authentication error. Use `npm whoami` to troubleshoot.');
45
+ }
46
+ opts.log.warn('EWHOAMI', 'Unable to determine npm username from third-party registry, this command will likely fail soon!');
47
+ }
48
+ }
49
+ exports.getNpmUsername = getNpmUsername;
50
50
  //# 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,24 +1,24 @@
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.getPackagesWithoutLicense = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- /**
9
- * Retrieve a list of packages that lack a license file.
10
- * @param {Project} project
11
- * @param {Package[]} packagesToPublish
12
- * @returns {Package[]}
13
- */
14
- function getPackagesWithoutLicense(project, packagesToPublish) {
15
- return project.getPackageLicensePaths().then((licensePaths) => {
16
- // this assumes any existing license is a sibling of package.json, which is pretty safe
17
- // it also dedupes package locations, since we don't care about duplicate license files
18
- const licensed = new Set(licensePaths.map((lp) => path_1.default.dirname(lp)));
19
- return packagesToPublish.filter((pkg) => !licensed.has(pkg.location));
20
- });
21
- }
22
- exports.getPackagesWithoutLicense = getPackagesWithoutLicense;
23
- module.exports.getPackagesWithoutLicense = getPackagesWithoutLicense;
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.getPackagesWithoutLicense = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ /**
9
+ * Retrieve a list of packages that lack a license file.
10
+ * @param {Project} project
11
+ * @param {Package[]} packagesToPublish
12
+ * @returns {Package[]}
13
+ */
14
+ function getPackagesWithoutLicense(project, packagesToPublish) {
15
+ return project.getPackageLicensePaths().then((licensePaths) => {
16
+ // this assumes any existing license is a sibling of package.json, which is pretty safe
17
+ // it also dedupes package locations, since we don't care about duplicate license files
18
+ const licensed = new Set(licensePaths.map((lp) => path_1.default.dirname(lp)));
19
+ return packagesToPublish.filter((pkg) => !licensed.has(pkg.location));
20
+ });
21
+ }
22
+ exports.getPackagesWithoutLicense = getPackagesWithoutLicense;
23
+ module.exports.getPackagesWithoutLicense = getPackagesWithoutLicense;
24
24
  //# sourceMappingURL=get-packages-without-license.js.map