MCPcopy Create free account
hub / github.com/elastic/eui / stepCheckWorkspaces

Function stepCheckWorkspaces

packages/release-cli/src/steps/check_workspaces.ts:27–60  ·  view source on GitHub ↗
(
  options: ReleaseOptions,
  workspacesToPublish: Array<YarnWorkspace>
)

Source from the content-addressed store, hash-verified

25 * to make it safer.
26 */
27export const stepCheckWorkspaces = async (
28 options: ReleaseOptions,
29 workspacesToPublish: Array<YarnWorkspace>
30) => {
31 const { logger } = options;
32 const rootWorkspaceDir = getRootWorkspaceDir();
33 const publishableWorkspaces: Array<YarnWorkspace> = [];
34
35 logger.info('Checking latest versions of published packages on npmjs');
36
37 for (const workspace of workspacesToPublish) {
38 const workspaceDir = path.join(rootWorkspaceDir, workspace.location);
39 const packageJson = await getWorkspacePackageJson(workspaceDir);
40
41 if (packageJson.private) {
42 logger.debug(
43 `[${workspace.name}] Package is private and will not be published`
44 );
45 continue;
46 }
47
48 const publishedVersions = await getNpmPublishedVersions(workspace.name);
49 if (publishedVersions.includes(packageJson.version)) {
50 logger.warning(
51 `[${workspace.name}] Version ${packageJson.version} is already available on npmjs and cannot be republished. The package will be skipped from publishing`
52 );
53 continue;
54 }
55
56 publishableWorkspaces.push(workspace);
57 }
58
59 return publishableWorkspaces;
60};

Callers 1

releaseFunction · 0.90

Calls 6

getRootWorkspaceDirFunction · 0.90
getWorkspacePackageJsonFunction · 0.90
getNpmPublishedVersionsFunction · 0.90
infoMethod · 0.80
debugMethod · 0.80
warningMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…