Skip to content

Commit

Permalink
chore(deps): bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
sonofmagic committed Oct 12, 2024
1 parent 28d2320 commit fee6c21
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/monorepo/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@icebreakers/monorepo",
"type": "module",
"version": "0.6.5",
"version": "0.6.6",
"description": "icebreaker's monorepo config generator",
"author": "ice breaker <[email protected]>",
"license": "MIT",
Expand Down
2 changes: 2 additions & 0 deletions packages/monorepo/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export * from './lib'
export * from './monorepo'
export * from './utils'
9 changes: 9 additions & 0 deletions packages/monorepo/src/monorepo/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import type { GetWorkspacePackagesOptions } from './workspace'
import { setVscodeBinaryMirror } from './binaryMirror'
import { cleanProjects } from './clean'
import { GitClient } from './git'
import { init } from './init'
import { syncNpmMirror } from './sync'
import { getWorkspacePackages } from './workspace'

export type {
GetWorkspacePackagesOptions,
}

export {
cleanProjects,
getWorkspacePackages,
GitClient,
init,
setVscodeBinaryMirror,
syncNpmMirror,
Expand Down
21 changes: 13 additions & 8 deletions packages/monorepo/src/monorepo/sync.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import os from 'node:os'
import { execa } from 'execa'
import PQueue from 'p-queue'
import pc from 'picocolors'
import { logger } from '../logger'
import { getWorkspacePackages } from './workspace'

export async function syncNpmMirror(cwd: string) {
const packages = await getWorkspacePackages(cwd)
logger.info(`[即将同步的包]:\n${packages.filter(x => x.manifest.name).map(x => `- ${pc.green(x.manifest.name)}`).join('\n')}\n`)
for (
const project of packages
) {
if (project.manifest.name) {
await execa({
stdout: ['pipe', 'inherit'],
})`cnpm sync ${project.manifest.name}`
const set = new Set(packages.map(x => x.manifest.name))
logger.info(`[即将同步的包]:\n${Array.from(set).map(x => `- ${pc.green(x)}`).join('\n')}\n`)
const concurrency = Math.max(os.cpus().length, 1)
const queue = new PQueue({ concurrency })
for (const pkgName of set) {
if (pkgName) {
await queue.add(async () => {
return execa({
stdout: ['pipe', 'inherit'],
})`cnpm sync ${pkgName}`
})
}
}
}

0 comments on commit fee6c21

Please sign in to comment.