Skip to content

Commit

Permalink
feat(init): implement init command
Browse files Browse the repository at this point in the history
- generate todo app
- install dependencies after generation
- stand up app after installing
- refactor toward better esm compatibility
    - `execa` is esm only which forces us to be esm compatible; we could try to use a different package, but as esm gains adoption, we would have to reconcile with compatibility sooner or later so I ripped off the band-aid early before it becomes a massive issue
    - use unbuild (rollup based build tool) for building since tsc is doesn't easily output esm compatible code
    - statically import commands and actions since dynamically importing them using templated strings as we currently do requires a more complicated build setup
        - we can add this back using extra plugins if it is valuable for us
    - run built cli in development directly as `ts-node` has very poor support for esm in later node versions despite what their docs say
- update readme with development instructions

Part of #16
  • Loading branch information
RyanClementsHax committed Feb 20, 2024
1 parent a6ad846 commit 4e34793
Show file tree
Hide file tree
Showing 178 changed files with 54,945 additions and 494 deletions.
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Mantis CLI

M.A.N.T.I.S (MongoDB, Angular, NestJS, Tailwind CSS, Ionic, Storybook) is not just a CLI tool; it's your passport to a seamless full-stack project launch.

This repo contains the cli source code to generate template projects.

## Setup

Run `npm install` to install all of the dependencies.

## Developing

Run `npm run start:dev` to build and run the cli.

To run a built cli, run `npx mantis <arguments>` e.g. `npx mantis init`.

## Building

Run `npm run build` to build the cli.

## Commands

### `init`

`npx mantis init`: Scaffolds a basic mantis application.

**TEMPORARY**: DB setup

In order for the generated project to work properly with a database, you'll need to put a `.env.local` file with database credentials at `templates/mantis-todo/apps/server/.env.local`. This will be automated in the future.

```shell
# Example
MONGODB_URI='mongodb+srv://<user>:<password>@<cluster-name>.mongodb.net/?retryWrites=true&w=majority'
```
3 changes: 3 additions & 0 deletions bin/mantis.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node

import '../dist/mantis.mjs'
5 changes: 5 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineBuildConfig } from 'unbuild';

export default defineBuildConfig({
entries: ['src/mantis'],
});
Loading

0 comments on commit 4e34793

Please sign in to comment.