@yarnpkg/plugin-essentials 3.1.0-rc.7 → 3.2.0-rc.1

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 {
@@ -18,5 +18,6 @@ export default class YarnCommand extends BaseCommand {
18
18
  production: boolean | undefined;
19
19
  registry: string | undefined;
20
20
  silent: boolean | undefined;
21
+ networkTimeout: string | undefined;
21
22
  execute(): Promise<1 | 0>;
22
23
  }
@@ -5,6 +5,7 @@ const cli_1 = require("@yarnpkg/cli");
5
5
  const core_1 = require("@yarnpkg/core");
6
6
  const fslib_1 = require("@yarnpkg/fslib");
7
7
  const parsers_1 = require("@yarnpkg/parsers");
8
+ const ci_info_1 = (0, tslib_1.__importDefault)(require("ci-info"));
8
9
  const clipanion_1 = require("clipanion");
9
10
  const t = (0, tslib_1.__importStar)(require("typanion"));
10
11
  // eslint-disable-next-line arca/no-default-export
@@ -39,14 +40,13 @@ class YarnCommand extends cli_1.BaseCommand {
39
40
  this.production = clipanion_1.Option.Boolean(`--production`, { hidden: true });
40
41
  this.registry = clipanion_1.Option.String(`--registry`, { hidden: true });
41
42
  this.silent = clipanion_1.Option.Boolean(`--silent`, { hidden: true });
43
+ this.networkTimeout = clipanion_1.Option.String(`--network-timeout`, { hidden: true });
42
44
  }
43
45
  async execute() {
44
46
  var _a;
45
47
  const configuration = await core_1.Configuration.find(this.context.cwd, this.context.plugins);
46
48
  if (typeof this.inlineBuilds !== `undefined`)
47
49
  configuration.useWithSource(`<cli>`, { enableInlineBuilds: this.inlineBuilds }, configuration.startingCwd, { overwrite: true });
48
- const isZeitNow = !!process.env.NOW_BUILDER;
49
- const isNetlify = !!process.env.NETLIFY;
50
50
  // These variables are used in Google Cloud Platform environment
51
51
  // in process of deploying Google Cloud Functions and
52
52
  // Google App Engine
@@ -79,7 +79,7 @@ class YarnCommand extends cli_1.BaseCommand {
79
79
  // it would definitely be a configuration setting.
80
80
  if (typeof this.ignoreEngines !== `undefined`) {
81
81
  const exitCode = await reportDeprecation(`The --ignore-engines option is deprecated; engine checking isn't a core feature anymore`, {
82
- error: !isZeitNow,
82
+ error: !ci_info_1.default.VERCEL,
83
83
  });
84
84
  if (exitCode !== null) {
85
85
  return exitCode;
@@ -105,7 +105,7 @@ class YarnCommand extends cli_1.BaseCommand {
105
105
  // let someone implement this "resolver-that-reads-the-cache" logic.
106
106
  if (typeof this.preferOffline !== `undefined`) {
107
107
  const exitCode = await reportDeprecation(`The --prefer-offline flag is deprecated; use the --cached flag with 'yarn add' instead`, {
108
- error: !isZeitNow,
108
+ error: !ci_info_1.default.VERCEL,
109
109
  });
110
110
  if (exitCode !== null) {
111
111
  return exitCode;
@@ -148,7 +148,7 @@ class YarnCommand extends cli_1.BaseCommand {
148
148
  // Yarn commands would use different caches, causing unexpected behaviors.
149
149
  if (typeof this.cacheFolder !== `undefined`) {
150
150
  const exitCode = await reportDeprecation(`The cache-folder option has been deprecated; use rc settings instead`, {
151
- error: !isNetlify,
151
+ error: !ci_info_1.default.NETLIFY,
152
152
  });
153
153
  if (exitCode !== null) {
154
154
  return exitCode;
@@ -21,11 +21,11 @@ function getBranchRef(branch) {
21
21
  const cloneWorkflow = ({ repository, branch }, target) => [
22
22
  [`git`, `init`, fslib_1.npath.fromPortablePath(target)],
23
23
  [`git`, `remote`, `add`, `origin`, repository],
24
- [`git`, `fetch`, `origin`, getBranchRef(branch)],
24
+ [`git`, `fetch`, `origin`, `--depth=1`, getBranchRef(branch)],
25
25
  [`git`, `reset`, `--hard`, `FETCH_HEAD`],
26
26
  ];
27
27
  const updateWorkflow = ({ branch }) => [
28
- [`git`, `fetch`, `origin`, getBranchRef(branch), `--force`],
28
+ [`git`, `fetch`, `origin`, `--depth=1`, getBranchRef(branch), `--force`],
29
29
  [`git`, `reset`, `--hard`, `FETCH_HEAD`],
30
30
  [`git`, `clean`, `-dfx`],
31
31
  ];
@@ -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,13 +1,13 @@
1
1
  {
2
2
  "name": "@yarnpkg/plugin-essentials",
3
- "version": "3.1.0-rc.7",
3
+ "version": "3.2.0-rc.1",
4
4
  "license": "BSD-2-Clause",
5
5
  "main": "./lib/index.js",
6
6
  "dependencies": {
7
- "@yarnpkg/fslib": "^2.6.0-rc.7",
7
+ "@yarnpkg/fslib": "^2.6.0",
8
8
  "@yarnpkg/json-proxy": "^2.1.1",
9
- "@yarnpkg/parsers": "^2.4.1-rc.7",
10
- "ci-info": "^2.0.0",
9
+ "@yarnpkg/parsers": "^2.5.0-rc.1",
10
+ "ci-info": "^3.2.0",
11
11
  "clipanion": "^3.0.1",
12
12
  "enquirer": "^2.3.6",
13
13
  "lodash": "^4.17.15",
@@ -17,17 +17,18 @@
17
17
  "typanion": "^3.3.0"
18
18
  },
19
19
  "peerDependencies": {
20
- "@yarnpkg/cli": "^3.1.0-rc.7",
21
- "@yarnpkg/core": "^3.1.0-rc.8"
20
+ "@yarnpkg/cli": "^3.2.0-rc.3",
21
+ "@yarnpkg/core": "^3.2.0-rc.3",
22
+ "@yarnpkg/plugin-git": "^2.6.0-rc.3"
22
23
  },
23
24
  "devDependencies": {
24
- "@types/ci-info": "^2",
25
25
  "@types/lodash": "^4.14.136",
26
26
  "@types/micromatch": "^4.0.1",
27
27
  "@types/semver": "^7.1.0",
28
28
  "@types/treeify": "^1.0.0",
29
- "@yarnpkg/cli": "^3.1.0-rc.7",
30
- "@yarnpkg/core": "^3.1.0-rc.8"
29
+ "@yarnpkg/cli": "^3.2.0-rc.3",
30
+ "@yarnpkg/core": "^3.2.0-rc.3",
31
+ "@yarnpkg/plugin-git": "^2.6.0-rc.3"
31
32
  },
32
33
  "repository": {
33
34
  "type": "git",
@@ -48,6 +49,6 @@
48
49
  "engines": {
49
50
  "node": ">=12 <14 || 14.2 - 14.9 || >14.10.0"
50
51
  },
51
- "stableVersion": "3.0.0",
52
+ "stableVersion": "3.1.0",
52
53
  "typings": "./lib/index.d.ts"
53
54
  }