@pradip1995/framework-compiler 0.3.0 → 0.3.2
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.
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
const pluginDefinitions = require("./plugin-definitions.cjs")
|
|
2
2
|
|
|
3
|
+
function formatObjectKey(key) {
|
|
4
|
+
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key) ? key : JSON.stringify(key)
|
|
5
|
+
}
|
|
6
|
+
|
|
3
7
|
function formatValue(value, indent = 4) {
|
|
4
8
|
const pad = " ".repeat(indent)
|
|
5
9
|
if (value === "homepageConfig") return "homepageConfig"
|
|
@@ -16,7 +20,7 @@ function formatValue(value, indent = 4) {
|
|
|
16
20
|
if (value && typeof value === "object") {
|
|
17
21
|
const entries = Object.entries(value)
|
|
18
22
|
return `{\n${entries
|
|
19
|
-
.map(([key, val]) => `${pad} ${key}: ${formatValue(val, indent + 2)}`)
|
|
23
|
+
.map(([key, val]) => `${pad} ${formatObjectKey(key)}: ${formatValue(val, indent + 2)}`)
|
|
20
24
|
.join(",\n")}\n${pad}}`
|
|
21
25
|
}
|
|
22
26
|
return "undefined"
|
|
@@ -59,6 +63,7 @@ function generateMedusaConfig({ enabledPlugins, preset = "full" }) {
|
|
|
59
63
|
const usePaymentProvider =
|
|
60
64
|
preset === "full" && hasPlugin(enabledPlugins, "medusa-payment-provider")
|
|
61
65
|
const useCustomerRegistration = hasPlugin(enabledPlugins, "customer-registration")
|
|
66
|
+
const useSmtpPlugin = hasPlugin(enabledPlugins, "@tsc_tech/medusa-plugin-smtp")
|
|
62
67
|
|
|
63
68
|
const fulfillmentProviders = useShiprocket
|
|
64
69
|
? ` providers: [
|
|
@@ -133,9 +138,8 @@ function generateMedusaConfig({ enabledPlugins, preset = "full" }) {
|
|
|
133
138
|
: {}),`
|
|
134
139
|
: ""
|
|
135
140
|
|
|
136
|
-
const notificationModule =
|
|
137
|
-
|
|
138
|
-
? `
|
|
141
|
+
const notificationModule = useSmtpPlugin
|
|
142
|
+
? `
|
|
139
143
|
...(process.env.SMTP_HOST
|
|
140
144
|
? {
|
|
141
145
|
[Modules.NOTIFICATION]: {
|
|
@@ -161,7 +165,7 @@ function generateMedusaConfig({ enabledPlugins, preset = "full" }) {
|
|
|
161
165
|
},
|
|
162
166
|
}
|
|
163
167
|
: {}),`
|
|
164
|
-
|
|
168
|
+
: ""
|
|
165
169
|
|
|
166
170
|
const fileModule =
|
|
167
171
|
preset === "full"
|
|
@@ -215,10 +219,10 @@ function generateMedusaConfig({ enabledPlugins, preset = "full" }) {
|
|
|
215
219
|
|
|
216
220
|
const needsPathImport = hasPlugin(enabledPlugins, "medusa-analytics")
|
|
217
221
|
|
|
218
|
-
return `${needsPathImport ? 'import path from "path"\n' : ""}
|
|
222
|
+
return `${needsPathImport ? 'import path from "path"\n' : ""}import { loadEnv, defineConfig, Modules, ContainerRegistrationKeys } from "@medusajs/framework/utils"
|
|
219
223
|
import homepageConfig from "./config/homepage-config.json"
|
|
220
224
|
import { PRODUCT_METADATA_DESCRIPTORS } from "./src/config/product-metadata-descriptors"
|
|
221
|
-
|
|
225
|
+
|
|
222
226
|
loadEnv(process.env.NODE_ENV || "development", process.cwd())
|
|
223
227
|
|
|
224
228
|
const storefrontUrl = process.env.STOREFRONT_URL || "http://localhost:8000"
|
|
@@ -7,15 +7,20 @@
|
|
|
7
7
|
"emitDecoratorMetadata": true,
|
|
8
8
|
"experimentalDecorators": true,
|
|
9
9
|
"skipLibCheck": true,
|
|
10
|
+
"skipDefaultLibCheck": true,
|
|
10
11
|
"declaration": false,
|
|
12
|
+
"sourceMap": false,
|
|
13
|
+
"inlineSourceMap": true,
|
|
11
14
|
"outDir": "./.medusa/server",
|
|
12
15
|
"rootDir": "./",
|
|
13
16
|
"jsx": "react-jsx",
|
|
14
17
|
"forceConsistentCasingInFileNames": true,
|
|
15
18
|
"resolveJsonModule": true,
|
|
19
|
+
"checkJs": false,
|
|
16
20
|
"strictNullChecks": true
|
|
17
21
|
},
|
|
18
22
|
"ts-node": {
|
|
23
|
+
"swc": false,
|
|
19
24
|
"compiler": "typescript",
|
|
20
25
|
"transpileOnly": true
|
|
21
26
|
},
|
package/bin/storefront-build.js
CHANGED
|
@@ -282,9 +282,10 @@ function syncBackendDynamicConfigFromBuild(pagesConfig) {
|
|
|
282
282
|
})
|
|
283
283
|
|
|
284
284
|
if (result.synced) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
285
|
+
const relPath = result.backendConfigPath
|
|
286
|
+
? relative(join(clientDir, ".."), result.backendConfigPath)
|
|
287
|
+
: "backend/.generated-backend/config/homepage-config.json"
|
|
288
|
+
console.log(` dynamic-config: synced ${result.fieldCount} field(s) to ${relPath}`)
|
|
288
289
|
for (const warning of result.warnings || []) {
|
|
289
290
|
console.warn(` dynamic-config: ${warning}`)
|
|
290
291
|
}
|