New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alokai-cli core module #7099
base: main
Are you sure you want to change the base?
alokai-cli core module #7099
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this file and run yarn install
in project root to update /yarn.lock, we don't use pnpm (yet)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the original package this one is based on was using pnpm and I sticked to it, now switched to yarn and got tons of errors as always :D Trying to fix it
"rimraf": "^4.1.3", | ||
"tsup": "^6.6.3", | ||
"type-fest": "^3.8.0", | ||
"typescript": "^4.9.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typescript is already in the root package.json, please use the one from there (so that all workspace packages in this repo use the same TS)
"typescript": "^4.9.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there going to be tests? If not, please remove this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not in the core probably, removing
const nodeModulesPath = path.join(process.cwd(), "node_modules"); | ||
const modules = []; | ||
// Function to import and initialize command modules | ||
(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this an IIFE if it doesn't use async/awwait? It could just be regular code
.name("alokai") | ||
.description("Alokai CLI is a tool to help you manage your Alokai projects") | ||
.usage("[command] [options]") | ||
.version("0.0.1", "-v, --version", "display the version number") | ||
.action(() => { | ||
program.help(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the exact same snippet in src/index.ts? Shouldn't the duplication be removed, as it looks like prebuild.js ins the main file?
Please also add changeset ( |
To add a new package to the Alokai CLI, you can run the following command: | ||
|
||
```bash | ||
pnpm add alokai-[your-package-name] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why pnpm?
@@ -0,0 +1,41 @@ | |||
Alokai CLI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alokai CLI | |
# Alokai CLI |
```typescript | ||
import alokaiCli[YourPackageName] from 'alokai-[your-package-name]'; | ||
``` | ||
|
||
Then, you can use the package in the `index.ts` file: | ||
|
||
```typescript | ||
alokaiCli[YourPackageName].forEach((command) => { | ||
program.addCommand(command); | ||
}); | ||
``` | ||
|
||
This will add the command to the core CLI application and will be available to use once the project is published. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imo it's better to create an abstraction over the commands' registration. We could have a following API
import integrationCommands from "alokai-integrations";
const program = createAlokaiCli({
plugins: [
{ name: "integrations", commands: integrationCommands },
{ name: "modules", commands: modulesCommands },
//...
]
});
or
import integrationCommands from "alokai-integrations";
const program = createAlokaiCli({
plugins: {
integrations: integrationsCommands,
modules: modulesCommands,
//...
}
});
π Linked issue
β Type of change
π Description
π Checklist