Skip to content

Commit

Permalink
fix: logging
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Dec 20, 2024
1 parent 09c7cd7 commit fca8c00
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 15 additions & 6 deletions packages/create-webpack-app/src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,21 @@ const typeDisplay: Record<string, Color | string> = {
};

function onSuccessHandler(change: PlopActionHooksChanges): void {
change.path.split("\n").forEach((line) => {
const [operationType = "", renderPath = ""] = line.split("|") as [string, string];
console.log(
`\t${typeDisplay[operationType]} ${normalize(relative(process.cwd(), renderPath))}`,
);
});
switch (change.type) {
case "fileGenerator": {
change.path.split("\n").forEach((line) => {
const [operationType = "", renderPath = ""] = line.split("|");
console.log(
`\t${typeDisplay[operationType]} ${normalize(relative(process.cwd(), renderPath))}`,
);
});
break;
}
case "pkgInstall": {
logger.success(change.path);
break;
}
}
}

function onFailureHandler(failure: PlopActionHooksFailures): void {
Expand Down
2 changes: 1 addition & 1 deletion packages/create-webpack-app/src/utils/pkgInstallAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default async function (plop: NodePlopAPI) {

// promise to complete subprocess of installing packages and return a message
const returnPromise: Promise<string> = new Promise((resolve, reject) => {
const returnMessage = `Project Dependencies installed successfully`;
const returnMessage = `Project dependencies installed successfully!`;
const packageManager = answers.packageManager;
const packages = config.packages.length == 1 ? [config.packages[0]] : config.packages;
const installOptions: Record<string, Array<string>> = {
Expand Down

0 comments on commit fca8c00

Please sign in to comment.