Skip to content

Commit

Permalink
Merge pull request #818 from pranshuchittora/refactor-utils
Browse files Browse the repository at this point in the history
misc: Refactoring utils
  • Loading branch information
evenstensberg committed Apr 17, 2019
2 parents 8506ccf + 80fd4fa commit 963c85f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions packages/utils/defineTest.ts
@@ -1,5 +1,6 @@
import * as fs from "fs";
import * as path from "path";

import { IJSCodeshift, INode } from "./types/NodePath";

interface IModule {
Expand Down
6 changes: 6 additions & 0 deletions packages/utils/find-root.ts
@@ -1,6 +1,12 @@
import * as findup from "findup-sync";
import * as path from "path";

/**
* Returns the absolute path of the project directory
* Finds the package.json, by using findup-sync
* @returns {String} path of project directory
*/

export function findProjectRoot(): string {
const rootFilePath = findup(`package.json`);
const projectRoot = path.dirname(rootFilePath);
Expand Down
26 changes: 10 additions & 16 deletions packages/utils/scaffold.ts
Expand Up @@ -90,22 +90,16 @@ export default function runTransform(transformConfig: ITransformConfig, action:
console.error(err.message ? err.message : err);
});
});

let successMessage: string = `Congratulations! Your new webpack configuration file has been created!\n`;
if (initActionNotDefined && transformConfig.config.item) {
process.stdout.write(
"\n" +
chalk.green(
`Congratulations! ${
transformConfig.config.item
} has been ${action}ed!\n`,
),
);
} else {
process.stdout.write(
"\n" +
chalk.green(
"Congratulations! Your new webpack configuration file has been created!\n",
),
);
successMessage = `Congratulations! ${
transformConfig.config.item
} has been ${action}ed!\n`;
}
process.stdout.write(
"\n" +
chalk.green(
successMessage,
),
);
}

0 comments on commit 963c85f

Please sign in to comment.