Skip to content
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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

alokai-cli core module #7099

wants to merge 17 commits into from

Conversation

skirianov
Copy link
Contributor

@skirianov skirianov commented Mar 28, 2024

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSDoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@skirianov skirianov requested a review from a team as a code owner March 28, 2024 16:43
Copy link

changeset-bot bot commented Mar 28, 2024

⚠️ No Changeset found

Latest commit: 84939ea

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

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)

Copy link
Contributor Author

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

packages/alokai-cli/package.json Show resolved Hide resolved
packages/alokai-cli/package.json Show resolved Hide resolved
"rimraf": "^4.1.3",
"tsup": "^6.6.3",
"type-fest": "^3.8.0",
"typescript": "^4.9.3",
Copy link
Contributor

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)

Suggested change
"typescript": "^4.9.3",

Copy link
Contributor

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

Copy link
Contributor Author

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
(() => {
Copy link
Contributor

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

Comment on lines +44 to +50
.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();
});
Copy link
Contributor

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?

@sethidden
Copy link
Contributor

Please also add changeset (npx changeset)

To add a new package to the Alokai CLI, you can run the following command:

```bash
pnpm add alokai-[your-package-name]
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Alokai CLI
# Alokai CLI

Comment on lines +15 to +27
```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.
Copy link
Contributor

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,
    //...
  }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants