@yarnpkg/plugin-essentials 3.1.0-rc.9 → 3.1.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.
@@ -160,7 +160,7 @@ class InfoCommand extends cli_1.BaseCommand {
160
160
  const infoTreeChildren = {};
161
161
  const infoTree = { children: infoTreeChildren };
162
162
  const fetcher = configuration.makeFetcher();
163
- const fetcherOptions = { project, fetcher, cache, checksums: project.storedChecksums, report: new core_1.ThrowReport(), skipIntegrityCheck: true };
163
+ const fetcherOptions = { project, fetcher, cache, checksums: project.storedChecksums, report: new core_1.ThrowReport(), cacheOptions: { skipIntegrityCheck: true }, skipIntegrityCheck: true };
164
164
  const builtinInfoBuilders = [
165
165
  // Manifest fields
166
166
  async (pkg, extra, registerData) => {
@@ -185,8 +185,12 @@ class InfoCommand extends cli_1.BaseCommand {
185
185
  var _a;
186
186
  if (!extra.has(`cache`))
187
187
  return;
188
+ const cacheOptions = {
189
+ mockedPackages: project.disabledLocators,
190
+ unstablePackages: project.conditionalLocators,
191
+ };
188
192
  const checksum = (_a = project.storedChecksums.get(pkg.locatorHash)) !== null && _a !== void 0 ? _a : null;
189
- const cachePath = cache.getLocatorPath(pkg, checksum);
193
+ const cachePath = cache.getLocatorPath(pkg, checksum, cacheOptions);
190
194
  let stat;
191
195
  if (cachePath !== null) {
192
196
  try {
@@ -3,6 +3,8 @@ import { Usage } from 'clipanion';
3
3
  export default class WorkspacesListCommand extends BaseCommand {
4
4
  static paths: string[][];
5
5
  static usage: Usage;
6
+ since: string | boolean | undefined;
7
+ recursive: boolean;
6
8
  verbose: boolean;
7
9
  json: boolean;
8
10
  execute(): Promise<1 | 0>;
@@ -2,11 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const cli_1 = require("@yarnpkg/cli");
4
4
  const core_1 = require("@yarnpkg/core");
5
+ const plugin_git_1 = require("@yarnpkg/plugin-git");
5
6
  const clipanion_1 = require("clipanion");
6
7
  // eslint-disable-next-line arca/no-default-export
7
8
  class WorkspacesListCommand extends cli_1.BaseCommand {
8
9
  constructor() {
9
10
  super(...arguments);
11
+ this.since = clipanion_1.Option.String(`--since`, {
12
+ description: `Only include workspaces that have been changed since the specified ref.`,
13
+ tolerateBoolean: true,
14
+ });
15
+ this.recursive = clipanion_1.Option.Boolean(`-R,--recursive`, false, {
16
+ description: `Find packages via dependencies/devDependencies instead of using the workspaces field`,
17
+ });
10
18
  this.verbose = clipanion_1.Option.Boolean(`-v,--verbose`, false, {
11
19
  description: `Also return the cross-dependencies between workspaces`,
12
20
  });
@@ -22,7 +30,15 @@ class WorkspacesListCommand extends cli_1.BaseCommand {
22
30
  json: this.json,
23
31
  stdout: this.context.stdout,
24
32
  }, async (report) => {
25
- for (const workspace of project.workspaces) {
33
+ const candidates = this.since
34
+ ? await plugin_git_1.gitUtils.fetchChangedWorkspaces({ ref: this.since, project })
35
+ : project.workspaces;
36
+ const workspaces = new Set(candidates);
37
+ if (this.recursive)
38
+ for (const dependents of [...candidates].map(candidate => candidate.getRecursiveWorkspaceDependents()))
39
+ for (const dependent of dependents)
40
+ workspaces.add(dependent);
41
+ for (const workspace of workspaces) {
26
42
  const { manifest } = workspace;
27
43
  let extra;
28
44
  if (this.verbose) {
@@ -71,6 +87,12 @@ WorkspacesListCommand.usage = clipanion_1.Command.Usage({
71
87
  category: `Workspace-related commands`,
72
88
  description: `list all available workspaces`,
73
89
  details: `
74
- This command will print the list of all workspaces in the project. If both the \`-v,--verbose\` and \`--json\` options are set, Yarn will also return the cross-dependencies between each workspaces (useful when you wish to automatically generate Buck / Bazel rules).
90
+ This command will print the list of all workspaces in the project.
91
+
92
+ - If \`--since\` is set, Yarn will only list workspaces that have been modified since the specified ref. By default Yarn will use the refs specified by the \`changesetBaseRefs\` configuration option.
93
+
94
+ - If \`-R,--recursive\` is set, Yarn will find workspaces to run the command on by recursively evaluating \`dependencies\` and \`devDependencies\` fields, instead of looking at the \`workspaces\` fields.
95
+
96
+ - If both the \`-v,--verbose\` and \`--json\` options are set, Yarn will also return the cross-dependencies between each workspaces (useful when you wish to automatically generate Buck / Bazel rules).
75
97
  `,
76
98
  });
@@ -79,6 +79,9 @@ async function dedupe(project, { strategy, patterns, cache, report }) {
79
79
  project,
80
80
  report: throwReport,
81
81
  skipIntegrityCheck: true,
82
+ cacheOptions: {
83
+ skipIntegrityCheck: true,
84
+ },
82
85
  };
83
86
  const resolveOptions = {
84
87
  project,
@@ -313,7 +313,7 @@ async function fetchDescriptorFrom(ident, range, { project, cache, workspace, pr
313
313
  const report = new core_1.ThrowReport();
314
314
  const fetcher = project.configuration.makeFetcher();
315
315
  const resolver = project.configuration.makeResolver();
316
- const fetchOptions = { project, fetcher, cache, checksums: project.storedChecksums, report, skipIntegrityCheck: true };
316
+ const fetchOptions = { project, fetcher, cache, checksums: project.storedChecksums, report, cacheOptions: { skipIntegrityCheck: true }, skipIntegrityCheck: true };
317
317
  const resolveOptions = { ...fetchOptions, resolver, fetchOptions };
318
318
  // The descriptor has to be bound for the resolvers that need a parent locator. (e.g. FileResolver)
319
319
  // If we didn't bind it, `yarn add ./folder` wouldn't work.
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@yarnpkg/plugin-essentials",
3
- "version": "3.1.0-rc.9",
3
+ "version": "3.1.0",
4
4
  "license": "BSD-2-Clause",
5
5
  "main": "./lib/index.js",
6
6
  "dependencies": {
7
- "@yarnpkg/fslib": "^2.6.0-rc.9",
7
+ "@yarnpkg/fslib": "^2.6.0",
8
8
  "@yarnpkg/json-proxy": "^2.1.1",
9
- "@yarnpkg/parsers": "^2.4.1-rc.9",
9
+ "@yarnpkg/parsers": "^2.4.1",
10
10
  "ci-info": "^3.2.0",
11
11
  "clipanion": "^3.0.1",
12
12
  "enquirer": "^2.3.6",
@@ -17,16 +17,18 @@
17
17
  "typanion": "^3.3.0"
18
18
  },
19
19
  "peerDependencies": {
20
- "@yarnpkg/cli": "^3.1.0-rc.9",
21
- "@yarnpkg/core": "^3.1.0-rc.10"
20
+ "@yarnpkg/cli": "^3.1.0",
21
+ "@yarnpkg/core": "^3.1.0",
22
+ "@yarnpkg/plugin-git": "^2.5.0"
22
23
  },
23
24
  "devDependencies": {
24
25
  "@types/lodash": "^4.14.136",
25
26
  "@types/micromatch": "^4.0.1",
26
27
  "@types/semver": "^7.1.0",
27
28
  "@types/treeify": "^1.0.0",
28
- "@yarnpkg/cli": "^3.1.0-rc.9",
29
- "@yarnpkg/core": "^3.1.0-rc.10"
29
+ "@yarnpkg/cli": "^3.1.0",
30
+ "@yarnpkg/core": "^3.1.0",
31
+ "@yarnpkg/plugin-git": "^2.5.0"
30
32
  },
31
33
  "repository": {
32
34
  "type": "git",
@@ -47,6 +49,5 @@
47
49
  "engines": {
48
50
  "node": ">=12 <14 || 14.2 - 14.9 || >14.10.0"
49
51
  },
50
- "stableVersion": "3.0.0",
51
52
  "typings": "./lib/index.d.ts"
52
53
  }