( options: ReleaseOptions, workspacesToPublish: Array<YarnWorkspace> )
| 25 | * to make it safer. |
| 26 | */ |
| 27 | export 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 | }; |
no test coverage detected
searching dependent graphs…