Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import tools.dynamia.app.reports.JasperReportCompiler;
import tools.dynamia.commons.StringUtils;
import tools.dynamia.domain.services.CrudService;
import tools.dynamia.domain.services.impl.NoOpCrudService;
import tools.dynamia.integration.ms.MessageService;
Expand All @@ -31,6 +32,8 @@
import tools.dynamia.integration.search.NoOpSearchProvider;
import tools.dynamia.integration.search.SearchResultProvider;
import tools.dynamia.integration.search.SearchService;
import tools.dynamia.navigation.Module;
import tools.dynamia.navigation.ModuleProvider;
import tools.dynamia.reports.ReportCompiler;
import tools.dynamia.templates.TemplateEngine;
import tools.dynamia.web.navigation.RestApiNavigationConfiguration;
Expand Down Expand Up @@ -178,4 +181,16 @@ public TemplateEngine templateEngine() {



/**
* Provides an empty {@link ModuleProvider} bean if none is registered.
*
* @return a ModuleProvider that returns a dummy module with a random name and message
*/
@Bean
@ConditionalOnMissingBean(ModuleProvider.class)
public ModuleProvider emptyModuleProvider() {
return () -> new Module(StringUtils.randomString(), "No modules registered");
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,5 @@ public PWAManifestController pwaManifestController(PWAManifest manifest) {
return new PWAManifestController(manifest);
}

/**
* Provides an empty {@link ModuleProvider} bean if none is registered.
*
* @return a ModuleProvider that returns a dummy module with a random name and message
*/
@Bean
@ConditionalOnMissingBean(ModuleProvider.class)
public ModuleProvider emptyModuleProvider() {
return () -> new Module(StringUtils.randomString(), "No modules registered");
}

}
128 changes: 128 additions & 0 deletions platform/packages/cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# @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 | 24 |
| 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

> Beta note: this CLI is in active beta. If a command or template is not ready yet, you will get a friendly "not available yet" message.

Errors include short support codes such as `DT-TEMPLATE-002` to make issue reporting easier.

---

## 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`)
- Template repository and branch are validated before cloning
- 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`)
- Template repository and branch are validated before cloning
- Falls back to `npm create vite@latest` if template clone/validation 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 |
| `beta.*` | Beta-mode UX messages |
| `java.*` | JDK version and SDKMAN candidate |
| `template.backend.<id>.*` | Backend template repos (java, kotlin, groovy) |
| `template.frontend.<id>.*` | Frontend template repos (vue, react) |
| `template.*.<id>.enabled` | Enable/disable template options in the wizard |
| `template.*.<id>.availabilityMessage` | Message shown when a template is disabled |
| `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
109 changes: 109 additions & 0 deletions platform/packages/cli/cli.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# 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.4.1
dynamia.docs.url=https://dynamia.tools/docs

# ---
# beta.*
# ---
beta.enabled=true
beta.intro.message.enabled=true
beta.not.available.message.enabled=true

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

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

# ---
# 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=4.0.5

# ---
# 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.java.enabled=true
template.backend.java.availabilityMessage=Backend Java template is not available yet.

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.kotlin.enabled=true
template.backend.kotlin.availabilityMessage=Backend Kotlin template is not available yet.

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.backend.groovy.enabled=true
template.backend.groovy.availabilityMessage=Backend Groovy template is not available yet.

# ---
# 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.vue.enabled=true
template.frontend.vue.availabilityMessage=Vue frontend template is not available yet.

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
template.frontend.react.enabled=true
template.frontend.react.availabilityMessage=React frontend template is not available yet.

# ---
# 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.4.1
npm.ui-core.package=@dynamia-tools/ui-core
npm.ui-core.version=26.4.1
npm.vue.package=@dynamia-tools/vue
npm.vue.version=26.4.1

# ---
# 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
Loading