@adobedjangir/commerce-admin-management 0.0.8 → 0.0.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/package.json +1 -1
- package/scripts/setup.js +44 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobedjangir/commerce-admin-management",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Schema-driven system configuration for Adobe Commerce App Builder sync apps. Magento-style scoped config in Adobe App Builder Database (ABDB) with encryption, Commerce REST helpers, and React Admin UI.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Adobe Inc.",
|
package/scripts/setup.js
CHANGED
|
@@ -69,29 +69,56 @@ function updateExistingExtensionBlock (content) {
|
|
|
69
69
|
return next !== content ? next : null
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Remove the boilerplate `dx/excshell/1` extension block that aio's default
|
|
74
|
+
* `app init` ships with. The host can only run one extension point per
|
|
75
|
+
* project for our purposes, and `commerce/backend-ui/1` is what this
|
|
76
|
+
* package needs — leaving `dx/excshell/1` in place causes aio to try
|
|
77
|
+
* building BOTH, which fails on the excshell side because we don't ship
|
|
78
|
+
* any code for it.
|
|
79
|
+
*
|
|
80
|
+
* Matches a 2-space-indented `dx/excshell/1:` block followed by any
|
|
81
|
+
* deeper-indented nested lines, terminating when we see a non-indented
|
|
82
|
+
* line or a sibling extension. Safe to run repeatedly — no-op if absent.
|
|
83
|
+
*/
|
|
84
|
+
function stripExcshellBlock (content) {
|
|
85
|
+
const re = /^[ \t]*dx\/excshell\/1:[ \t]*\n(?:[ \t]+[^\n]*\n)*/m
|
|
86
|
+
if (!re.test(content)) return { content, changed: false }
|
|
87
|
+
const next = content.replace(re, '')
|
|
88
|
+
return { content: next, changed: true }
|
|
89
|
+
}
|
|
90
|
+
|
|
72
91
|
function patchAppConfig (content) {
|
|
73
|
-
|
|
74
|
-
|
|
92
|
+
// First strip the boilerplate dx/excshell/1 block — see stripExcshellBlock.
|
|
93
|
+
const excshell = stripExcshellBlock(content)
|
|
94
|
+
let working = excshell.content
|
|
95
|
+
|
|
96
|
+
if (alreadyLinked(working)) {
|
|
97
|
+
return {
|
|
98
|
+
content: working,
|
|
99
|
+
changed: excshell.changed,
|
|
100
|
+
reason: excshell.changed ? 'stripped-excshell' : 'already-linked'
|
|
101
|
+
}
|
|
75
102
|
}
|
|
76
103
|
|
|
77
|
-
if (hasExtensionPoint(
|
|
78
|
-
const updated = updateExistingExtensionBlock(
|
|
104
|
+
if (hasExtensionPoint(working)) {
|
|
105
|
+
const updated = updateExistingExtensionBlock(working)
|
|
79
106
|
if (updated) {
|
|
80
107
|
return { content: updated, changed: true, reason: 'updated-existing-extension' }
|
|
81
108
|
}
|
|
82
|
-
return { content, changed:
|
|
109
|
+
return { content: working, changed: excshell.changed, reason: 'extension-exists-unmodified' }
|
|
83
110
|
}
|
|
84
111
|
|
|
85
|
-
if (/^extensions:[ \t]*\n/m.test(
|
|
112
|
+
if (/^extensions:[ \t]*\n/m.test(working)) {
|
|
86
113
|
const injection = ` ${EXTENSION_POINT}:\n $include: ${INCLUDE_REL}\n`
|
|
87
|
-
const next =
|
|
88
|
-
if (next !==
|
|
114
|
+
const next = working.replace(/^extensions:[ \t]*\n/m, `extensions:\n${injection}`)
|
|
115
|
+
if (next !== working) {
|
|
89
116
|
return { content: next, changed: true, reason: 'added-under-extensions' }
|
|
90
117
|
}
|
|
91
118
|
}
|
|
92
119
|
|
|
93
|
-
if (!/^extensions:/m.test(
|
|
94
|
-
const trimmed =
|
|
120
|
+
if (!/^extensions:/m.test(working)) {
|
|
121
|
+
const trimmed = working.replace(/\s+$/, '')
|
|
95
122
|
const separator = trimmed.length > 0 ? '\n\n' : ''
|
|
96
123
|
return {
|
|
97
124
|
content: `${trimmed}${separator}${buildExtensionBlock()}\n`,
|
|
@@ -100,7 +127,7 @@ function patchAppConfig (content) {
|
|
|
100
127
|
}
|
|
101
128
|
}
|
|
102
129
|
|
|
103
|
-
return { content, changed:
|
|
130
|
+
return { content: working, changed: excshell.changed, reason: excshell.changed ? 'stripped-excshell' : 'no-change' }
|
|
104
131
|
}
|
|
105
132
|
|
|
106
133
|
// ────────────────────────────────────────────────────────────────────────────
|
|
@@ -369,19 +396,17 @@ function indexHtmlContents () {
|
|
|
369
396
|
}
|
|
370
397
|
|
|
371
398
|
function excRuntimeContents () {
|
|
372
|
-
//
|
|
373
|
-
//
|
|
374
|
-
//
|
|
375
|
-
//
|
|
399
|
+
// exc-runtime.js's only job is to side-effect-import the Adobe Experience
|
|
400
|
+
// Cloud Shell runtime so the bootstrap can call init(...) afterwards.
|
|
401
|
+
// The bootstrap wraps `require('./exc-runtime')` in try/catch — if this
|
|
402
|
+
// import fails (e.g. when running outside the shell) bootstrapRaw() takes
|
|
403
|
+
// over. So this file is intentionally minimal.
|
|
376
404
|
return `/*
|
|
377
405
|
Copyright 2025 Adobe. All rights reserved.
|
|
378
406
|
Licensed under the Apache License, Version 2.0
|
|
379
407
|
*/
|
|
380
408
|
|
|
381
|
-
|
|
382
|
-
// Pulls in the @adobe/exc-app runtime which the bootstrap then initialises.
|
|
383
|
-
import '@adobe/exc-app/page'
|
|
384
|
-
import '@adobe/exc-app/page/Page'
|
|
409
|
+
import '@adobe/exc-app'
|
|
385
410
|
`
|
|
386
411
|
}
|
|
387
412
|
|