feat: introduce v1 modern TypeScript + ESM CLI#130
Draft
Conversation
Co-authored-by: inpercima <10551931+inpercima@users.noreply.github.com> Agent-Logs-Url: https://github.com/inpercima/swaaplate/sessions/3b10058e-1b0b-46ae-a9c5-c610386eaf75
Copilot
AI
changed the title
[WIP] Add v1 modern TypeScript + ESM CLI implementation
feat: introduce v1 modern TypeScript + ESM CLI
Mar 26, 2026
e1544aa to
49268ec
Compare
49268ec to
1954182
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the old JSON-config-driven generator with a modern, interactive CLI built on TypeScript + ESM (Node ≥ 20.9.0). Ignores legacy
swaaplate.jsonlogic entirely.New CLI architecture
src/cli/index.ts— entry point with#!/usr/bin/env nodeshebang;binmapsswaaplate→dist/cli/index.jssrc/cli/init.ts—swaaplate init [name]command; interactive (@inquirer/promptsselect/input) and non-interactive via flagssrc/cli/types.ts— sharedPreset,PackageManager,InitOptionstypestsconfig.json—module/moduleResolution: NodeNext, targetssrc/cli/**only (excludes legacy template.tsstubs)swaaplate initflags--presetpreset-angular-only|preset-angular-java|preset-angular-php--pmpnpm|npm|yarnpnpm--yes/-yfalse--force/-ffalseWhat each preset generates
Package changes
package.json:"type": "module", newbin/scripts/dependencies/devDependencies, version bumped to3.0.0-SNAPSHOTyarn.lockremoved,package-lock.jsonaddedcommander,@inquirer/prompts,execa,fs-extratypescript,tsx,@types/node,@types/fs-extraOriginal prompt
Create a PR for repository
inpercima/swaaplatethat introduces a v1 modern TypeScript + ESM CLI.Context:
swaaplate.js) that reads aswaaplate.jsonconfiguration and uses internal modules undersrc/js/**.Requirements (v1):
Implement a new CLI written in TypeScript using ESM:
"type": "module"and TypeScriptmodule/moduleResolutionset toNodeNext.dist/.CLI commands:
swaaplate init [name]--preset <preset>where preset is one of:preset-angular-onlypreset-angular-javapreset-angular-php--pm <pm>where pm is one ofpnpm|npm|yarn(default should bepnpmif not provided)--yesto skip prompts where possible--forceto overwrite existing non-empty target directoryOutput project structure (monorepo):
[name](or prompt for it).apps/subfolder.apps/frontendusing official Angular CLI vianpx -y @angular/cli@latest new ....apps/frontend.preset-angular-only: no backend.preset-angular-java: createapps/backend/README.mdplaceholder (skeleton). Do not yet integrate Spring Boot initializr.preset-angular-php: createapps/backend/public/index.phpthat returns JSON and aREADME.md.Root workspace setup:
package.jsonin the generated monorepo enabling workspaces forapps/*and add a convenience script to run the frontend.pnpm-workspace.yaml.Repository changes:
src/cli/**(or similar) and necessary config files (tsconfig.json).package.jsonto include:type: modulebinentry forswaaplate->dist/cli/index.jsbuild,dev,startbin.Documentation:
README.mdwith new usage examples forswaaplate initand presets.Acceptance criteria:
npm run buildproducesdist/cli/index.js.node dist/cli/index.js init test-app --preset preset-angular-only --pm pnpm --yesgenerates the monorepo with Angular frontend.npm run dev -- initor equivalent.Notes:
swaaplate.jsonconfiguration.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Das ist ein sehr altes Projekt, womit ich vor hatte, einen einfachen Generator zu haben für Apps, die ich oft baue. Leider konnte ich das nicht damals weiterführen, würde es jetzt aber angehen.
Ich möchte also eine console app, mit der ich sagen kann:
das mit einer sehr coolen consolen anwendungen und ggf. templates.
Wie würde ich das heuzutage angehen oder gibts das schon enau für meinen geschmack?
Assistant: Am sinnvollsten würdest du das heute als „Opinionated App Generator“ angehen – also ein CLI, das deine wiederkehrenden Entscheidungen (Angular vs. plain, Nest vs. Java, pnpm vs. npm, Tailwind vs. Bootstrap/Material, optional Spring Boot) in vordefinierte Presets + Templates gießt und dann reproduzierbar ein Projekt ausspuckt.
1) Gibt’s das schon „genau so“?
Es gibt viele Generatoren, aber meist nicht in genau der Kombi und Opinionated-Form, die du beschreibst:
This pull request was created from Copilot chat.
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.