@adobedjangir/commerce-admin-management 0.0.7 → 0.0.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/setup.js +59 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobedjangir/commerce-admin-management",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
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
@@ -347,20 +347,70 @@ function writeBootstrap (filePath, contents) {
347
347
  return { changed: true, reason: 'written' }
348
348
  }
349
349
 
350
+ function indexHtmlContents () {
351
+ return `<!DOCTYPE html>
352
+ <html lang="en">
353
+ <head>
354
+ <meta charset="UTF-8" />
355
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no" />
356
+ <meta name="theme-color" content="#1473e6" />
357
+ <meta http-equiv="X-UA-Compatible" content="ie=edge" />
358
+ <link rel="icon" type="image/svg+xml" href="./favicon.svg" />
359
+ <link rel="apple-touch-icon" href="./favicon.svg" />
360
+ <title>Commerce Admin Management</title>
361
+ </head>
362
+ <body>
363
+ <noscript>You need to enable JavaScript to run this app.</noscript>
364
+ <div id="root"></div>
365
+ <script src="./src/index.js" async type="module"></script>
366
+ </body>
367
+ </html>
368
+ `
369
+ }
370
+
371
+ function excRuntimeContents () {
372
+ // Minimal exc-runtime shim — the package's bootstrap requires it. aio's
373
+ // template ships a similar file. We keep this thin so it stays current
374
+ // even if Adobe's exc-runtime evolves; the meaningful glue lives in
375
+ // index.js (also scaffolded by this script).
376
+ return `/*
377
+ Copyright 2025 Adobe. All rights reserved.
378
+ Licensed under the Apache License, Version 2.0
379
+ */
380
+
381
+ // Loaded by index.js when running inside the Adobe Experience Cloud Shell.
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'
385
+ `
386
+ }
387
+
388
+ function faviconSvgContents () {
389
+ // Inline SVG gear — small enough to inline, doesn't pull in a binary asset.
390
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#1473e6">
391
+ <path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 0 0 .12-.61l-1.92-3.32a.488.488 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 0 0-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94 0 .31.02.64.07.94l-2.03 1.58a.49.49 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/>
392
+ </svg>
393
+ `
394
+ }
395
+
350
396
  function setupWebSrc (projectRoot) {
351
- const webSrcDir = path.join(projectRoot, 'web-src', 'src')
352
- const hasShell = fs.existsSync(path.join(projectRoot, 'web-src'))
353
- if (!hasShell) {
354
- return { changed: false, reason: 'no-web-src' }
355
- }
397
+ const webSrcRoot = path.join(projectRoot, 'web-src')
398
+ const webSrcDir = path.join(webSrcRoot, 'src')
399
+ // No longer bail when the directory is missing — create it. Fresh aio
400
+ // app templates without a backend-ui extension don't ship a web-src/,
401
+ // and our package depends on one.
402
+ ensureDir(webSrcDir)
356
403
 
357
404
  const results = {
358
- bootstrap: writeBootstrap(path.join(webSrcDir, 'index.js'), bootstrapContents()),
359
- nav: writeIfMissing(path.join(webSrcDir, 'nav.json'), navJsonContents()),
360
- pages: writeIfMissing(path.join(webSrcDir, 'pages', 'index.js'), pagesIndexContents()),
405
+ html: writeIfMissing(path.join(webSrcRoot, 'index.html'), indexHtmlContents()),
406
+ favicon: writeIfMissing(path.join(webSrcRoot, 'favicon.svg'), faviconSvgContents()),
407
+ excRuntime: writeIfMissing(path.join(webSrcDir, 'exc-runtime.js'), excRuntimeContents()),
408
+ bootstrap: writeBootstrap(path.join(webSrcDir, 'index.js'), bootstrapContents()),
409
+ nav: writeIfMissing(path.join(webSrcDir, 'nav.json'), navJsonContents()),
410
+ pages: writeIfMissing(path.join(webSrcDir, 'pages', 'index.js'), pagesIndexContents()),
361
411
  // Default starter page — only created on first install, never overwritten,
362
412
  // and never auto-removed even if the dev deletes the registry entry.
363
- welcome: writeIfMissing(path.join(webSrcDir, 'pages', 'Welcome.js'), welcomePageContents())
413
+ welcome: writeIfMissing(path.join(webSrcDir, 'pages', 'Welcome.js'), welcomePageContents())
364
414
  }
365
415
  const changed = Object.values(results).some((r) => r.changed)
366
416
  return { changed, results }