@pacaf/wizard-ux 3.3.5 → 3.3.6
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/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Step 9 - Verify & Deploy. Browser-native build and optional pac code push.
|
|
2
|
-
import { existsSync
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
3
|
import { spawn, execFileSync } from 'node:child_process';
|
|
4
4
|
import { dirname, join, resolve } from 'node:path';
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
@@ -39,22 +39,6 @@ function runCommand(log, command, opts = {}) {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
function runFile(log, file, args, opts = {}) {
|
|
43
|
-
return new Promise((resolvePromise) => {
|
|
44
|
-
log.info(`$ ${SHELL.formatCommandForLog(file, args)}`);
|
|
45
|
-
const child = SHELL.spawnSafe(file, args, { cwd: opts.cwd || PROJECT_DIR, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
46
|
-
child.stdout.setEncoding('utf-8');
|
|
47
|
-
child.stderr.setEncoding('utf-8');
|
|
48
|
-
child.stdout.on('data', (chunk) => log.info(String(chunk).trimEnd()));
|
|
49
|
-
child.stderr.on('data', (chunk) => log.warn(String(chunk).trimEnd()));
|
|
50
|
-
child.on('error', (error) => {
|
|
51
|
-
log.fail(`Failed to start ${file}: ${error.message}`);
|
|
52
|
-
resolvePromise(false);
|
|
53
|
-
});
|
|
54
|
-
child.on('close', (code) => resolvePromise(code === 0));
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
42
|
function runFileCapture(log, file, args, opts = {}) {
|
|
59
43
|
return new Promise((resolvePromise) => {
|
|
60
44
|
log.info(`$ ${SHELL.formatCommandForLog(file, args)}`);
|
|
@@ -120,21 +104,28 @@ function verifyUserProfile(pac, projectDir, state, credentialValues) {
|
|
|
120
104
|
});
|
|
121
105
|
}
|
|
122
106
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
107
|
+
// Verify the deployed Code App joined the selected solution.
|
|
108
|
+
//
|
|
109
|
+
// Association happens during `pac code push -s <UNIQUE name>` on the FIRST
|
|
110
|
+
// push — it is what creates the Dataverse `canvasapps` record inside the
|
|
111
|
+
// solution. A later `-s` re-push does NOT retroactively associate an app that
|
|
112
|
+
// was first pushed bare, and there is no reliable post-hoc CLI fix: the old
|
|
113
|
+
// `solution add-solution-component -ct 300` path passed the Code App's
|
|
114
|
+
// play-URL appId where the canvasapp record GUID is expected and always failed
|
|
115
|
+
// with "...because it does not exist" (issue #81). So we verify and guide
|
|
116
|
+
// recovery instead of pretending to repair.
|
|
117
|
+
async function verifyAppInSolution(log, pac, projectDir, solutionUniqueName) {
|
|
118
|
+
if (!solutionUniqueName) return;
|
|
119
|
+
log.info(`Verifying app is a component of solution "${solutionUniqueName}"...`);
|
|
120
|
+
const { ok, stdout, stderr } = await runFileCapture(log, pac, ['solution', 'list'], { cwd: projectDir });
|
|
121
|
+
const combined = `${stdout}\n${stderr}`;
|
|
122
|
+
if (ok && new RegExp(`\\b${solutionUniqueName}\\b`, 'i').test(combined)) {
|
|
123
|
+
log.ok(`Solution "${solutionUniqueName}" exists and the push carried -s — the app should now appear under it.`);
|
|
124
|
+
log.info(`Confirm in Maker Portal → Solutions → ${solutionUniqueName} → Apps.`);
|
|
125
|
+
} else {
|
|
126
|
+
log.warn(`Could not confirm solution "${solutionUniqueName}". Verify in the Maker Portal that the app is listed under it.`);
|
|
134
127
|
}
|
|
135
|
-
|
|
136
|
-
if (ok) log.ok(`App added to solution ${solutionName}`);
|
|
137
|
-
else log.warn(`Could not add app to solution ${solutionName}. It may already be present, or you can add it manually.`);
|
|
128
|
+
log.info('If the app is NOT listed under the solution, it was pushed without a valid solution unique name. A later -s re-push will NOT fix it — delete the orphaned Code App in the Maker Portal, then re-push with the UNIQUE name.');
|
|
138
129
|
}
|
|
139
130
|
|
|
140
131
|
export default {
|
|
@@ -197,8 +188,17 @@ export default {
|
|
|
197
188
|
const verification = verifyUserProfile(pac, projectDir, state, credentialValues);
|
|
198
189
|
log.ok(`Verified user profile ${verification.profileName}`);
|
|
199
190
|
|
|
191
|
+
// -s MUST be the solution UNIQUE name. Passing the friendly display name
|
|
192
|
+
// (e.g. "AI PMO" with a space) silently no-ops and leaves the app OUTSIDE
|
|
193
|
+
// the solution — association only happens on the first push WITH the unique
|
|
194
|
+
// name, and a later -s re-push cannot fix it (issue #81).
|
|
195
|
+
const solutionUniqueName = String(state.SOLUTION_UNIQUE_NAME || '').trim();
|
|
200
196
|
const pushArgs = ['code', 'push'];
|
|
201
|
-
if (
|
|
197
|
+
if (solutionUniqueName) {
|
|
198
|
+
pushArgs.push('-s', solutionUniqueName);
|
|
199
|
+
} else {
|
|
200
|
+
throw new Error('No solution unique name (SOLUTION_UNIQUE_NAME) is available. Refusing to run a bare `pac code push`, which would create the Code App outside any solution (a silent failure a later -s re-push cannot fix). Re-run the wizard solution step so the unique name is captured before deploying.');
|
|
201
|
+
}
|
|
202
202
|
const pushResult = await runFileCapture(log, pac, pushArgs, { cwd: projectDir });
|
|
203
203
|
const pushOutput = `${pushResult.stdout}\n${pushResult.stderr}`;
|
|
204
204
|
if (!pushResult.ok || PAC_HTTP_ERROR_RE.test(pushOutput)) throw new Error('pac code push failed. Check the live output above, then retry.');
|
|
@@ -220,7 +220,7 @@ export default {
|
|
|
220
220
|
log.warn('Could not detect deployed app URL in pac output. Open the app from Power Apps Maker Portal.');
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
await
|
|
223
|
+
await verifyAppInSolution(log, pac, projectDir, solutionUniqueName);
|
|
224
224
|
|
|
225
225
|
return { stateUpdate, completedStep: 9 };
|
|
226
226
|
},
|