@adobedjangir/commerce-admin-management 0.0.7 → 0.0.9

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 +57 -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.9",
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,68 @@ 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
+ // exc-runtime.js's only job is to side-effect-import the Adobe Experience
373
+ // Cloud Shell runtime so the bootstrap can call init(...) afterwards.
374
+ // The bootstrap wraps `require('./exc-runtime')` in try/catch — if this
375
+ // import fails (e.g. when running outside the shell) bootstrapRaw() takes
376
+ // over. So this file is intentionally minimal.
377
+ return `/*
378
+ Copyright 2025 Adobe. All rights reserved.
379
+ Licensed under the Apache License, Version 2.0
380
+ */
381
+
382
+ import '@adobe/exc-app'
383
+ `
384
+ }
385
+
386
+ function faviconSvgContents () {
387
+ // Inline SVG gear — small enough to inline, doesn't pull in a binary asset.
388
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#1473e6">
389
+ <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"/>
390
+ </svg>
391
+ `
392
+ }
393
+
350
394
  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
- }
395
+ const webSrcRoot = path.join(projectRoot, 'web-src')
396
+ const webSrcDir = path.join(webSrcRoot, 'src')
397
+ // No longer bail when the directory is missing — create it. Fresh aio
398
+ // app templates without a backend-ui extension don't ship a web-src/,
399
+ // and our package depends on one.
400
+ ensureDir(webSrcDir)
356
401
 
357
402
  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()),
403
+ html: writeIfMissing(path.join(webSrcRoot, 'index.html'), indexHtmlContents()),
404
+ favicon: writeIfMissing(path.join(webSrcRoot, 'favicon.svg'), faviconSvgContents()),
405
+ excRuntime: writeIfMissing(path.join(webSrcDir, 'exc-runtime.js'), excRuntimeContents()),
406
+ bootstrap: writeBootstrap(path.join(webSrcDir, 'index.js'), bootstrapContents()),
407
+ nav: writeIfMissing(path.join(webSrcDir, 'nav.json'), navJsonContents()),
408
+ pages: writeIfMissing(path.join(webSrcDir, 'pages', 'index.js'), pagesIndexContents()),
361
409
  // Default starter page — only created on first install, never overwritten,
362
410
  // and never auto-removed even if the dev deletes the registry entry.
363
- welcome: writeIfMissing(path.join(webSrcDir, 'pages', 'Welcome.js'), welcomePageContents())
411
+ welcome: writeIfMissing(path.join(webSrcDir, 'pages', 'Welcome.js'), welcomePageContents())
364
412
  }
365
413
  const changed = Object.values(results).some((r) => r.changed)
366
414
  return { changed, results }