@magentrix-corp/magentrix-cli 1.3.6 → 1.3.7
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 +16 -1
- package/actions/iris/buildStage.js +11 -0
- package/package.json +1 -1
- package/utils/iris/builder.js +11 -6
package/README.md
CHANGED
|
@@ -505,7 +505,9 @@ magentrix vue-build-stage
|
|
|
505
505
|
1. Select from linked projects or enter path manually
|
|
506
506
|
2. Run `npm run build` in the Vue project
|
|
507
507
|
3. Validate the build output
|
|
508
|
-
4. Copy to workspace `src/iris-apps/<app-slug>/`
|
|
508
|
+
4. Copy to workspace `src/iris-apps/<app-slug>/` (excludes index.html, favicon.ico)
|
|
509
|
+
5. Check sync status and prompt to pull if needed (required before publishing)
|
|
510
|
+
6. Prompt to publish to Magentrix
|
|
509
511
|
|
|
510
512
|
#### Vue Development Server
|
|
511
513
|
```bash
|
|
@@ -678,6 +680,19 @@ When running from a Vue project, the command looks for registered workspaces in
|
|
|
678
680
|
|
|
679
681
|
**Note**: Existing workspaces are auto-registered when you run any command from them.
|
|
680
682
|
|
|
683
|
+
#### "Publishing Iris apps from an out-of-sync workspace is not allowed"
|
|
684
|
+
When running `vue-build-stage` from a Vue project, the CLI checks if the target workspace is in sync with the server. If there are pending remote changes, you must pull first.
|
|
685
|
+
|
|
686
|
+
**Why this is required:**
|
|
687
|
+
- Prevents deployment conflicts
|
|
688
|
+
- Ensures your app is deployed alongside the latest server state
|
|
689
|
+
- Avoids overwriting changes made by other team members
|
|
690
|
+
|
|
691
|
+
**To resolve:**
|
|
692
|
+
1. Navigate to the workspace: `cd /path/to/workspace`
|
|
693
|
+
2. Pull latest changes: `magentrix pull`
|
|
694
|
+
3. Re-run `vue-build-stage` from your Vue project
|
|
695
|
+
|
|
681
696
|
#### "Missing required field in config.ts: slug (appPath)"
|
|
682
697
|
Your Vue project's `config.ts` is missing the app identifier. Add an `appPath` or `slug` field.
|
|
683
698
|
|
|
@@ -458,6 +458,17 @@ async function buildFromVueProject(options) {
|
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
460
|
console.log();
|
|
461
|
+
} else {
|
|
462
|
+
// User declined to pull - block publishing from out-of-sync workspace
|
|
463
|
+
console.log();
|
|
464
|
+
console.log(chalk.red('Publishing Iris apps from an out-of-sync workspace is not allowed.'));
|
|
465
|
+
console.log(chalk.gray('This prevents conflicts and ensures your deployment is based on the latest server state.'));
|
|
466
|
+
console.log();
|
|
467
|
+
console.log(chalk.cyan('To continue:'));
|
|
468
|
+
console.log(chalk.white(` 1. Navigate to workspace: ${chalk.yellow(`cd "${workspacePath}"`)}`));
|
|
469
|
+
console.log(chalk.white(` 2. Run ${chalk.yellow('magentrix pull')} to sync with server`));
|
|
470
|
+
console.log(chalk.white(` 3. Run ${chalk.yellow('magentrix publish')} to deploy`));
|
|
471
|
+
return;
|
|
461
472
|
}
|
|
462
473
|
} else if (syncStatus.checked) {
|
|
463
474
|
console.log(chalk.green('✓ Workspace is in sync'));
|
package/package.json
CHANGED
package/utils/iris/builder.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { existsSync, mkdirSync, cpSync, rmSync, readdirSync } from 'node:fs';
|
|
3
|
-
import { join, resolve } from 'node:path';
|
|
3
|
+
import { join, resolve, basename } from 'node:path';
|
|
4
4
|
import { validateIrisBuild } from './validator.js';
|
|
5
5
|
import { updateLastBuild } from './linker.js';
|
|
6
6
|
import { EXPORT_ROOT, IRIS_APPS_DIR } from '../../vars/global.js';
|
|
7
7
|
|
|
8
|
+
// Files to exclude when staging Iris apps (not needed on server)
|
|
9
|
+
const EXCLUDED_FILES = new Set(['index.html', 'favicon.ico']);
|
|
10
|
+
|
|
8
11
|
/**
|
|
9
12
|
* Build a Vue project using npm run build.
|
|
10
13
|
*
|
|
@@ -176,16 +179,18 @@ export function stageToWorkspace(distPath, slug, workspacePath = process.cwd())
|
|
|
176
179
|
rmSync(targetDir, { recursive: true, force: true });
|
|
177
180
|
}
|
|
178
181
|
|
|
179
|
-
// Files to exclude from staging (not needed for Iris apps)
|
|
180
|
-
const excludeFiles = new Set(['index.html', 'favicon.ico']);
|
|
181
|
-
|
|
182
182
|
// Copy dist contents to target, excluding unnecessary files
|
|
183
183
|
try {
|
|
184
184
|
cpSync(resolvedDistPath, targetDir, {
|
|
185
185
|
recursive: true,
|
|
186
186
|
filter: (src) => {
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
// Use basename for reliable cross-platform filename extraction
|
|
188
|
+
const filename = basename(src);
|
|
189
|
+
// Only exclude specific files, not directories
|
|
190
|
+
if (EXCLUDED_FILES.has(filename)) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
return true;
|
|
189
194
|
}
|
|
190
195
|
});
|
|
191
196
|
} catch (err) {
|