Skip to content
This repository has been archived by the owner on Aug 14, 2021. It is now read-only.

corejam create component / route #375

Open
mattvb91 opened this issue Feb 6, 2021 · 0 comments
Open

corejam create component / route #375

mattvb91 opened this issue Feb 6, 2021 · 0 comments
Labels
CLI good first issue Good for newcomers help wanted Extra attention is needed up-for-grabs
Projects

Comments

@mattvb91
Copy link
Member

mattvb91 commented Feb 6, 2021

In the CLI package we can provide some QoL improvements when creating new components or routes. Currently when you want to create a new component or route it usually ends up with having to copy / paste an existing stencil file and renaming / removing existing code.

This can be made simpler by a command in the @corejam/cli package: corejam create component my-component or corejam create route my-route.

Both commands should then create an empty file with the correct class name & tag name. For example:

corejam create component my-component will result in the following file inside your project:

// app/components/my-component/my-component.tsx
import { Component, h } from "@stencil/core";

@Component({
  tag: "my-component",
})
export class MyComponent {

  render() {
    return (
        <corejam-box>
          my-component
        </corejam-box>
    );
  }
}

When creating a route it should take the path into consideration. For example corejam create route new/test should result in a file being created in app/routes/new/test.tsx:

import { Component, h, Host } from "@stencil/core";

@Component({
  tag: "route-new-test",
})
export class RouteNewTest {
  render() {
    return (
      <Host>
        <corejam-box>route-new-test</corejam-box>
      </Host>
    );
  }
}

A good starting point is to take a look at existing commands and go from there to add a new one: packages/cli/src/index.ts

@mattvb91 mattvb91 added good first issue Good for newcomers CLI labels Feb 6, 2021
@mattvb91 mattvb91 added this to To do in Corejam 1.0 via automation Feb 6, 2021
@mattvb91 mattvb91 added up-for-grabs help wanted Extra attention is needed labels Feb 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLI good first issue Good for newcomers help wanted Extra attention is needed up-for-grabs
Projects
Corejam 1.0
  
To do
Development

No branches or pull requests

1 participant