@kamaalio/codemod-kit 0.0.35 → 0.0.36
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 +9 -2
- package/dist/index.js +9 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -518,8 +518,9 @@ async function runCodemodRunner(codemods, repositories, workingDirectory) {
|
|
|
518
518
|
const results = Object.fromEntries(await Promise.all(codemods.map(async (codemod)=>{
|
|
519
519
|
const codemodRepositories = codemodRepositoriesMappedByCodemodName[codemod.name];
|
|
520
520
|
kamaal_namespaceObject.asserts.invariant(null != codemodRepositories, 'Codemod repositories should be present');
|
|
521
|
+
const codemodWorkingDirectory = external_node_path_default().resolve(workingDirectory, codemod.name.replace(/\//g, '-'));
|
|
521
522
|
const failedRepositoryAddressesMappedByCodemodNames = {};
|
|
522
|
-
const result = await runCodemod(codemod,
|
|
523
|
+
const result = await runCodemod(codemod, codemodWorkingDirectory, {
|
|
523
524
|
rootPaths: codemodRepositories.map((repository)=>repository.path),
|
|
524
525
|
hooks: {
|
|
525
526
|
preCodemodRun: async (codemod)=>{
|
|
@@ -550,10 +551,16 @@ async function prepareRepositoriesForCodemods(repositories, codemods, workingDir
|
|
|
550
551
|
if (prepareResult.isErr()) throw prepareResult.error;
|
|
551
552
|
return prepareResult.value;
|
|
552
553
|
}));
|
|
554
|
+
console.log(`\u{1F4CB} prepared the following repos for codemods!
|
|
555
|
+
${updatedRepositories.map((repo)=>repo.address).join('\n')}`);
|
|
553
556
|
return Object.fromEntries(await Promise.all(codemods.map(async (codemod)=>{
|
|
554
557
|
const codemodWorkingDirectory = external_node_path_default().resolve(workingDirectory, codemod.name.replace(/\//g, '-'));
|
|
555
558
|
await (0, external_execa_namespaceObject.$)`mkdir -p ${codemodWorkingDirectory}`;
|
|
556
|
-
const codeRepositories = await Promise.all(updatedRepositories.map((repo)=>
|
|
559
|
+
const codeRepositories = await Promise.all(updatedRepositories.map((repo)=>{
|
|
560
|
+
const newPath = external_node_path_default().join(codemodWorkingDirectory, repo.name);
|
|
561
|
+
console.log(`\xa9\u{FE0F} copying ${repo.name} -> ${newPath}`);
|
|
562
|
+
return repo.copy(newPath);
|
|
563
|
+
}));
|
|
557
564
|
return [
|
|
558
565
|
codemod.name,
|
|
559
566
|
codeRepositories
|
package/dist/index.js
CHANGED
|
@@ -469,8 +469,9 @@ async function runCodemodRunner(codemods, repositories, workingDirectory) {
|
|
|
469
469
|
const results = Object.fromEntries(await Promise.all(codemods.map(async (codemod)=>{
|
|
470
470
|
const codemodRepositories = codemodRepositoriesMappedByCodemodName[codemod.name];
|
|
471
471
|
asserts.invariant(null != codemodRepositories, 'Codemod repositories should be present');
|
|
472
|
+
const codemodWorkingDirectory = node_path.resolve(workingDirectory, codemod.name.replace(/\//g, '-'));
|
|
472
473
|
const failedRepositoryAddressesMappedByCodemodNames = {};
|
|
473
|
-
const result = await runCodemod(codemod,
|
|
474
|
+
const result = await runCodemod(codemod, codemodWorkingDirectory, {
|
|
474
475
|
rootPaths: codemodRepositories.map((repository)=>repository.path),
|
|
475
476
|
hooks: {
|
|
476
477
|
preCodemodRun: async (codemod)=>{
|
|
@@ -501,10 +502,16 @@ async function prepareRepositoriesForCodemods(repositories, codemods, workingDir
|
|
|
501
502
|
if (prepareResult.isErr()) throw prepareResult.error;
|
|
502
503
|
return prepareResult.value;
|
|
503
504
|
}));
|
|
505
|
+
console.log(`\u{1F4CB} prepared the following repos for codemods!
|
|
506
|
+
${updatedRepositories.map((repo)=>repo.address).join('\n')}`);
|
|
504
507
|
return Object.fromEntries(await Promise.all(codemods.map(async (codemod)=>{
|
|
505
508
|
const codemodWorkingDirectory = node_path.resolve(workingDirectory, codemod.name.replace(/\//g, '-'));
|
|
506
509
|
await $`mkdir -p ${codemodWorkingDirectory}`;
|
|
507
|
-
const codeRepositories = await Promise.all(updatedRepositories.map((repo)=>
|
|
510
|
+
const codeRepositories = await Promise.all(updatedRepositories.map((repo)=>{
|
|
511
|
+
const newPath = node_path.join(codemodWorkingDirectory, repo.name);
|
|
512
|
+
console.log(`\xa9\u{FE0F} copying ${repo.name} -> ${newPath}`);
|
|
513
|
+
return repo.copy(newPath);
|
|
514
|
+
}));
|
|
508
515
|
return [
|
|
509
516
|
codemod.name,
|
|
510
517
|
codeRepositories
|