@magentrix-corp/magentrix-cli 1.3.9 → 1.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -4
- package/package.json +1 -1
- package/utils/iris/config-reader.js +6 -6
package/README.md
CHANGED
|
@@ -573,7 +573,7 @@ Your Vue project needs two configuration files:
|
|
|
573
573
|
```typescript
|
|
574
574
|
// src/config.ts
|
|
575
575
|
export const config = {
|
|
576
|
-
|
|
576
|
+
appSlug: "my-app", // Required: App identifier (folder name on server)
|
|
577
577
|
appName: "My Application", // Required: Display name in navigation menu
|
|
578
578
|
appDescription: "", // Optional: App description
|
|
579
579
|
appIconId: "", // Optional: App icon ID
|
|
@@ -589,11 +589,43 @@ VITE_ASSETS = '[]' # Injected automatically by vue-run-dev
|
|
|
589
589
|
```
|
|
590
590
|
|
|
591
591
|
**Accepted field names in config.ts:**
|
|
592
|
-
- Slug: `
|
|
592
|
+
- Slug: `appSlug`, `slug`, or `app_slug`
|
|
593
593
|
- Name: `appName`, `app_name`, or `name`
|
|
594
594
|
- Description: `appDescription` or `app_description`
|
|
595
595
|
- Icon: `appIconId` or `app_icon_id`
|
|
596
596
|
|
|
597
|
+
#### Changing an App Slug
|
|
598
|
+
|
|
599
|
+
> **⚠️ Important:** Changing the `appSlug`/`slug` in `config.ts` creates a **new** Iris app on Magentrix. The old app is **not** automatically deleted.
|
|
600
|
+
|
|
601
|
+
If you simply change the slug and run `vue-run-build`, you'll end up with two apps on the server - the old one becomes orphaned.
|
|
602
|
+
|
|
603
|
+
**Recommended workflow for changing an app slug:**
|
|
604
|
+
|
|
605
|
+
```bash
|
|
606
|
+
# 1. Delete the old app first (from Magentrix workspace)
|
|
607
|
+
cd ~/magentrix-workspace
|
|
608
|
+
magentrix iris-app-delete # Select the old app, confirm deletion
|
|
609
|
+
# This removes it from server, local files, and cache
|
|
610
|
+
# Optionally unlink the Vue project when prompted
|
|
611
|
+
|
|
612
|
+
# 2. Change the slug in your Vue project
|
|
613
|
+
cd ~/my-vue-app
|
|
614
|
+
# Edit config.ts: change appSlug from "old-slug" to "new-slug"
|
|
615
|
+
|
|
616
|
+
# 3. Re-link the project with the new slug
|
|
617
|
+
magentrix iris-app-link # Updates the linked project with new slug
|
|
618
|
+
|
|
619
|
+
# 4. Build, stage, and publish
|
|
620
|
+
magentrix vue-run-build # Stages to new folder: src/iris-apps/new-slug/
|
|
621
|
+
# When prompted, choose to publish
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
**What happens if you don't follow this workflow:**
|
|
625
|
+
- Both `old-slug` and `new-slug` apps will exist on the server
|
|
626
|
+
- The old app remains in `src/iris-apps/old-slug/` locally
|
|
627
|
+
- You'll need to manually delete the old app using `magentrix iris-app-delete`
|
|
628
|
+
|
|
597
629
|
### Command Availability
|
|
598
630
|
|
|
599
631
|
**In Vue project directories** (detected by presence of `config.ts`):
|
|
@@ -693,8 +725,8 @@ When running `vue-run-build` from a Vue project, the CLI checks if the target wo
|
|
|
693
725
|
2. Pull latest changes: `magentrix pull`
|
|
694
726
|
3. Re-run `vue-run-build` from your Vue project
|
|
695
727
|
|
|
696
|
-
#### "Missing required field in config.ts: slug (
|
|
697
|
-
Your Vue project's `config.ts` is missing the app identifier. Add an `
|
|
728
|
+
#### "Missing required field in config.ts: slug (appSlug)"
|
|
729
|
+
Your Vue project's `config.ts` is missing the app identifier. Add an `appSlug` or `slug` field.
|
|
698
730
|
|
|
699
731
|
#### "Missing required field in config.ts: appName"
|
|
700
732
|
Your Vue project's `config.ts` is missing the display name. Add an `appName` field.
|
|
@@ -743,6 +775,12 @@ magentrix publish # Sync to server
|
|
|
743
775
|
#### Changes not detected after vue-run-build
|
|
744
776
|
The CLI uses content hash tracking to detect changes. If you rebuild without changes, `magentrix publish` will show "All files are in sync — nothing to publish!" This is expected behavior and saves unnecessary uploads.
|
|
745
777
|
|
|
778
|
+
#### Duplicate apps after changing slug
|
|
779
|
+
If you changed the `appSlug`/`slug` in `config.ts` and now have two apps on the server:
|
|
780
|
+
1. The old app is orphaned and needs manual cleanup
|
|
781
|
+
2. Run `magentrix iris-app-delete` and select the old app to remove it
|
|
782
|
+
3. See [Changing an App Slug](#changing-an-app-slug) for the proper workflow
|
|
783
|
+
|
|
746
784
|
---
|
|
747
785
|
|
|
748
786
|
## Handling Conflicts
|
package/package.json
CHANGED
|
@@ -163,13 +163,13 @@ export function parseConfigFile(configPath) {
|
|
|
163
163
|
result.raw = content;
|
|
164
164
|
|
|
165
165
|
// Extract slug (various patterns)
|
|
166
|
-
// slug: "dashboard",
|
|
166
|
+
// slug: "dashboard", appSlug: "dashboard", app_slug: "dashboard"
|
|
167
167
|
// Also handles: slug: env.slug || "fallback"
|
|
168
|
-
const slugMatch = content.match(/(?:slug|
|
|
168
|
+
const slugMatch = content.match(/(?:slug|appSlug|app_slug)\s*:\s*["'`]([^"'`]+)["'`]/);
|
|
169
169
|
if (slugMatch) {
|
|
170
170
|
result.slug = slugMatch[1];
|
|
171
171
|
} else {
|
|
172
|
-
const slugFallbackMatch = content.match(/(?:slug|
|
|
172
|
+
const slugFallbackMatch = content.match(/(?:slug|appSlug|app_slug)\s*:\s*[^,\n]+\|\|\s*["'`]([^"'`]+)["'`]/);
|
|
173
173
|
if (slugFallbackMatch) {
|
|
174
174
|
result.slug = slugFallbackMatch[1];
|
|
175
175
|
}
|
|
@@ -296,7 +296,7 @@ export function readVueConfig(projectPath) {
|
|
|
296
296
|
|
|
297
297
|
// Validate required fields in config.ts
|
|
298
298
|
if (!result.slug) {
|
|
299
|
-
result.errors.push('Missing required field in config.ts: slug (
|
|
299
|
+
result.errors.push('Missing required field in config.ts: slug (appSlug)');
|
|
300
300
|
}
|
|
301
301
|
if (!result.appName) {
|
|
302
302
|
result.errors.push('Missing required field in config.ts: appName');
|
|
@@ -422,7 +422,7 @@ Could not find config.ts in the Vue project.
|
|
|
422
422
|
Expected location: ${join(projectPath, 'src/config.ts')}
|
|
423
423
|
|
|
424
424
|
Required fields in config.ts:
|
|
425
|
-
-
|
|
425
|
+
- appSlug (slug): App identifier (used as folder name)
|
|
426
426
|
- appName: Display name for navigation menu
|
|
427
427
|
|
|
428
428
|
Required fields in .env.development:
|
|
@@ -432,7 +432,7 @@ Required fields in .env.development:
|
|
|
432
432
|
|
|
433
433
|
Example config.ts:
|
|
434
434
|
export const config = {
|
|
435
|
-
|
|
435
|
+
appSlug: "my-app",
|
|
436
436
|
appName: "My Application"
|
|
437
437
|
}
|
|
438
438
|
|