@magentrix-corp/magentrix-cli 1.3.3 → 1.3.4
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 +21 -6
- package/actions/iris/dev.js +9 -7
- package/bin/magentrix.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -503,17 +503,19 @@ magentrix vue-build-stage
|
|
|
503
503
|
|
|
504
504
|
#### Vue Development Server
|
|
505
505
|
```bash
|
|
506
|
-
magentrix
|
|
506
|
+
magentrix run-dev
|
|
507
507
|
```
|
|
508
508
|
**What it does**: Starts the Vue development server with platform assets (CSS, fonts) automatically injected from your Magentrix instance.
|
|
509
509
|
|
|
510
|
+
**Authentication**: Uses `VITE_REFRESH_TOKEN` from `.env.development` (no CLI authentication required). This command can be run inside the Vue project directory.
|
|
511
|
+
|
|
510
512
|
**Options:**
|
|
511
513
|
- `--path <dir>` - Specify Vue project path
|
|
512
514
|
- `--no-inject` - Skip asset injection, just run dev server
|
|
513
515
|
- `--restore` - Restore `.env.development` from backup without running
|
|
514
516
|
|
|
515
517
|
**Process:**
|
|
516
|
-
1. Fetch platform assets from Magentrix
|
|
518
|
+
1. Fetch platform assets from Magentrix using `.env.development` credentials
|
|
517
519
|
2. Backup `.env.development` and inject assets
|
|
518
520
|
3. Run `npm run dev`
|
|
519
521
|
4. Restore `.env.development` on exit (Ctrl+C)
|
|
@@ -577,7 +579,7 @@ export const config = {
|
|
|
577
579
|
```bash
|
|
578
580
|
VITE_SITE_URL = https://yourinstance.magentrix.com
|
|
579
581
|
VITE_REFRESH_TOKEN = your-api-key
|
|
580
|
-
VITE_ASSETS = '[]' # Injected automatically by
|
|
582
|
+
VITE_ASSETS = '[]' # Injected automatically by run-dev
|
|
581
583
|
```
|
|
582
584
|
|
|
583
585
|
**Accepted field names in config.ts:**
|
|
@@ -586,6 +588,19 @@ VITE_ASSETS = '[]' # Injected automatically by iris-dev
|
|
|
586
588
|
- Description: `appDescription` or `app_description`
|
|
587
589
|
- Icon: `appIconId` or `app_icon_id`
|
|
588
590
|
|
|
591
|
+
### Command Availability
|
|
592
|
+
|
|
593
|
+
**In Vue project directories** (detected by presence of `config.ts`):
|
|
594
|
+
- ✓ `magentrix iris-link` - Link project to CLI
|
|
595
|
+
- ✓ `magentrix run-dev` - Start dev server (uses `.env.development` credentials)
|
|
596
|
+
- ✓ `magentrix vue-build-stage` - Build and stage
|
|
597
|
+
|
|
598
|
+
**In Magentrix workspace directories** (has `.magentrix/` folder):
|
|
599
|
+
- ✓ All standard commands (`setup`, `pull`, `publish`, etc.)
|
|
600
|
+
- ✓ All Iris commands (`iris-delete`, `iris-recover`, etc.)
|
|
601
|
+
|
|
602
|
+
**Note**: Commands like `pull`, `publish`, `autopublish` require a Magentrix workspace and will show an error if run inside a Vue project directory.
|
|
603
|
+
|
|
589
604
|
### Typical Development Workflow
|
|
590
605
|
|
|
591
606
|
```bash
|
|
@@ -593,7 +608,7 @@ VITE_ASSETS = '[]' # Injected automatically by iris-dev
|
|
|
593
608
|
magentrix iris-link # Link your Vue project
|
|
594
609
|
|
|
595
610
|
# Development
|
|
596
|
-
magentrix
|
|
611
|
+
magentrix run-dev # Start dev server with platform assets
|
|
597
612
|
# Make changes, test locally
|
|
598
613
|
# Press Ctrl+C to stop
|
|
599
614
|
|
|
@@ -1058,7 +1073,7 @@ magentrix status # Shows sync status
|
|
|
1058
1073
|
- `magentrix update` - Update to latest version
|
|
1059
1074
|
- `magentrix iris-link` - Link Vue.js projects for deployment
|
|
1060
1075
|
- `magentrix vue-build-stage` - Build and stage Vue.js apps
|
|
1061
|
-
- `magentrix
|
|
1076
|
+
- `magentrix run-dev` - Start Vue dev server with platform assets
|
|
1062
1077
|
- `magentrix iris-delete` - Delete an Iris app with recovery backup
|
|
1063
1078
|
- `magentrix iris-recover` - Recover a deleted Iris app
|
|
1064
1079
|
|
|
@@ -1072,6 +1087,6 @@ Once you're comfortable with basic usage:
|
|
|
1072
1087
|
2. **Learn the autopublish workflow** for faster development
|
|
1073
1088
|
3. **Explore conflict resolution** if you work in a team
|
|
1074
1089
|
4. **Check out templates** created by the `create` command to understand best practices
|
|
1075
|
-
5. **Deploy Vue.js apps** using `iris-link`, `vue-build-stage`, and `
|
|
1090
|
+
5. **Deploy Vue.js apps** using `iris-link`, `vue-build-stage`, and `run-dev` commands
|
|
1076
1091
|
|
|
1077
1092
|
Happy coding with MagentrixCLI! 🚀
|
package/actions/iris/dev.js
CHANGED
|
@@ -20,15 +20,16 @@ import {
|
|
|
20
20
|
} from '../../utils/iris/linker.js';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* run-dev command - Start Vue dev server with platform assets injected.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
* Uses credentials from .env.development (VITE_REFRESH_TOKEN, VITE_SITE_URL).
|
|
26
|
+
* Assets are injected into .env.development only.
|
|
27
|
+
* The .env.development file is backed up and restored when the dev server exits.
|
|
27
28
|
*
|
|
28
29
|
* Options:
|
|
29
30
|
* --path <dir> Specify Vue project path
|
|
30
31
|
* --no-inject Skip asset injection, just run dev server
|
|
31
|
-
* --restore Restore .env.development
|
|
32
|
+
* --restore Restore .env.development from backup
|
|
32
33
|
*/
|
|
33
34
|
export const irisDev = async (options = {}) => {
|
|
34
35
|
process.stdout.write('\x1Bc'); // Clear console
|
|
@@ -173,12 +174,13 @@ export const irisDev = async (options = {}) => {
|
|
|
173
174
|
*/
|
|
174
175
|
async function runDevServer(projectPath, modifiedFilePath, modifiedFileName, backupPath, assetsInjected) {
|
|
175
176
|
return new Promise((resolvePromise) => {
|
|
176
|
-
const
|
|
177
|
+
const isWindows = process.platform === 'win32';
|
|
178
|
+
const npmCmd = isWindows ? 'npm.cmd' : 'npm';
|
|
177
179
|
|
|
178
180
|
const child = spawn(npmCmd, ['run', 'dev'], {
|
|
179
181
|
cwd: projectPath,
|
|
180
182
|
stdio: 'inherit',
|
|
181
|
-
shell:
|
|
183
|
+
shell: isWindows // Windows requires shell: true for .cmd files
|
|
182
184
|
});
|
|
183
185
|
|
|
184
186
|
// Handle cleanup on exit
|
|
@@ -316,7 +318,7 @@ async function selectProject() {
|
|
|
316
318
|
console.log();
|
|
317
319
|
console.log(chalk.gray('To get started:'));
|
|
318
320
|
console.log(chalk.white(` 1. Link a Vue project: ${chalk.cyan('magentrix iris-link')}`));
|
|
319
|
-
console.log(chalk.white(` 2. Or specify path: ${chalk.cyan('magentrix
|
|
321
|
+
console.log(chalk.white(` 2. Or specify path: ${chalk.cyan('magentrix run-dev --path /path/to/vue-project')}`));
|
|
320
322
|
console.log();
|
|
321
323
|
}
|
|
322
324
|
|
package/bin/magentrix.js
CHANGED
|
@@ -44,7 +44,7 @@ function requireMagentrixWorkspace(fn) {
|
|
|
44
44
|
console.error(chalk.gray('This command requires a Magentrix workspace with global API key and instance URL.\n'));
|
|
45
45
|
console.error(chalk.cyan('Available commands in Vue projects:'));
|
|
46
46
|
console.error(chalk.gray(' • magentrix iris-link'));
|
|
47
|
-
console.error(chalk.gray(' • magentrix
|
|
47
|
+
console.error(chalk.gray(' • magentrix run-dev'));
|
|
48
48
|
console.error(chalk.gray(' • magentrix vue-build-stage\n'));
|
|
49
49
|
process.exit(1);
|
|
50
50
|
}
|
|
@@ -105,7 +105,7 @@ program
|
|
|
105
105
|
{ name: 'update', desc: 'Update MagentrixCLI to the latest version', icon: '⬆️ ' },
|
|
106
106
|
{ name: 'iris-link', desc: 'Link a Vue project to the CLI', icon: '🔗 ' },
|
|
107
107
|
{ name: 'vue-build-stage', desc: 'Build Vue project and stage for publish', icon: '🏗️ ' },
|
|
108
|
-
{ name: '
|
|
108
|
+
{ name: 'run-dev', desc: 'Start Vue dev server with platform assets', icon: '🌐 ' },
|
|
109
109
|
{ name: 'iris-delete', desc: 'Delete an Iris app with backup', icon: '🗑️ ' },
|
|
110
110
|
{ name: 'iris-recover', desc: 'Recover a deleted Iris app from backup', icon: '♻️ ' }
|
|
111
111
|
];
|
|
@@ -254,7 +254,7 @@ program
|
|
|
254
254
|
.action(vueBuildStage);
|
|
255
255
|
|
|
256
256
|
program
|
|
257
|
-
.command('
|
|
257
|
+
.command('run-dev')
|
|
258
258
|
.description('Start Vue dev server with platform assets injected')
|
|
259
259
|
.option('--path <path>', 'Path to the Vue project')
|
|
260
260
|
.option('--no-inject', 'Skip asset injection')
|
|
@@ -282,7 +282,7 @@ program.argument('[command]', 'command to run').action((cmd) => {
|
|
|
282
282
|
console.error(chalk.gray('This command requires a Magentrix workspace with global API key and instance URL.\n'));
|
|
283
283
|
console.error(chalk.cyan('Available commands in Vue projects:'));
|
|
284
284
|
console.error(chalk.gray(' • magentrix iris-link'));
|
|
285
|
-
console.error(chalk.gray(' • magentrix
|
|
285
|
+
console.error(chalk.gray(' • magentrix run-dev'));
|
|
286
286
|
console.error(chalk.gray(' • magentrix vue-build-stage\n'));
|
|
287
287
|
process.exit(1);
|
|
288
288
|
}
|