@adobedjangir/commerce-admin-management 0.0.14 → 0.0.15
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 +4 -2
- package/package.json +8 -14
- package/scripts/setup.js +43 -7
package/README.md
CHANGED
|
@@ -40,6 +40,7 @@ and an extension point for host apps to add their own pages and actions.
|
|
|
40
40
|
| App Builder Database (ABDB) auto-provisioning on deploy | `ext.config.yaml` |
|
|
41
41
|
| Host-extensible nav and pages | `configureWeb({ extraNav, extraPages })` |
|
|
42
42
|
| Auto-scaffolded host scaffold on `npm install` | `scripts/setup.js` (postinstall hook) |
|
|
43
|
+
| Auto-bump host React/Spectrum/Adobe deps to React-18 floor | `scripts/setup.js` mutates host `package.json` |
|
|
43
44
|
|
|
44
45
|
---
|
|
45
46
|
|
|
@@ -50,14 +51,15 @@ and an extension point for host apps to add their own pages and actions.
|
|
|
50
51
|
aio app init my-commerce-admin
|
|
51
52
|
cd my-commerce-admin
|
|
52
53
|
|
|
53
|
-
# 2. Install the package
|
|
54
|
+
# 2. Install. The postinstall bumps the host's package.json to the
|
|
55
|
+
# React 18 / Spectrum 4 floor and re-runs `npm install` automatically.
|
|
54
56
|
npm install @adobedjangir/commerce-admin-management
|
|
55
57
|
|
|
56
58
|
# 3. Fill in .env (see required values below)
|
|
57
59
|
cp env.dist .env
|
|
58
60
|
$EDITOR .env
|
|
59
61
|
|
|
60
|
-
# 4. Deploy. ABDB is auto-provisioned;
|
|
62
|
+
# 4. Deploy. ABDB is auto-provisioned; actions + web assets ship to CDN.
|
|
61
63
|
aio app deploy
|
|
62
64
|
```
|
|
63
65
|
|
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.15",
|
|
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.",
|
|
@@ -53,26 +53,20 @@
|
|
|
53
53
|
"@adobe/aio-lib-core-auth": ">=1.1.0",
|
|
54
54
|
"@adobe/aio-lib-db": ">=1.0.0",
|
|
55
55
|
"@adobe/aio-lib-ims": ">=7.0.0",
|
|
56
|
-
"
|
|
57
|
-
"@adobe/exc-app": ">=1.0.0",
|
|
58
|
-
"@adobe/react-spectrum": ">=3.30.0",
|
|
59
|
-
"@adobe/uix-guest": ">=0.8.0",
|
|
60
|
-
"@spectrum-icons/workflow": ">=3.0.0 <5.0.0",
|
|
61
|
-
"dotenv": ">=16.0.0",
|
|
62
|
-
"react": ">=18.0.0",
|
|
63
|
-
"react-dom": ">=18.0.0",
|
|
64
|
-
"react-error-boundary": ">=3.1.0",
|
|
65
|
-
"react-router-dom": ">=6.0.0"
|
|
56
|
+
"dotenv": ">=16.0.0"
|
|
66
57
|
},
|
|
67
58
|
"peerDependenciesMeta": {
|
|
68
59
|
"@adobe/aio-lib-core-auth": {
|
|
69
|
-
"optional":
|
|
60
|
+
"optional": true
|
|
70
61
|
},
|
|
71
62
|
"@adobe/aio-lib-db": {
|
|
72
|
-
"optional":
|
|
63
|
+
"optional": true
|
|
73
64
|
},
|
|
74
65
|
"@adobe/aio-lib-ims": {
|
|
75
|
-
"optional":
|
|
66
|
+
"optional": true
|
|
67
|
+
},
|
|
68
|
+
"dotenv": {
|
|
69
|
+
"optional": true
|
|
76
70
|
}
|
|
77
71
|
},
|
|
78
72
|
"dependencies": {
|
package/scripts/setup.js
CHANGED
|
@@ -553,6 +553,35 @@ function satisfiesFloor (currentSpec, floorSpec) {
|
|
|
553
553
|
return compareVersions(cur, min) >= 0
|
|
554
554
|
}
|
|
555
555
|
|
|
556
|
+
/**
|
|
557
|
+
* Re-run `npm install` after bumping host package.json so the upgraded
|
|
558
|
+
* versions actually land in node_modules. Without this, the consumer
|
|
559
|
+
* would have to run `npm install` manually after our postinstall.
|
|
560
|
+
*
|
|
561
|
+
* Recursion is prevented by setting COMMERCE_ADMIN_MANAGEMENT_SKIP_SETUP=1
|
|
562
|
+
* in the child npm's env — main() bails immediately when it sees that
|
|
563
|
+
* flag, so the inner install doesn't loop back through this code.
|
|
564
|
+
*
|
|
565
|
+
* Failures here don't throw — we print a fallback hint and let the
|
|
566
|
+
* outer install report success. The consumer can re-run `npm install`
|
|
567
|
+
* manually if our auto-invocation can't reach the network.
|
|
568
|
+
*/
|
|
569
|
+
function autoRunNpmInstall (projectRoot) {
|
|
570
|
+
const { execSync } = require('child_process')
|
|
571
|
+
console.log('[@adobedjangir/commerce-admin-management] running `npm install` to apply the bumped versions…')
|
|
572
|
+
try {
|
|
573
|
+
execSync('npm install --no-audit --no-fund --silent --legacy-peer-deps', {
|
|
574
|
+
cwd: projectRoot,
|
|
575
|
+
stdio: 'inherit',
|
|
576
|
+
env: { ...process.env, COMMERCE_ADMIN_MANAGEMENT_SKIP_SETUP: '1' }
|
|
577
|
+
})
|
|
578
|
+
console.log('[@adobedjangir/commerce-admin-management] dependency upgrade complete ✓')
|
|
579
|
+
} catch (e) {
|
|
580
|
+
console.warn('[@adobedjangir/commerce-admin-management] auto-install failed. Run `npm install` manually.')
|
|
581
|
+
console.warn(` reason: ${e.message}`)
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
556
585
|
function ensureHostDeps (projectRoot) {
|
|
557
586
|
const pkgPath = path.join(projectRoot, 'package.json')
|
|
558
587
|
if (!fs.existsSync(pkgPath)) {
|
|
@@ -606,9 +635,12 @@ function setupAppConfig (projectRoot) {
|
|
|
606
635
|
}
|
|
607
636
|
|
|
608
637
|
function main () {
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
638
|
+
// Two opt-outs:
|
|
639
|
+
// - CONFIGURATION_MANAGEMENT_SKIP_SETUP: legacy name kept for compat.
|
|
640
|
+
// - COMMERCE_ADMIN_MANAGEMENT_SKIP_SETUP: set by autoRunNpmInstall to
|
|
641
|
+
// prevent the recursive postinstall from re-running this code.
|
|
642
|
+
if (process.env.CONFIGURATION_MANAGEMENT_SKIP_SETUP === '1') return
|
|
643
|
+
if (process.env.COMMERCE_ADMIN_MANAGEMENT_SKIP_SETUP === '1') return
|
|
612
644
|
|
|
613
645
|
const projectRoot = resolveProjectRoot()
|
|
614
646
|
if (!projectRoot) {
|
|
@@ -628,16 +660,20 @@ function main () {
|
|
|
628
660
|
|
|
629
661
|
// Bump host package.json so React-18 + Spectrum-4 peers are satisfied
|
|
630
662
|
// without the consumer running a long `npm install --save react@^18 ...`
|
|
631
|
-
// chant.
|
|
632
|
-
//
|
|
633
|
-
//
|
|
663
|
+
// chant. If anything was bumped, automatically re-run npm install so the
|
|
664
|
+
// new versions actually land in node_modules. A guard env var prevents
|
|
665
|
+
// the recursive postinstall from re-running this step.
|
|
634
666
|
const deps = ensureHostDeps(projectRoot)
|
|
635
667
|
if (deps.changed) {
|
|
636
668
|
console.log('[@adobedjangir/commerce-admin-management] bumped host package.json:')
|
|
637
669
|
for (const b of deps.bumped) {
|
|
638
670
|
console.log(` • ${b.name}: ${b.was} → ${b.now}`)
|
|
639
671
|
}
|
|
640
|
-
|
|
672
|
+
if (process.env.COMMERCE_ADMIN_MANAGEMENT_NO_AUTO_INSTALL === '1') {
|
|
673
|
+
console.log('[@adobedjangir/commerce-admin-management] auto-install disabled; run `npm install` to apply.')
|
|
674
|
+
} else {
|
|
675
|
+
autoRunNpmInstall(projectRoot)
|
|
676
|
+
}
|
|
641
677
|
}
|
|
642
678
|
|
|
643
679
|
const app = setupAppConfig(projectRoot)
|