Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions platform/packages/cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# @dynamia-tools/cli

> Scaffold new [Dynamia Platform](https://dynamia.tools) projects from the command line.

---

## Installation

### One-line bootstrap (Linux & macOS)

Installs JDK 25, Node.js LTS, and the CLI:

```bash
curl -fsSL https://get.dynamia.tools | bash
```

### npm (global)

```bash
npm install -g @dynamia-tools/cli
```

### Requirements

| Tool | Minimum version |
|---|---|
| Node.js | 22 |
| git | any recent version (required) |
| Java | 25 (recommended) |

---

## Usage

```bash
dynamia new
```

The wizard guides you through:

1. **Project name** — lowercase, letters/numbers/hyphens only
2. **Scaffold choice** — Backend + Frontend / Backend only / Frontend only
3. **Backend language** — Java, Kotlin, or Groovy
4. **Maven coordinates** — Group ID, Artifact ID, version, description
5. **Frontend framework** — Vue 3 or React
6. **Package manager** — pnpm, npm, or yarn
7. **Confirm** — shows a summary table before generating

---

## What gets generated

```
my-erp-app/
├── backend/ Spring Boot + Dynamia Tools (Java/Kotlin/Groovy)
└── frontend/ Vue 3 or React + Vite + @dynamia-tools/vue|sdk
```

### Backend

- Cloned from a GitHub template repo (e.g. `dynamiatools/template-backend-java`)
- Placeholder package `com.example.demo` renamed to your `groupId.artifactId`
- All tokens replaced in `.java`, `.kt`, `.groovy`, `.xml`, `.yml`, `.properties`, `.md`
- `DemoApplication.java` renamed to `<YourArtifactId>Application.java`

### Frontend

- Cloned from a GitHub template repo (e.g. `dynamiatools/template-frontend-vue`)
- Falls back to `npm create vite@latest` if clone fails
- `@dynamia-tools/sdk` and `@dynamia-tools/ui-core` installed automatically

---

## Configuration

All versions, URLs, and template repositories live in `cli.properties` — the single source of truth. TypeScript code never hardcodes versions or URLs.

Key sections:

| Section | Description |
|---|---|
| `dynamia.*` | Framework version and docs URL |
| `java.*` | JDK version and SDKMAN candidate |
| `template.backend.<id>.*` | Backend template repos (java, kotlin, groovy) |
| `template.frontend.<id>.*` | Frontend template repos (vue, react) |
| `token.*` | Placeholder tokens used inside template repos |
| `vite.*` | Vite fallback config |

---

## Template author conventions

When creating template repos (e.g. `dynamiatools/template-backend-java`):

- Default Java source package: `com.example.demo`
- `pom.xml` groupId: `com.example`, artifactId: `demo`
- Main class: `src/main/java/com/example/demo/DemoApplication.java`
- Use these placeholders in files:
- `{{GROUP_ID}}` — user's group ID
- `{{ARTIFACT_ID}}` — user's artifact ID
- `{{BASE_PACKAGE}}` — computed base package
- `{{PROJECT_NAME}}` — project name
- `{{PROJECT_VERSION}}` — project version
- `{{DYNAMIA_VERSION}}` — Dynamia Tools version
- `{{SPRING_BOOT_VERSION}}` — Spring Boot version

---

## Links

- [Dynamia Tools docs](https://dynamia.tools/docs)
- [GitHub org](https://github.com/dynamiatools)
- [Framework repo](https://github.com/dynamiatools/framework)

---

## License

Apache-2.0 — © Dynamia Soluciones IT SAS
92 changes: 92 additions & 0 deletions platform/packages/cli/cli.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Dynamia Tools CLI Configuration
# All versions, URLs, template repos, and token names live here.
# Updating any version or adding a new template never requires touching TypeScript.

# ---
# dynamia.*
# ---
dynamia.version=26.3.0
dynamia.docs.url=https://dynamia.tools/docs

# ---
# java.*
# ---
java.version=25
java.sdkman.candidate=25-tem

# ---
# node.*
# ---
node.minimum.version=22

# ---
# spring.* (kept as reference metadata, not used for generation)
# ---
spring.initializr.url=https://start.spring.io
spring.initializr.metadata.url=https://start.spring.io/metadata/client
spring.boot.version=3.4.0

# ---
# template.backend.<id>.*
# ---
template.backend.java.label=Java
template.backend.java.repo=https://github.com/dynamiatools/template-backend-java
template.backend.java.branch=main
template.backend.java.description=Spring Boot + Dynamia Tools (Java)

template.backend.kotlin.label=Kotlin
template.backend.kotlin.repo=https://github.com/dynamiatools/template-backend-kotlin
template.backend.kotlin.branch=main
template.backend.kotlin.description=Spring Boot + Dynamia Tools (Kotlin)

template.backend.groovy.label=Groovy
template.backend.groovy.repo=https://github.com/dynamiatools/template-backend-groovy
template.backend.groovy.branch=main
template.backend.groovy.description=Spring Boot + Dynamia Tools (Groovy)

# ---
# template.frontend.<id>.*
# ---
template.frontend.vue.label=Vue 3
template.frontend.vue.repo=https://github.com/dynamiatools/template-frontend-vue
template.frontend.vue.branch=main
template.frontend.vue.description=Vue 3 + Vite + @dynamia-tools/vue

template.frontend.react.label=React
template.frontend.react.repo=https://github.com/dynamiatools/template-frontend-react
template.frontend.react.branch=main
template.frontend.react.description=React + Vite + @dynamia-tools/sdk

# ---
# vite.* (fallback when git clone fails)
# ---
vite.fallback.enabled=true
vite.templates.vue=vue-ts
vite.templates.react=react-ts

# ---
# npm.* (SDK package names and versions)
# ---
npm.sdk.package=@dynamia-tools/sdk
npm.sdk.version=26.3.0
npm.ui-core.package=@dynamia-tools/ui-core
npm.ui-core.version=26.3.0
npm.vue.package=@dynamia-tools/vue
npm.vue.version=26.3.0

# ---
# installer.*
# ---
installer.sdkman.url=https://get.sdkman.io
installer.fnm.url=https://fnm.vercel.app/install

# ---
# token.* (placeholders used in template repos)
# ---
token.group.id={{GROUP_ID}}
token.artifact.id={{ARTIFACT_ID}}
token.base.package={{BASE_PACKAGE}}
token.project.name={{PROJECT_NAME}}
token.project.version={{PROJECT_VERSION}}
token.dynamia.version={{DYNAMIA_VERSION}}
token.spring.boot.version={{SPRING_BOOT_VERSION}}
Loading