Skip to content

Commit

Permalink
chore: rename to esperf
Browse files Browse the repository at this point in the history
  • Loading branch information
43081j committed Aug 9, 2024
1 parent 62e04d6 commit 5712dfd
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
7 changes: 3 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "mr-cli",
"name": "esperf",
"version": "0.0.1",
"description": "A command-line utility for detecting performance issues",
"main": "lib/main.js",
Expand All @@ -9,8 +9,7 @@
"!lib/test"
],
"bin": {
"module-replacements": "./lib/bin.js",
"mr": "./lib/bin.js"
"esperf": "./lib/bin.js"
},
"scripts": {
"clean:build": "premove lib",
Expand Down
35 changes: 31 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,40 @@ function isDependenciesLike(obj: unknown): obj is Record<string, string> {
}

export async function run(): Promise<void> {
cl.intro('esperf');

const tasks = await cl.multiselect({
message: 'What would you like to do?',
initialValues: [
'module-replacements'
],
options: [
{
label: 'Scan for module replacements',
value: 'module-replacements'
}
]
});

if (cl.isCancel(tasks)) {
cl.cancel('Operation cancelled');
exit(0);
}

for (const task of tasks) {
switch (task) {
case 'module-replacements':
await runModuleReplacements();
break;
}
}

cl.outro('All tasks complete!');
}
async function runModuleReplacements(): Promise<void> {
const cwd = getCwd();
const packageManifest = await findPackage(cwd);

cl.intro('module-replacements');

if (packageManifest === null) {
cl.log.error(dedent`
Could not find package.json. Please ensure that you run this command in a project which has one setup.
Expand Down Expand Up @@ -208,6 +237,4 @@ export async function run(): Promise<void> {
if (options.fix) {
await fixFiles(scanFilesResult);
}

cl.outro('All checks complete!');
}

0 comments on commit 5712dfd

Please sign in to comment.