@kamaalio/codemod-kit 0.0.36 → 0.0.37

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.
package/dist/index.cjs CHANGED
@@ -538,21 +538,21 @@ async function runCodemodRunner(codemods, repositories, workingDirectory) {
538
538
  return results;
539
539
  }
540
540
  async function prepareRepositoriesForCodemods(repositories, codemods, workingDirectory) {
541
- const reposMappedByMainBranchName = Object.fromEntries(await Promise.all(repositories.map(async (repo)=>{
541
+ const reposMappedByMainBranch = await Promise.all(repositories.map(async (repo)=>{
542
542
  const mainBranchResult = await repo.getMainBranch();
543
543
  if (mainBranchResult.isErr()) throw mainBranchResult.error;
544
- return [
545
- mainBranchResult.value.name,
546
- repo
547
- ];
548
- })));
549
- const updatedRepositories = await Promise.all(kamaal_namespaceObject.objects.toEntries(reposMappedByMainBranchName).map(async ([mainBranchName, repo])=>{
550
- const prepareResult = await repo.prepareForUpdate(mainBranchName);
544
+ return {
545
+ mainBranchName: mainBranchResult.value.name,
546
+ repository: repo
547
+ };
548
+ }));
549
+ const updatedRepositories = await Promise.all(reposMappedByMainBranch.map(async ({ mainBranchName, repository })=>{
550
+ const prepareResult = await repository.prepareForUpdate(mainBranchName);
551
551
  if (prepareResult.isErr()) throw prepareResult.error;
552
552
  return prepareResult.value;
553
553
  }));
554
554
  console.log(`\u{1F4CB} prepared the following repos for codemods!
555
- ${updatedRepositories.map((repo)=>repo.address).join('\n')}`);
555
+ \xb7 ${updatedRepositories.map((repo)=>repo.address).join("\n\xb7 ")}`);
556
556
  return Object.fromEntries(await Promise.all(codemods.map(async (codemod)=>{
557
557
  const codemodWorkingDirectory = external_node_path_default().resolve(workingDirectory, codemod.name.replace(/\//g, '-'));
558
558
  await (0, external_execa_namespaceObject.$)`mkdir -p ${codemodWorkingDirectory}`;
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { $ } from "execa";
4
4
  import fast_glob from "fast-glob";
5
5
  import { ResultAsync, err, ok } from "neverthrow";
6
6
  import { Lang, parseAsync } from "@ast-grep/napi";
7
- import { arrays, asserts, objects } from "@kamaalio/kamaal";
7
+ import { arrays, asserts } from "@kamaalio/kamaal";
8
8
  import zod from "zod";
9
9
  const JAVASCRIPT_EXTENSIONS = [
10
10
  '.js',
@@ -489,21 +489,21 @@ async function runCodemodRunner(codemods, repositories, workingDirectory) {
489
489
  return results;
490
490
  }
491
491
  async function prepareRepositoriesForCodemods(repositories, codemods, workingDirectory) {
492
- const reposMappedByMainBranchName = Object.fromEntries(await Promise.all(repositories.map(async (repo)=>{
492
+ const reposMappedByMainBranch = await Promise.all(repositories.map(async (repo)=>{
493
493
  const mainBranchResult = await repo.getMainBranch();
494
494
  if (mainBranchResult.isErr()) throw mainBranchResult.error;
495
- return [
496
- mainBranchResult.value.name,
497
- repo
498
- ];
499
- })));
500
- const updatedRepositories = await Promise.all(objects.toEntries(reposMappedByMainBranchName).map(async ([mainBranchName, repo])=>{
501
- const prepareResult = await repo.prepareForUpdate(mainBranchName);
495
+ return {
496
+ mainBranchName: mainBranchResult.value.name,
497
+ repository: repo
498
+ };
499
+ }));
500
+ const updatedRepositories = await Promise.all(reposMappedByMainBranch.map(async ({ mainBranchName, repository })=>{
501
+ const prepareResult = await repository.prepareForUpdate(mainBranchName);
502
502
  if (prepareResult.isErr()) throw prepareResult.error;
503
503
  return prepareResult.value;
504
504
  }));
505
505
  console.log(`\u{1F4CB} prepared the following repos for codemods!
506
- ${updatedRepositories.map((repo)=>repo.address).join('\n')}`);
506
+ \xb7 ${updatedRepositories.map((repo)=>repo.address).join("\n\xb7 ")}`);
507
507
  return Object.fromEntries(await Promise.all(codemods.map(async (codemod)=>{
508
508
  const codemodWorkingDirectory = node_path.resolve(workingDirectory, codemod.name.replace(/\//g, '-'));
509
509
  await $`mkdir -p ${codemodWorkingDirectory}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kamaalio/codemod-kit",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "type": "module",
5
5
  "author": "Kamaal Farah",
6
6
  "license": "MIT",