okupter / kitforstartups

The Open Source SvelteKit SaaS boilerplate.
https://kitforstartups.com
MIT License
684 stars 31 forks source link

Command-Line-Interface for kitforstartups #2

Open Bloeckchengrafik opened 9 months ago

Bloeckchengrafik commented 9 months ago

Hey there! I built a small CLI for creating new kitforstartup-projects heavily inspired by create-svelte! It currently lives under https://github.com/Bloeckchengrafik/kitforstartups-cli, but I have no problem transfering it to the okupter organization.

Also, let me know if you have other ideas. I'll also update the cli to incorporate PostgreSQL with a global configuration file in the future.

PS: What an honor to be the first issue on this awesome project :)

JustinyAhin commented 9 months ago

@Bloeckchengrafik this looks absolutely great. A CLI was the next thing I wanted to work on. Happy that you started it.

Plus, I was also looking to use @clack and @clack/prompts. What I'm intending is to do is to convert this repository to a monorepo, with the CLI as one of the packages.

I will on that setup, and copy over your code.

I will also keep this issue open so we can discuss along the way.

Bloeckchengrafik commented 9 months ago

Thats's a good idea!

Bloeckchengrafik commented 3 months ago

@JustinyAhin I think it's time to revisit this. What do you say? Should I just open a PR if everything is working?

JustinyAhin commented 3 months ago

Hi @Bloeckchengrafik. Yes please, if you have a working CLI, definitely open a PR. I'll be happy to check is as soon as possible and merge.

Let me know if you need any help with that. Thanks

Bloeckchengrafik commented 3 months ago

Hi, i've just linked the PR. It is still a draft because I'm currently running into the following issue:

When setting up a development environment with mysql (just choose the default for every option in the installer), the pnpm migrate:mysql command seems to fail:

/p/07_JS/kfs-tests/kfs/node_modules/.pnpm/mysql2@3.9.2/node_modules/mysql2/promise.js:356
    const localErr = new Error();
                     ^
Error: Connection lost: The server closed the connection.
    at PromisePool.query (/p/07_JS/kfs-tests/kfs/node_modules/.pnpm/mysql2@3.9.2/node_modules/mysql2/promise.js:356:22)
    at MySql2PreparedQuery.execute (file:///p/07_JS/kfs-tests/kfs/node_modules/.pnpm/drizzle-orm@0.28.6_@libsql+client@0.3.6_@types+pg@8.11.2_better-sqlite3@9.4.3_mysql2@3.9.2_postgres@3.4.3/node_modules/src/mysql2/session.ts:85:18)
    at MySql2Session.execute (file:///p/07_JS/kfs-tests/kfs/node_modules/.pnpm/drizzle-orm@0.28.6_@libsql+client@0.3.6_@types+pg@8.11.2_better-sqlite3@9.4.3_mysql2@3.9.2_postgres@3.4.3/node_modules/src/mysql-core/session.ts:77:5)
    at MySqlDialect.migrate (file:///p/07_JS/kfs-tests/kfs/node_modules/.pnpm/drizzle-orm@0.28.6_@libsql+client@0.3.6_@types+pg@8.11.2_better-sqlite3@9.4.3_mysql2@3.9.2_postgres@3.4.3/node_modules/src/mysql-core/dialect.ts:52:17)
    at migrate (file:///p/07_JS/kfs-tests/kfs/node_modules/.pnpm/drizzle-orm@0.28.6_@libsql+client@0.3.6_@types+pg@8.11.2_better-sqlite3@9.4.3_mysql2@3.9.2_postgres@3.4.3/node_modules/src/mysql2/migrator.ts:10:19)
    at file:///p/07_JS/kfs-tests/kfs/src/lib/drizzle/mysql/migrations/migrate.ts:17:7
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at ModuleLoader.import (node:internal/modules/esm/loader:323:24)
    at loadESM (node:internal/process/esm_loader:28:7)
    at handleMainPromise (node:internal/modules/run_main:120:12)

This does not happen if I try to set it up manually for some reason. If you have any ideas where this is coming from, let me know.

Pnpm workspaces don't seem to play nicely with binary installs so I wrote a small script to test the installer (might be helpful while testing):

#!/bin/bash
rm -rf kfs
pushd $KFS_ROOT_DIR/create/
pnpm run prepublishOnly
popd
node $KFS_ROOT_DIR/create/build/index.js kfs