cloudcommerce 0.22.0 → 0.22.1

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 (72) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/ecomplus-stores/iluminim/functions/many/package.json +3 -3
  3. package/ecomplus-stores/iluminim/functions/ssr/package.json +6 -6
  4. package/ecomplus-stores/iluminim/functions/with-apps/package.json +3 -3
  5. package/ecomplus-stores/iluminim/package.json +1 -1
  6. package/package.json +6 -6
  7. package/packages/api/package.json +1 -1
  8. package/packages/apps/affilate-program/package.json +1 -1
  9. package/packages/apps/correios/package.json +1 -1
  10. package/packages/apps/custom-payment/package.json +1 -1
  11. package/packages/apps/custom-shipping/package.json +1 -1
  12. package/packages/apps/datafrete/package.json +1 -1
  13. package/packages/apps/discounts/package.json +1 -1
  14. package/packages/apps/emails/package.json +1 -1
  15. package/packages/apps/fb-conversions/package.json +2 -2
  16. package/packages/apps/flash-courier/package.json +1 -1
  17. package/packages/apps/frenet/package.json +1 -1
  18. package/packages/apps/galaxpay/package.json +1 -1
  19. package/packages/apps/google-analytics/package.json +1 -1
  20. package/packages/apps/jadlog/package.json +1 -1
  21. package/packages/apps/loyalty-points/package.json +1 -1
  22. package/packages/apps/melhor-envio/package.json +1 -1
  23. package/packages/apps/mercadopago/package.json +1 -1
  24. package/packages/apps/pagarme/package.json +1 -1
  25. package/packages/apps/paghiper/package.json +1 -1
  26. package/packages/apps/pix/package.json +1 -1
  27. package/packages/apps/tiny-erp/package.json +1 -1
  28. package/packages/apps/webhooks/package.json +1 -1
  29. package/packages/cli/lib/build.js +15 -4
  30. package/packages/cli/lib/cli.js +3 -3
  31. package/packages/cli/package.json +1 -1
  32. package/packages/cli/src/build.ts +17 -4
  33. package/packages/cli/src/cli.ts +3 -3
  34. package/packages/config/package.json +1 -1
  35. package/packages/emails/package.json +1 -1
  36. package/packages/events/package.json +1 -1
  37. package/packages/feeds/package.json +1 -1
  38. package/packages/firebase/package.json +1 -1
  39. package/packages/i18n/lib/dirname.js +3 -1
  40. package/packages/i18n/lib/dirname.js.map +1 -1
  41. package/packages/i18n/package.json +1 -1
  42. package/packages/i18n/scripts/build-txt.mjs +2 -1
  43. package/packages/i18n/src/dirname.ts +3 -1
  44. package/packages/modules/package.json +1 -1
  45. package/packages/passport/package.json +1 -1
  46. package/packages/ssr/package.json +2 -2
  47. package/packages/storefront/astro.config.mjs +2 -1
  48. package/packages/storefront/dist/client/_astro/{_...slug_.c85b8978.css → _...slug_.2f4f6929.css} +1 -1
  49. package/packages/storefront/dist/client/assets/.gitkeep +2 -0
  50. package/packages/storefront/dist/client/sw.js +1 -1
  51. package/packages/storefront/dist/server/chunks/{_...7e1df40a.mjs → _...d496b072.mjs} +3 -3
  52. package/packages/storefront/dist/server/chunks/{account@_@astro.5f1dba7a.mjs → account@_@astro.1b311a3d.mjs} +3 -3
  53. package/packages/storefront/dist/server/chunks/{astro.2d3ebf0f.mjs → astro.e0968ba7.mjs} +201 -156
  54. package/packages/storefront/dist/server/chunks/{endpoint@_@js.80de0568.mjs → endpoint@_@js.631ff6c5.mjs} +3 -3
  55. package/packages/storefront/dist/server/chunks/{fallback@_@astro.02a45b47.mjs → fallback@_@astro.12cf85ba.mjs} +3 -3
  56. package/packages/storefront/dist/server/chunks/{index@_@astro.23b50301.mjs → index@_@astro.69eb5e8a.mjs} +3 -3
  57. package/packages/storefront/dist/server/chunks/{index@_@astro.7cb07e52.mjs → index@_@astro.a20d91aa.mjs} +3 -3
  58. package/packages/storefront/dist/server/chunks/pages/{_...slug_.astro.4358f614.mjs → _...slug_.astro.c93fc36d.mjs} +2 -2
  59. package/packages/storefront/dist/server/chunks/pages/{account.astro.afae5a12.mjs → account.astro.0003ca94.mjs} +1 -1
  60. package/packages/storefront/dist/server/chunks/pages/{endpoint.js.60fd21aa.mjs → endpoint.js.630b1212.mjs} +1 -1
  61. package/packages/storefront/dist/server/chunks/pages/{fallback.astro.e5566925.mjs → fallback.astro.58c7e581.mjs} +2 -2
  62. package/packages/storefront/dist/server/chunks/pages/{index.astro.5bc6b9d8.mjs → index.astro.6efe85be.mjs} +2 -2
  63. package/packages/storefront/dist/server/entry.mjs +9 -9
  64. package/packages/storefront/dist/server/renderers.mjs +2 -2
  65. package/packages/storefront/package.json +5 -5
  66. package/packages/types/package.json +1 -1
  67. package/packages/storefront/dist/client/assets/cms-preview.css +0 -274
  68. package/packages/storefront/dist/client/assets/cms.css +0 -114
  69. package/packages/storefront/dist/client/assets/cvv.png +0 -0
  70. package/packages/storefront/dist/client/assets/img-placeholder.png +0 -0
  71. package/packages/storefront/dist/client/assets/payments.png +0 -0
  72. package/packages/storefront/dist/client/assets/ssl-safe.png +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.22.1](https://github.com/ecomplus/cloud-commerce/compare/v0.22.0...v0.22.1) (2023-07-24)
6
+
7
+
8
+ ### Features
9
+
10
+ * **cli:** Check node_modules and install SSR dependencies on dev command if needed ([b60e94b](https://github.com/ecomplus/cloud-commerce/commit/b60e94b0315bf041392e2c322133d0cf77bd0d19))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **cli:** Create `functions/.env` with Store ID from config.json on first dev command ([17bf92b](https://github.com/ecomplus/cloud-commerce/commit/17bf92b67bfd29de57a2b1c0950c073b192370ca))
16
+ * **deps:** Update non-major dependencies ([#197](https://github.com/ecomplus/cloud-commerce/issues/197)) ([15715b1](https://github.com/ecomplus/cloud-commerce/commit/15715b1b587db364de627a35aafce4b34bb1c2ee))
17
+ * **fb-conversions:** Update dependency facebook-nodejs-business-sdk to v17 ([#199](https://github.com/ecomplus/cloud-commerce/issues/199)) ([5cac54e](https://github.com/ecomplus/cloud-commerce/commit/5cac54ee19b33d8f6b1e0ca9a6bab80decd99af6))
18
+ * **storefront:** Update dependency astro to v2.9.2 ([#196](https://github.com/ecomplus/cloud-commerce/issues/196)) ([7383674](https://github.com/ecomplus/cloud-commerce/commit/7383674c5980239d81bfa031066c09e948dc23d8))
19
+
5
20
  ## [0.22.0](https://github.com/ecomplus/cloud-commerce/compare/v0.21.0...v0.22.0) (2023-07-21)
6
21
 
7
22
 
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "main": "index.js",
17
17
  "dependencies": {
18
- "@cloudcommerce/feeds": "^0.21.0",
19
- "@cloudcommerce/firebase": "^0.21.0",
20
- "@cloudcommerce/passport": "^0.21.0"
18
+ "@cloudcommerce/feeds": "^0.22.0",
19
+ "@cloudcommerce/firebase": "^0.22.0",
20
+ "@cloudcommerce/passport": "^0.22.0"
21
21
  }
22
22
  }
@@ -17,14 +17,14 @@
17
17
  },
18
18
  "main": "index.js",
19
19
  "dependencies": {
20
- "@cloudcommerce/api": "^0.21.0",
21
- "@cloudcommerce/firebase": "^0.21.0",
22
- "@cloudcommerce/ssr": "^0.21.0"
20
+ "@cloudcommerce/api": "^0.22.0",
21
+ "@cloudcommerce/firebase": "^0.22.0",
22
+ "@cloudcommerce/ssr": "^0.22.0"
23
23
  },
24
24
  "devDependencies": {
25
- "@cloudcommerce/i18n": "^0.21.0",
26
- "@cloudcommerce/storefront": "^0.21.0",
27
- "@cloudcommerce/types": "^0.21.0",
25
+ "@cloudcommerce/i18n": "^0.22.0",
26
+ "@cloudcommerce/storefront": "^0.22.0",
27
+ "@cloudcommerce/types": "^0.22.0",
28
28
  "@fontsource-variable/heebo": "^5.0.5",
29
29
  "@iconify-json/carbon": "^1.1.18"
30
30
  }
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "main": "index.js",
17
17
  "dependencies": {
18
- "@cloudcommerce/events": "^0.21.0",
19
- "@cloudcommerce/firebase": "^0.21.0",
20
- "@cloudcommerce/modules": "^0.21.0"
18
+ "@cloudcommerce/events": "^0.22.0",
19
+ "@cloudcommerce/firebase": "^0.22.0",
20
+ "@cloudcommerce/modules": "^0.22.0"
21
21
  }
22
22
  }
@@ -23,6 +23,6 @@
23
23
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
24
24
  },
25
25
  "dependencies": {
26
- "@cloudcommerce/cli": "^0.21.0"
26
+ "@cloudcommerce/cli": "^0.22.0"
27
27
  }
28
28
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloudcommerce",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "Open fair-code headless commerce platform: API-first, microservices based, event driven and cloud native",
6
6
  "main": "packages/api/lib/index.js",
7
7
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
@@ -19,9 +19,9 @@
19
19
  "@commitlint/cli": "^17.6.7",
20
20
  "@commitlint/config-conventional": "^17.6.7",
21
21
  "@commitlint/rules": "^17.6.7",
22
- "@types/node": "^18.16.19",
23
- "@typescript-eslint/eslint-plugin": "^5.62.0",
24
- "@typescript-eslint/parser": "^5.62.0",
22
+ "@types/node": "^18.17.0",
23
+ "@typescript-eslint/eslint-plugin": "^6.1.0",
24
+ "@typescript-eslint/parser": "^6.1.0",
25
25
  "eslint": "^8.45.0",
26
26
  "eslint-config-airbnb-base": "^15.0.0",
27
27
  "eslint-plugin-import": "^2.27.5",
@@ -29,10 +29,10 @@
29
29
  "husky": "^8.0.3",
30
30
  "standard-version": "^9.5.0",
31
31
  "ts-node": "^10.9.1",
32
- "turbo": "^1.10.8",
32
+ "turbo": "^1.10.9",
33
33
  "typescript": "~5.0.4",
34
34
  "uglify-js": "^3.17.4",
35
- "vite": "^4.4.4",
35
+ "vite": "^4.4.6",
36
36
  "vitest": "^0.33.0",
37
37
  "zx": "^7.2.3"
38
38
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/api",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce APIs client/adapter",
6
6
  "main": "lib/api.js",
7
7
  "types": "lib/api.d.ts",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-affilate-program",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app for simple affiliate program",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-correios",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app for Correios shipping calculation",
6
6
  "main": "lib/correios.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-custom-payment",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app for simple custom payment methods",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-custom-shipping",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app for custom shipping methods",
6
6
  "main": "lib/custom-shipping.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-datafrete",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Datafrete shipping gateway ",
6
6
  "main": "lib/datafrete.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-discounts",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app for complex discount rules",
6
6
  "main": "lib/discounts.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-emails",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce default transactional email app",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-fb-conversions",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app to send carts/orders to Facebook Conversions API",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@cloudcommerce/api": "workspace:*",
23
23
  "@cloudcommerce/firebase": "workspace:*",
24
- "facebook-nodejs-business-sdk": "^16.0.2",
24
+ "facebook-nodejs-business-sdk": "^17.0.1",
25
25
  "firebase-admin": "^11.10.1",
26
26
  "firebase-functions": "^4.4.1"
27
27
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-flash-courier",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Flash Courier",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-frenet",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app for Frenet shipping calculation",
6
6
  "main": "lib/frenet.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-galaxpay",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Galax Pay for recurring payments",
6
6
  "main": "lib/galaxpay.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-google-analytics",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app to send carts/orders events to GA Measurement Protocol",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-jadlog",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app for Jadlog shipping calculation",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-loyalty-points",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app to handle simple loyalty points programs",
6
6
  "main": "lib/loyalty-points.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-melhor-envio",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Melhor Envio",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-mercadopago",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Mercado Pago",
6
6
  "main": "lib/mercadopago.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-pagarme",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Pagar.me",
6
6
  "main": "lib/pagarme.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-paghiper",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate PagHiper",
6
6
  "main": "lib/paghiper.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-pix",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Pix API (Bacen)",
6
6
  "main": "lib/pix.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-tiny-erp",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app for Tiny ERP",
6
6
  "main": "lib/tiny-erp.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-webhooks",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app for general order webhooks",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -1,22 +1,33 @@
1
1
  import { join as joinPath } from 'node:path';
2
2
  import { $, fs } from 'zx';
3
3
 
4
- const copyFunctionsConfig = async () => {
4
+ const copyFunctionsConfig = async (isDev = false) => {
5
5
  const functionsDir = joinPath(process.cwd(), 'functions');
6
+ if (isDev && !fs.existsSync(joinPath(functionsDir, '.env'))) {
7
+ try {
8
+ const { storeId } = JSON.parse(fs.readFileSync(joinPath(functionsDir, 'config.json'), 'utf8'));
9
+ await fs.writeFile(joinPath(functionsDir, '.env'), `ECOM_STORE_ID=${storeId}\n`);
10
+ } catch {
11
+ //
12
+ }
13
+ }
6
14
  const filesToCopy = ['.env', 'config.json', 'ssr/content/settings.json'];
7
15
  const dirents = await fs.readdir(functionsDir, { withFileTypes: true });
16
+ /* eslint-disable no-await-in-loop */
8
17
  for (let i = 0; i < dirents.length; i++) {
9
18
  if (dirents[i].isDirectory() && dirents[i].name.charAt(0) !== '.') {
10
19
  const codebase = dirents[i].name;
11
20
  const codebaseDir = joinPath(functionsDir, codebase);
12
- // eslint-disable-next-line no-await-in-loop
21
+ const isSSR = codebase === 'ssr';
13
22
  await fs.ensureDir(joinPath(codebaseDir, 'content'));
23
+ if (isDev && isSSR && !fs.existsSync(joinPath(functionsDir, 'node_modules'))) {
24
+ await $`npm --prefix "functions/ssr" i`;
25
+ }
14
26
  for (let ii = 0; ii < filesToCopy.length; ii++) {
15
27
  const fileToCopy = filesToCopy[ii];
16
- if (codebase !== 'ssr' || !fileToCopy.includes('ssr/')) {
28
+ if (!isSSR || !fileToCopy.includes('ssr/')) {
17
29
  const srcPath = joinPath(functionsDir, fileToCopy);
18
30
  if (fs.existsSync(srcPath) && srcPath) {
19
- // eslint-disable-next-line no-await-in-loop
20
31
  await fs.copy(srcPath, joinPath(codebaseDir, fileToCopy.replace('ssr/', '')));
21
32
  }
22
33
  }
@@ -1,4 +1,4 @@
1
- import url from 'node:url';
1
+ import { fileURLToPath } from 'node:url';
2
2
  import path from 'node:path';
3
3
  import {
4
4
  $, argv, fs, echo, chalk,
@@ -11,7 +11,7 @@ import createGhSecrets from './setup-gh.js';
11
11
  const { FIREBASE_PROJECT_ID, GOOGLE_APPLICATION_CREDENTIALS, GITHUB_TOKEN } = process.env;
12
12
  // https://github.com/google/zx/issues/124
13
13
  process.env.FORCE_COLOR = '3';
14
- const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
14
+ const __dirname = fileURLToPath(new URL('.', import.meta.url));
15
15
  const pwd = process.cwd();
16
16
  let projectId = FIREBASE_PROJECT_ID;
17
17
  if (projectId) {
@@ -146,7 +146,7 @@ Finish by saving the following secrets to your GitHub repository:
146
146
  `;
147
147
  }
148
148
  if (argv._.includes('dev') || !argv._.length) {
149
- await prepareCodebases();
149
+ await prepareCodebases(true);
150
150
  return $`npm --prefix "${path.join(pwd, 'functions/ssr')}" run dev`;
151
151
  }
152
152
  return $`echo 'Hello from @cloudcommerce/cli'`;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/cli",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce CLI tools",
6
6
  "bin": {
7
7
  "cloudcommerce": "./bin/run.mjs"
@@ -1,22 +1,35 @@
1
1
  import { join as joinPath } from 'node:path';
2
2
  import { $, fs } from 'zx';
3
3
 
4
- const copyFunctionsConfig = async () => {
4
+ const copyFunctionsConfig = async (isDev = false) => {
5
5
  const functionsDir = joinPath(process.cwd(), 'functions');
6
+ if (isDev && !fs.existsSync(joinPath(functionsDir, '.env'))) {
7
+ try {
8
+ const { storeId } = JSON.parse(
9
+ fs.readFileSync(joinPath(functionsDir, 'config.json'), 'utf8'),
10
+ );
11
+ await fs.writeFile(joinPath(functionsDir, '.env'), `ECOM_STORE_ID=${storeId}\n`);
12
+ } catch {
13
+ //
14
+ }
15
+ }
6
16
  const filesToCopy = ['.env', 'config.json', 'ssr/content/settings.json'];
7
17
  const dirents = await fs.readdir(functionsDir, { withFileTypes: true });
18
+ /* eslint-disable no-await-in-loop */
8
19
  for (let i = 0; i < dirents.length; i++) {
9
20
  if (dirents[i].isDirectory() && dirents[i].name.charAt(0) !== '.') {
10
21
  const codebase = dirents[i].name;
11
22
  const codebaseDir = joinPath(functionsDir, codebase);
12
- // eslint-disable-next-line no-await-in-loop
23
+ const isSSR = codebase === 'ssr';
13
24
  await fs.ensureDir(joinPath(codebaseDir, 'content'));
25
+ if (isDev && isSSR && !fs.existsSync(joinPath(functionsDir, 'node_modules'))) {
26
+ await $`npm --prefix "functions/ssr" i`;
27
+ }
14
28
  for (let ii = 0; ii < filesToCopy.length; ii++) {
15
29
  const fileToCopy = filesToCopy[ii];
16
- if (codebase !== 'ssr' || !fileToCopy.includes('ssr/')) {
30
+ if (!isSSR || !fileToCopy.includes('ssr/')) {
17
31
  const srcPath = joinPath(functionsDir, fileToCopy);
18
32
  if (fs.existsSync(srcPath) && srcPath) {
19
- // eslint-disable-next-line no-await-in-loop
20
33
  await fs.copy(
21
34
  srcPath,
22
35
  joinPath(codebaseDir, fileToCopy.replace('ssr/', '')),
@@ -1,4 +1,4 @@
1
- import url from 'node:url';
1
+ import { fileURLToPath } from 'node:url';
2
2
  import path from 'node:path';
3
3
  import {
4
4
  $,
@@ -21,7 +21,7 @@ const {
21
21
  // https://github.com/google/zx/issues/124
22
22
  process.env.FORCE_COLOR = '3';
23
23
 
24
- const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
24
+ const __dirname = fileURLToPath(new URL('.', import.meta.url));
25
25
  const pwd = process.cwd();
26
26
 
27
27
  let projectId = FIREBASE_PROJECT_ID;
@@ -179,7 +179,7 @@ Finish by saving the following secrets to your GitHub repository:
179
179
  }
180
180
 
181
181
  if (argv._.includes('dev') || !argv._.length) {
182
- await prepareCodebases();
182
+ await prepareCodebases(true);
183
183
  return $`npm --prefix "${path.join(pwd, 'functions/ssr')}" run dev`;
184
184
  }
185
185
  return $`echo 'Hello from @cloudcommerce/cli'`;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/config",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce base config",
6
6
  "main": "lib/config.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/emails",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce email sender",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/events",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce app events",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/feeds",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce catalog feeds",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/firebase",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce on Firebase",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -1,2 +1,4 @@
1
- export default new URL('.', import.meta.url).pathname;
1
+ import { fileURLToPath } from 'node:url';
2
+
3
+ export default fileURLToPath(new URL('.', import.meta.url));
2
4
  // # sourceMappingURL=dirname.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dirname.js","sourceRoot":"","sources":["../src/dirname.ts"],"names":[],"mappings":"AAAA,eAAe,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC"}
1
+ {"version":3,"file":"dirname.js","sourceRoot":"","sources":["../src/dirname.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAe,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/i18n",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce i18n",
6
6
  "main": "lib/all.js",
7
7
  "exports": {
@@ -2,9 +2,10 @@
2
2
  /* eslint-disable no-console, no-await-in-loop, import/no-unresolved */
3
3
  /* global $ */
4
4
  import 'zx/globals';
5
+ import { fileURLToPath } from 'node:url';
5
6
  import all from '../lib/all.js';
6
7
 
7
- const __dirname = new URL('.', import.meta.url).pathname;
8
+ const __dirname = fileURLToPath(new URL('.', import.meta.url));
8
9
  $.cwd = __dirname;
9
10
  $.verbose = false;
10
11
 
@@ -1 +1,3 @@
1
- export default new URL('.', import.meta.url).pathname;
1
+ import { fileURLToPath } from 'node:url';
2
+
3
+ export default fileURLToPath(new URL('.', import.meta.url));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/modules",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce modules API",
6
6
  "main": "lib/index.cjs",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/passport",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce customers authentication (passport) API",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/ssr",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "description": "E-Com Plus Cloud Commerce storefront SSR",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -30,7 +30,7 @@
30
30
  "@ecomplus/utils": "1.5.0-rc.5",
31
31
  "@headlessui/vue": "^1.7.14",
32
32
  "@vueuse/core": "10.2.1",
33
- "astro": "2.9.0",
33
+ "astro": "2.9.2",
34
34
  "firebase-admin": "^11.10.1",
35
35
  "firebase-functions": "^4.4.1",
36
36
  "semver": "^7.5.4",
@@ -1,3 +1,4 @@
1
+ import { fileURLToPath } from 'node:url';
1
2
  import { lstatSync, readFileSync } from 'node:fs';
2
3
  import { join as joinPath } from 'node:path';
3
4
  import * as dotenv from 'dotenv';
@@ -10,7 +11,7 @@ import AstroPWA from '@vite-pwa/astro';
10
11
  import dictionaryDir from '@cloudcommerce/i18n/lib/dirname';
11
12
  import getConfig from './config/storefront.config.mjs';
12
13
 
13
- const __dirname = new URL('.', import.meta.url).pathname;
14
+ const __dirname = fileURLToPath(new URL('.', import.meta.url));
14
15
  dotenv.config();
15
16
 
16
17
  const isSSG = process.env.BUILD_OUTPUT === 'static';