cloudcommerce 2.0.9 → 2.2.0

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 (156) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/LICENSE +21 -0
  3. package/README.md +3 -7
  4. package/action.yml +70 -6
  5. package/ecomplus-stores/barra-doce/.github/workflows/build-and-deploy.yml +4 -2
  6. package/ecomplus-stores/barra-doce/.vscode/settings.json +8 -1
  7. package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
  8. package/ecomplus-stores/barra-doce/functions/ssr/package.json +6 -6
  9. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopHeader.vue +5 -9
  10. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopHeaderMenu.vue +6 -3
  11. package/ecomplus-stores/barra-doce/functions/ssr/src/layouts/PageHeader.astro +2 -2
  12. package/ecomplus-stores/barra-doce/functions/ssr/src/pages/[...slug].astro +10 -2
  13. package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
  14. package/ecomplus-stores/barra-doce/package.json +2 -4
  15. package/ecomplus-stores/tia-sonia/.github/workflows/build-and-deploy.yml +4 -2
  16. package/ecomplus-stores/tia-sonia/.vscode/settings.json +7 -1
  17. package/ecomplus-stores/tia-sonia/package.json +0 -2
  18. package/package.json +8 -8
  19. package/packages/__skeleton/package.json +1 -1
  20. package/packages/api/lib/api.js +1 -1
  21. package/packages/api/lib/api.js.map +1 -1
  22. package/packages/api/package.json +2 -2
  23. package/packages/api/src/api.ts +1 -1
  24. package/packages/apps/affiliate-program/package.json +2 -2
  25. package/packages/apps/correios/package.json +2 -2
  26. package/packages/apps/custom-payment/package.json +2 -2
  27. package/packages/apps/custom-shipping/package.json +2 -2
  28. package/packages/apps/datafrete/package.json +2 -2
  29. package/packages/apps/discounts/package.json +2 -2
  30. package/packages/apps/emails/package.json +2 -2
  31. package/packages/apps/fb-conversions/package.json +2 -2
  32. package/packages/apps/flash-courier/package.json +2 -2
  33. package/packages/apps/frenet/package.json +2 -2
  34. package/packages/apps/galaxpay/package.json +2 -2
  35. package/packages/apps/google-analytics/package.json +2 -2
  36. package/packages/apps/jadlog/package.json +2 -2
  37. package/packages/apps/loyalty-points/package.json +2 -2
  38. package/packages/apps/mandae/package.json +2 -2
  39. package/packages/apps/melhor-envio/package.json +2 -2
  40. package/packages/apps/mercadopago/package.json +2 -2
  41. package/packages/apps/pagarme/package.json +2 -2
  42. package/packages/apps/pagarme-v5/package.json +2 -2
  43. package/packages/apps/paghiper/package.json +2 -2
  44. package/packages/apps/pix/package.json +2 -2
  45. package/packages/apps/tiny-erp/package.json +2 -2
  46. package/packages/apps/webhooks/package.json +2 -2
  47. package/packages/cli/ci/bunny-config-base.sh +225 -0
  48. package/packages/cli/ci/bunny-prepare-ab.sh +173 -0
  49. package/packages/cli/ci/bunny-remove-ab.sh +54 -0
  50. package/packages/cli/ci/bunny-setup.sh +103 -0
  51. package/packages/cli/lib/cli.js +6 -0
  52. package/packages/cli/package.json +3 -2
  53. package/packages/cli/src/cli.ts +6 -0
  54. package/packages/config/package.json +2 -2
  55. package/packages/emails/package.json +2 -2
  56. package/packages/eslint/base.eslintrc.cjs +2 -0
  57. package/packages/eslint/package.json +4 -4
  58. package/packages/eslint/storefront.eslintrc.cjs +0 -2
  59. package/packages/events/package.json +2 -2
  60. package/packages/feeds/package.json +2 -2
  61. package/packages/firebase/package.json +3 -3
  62. package/packages/i18n/package.json +2 -2
  63. package/packages/modules/package.json +2 -2
  64. package/packages/passport/package.json +2 -2
  65. package/packages/ssr/lib/lib/cron-ssr-save-views.js +76 -4
  66. package/packages/ssr/lib/lib/cron-ssr-save-views.js.map +1 -1
  67. package/packages/ssr/package.json +3 -3
  68. package/packages/ssr/src/lib/cron-ssr-save-views.ts +78 -4
  69. package/packages/storefront/client.d.ts +2 -0
  70. package/packages/storefront/dist/client/_astro/{AccountPage.9BlGHXT3.js → AccountPage.89hLh9p2.js} +1 -1
  71. package/packages/storefront/dist/client/_astro/{CartSidebar.55UgTcV0.js → CartSidebar.G25ZUnKP.js} +1 -1
  72. package/packages/storefront/dist/client/_astro/{ProductDetails.ENLKdSz_.js → ProductDetails.ntFWLjla.js} +1 -1
  73. package/packages/storefront/dist/client/_astro/{ProductShelf.lCBJky3e.js → ProductShelf.PPitdYxI.js} +1 -1
  74. package/packages/storefront/dist/client/_astro/{ProductShelf.CNf5JDrU.js → ProductShelf.xSxmHkTe.js} +1 -1
  75. package/packages/storefront/dist/client/_astro/{SearchModal.4osqtafp.js → SearchModal.R55jFaBZ.js} +1 -1
  76. package/packages/storefront/dist/client/_astro/{SearchShowcase.hg6TWrz3.js → SearchShowcase.I1PPFu_n.js} +1 -1
  77. package/packages/storefront/dist/client/_astro/{ShopHeader.xLMeJpqV.js → ShopHeader.OLf0l4Ot.js} +2 -2
  78. package/packages/storefront/dist/client/_astro/{_slug_.r344YGqG.css → _slug_.Hc-dqhcW.css} +1 -1
  79. package/packages/storefront/dist/client/_astro/customer-session.AcETMuhI.js +7 -0
  80. package/packages/storefront/dist/client/_astro/ecom-icon_12falx.png +0 -0
  81. package/packages/storefront/dist/client/_astro/ecom-icon_15pqnO.png +0 -0
  82. package/packages/storefront/dist/client/_astro/ecom-icon_t3guw.png +0 -0
  83. package/packages/storefront/dist/client/_astro/{firebase-app.cPMfoOsn.js → firebase-app.VduCDgof.js} +1 -1
  84. package/packages/storefront/dist/client/_astro/headphone_T2Jjc.avif +0 -0
  85. package/packages/storefront/dist/client/_astro/headphone_Z1CG18r.webp +0 -0
  86. package/packages/storefront/dist/client/_astro/{hoisted.J15ErMtK.js → hoisted.PxLuJZKI.js} +1 -1
  87. package/packages/storefront/dist/client/_astro/{hoisted.KYhwGfsv.js → hoisted.WBjTfX6e.js} +1 -1
  88. package/packages/storefront/dist/client/_astro/{hoisted.HGTzAuTI.js → hoisted.Wi6YpdWJ.js} +1 -1
  89. package/packages/storefront/dist/client/_astro/{index-dd468b12.D5s8VdAL.js → index-dd468b12.fl8bpn8l.js} +3 -3
  90. package/packages/storefront/dist/client/_astro/logo_1UBsBq.webp +0 -0
  91. package/packages/storefront/dist/client/_astro/logo_Z1K5PE9.png +0 -0
  92. package/packages/storefront/dist/client/_astro/logo_Z1KIIl1.avif +0 -0
  93. package/packages/storefront/dist/client/_astro/passion_LHbe9.webp +0 -0
  94. package/packages/storefront/dist/client/_astro/passion_Z23MeUb.avif +0 -0
  95. package/packages/storefront/dist/client/_astro/rect8589_1TtOHY.png +0 -0
  96. package/packages/storefront/dist/client/_astro/rect8589_1f5opX.webp +0 -0
  97. package/packages/storefront/dist/client/_astro/rect8589_IUskt.webp +0 -0
  98. package/packages/storefront/dist/client/_astro/rect8589_Uxfdf.png +0 -0
  99. package/packages/storefront/dist/client/_astro/rect8589_Z15uApA.png +0 -0
  100. package/packages/storefront/dist/client/_astro/rect8589_Z1Ap1Im.avif +0 -0
  101. package/packages/storefront/dist/client/_astro/rect8589_Z1JT1HB.webp +0 -0
  102. package/packages/storefront/dist/client/_astro/rect8589_ZY9mtN.avif +0 -0
  103. package/packages/storefront/dist/client/_astro/rect8589_tMFW0.avif +0 -0
  104. package/packages/storefront/dist/client/_astro/rect859_1TgQXS.avif +0 -0
  105. package/packages/storefront/dist/client/_astro/rect859_2Nm1z.avif +0 -0
  106. package/packages/storefront/dist/client/_astro/rect859_DIqwR.png +0 -0
  107. package/packages/storefront/dist/client/_astro/rect859_Z1IKDb2.png +0 -0
  108. package/packages/storefront/dist/client/_astro/rect859_Z29FI4V.webp +0 -0
  109. package/packages/storefront/dist/client/_astro/rect859_Z2kFHGk.avif +0 -0
  110. package/packages/storefront/dist/client/_astro/rect859_ZkpPFI.webp +0 -0
  111. package/packages/storefront/dist/client/_astro/rect859_jXzBi.png +0 -0
  112. package/packages/storefront/dist/client/_astro/rect859_x1l16.webp +0 -0
  113. package/packages/storefront/dist/client/_astro/rect89_1TSfW7.avif +0 -0
  114. package/packages/storefront/dist/client/_astro/rect89_Z1re32x.webp +0 -0
  115. package/packages/storefront/dist/client/_astro/{shopping-cart.ZdSCrjS6.js → shopping-cart.dJsZkyuD.js} +1 -1
  116. package/packages/storefront/dist/client/_astro/use-analytics.uqK_2k_k.js +1 -0
  117. package/packages/storefront/dist/client/_astro/{use-product-card.-9TsgDDW.js → use-product-card.WRVLjenR.js} +1 -1
  118. package/packages/storefront/dist/client/~fallback.html +98 -0
  119. package/packages/storefront/dist/client/~index.html +128 -0
  120. package/packages/storefront/dist/server/chunks/{CartSidebar_7UWmGIF6.mjs → CartSidebar_yYIzwp_R.mjs} +1 -1
  121. package/packages/storefront/dist/server/chunks/{SearchModal_MNdcYMws.mjs → SearchModal_GvRUZ6ce.mjs} +1 -1
  122. package/packages/storefront/dist/server/chunks/{_.._h5R83hoK.mjs → _.._Lq3r7hpv.mjs} +1 -1
  123. package/packages/storefront/dist/server/chunks/{_page__lWVlZyRe.mjs → _page__LqbeNfr1.mjs} +1 -1
  124. package/packages/storefront/dist/server/chunks/{account_jmelxnlw.mjs → account_4n4rpirV.mjs} +1 -1
  125. package/packages/storefront/dist/server/chunks/astro/{assets-service_xNulQtBO.mjs → assets-service_yXRChsFH.mjs} +11 -66
  126. package/packages/storefront/dist/server/chunks/{astro_tggR3S_9.mjs → astro_F4pl3toV.mjs} +1 -7
  127. package/packages/storefront/dist/server/chunks/{index_e3ytAL8v.mjs → index_SwXtE1IM.mjs} +1 -1
  128. package/packages/storefront/dist/server/chunks/{node_kUJIRL0c.mjs → node_Nzz44v5l.mjs} +1 -1
  129. package/packages/storefront/dist/server/chunks/pages/{__wihn0dYD.mjs → __z8Igc_-f.mjs} +102 -298
  130. package/packages/storefront/dist/server/chunks/pages/{_page__Sb1eYhpz.mjs → _page__-V1Q-Ymk.mjs} +3 -17
  131. package/packages/storefront/dist/server/chunks/pages/account_frSUn7gD.mjs +22 -0
  132. package/packages/storefront/dist/server/chunks/pages/{index_mQXYNYRg.mjs → index_QqJiJpFy.mjs} +4 -15
  133. package/packages/storefront/dist/server/chunks/pages/node_FoDIj_f7.mjs +257 -0
  134. package/packages/storefront/dist/server/chunks/pages/~fallback_t0lNhRm9.mjs +33 -0
  135. package/packages/storefront/dist/server/chunks/~fallback_EWqi0UyU.mjs +6 -0
  136. package/packages/storefront/dist/server/entry.mjs +8 -8
  137. package/packages/storefront/dist/server/images.dist.csv +30 -0
  138. package/packages/storefront/dist/server/images.src.csv +11 -0
  139. package/packages/storefront/dist/server/manifest_ZHJUD8_m.mjs +196 -0
  140. package/packages/storefront/dist/server/renderers.mjs +1 -1
  141. package/packages/storefront/dist/server/static-builds.csv +71 -0
  142. package/packages/storefront/package.json +4 -4
  143. package/packages/storefront/src/lib/layouts/BaseHead.astro +1 -0
  144. package/packages/storefront/src/lib/state/use-analytics.ts +24 -6
  145. package/packages/test-base/package.json +2 -2
  146. package/packages/types/package.json +2 -2
  147. package/LICENSE.md +0 -230
  148. package/ecomplus-stores/barra-doce/LICENSE.md +0 -230
  149. package/ecomplus-stores/tia-sonia/LICENSE.md +0 -230
  150. package/packages/storefront/dist/client/_astro/customer-session.hXdZh5Ii.js +0 -7
  151. package/packages/storefront/dist/client/_astro/use-analytics.tCrQbW8O.js +0 -1
  152. package/packages/storefront/dist/server/chunks/pages/account_-mULVQUB.mjs +0 -32
  153. package/packages/storefront/dist/server/chunks/pages/node_-qe5LuQh.mjs +0 -112
  154. package/packages/storefront/dist/server/chunks/pages/~fallback_ad_xyGHU.mjs +0 -58
  155. package/packages/storefront/dist/server/chunks/~fallback_EZqiEAFE.mjs +0 -6
  156. package/packages/storefront/dist/server/manifest_RrmXPEuL.mjs +0 -196
@@ -0,0 +1,173 @@
1
+ #!/bin/bash
2
+
3
+ if [ -z "$BUNNYNET_API_KEY" ]; then
4
+ echo "BUNNYNET_API_KEY env var must be set"
5
+ exit 1
6
+ fi
7
+ if [ $# -eq 0 ]; then
8
+ echo "Provide the Firebase project ID as the first argument"
9
+ exit 1
10
+ fi
11
+ if [ $# -eq 1 ]; then
12
+ echo "Provide the domain as the first argument"
13
+ exit 1
14
+ fi
15
+
16
+ project_id=$1
17
+ domain=$2
18
+ channel_url=$3
19
+
20
+ base_uri=""
21
+ additional_patterns=()
22
+
23
+ fetch_and_purge() {
24
+ local endpoint=$1
25
+ local response=$(curl --silent "$base_uri$endpoint")
26
+ local slugs=$(echo $response | jq -r '.result[].slug')
27
+
28
+ for slug in $slugs; do
29
+ if [ -n "$slug" ]; then
30
+ additional_patterns+=("\"https://$domain/$slug\"")
31
+ fi
32
+ done
33
+ }
34
+
35
+ if [ -n "$ECOM_STORE_ID" ]; then
36
+ base_uri="https://ecomplus.io/v2/:$ECOM_STORE_ID/"
37
+
38
+ fetch_and_purge 'products?fields=slug&sort=-sales&limit=2'
39
+ fetch_and_purge 'categories?fields=slug&sort=created_at&limit=1'
40
+ fi
41
+
42
+ if [ -z "$GIT_BRANCH" ]; then
43
+ echo "GIT_BRANCH env not set, skipping edge rules config"
44
+ exit 0
45
+ fi
46
+ if [ -z "$channel_url" ]; then
47
+ echo "Channel URL not set (second argument), skipping edge rules config"
48
+ exit 0
49
+ fi
50
+ channel_url="${channel_url%/}"
51
+
52
+ response=$(curl --silent --request GET \
53
+ --url https://api.bunny.net/pullzone \
54
+ --header "AccessKey: $BUNNYNET_API_KEY" \
55
+ --header 'accept: application/json')
56
+
57
+ pull_zone_id=$(echo $response | jq --arg domain "$domain" '[.[] | select(.Hostnames[].Value | contains($domain)).Id][0]')
58
+ if [ -z "$pull_zone_id" ]; then
59
+ echo "bunny.net pull zone not found for domain $domain"
60
+ exit 1
61
+ fi
62
+
63
+ edge_rules=$(echo $response | jq --arg id "$pull_zone_id" '.[] | select(.Id == ($id | tonumber)).EdgeRules')
64
+
65
+ configure_edge_rule() {
66
+ printf "\n"
67
+ local description=$1
68
+ local rule_data=$2
69
+ local is_additional_patterns=${3:-true}
70
+ local found_rule=$(echo $edge_rules | jq --arg description "$description" '.[] | select(.Description == $description)')
71
+ local guid=$(echo $found_rule | jq -r '.Guid // empty')
72
+
73
+ local json_data="$rule_data"
74
+ if [ "$is_additional_patterns" = true ]; then
75
+ local additional_patterns_json=$(printf '%s\n' "${additional_patterns[@]}" | jq -s '.')
76
+ json_data=$(echo $json_data | jq --argjson additionalPatterns "$additional_patterns_json" '.Triggers[0].PatternMatches += $additionalPatterns')
77
+ fi
78
+ if [ -n "$guid" ]; then
79
+ json_data=$(echo $json_data | jq --arg guid "$guid" '. + {Guid: $guid}')
80
+ fi
81
+
82
+ curl --silent --request POST \
83
+ --url "https://api.bunny.net/pullzone/$pull_zone_id/edgerules/addOrUpdate" \
84
+ --header "AccessKey: $BUNNYNET_API_KEY" \
85
+ --header 'content-type: application/json' \
86
+ --data "$json_data"
87
+ printf "\n\n> Configured edge rule \"$description\"\n"
88
+ }
89
+
90
+ ab_testing_data="
91
+ {
92
+ \"ActionType\": 2,
93
+ \"ActionParameter1\": \"$channel_url\",
94
+ \"ActionParameter2\": \"\",
95
+ \"Triggers\": [
96
+ {
97
+ \"Type\": 0,
98
+ \"PatternMatches\": [
99
+ \"https://$domain/\"
100
+ ],
101
+ \"PatternMatchingType\": 0,
102
+ \"Parameter1\": \"\"
103
+ },
104
+ {
105
+ \"Type\": 7,
106
+ \"PatternMatches\": [
107
+ \"50\"
108
+ ],
109
+ \"PatternMatchingType\": 0,
110
+ \"Parameter1\": \"\"
111
+ }
112
+ ],
113
+ \"TriggerMatchingType\": 1,
114
+ \"Description\": \"A/B testing [$GIT_BRANCH]\",
115
+ \"Enabled\": true
116
+ }"
117
+
118
+ ab_testing_bypass_data="
119
+ {
120
+ \"ActionType\": 3,
121
+ \"ActionParameter1\": \"0\",
122
+ \"ActionParameter2\": \"\",
123
+ \"Triggers\": [
124
+ {
125
+ \"Type\": 0,
126
+ \"PatternMatches\": [
127
+ \"https://$domain/\"
128
+ ],
129
+ \"PatternMatchingType\": 0,
130
+ \"Parameter1\": \"\"
131
+ }
132
+ ],
133
+ \"TriggerMatchingType\": 1,
134
+ \"Description\": \"A/B CDN cache bypass [$GIT_BRANCH]\",
135
+ \"Enabled\": true
136
+ }"
137
+
138
+ ab_testing_perma_bypass_data="
139
+ {
140
+ \"ActionType\": 15,
141
+ \"ActionParameter1\": null,
142
+ \"ActionParameter2\": null,
143
+ \"Triggers\": [
144
+ {
145
+ \"Type\": 0,
146
+ \"PatternMatches\": [
147
+ \"https://$domain/\"
148
+ ],
149
+ \"PatternMatchingType\": 0,
150
+ \"Parameter1\": \"\"
151
+ }
152
+ ],
153
+ \"TriggerMatchingType\": 1,
154
+ \"Description\": \"A/B perma-cache bypass [$GIT_BRANCH]\",
155
+ \"Enabled\": true
156
+ }"
157
+
158
+ configure_edge_rule "A/B testing [$GIT_BRANCH]" "$ab_testing_data"
159
+ configure_edge_rule "A/B CDN cache bypass [$GIT_BRANCH]" "$ab_testing_bypass_data"
160
+ configure_edge_rule "A/B perma-cache bypass [$GIT_BRANCH]" "$ab_testing_perma_bypass_data"
161
+
162
+ curl --silent --request POST \
163
+ --url "https://api.bunny.net/purge?url=https://$domain/" \
164
+ --header "AccessKey: $BUNNYNET_API_KEY"
165
+ printf "\n> Purged https://$domain/ cache"
166
+
167
+ for slug_url in "${additional_patterns[@]}"; do
168
+ clean_url=${slug_url//\"/}
169
+ curl --silent --request POST \
170
+ --url "https://api.bunny.net/purge?url=$clean_url" \
171
+ --header "AccessKey: $BUNNYNET_API_KEY"
172
+ echo "> Purged $clean_url cache"
173
+ done
@@ -0,0 +1,54 @@
1
+ #!/bin/bash
2
+
3
+ if [ -z "$BUNNYNET_API_KEY" ]; then
4
+ echo "BUNNYNET_API_KEY env var must be set"
5
+ exit 1
6
+ fi
7
+ if [ $# -eq 0 ]; then
8
+ echo "Provide the Firebase project ID as the first argument"
9
+ exit 1
10
+ fi
11
+ if [ $# -eq 1 ]; then
12
+ echo "Provide the domain as the first argument"
13
+ exit 1
14
+ fi
15
+
16
+ project_id=$1
17
+ domain=$2
18
+
19
+ if [ -z "$GIT_BRANCH" ]; then
20
+ echo "GIT_BRANCH env not set, skipping edge rules removal"
21
+ exit 0
22
+ fi
23
+
24
+ response=$(curl --silent --request GET \
25
+ --url https://api.bunny.net/pullzone \
26
+ --header "AccessKey: $BUNNYNET_API_KEY" \
27
+ --header 'accept: application/json')
28
+
29
+ pull_zone_id=$(echo $response | jq --arg domain "$domain" '[.[] | select(.Hostnames[].Value | contains($domain)).Id][0]')
30
+ if [ -z "$pull_zone_id" ]; then
31
+ echo "bunny.net pull zone not found for domain $domain"
32
+ exit 1
33
+ fi
34
+
35
+ edge_rules=$(echo $response | jq --arg id "$pull_zone_id" '.[] | select(.Id == ($id | tonumber)).EdgeRules')
36
+
37
+ remove_edge_rule() {
38
+ local description=$1
39
+ local found_rule=$(echo $edge_rules | jq --arg description "$description" '.[] | select(.Description == $description)')
40
+ local guid=$(echo $found_rule | jq -r '.Guid // empty')
41
+
42
+ if [ -n "$guid" ]; then
43
+ curl --silent --request DELETE \
44
+ --url "https://api.bunny.net/pullzone/$pull_zone_id/edgerules/$guid" \
45
+ --header "AccessKey: $BUNNYNET_API_KEY"
46
+ echo "> Removed edge rule \"$description\""
47
+ else
48
+ echo "> Edge rule \"$description\" not found"
49
+ fi
50
+ }
51
+
52
+ remove_edge_rule "A/B testing [$GIT_BRANCH]"
53
+ remove_edge_rule "A/B CDN cache bypass [$GIT_BRANCH]"
54
+ remove_edge_rule "A/B perma-cache bypass [$GIT_BRANCH]"
@@ -0,0 +1,103 @@
1
+ #!/bin/bash
2
+
3
+ if [ -z "$BUNNYNET_API_KEY" ]; then
4
+ echo "BUNNYNET_API_KEY env var must be set"
5
+ exit 1
6
+ fi
7
+ if [ $# -eq 0 ]; then
8
+ echo "Provide the Firebase project ID as the first argument"
9
+ exit 1
10
+ fi
11
+
12
+ project_id=$1
13
+ domain=$2
14
+
15
+ storage_list=$(curl --silent --request GET \
16
+ --url https://api.bunny.net/storagezone \
17
+ --header "AccessKey: $BUNNYNET_API_KEY" \
18
+ --header 'accept: application/json')
19
+
20
+ storage_prefix="storefront-isr-"
21
+ storage_id=$(echo $storage_list | jq --arg prefix "$storage_prefix" '.[] | select(.Name | startswith($prefix)) | .Id')
22
+
23
+ if [ -z "$storage_id" ]; then
24
+ rand_suffix=$(printf "%06d" $((RANDOM % 10000000)))
25
+ storage_name="${storage_prefix}${rand_suffix}"
26
+
27
+ printf "\n"
28
+ response=$(curl --silent --request POST \
29
+ --url https://api.bunny.net/storagezone \
30
+ --header "AccessKey: $BUNNYNET_API_KEY" \
31
+ --header 'accept: application/json' \
32
+ --header 'content-type: application/json' \
33
+ --data "
34
+ {
35
+ \"Name\": \"$storage_name\",
36
+ \"Region\": \"DE\",
37
+ \"ReplicationRegions\": [
38
+ \"NY\",
39
+ \"BR\"
40
+ ],
41
+ \"ZoneTier\": 1
42
+ }
43
+ ")
44
+
45
+ storage_id=$(echo "$response" | jq -r '.Id')
46
+ printf "\n\n> Created storage zone \"$storage_name\" ($storage_id)"
47
+ fi
48
+
49
+ if [ -z "$storage_id" ]; then
50
+ echo "Could not create bunny.net storage zone"
51
+ exit 1
52
+ fi
53
+
54
+ origin_url="https://$project_id.web.app"
55
+
56
+ get_pull_zone_id() {
57
+ pull_zone_list=$(curl --silent --request GET \
58
+ --url https://api.bunny.net/pullzone \
59
+ --header "AccessKey: $BUNNYNET_API_KEY" \
60
+ --header 'accept: application/json')
61
+
62
+ pull_zone_id=$(echo $pull_zone_list | jq --arg url "$origin_url" '.[] | select(.OriginUrl == $url) | .Id')
63
+ }
64
+ get_pull_zone_id
65
+
66
+ if [ -z "$pull_zone_id" ]; then
67
+ printf "\n"
68
+ response=$(curl --silent --request POST \
69
+ --url https://api.bunny.net/pullzone \
70
+ --header "AccessKey: $BUNNYNET_API_KEY" \
71
+ --header 'accept: application/json' \
72
+ --header 'content-type: application/json' \
73
+ --data "
74
+ {
75
+ \"OriginUrl\": \"$origin_url\",
76
+ \"EnableGeoZoneUS\": true,
77
+ \"EnableGeoZoneEU\": true,
78
+ \"EnableGeoZoneASIA\": false,
79
+ \"EnableGeoZoneSA\": true,
80
+ \"EnableGeoZoneAF\": false,
81
+ \"Name\": \"$project_id\",
82
+ \"PermaCacheStorageZoneId\": $storage_id,
83
+ \"CacheControlMaxAgeOverride\": 31919000,
84
+ \"EnableOriginShield\": false
85
+ }
86
+ ")
87
+
88
+ get_pull_zone_id
89
+ printf "\n\n> Created pull zone \"$pull_zone_id\" with origin \"$origin_url\""
90
+ fi
91
+
92
+ if [ -n "$domain" ]; then
93
+ printf "\n"
94
+ curl --silent --request POST \
95
+ --url https://api.bunny.net/pullzone/$pull_zone_id/addHostname \
96
+ --header "AccessKey: $BUNNYNET_API_KEY" \
97
+ --header 'content-type: application/json' \
98
+ --data "{\"Hostname\":\"$domain\"}"
99
+ printf "\n\n> Added hostname \"$domain\" to pull zone"
100
+
101
+ script_dir=$(dirname $0)
102
+ bash $script_dir/bunny-config-base.sh $domain
103
+ fi
@@ -3,12 +3,18 @@ import { join as joinPath } from 'node:path';
3
3
  import {
4
4
  $, argv, fs, echo, chalk,
5
5
  } from 'zx';
6
+ import * as dotenv from 'dotenv';
6
7
  import Deepmerge from '@fastify/deepmerge';
7
8
  import login from './login.js';
8
9
  import build, { prepareCodebases } from './build.js';
9
10
  import { siginGcloudAndSetIAM, createServiceAccountKey } from './setup-gcloud.js';
10
11
  import createGhSecrets from './setup-gh.js';
11
12
 
13
+ if (!process.env.FIREBASE_PROJECT_ID && !process.env.GOOGLE_APPLICATION_CREDENTIALS) {
14
+ const pwd = process.cwd();
15
+ dotenv.config();
16
+ dotenv.config({ path: joinPath(pwd, 'functions/.env') });
17
+ }
12
18
  const { FIREBASE_PROJECT_ID, GOOGLE_APPLICATION_CREDENTIALS, GITHUB_TOKEN } = process.env;
13
19
  // https://github.com/google/zx/issues/124
14
20
  process.env.FORCE_COLOR = '3';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/cli",
3
3
  "type": "module",
4
- "version": "2.0.9",
4
+ "version": "2.2.0",
5
5
  "description": "E-Com Plus Cloud Commerce CLI tools",
6
6
  "bin": {
7
7
  "cloudcommerce": "./bin/run.mjs"
@@ -17,7 +17,7 @@
17
17
  "directory": "packages/cli"
18
18
  },
19
19
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
20
- "license": "Apache 2.0 with Commons Clause",
20
+ "license": "MIT",
21
21
  "bugs": {
22
22
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
23
23
  },
@@ -28,6 +28,7 @@
28
28
  "dependencies": {
29
29
  "@cloudcommerce/api": "workspace:*",
30
30
  "@fastify/deepmerge": "^1.3.0",
31
+ "dotenv": "^16.3.2",
31
32
  "libsodium-wrappers": "^0.7.13",
32
33
  "md5": "^2.3.0",
33
34
  "typescript": "~5.2.2",
@@ -7,12 +7,18 @@ import {
7
7
  echo,
8
8
  chalk,
9
9
  } from 'zx';
10
+ import * as dotenv from 'dotenv';
10
11
  import Deepmerge from '@fastify/deepmerge';
11
12
  import login from './login';
12
13
  import build, { prepareCodebases } from './build';
13
14
  import { siginGcloudAndSetIAM, createServiceAccountKey } from './setup-gcloud';
14
15
  import createGhSecrets from './setup-gh';
15
16
 
17
+ if (!process.env.FIREBASE_PROJECT_ID && !process.env.GOOGLE_APPLICATION_CREDENTIALS) {
18
+ const pwd = process.cwd();
19
+ dotenv.config();
20
+ dotenv.config({ path: joinPath(pwd, 'functions/.env') });
21
+ }
16
22
  const {
17
23
  FIREBASE_PROJECT_ID,
18
24
  GOOGLE_APPLICATION_CREDENTIALS,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/config",
3
3
  "type": "module",
4
- "version": "2.0.9",
4
+ "version": "2.2.0",
5
5
  "description": "E-Com Plus Cloud Commerce base config",
6
6
  "main": "lib/config.js",
7
7
  "exports": {
@@ -15,7 +15,7 @@
15
15
  "directory": "packages/config"
16
16
  },
17
17
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
18
- "license": "Apache 2.0 with Commons Clause",
18
+ "license": "MIT",
19
19
  "bugs": {
20
20
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
21
21
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/emails",
3
3
  "type": "module",
4
- "version": "2.0.9",
4
+ "version": "2.2.0",
5
5
  "description": "E-Com Plus Cloud Commerce email sender",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "directory": "packages/emails"
12
12
  },
13
13
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
14
- "license": "Apache 2.0 with Commons Clause",
14
+ "license": "MIT",
15
15
  "bugs": {
16
16
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
17
17
  },
@@ -5,6 +5,7 @@ module.exports = {
5
5
  node: true,
6
6
  },
7
7
  extends: [
8
+ 'plugin:vue/vue3-essential',
8
9
  'airbnb-base',
9
10
  ],
10
11
  parserOptions: {
@@ -68,6 +69,7 @@ module.exports = {
68
69
  'no-continue': 'off',
69
70
  'lines-between-class-members': 'off',
70
71
  'arrow-body-style': 'off',
72
+ 'vue/no-multiple-template-root': 'off',
71
73
  'import/extensions': [
72
74
  'error',
73
75
  'ignorePackages',
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/eslint",
3
3
  "type": "module",
4
- "version": "2.0.9",
4
+ "version": "2.2.0",
5
5
  "description": "E-Com Plus Cloud Commerce ESLint config",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -10,7 +10,7 @@
10
10
  "directory": "packages/eslint"
11
11
  },
12
12
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
13
- "license": "Apache 2.0 with Commons Clause",
13
+ "license": "MIT",
14
14
  "bugs": {
15
15
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
16
16
  },
@@ -19,8 +19,8 @@
19
19
  "build": "echo '@ecomplus/eslint'"
20
20
  },
21
21
  "dependencies": {
22
- "@typescript-eslint/eslint-plugin": "^6.18.1",
23
- "@typescript-eslint/parser": "^6.18.1",
22
+ "@typescript-eslint/eslint-plugin": "^6.19.1",
23
+ "@typescript-eslint/parser": "^6.19.1",
24
24
  "eslint": "^8.56.0",
25
25
  "eslint-config-airbnb-base": "^15.0.0",
26
26
  "eslint-plugin-astro": "^0.31.3",
@@ -1,7 +1,6 @@
1
1
  module.exports = {
2
2
  extends: [
3
3
  './base.eslintrc.cjs',
4
- 'plugin:vue/vue3-essential',
5
4
  'plugin:astro/recommended',
6
5
  ],
7
6
  rules: {
@@ -20,7 +19,6 @@ module.exports = {
20
19
  'import/no-dynamic-require': 'off',
21
20
  'import/prefer-default-export': 'warn',
22
21
  'import/extensions': 'off',
23
- 'vue/no-multiple-template-root': 'off',
24
22
  'vue/multi-word-component-names': ['error', {
25
23
  ignores: [
26
24
  'Fade',
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/events",
3
3
  "type": "module",
4
- "version": "2.0.9",
4
+ "version": "2.2.0",
5
5
  "description": "E-Com Plus Cloud Commerce app events",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -14,7 +14,7 @@
14
14
  "directory": "packages/events"
15
15
  },
16
16
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
17
- "license": "Apache 2.0 with Commons Clause",
17
+ "license": "MIT",
18
18
  "bugs": {
19
19
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
20
20
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/feeds",
3
3
  "type": "module",
4
- "version": "2.0.9",
4
+ "version": "2.2.0",
5
5
  "description": "E-Com Plus Cloud Commerce catalog feeds",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -14,7 +14,7 @@
14
14
  "directory": "packages/feeds"
15
15
  },
16
16
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
17
- "license": "Apache 2.0 with Commons Clause",
17
+ "license": "MIT",
18
18
  "bugs": {
19
19
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
20
20
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/firebase",
3
3
  "type": "module",
4
- "version": "2.0.9",
4
+ "version": "2.2.0",
5
5
  "description": "E-Com Plus Cloud Commerce on Firebase",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  "directory": "packages/firebase"
22
22
  },
23
23
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
24
- "license": "Apache 2.0 with Commons Clause",
24
+ "license": "MIT",
25
25
  "bugs": {
26
26
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
27
27
  },
@@ -33,7 +33,7 @@
33
33
  "@cloudcommerce/api": "workspace:*",
34
34
  "@cloudcommerce/config": "workspace:*",
35
35
  "@google-cloud/pubsub": "^4.1.1",
36
- "dotenv": "^16.3.1",
36
+ "dotenv": "^16.3.2",
37
37
  "firebase-admin": "^12.0.0",
38
38
  "firebase-functions": "^4.6.0",
39
39
  "source-map-support": "^0.5.21"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/i18n",
3
3
  "type": "module",
4
- "version": "2.0.9",
4
+ "version": "2.2.0",
5
5
  "description": "E-Com Plus Cloud Commerce i18n",
6
6
  "main": "lib/all.js",
7
7
  "exports": {
@@ -17,7 +17,7 @@
17
17
  "directory": "packages/i18n"
18
18
  },
19
19
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
20
- "license": "Apache 2.0 with Commons Clause",
20
+ "license": "MIT",
21
21
  "bugs": {
22
22
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
23
23
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/modules",
3
3
  "type": "module",
4
- "version": "2.0.9",
4
+ "version": "2.2.0",
5
5
  "description": "E-Com Plus Cloud Commerce modules API",
6
6
  "main": "lib/index.cjs",
7
7
  "exports": {
@@ -14,7 +14,7 @@
14
14
  "directory": "packages/modules"
15
15
  },
16
16
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
17
- "license": "Apache 2.0 with Commons Clause",
17
+ "license": "MIT",
18
18
  "bugs": {
19
19
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
20
20
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/passport",
3
3
  "type": "module",
4
- "version": "2.0.9",
4
+ "version": "2.2.0",
5
5
  "description": "E-Com Plus Cloud Commerce customers authentication (passport) API",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -14,7 +14,7 @@
14
14
  "directory": "packages/passport"
15
15
  },
16
16
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
17
- "license": "Apache 2.0 with Commons Clause",
17
+ "license": "MIT",
18
18
  "bugs": {
19
19
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
20
20
  },