MCPcopy Create free account
hub / github.com/fontsource/fontsource / getChanged

Function getChanged

packages/publish/src/changed.ts:12–45  ·  view source on GitHub ↗
(ctx: Context)

Source from the content-addressed store, hash-verified

10
11// Iterate through all packages in directory and return a list of changed packages
12const getChanged = async (ctx: Context) => {
13 const changedList: ChangedList = [];
14 const queue = new PQueue({ concurrency: 4 });
15
16 const handleHash = async (packagePath: string, packageJson: PackageJson) => {
17 // Get hash of current package and compare with old hash
18 const hash = await getHash(packagePath);
19 if (packageJson.publishHash !== hash || ctx.force) {
20 changedList.push({
21 name: packageJson.name,
22 hash,
23 path: packagePath,
24 version: packageJson.version,
25 });
26 }
27 };
28
29 for (const packageDir of ctx.packages) {
30 const packages = await getPackages(packageDir);
31 for (const packageName of packages) {
32 const packagePath = path.join(packageDir, packageName);
33
34 // Check if package.json exists
35 const packageJson: PackageJson = await fs.readJson(
36 path.join(process.cwd(), packagePath, 'package.json'),
37 );
38
39 void queue.add(() => handleHash(packagePath, packageJson));
40 }
41 }
42
43 await queue.onIdle();
44 return changedList;
45};
46
47const changed = async (options: ChangedFlags) => {
48 consola.info(colors.bold(colors.blue('Checking packages...')));

Callers 4

bumpFunction · 0.90
publishPackagesFunction · 0.90
changed.test.tsFile · 0.90
changedFunction · 0.85

Calls 2

getPackagesFunction · 0.90
handleHashFunction · 0.85

Tested by

no test coverage detected