@akqa-denmark/shopify-theme-build 0.1.0 → 0.1.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.
|
@@ -81,7 +81,7 @@ var SCHEMA_TYPES = [
|
|
|
81
81
|
"section-blocks",
|
|
82
82
|
"section-groups"
|
|
83
83
|
];
|
|
84
|
-
var LIQUID_SCHEMA_TYPES = ["sections", "blocks"
|
|
84
|
+
var LIQUID_SCHEMA_TYPES = ["sections", "blocks"];
|
|
85
85
|
var LOCALE_SCHEMA_TYPES = [
|
|
86
86
|
"settings",
|
|
87
87
|
"configs",
|
|
@@ -97,6 +97,22 @@ var ASSET_NAMING = {
|
|
|
97
97
|
entry: "[name]-[hash].js"
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
+
// src/utils/strings.ts
|
|
101
|
+
function capitalizeFirstLetter(string) {
|
|
102
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
103
|
+
}
|
|
104
|
+
function snakifyString(inputString) {
|
|
105
|
+
return inputString ? inputString.replace(/["\\/]/g, "").replace(/[\s-]+/g, "_").toLowerCase() : "";
|
|
106
|
+
}
|
|
107
|
+
function formatToName(fileName, type) {
|
|
108
|
+
const pascalCase = fileName.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
109
|
+
if (type === "section-blocks") {
|
|
110
|
+
return `${pascalCase}Block`;
|
|
111
|
+
}
|
|
112
|
+
const suffix = capitalizeFirstLetter(type).slice(0, -1);
|
|
113
|
+
return `${pascalCase}${suffix}`;
|
|
114
|
+
}
|
|
115
|
+
|
|
100
116
|
// src/core/orchestrator.ts
|
|
101
117
|
import { globSync as globSync2 } from "fs";
|
|
102
118
|
import { resolve as resolve4, basename, parse as pathParse } from "path";
|
|
@@ -285,8 +301,7 @@ ${spaces}}`;
|
|
|
285
301
|
};
|
|
286
302
|
var LIQUID_DIR_MAP = {
|
|
287
303
|
sections: "sections",
|
|
288
|
-
blocks: "blocks"
|
|
289
|
-
"section-blocks": "snippets"
|
|
304
|
+
blocks: "blocks"
|
|
290
305
|
};
|
|
291
306
|
async function buildLiquidSchema(filePath, schema, type, name, themeDir) {
|
|
292
307
|
const directory = LIQUID_DIR_MAP[type];
|
|
@@ -605,22 +620,6 @@ ${JSON.stringify(output, null, 2)}
|
|
|
605
620
|
}
|
|
606
621
|
}
|
|
607
622
|
|
|
608
|
-
// src/utils/strings.ts
|
|
609
|
-
function capitalizeFirstLetter(string) {
|
|
610
|
-
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
611
|
-
}
|
|
612
|
-
function snakifyString(inputString) {
|
|
613
|
-
return inputString ? inputString.replace(/["\\/]/g, "").replace(/[\s-]+/g, "_").toLowerCase() : "";
|
|
614
|
-
}
|
|
615
|
-
function formatToName(fileName, type) {
|
|
616
|
-
const pascalCase = fileName.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
617
|
-
if (type === "section-blocks") {
|
|
618
|
-
return `${pascalCase}Block`;
|
|
619
|
-
}
|
|
620
|
-
const suffix = capitalizeFirstLetter(type).slice(0, -1);
|
|
621
|
-
return `${pascalCase}${suffix}`;
|
|
622
|
-
}
|
|
623
|
-
|
|
624
623
|
// src/core/locale-extractor.ts
|
|
625
624
|
function simplifyObject(obj) {
|
|
626
625
|
if (!obj || typeof obj !== "object") return void 0;
|
|
@@ -702,6 +701,8 @@ async function orchestrate(options) {
|
|
|
702
701
|
const paths = getStorePaths(config, store);
|
|
703
702
|
const startTime = Date.now();
|
|
704
703
|
log("info", `Building store: ${store}`);
|
|
704
|
+
const { createJiti } = await import("jiti");
|
|
705
|
+
const jiti = createJiti(config.rootDir);
|
|
705
706
|
const localeAccumulator = {};
|
|
706
707
|
for (const schemaType of SCHEMA_TYPES) {
|
|
707
708
|
const schemaDir = `${paths.schemasDir}/${schemaType}`;
|
|
@@ -720,8 +721,8 @@ async function orchestrate(options) {
|
|
|
720
721
|
batch.map(async (file) => {
|
|
721
722
|
const { name } = pathParse(file);
|
|
722
723
|
try {
|
|
723
|
-
const
|
|
724
|
-
let schema =
|
|
724
|
+
const mod = await jiti.import(resolve4(file));
|
|
725
|
+
let schema = mod.default || mod[formatToName(name, schemaType)];
|
|
725
726
|
if (typeof schema === "function") schema = schema();
|
|
726
727
|
if (!schema) return;
|
|
727
728
|
if (!skipSchemas && LIQUID_SCHEMA_TYPES.includes(schemaType)) {
|
|
@@ -764,5 +765,6 @@ export {
|
|
|
764
765
|
getStorePaths,
|
|
765
766
|
ASSET_NAMING,
|
|
766
767
|
log,
|
|
768
|
+
snakifyString,
|
|
767
769
|
orchestrate
|
|
768
770
|
};
|
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ var [, , command, ...args] = process.argv;
|
|
|
5
5
|
async function main() {
|
|
6
6
|
switch (command) {
|
|
7
7
|
case "prepare": {
|
|
8
|
-
const { runPrepare } = await import("./prepare-
|
|
8
|
+
const { runPrepare } = await import("./prepare-VXDIYQBN.js");
|
|
9
9
|
await runPrepare(args);
|
|
10
10
|
break;
|
|
11
11
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -55,4 +55,6 @@ interface OrchestrateOptions {
|
|
|
55
55
|
}
|
|
56
56
|
declare function orchestrate(options: OrchestrateOptions): Promise<void>;
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
declare function snakifyString(inputString: string): string;
|
|
59
|
+
|
|
60
|
+
export { type BuildConfig, type ResolvedConfig, type StoreDefinition, defineConfig, getStorePaths, orchestrate, resolveConfig, resolveStore, snakifyString };
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,9 @@ import {
|
|
|
2
2
|
getStorePaths,
|
|
3
3
|
orchestrate,
|
|
4
4
|
resolveConfig,
|
|
5
|
-
resolveStore
|
|
6
|
-
|
|
5
|
+
resolveStore,
|
|
6
|
+
snakifyString
|
|
7
|
+
} from "./chunk-2PX74575.js";
|
|
7
8
|
|
|
8
9
|
// src/config/types.ts
|
|
9
10
|
function defineConfig(config) {
|
|
@@ -14,5 +15,6 @@ export {
|
|
|
14
15
|
getStorePaths,
|
|
15
16
|
orchestrate,
|
|
16
17
|
resolveConfig,
|
|
17
|
-
resolveStore
|
|
18
|
+
resolveStore,
|
|
19
|
+
snakifyString
|
|
18
20
|
};
|
|
@@ -18,7 +18,7 @@ var SCHEMA_TYPES = [
|
|
|
18
18
|
"section-blocks",
|
|
19
19
|
"section-groups"
|
|
20
20
|
];
|
|
21
|
-
var LIQUID_SCHEMA_TYPES = ["sections", "blocks"
|
|
21
|
+
var LIQUID_SCHEMA_TYPES = ["sections", "blocks"];
|
|
22
22
|
var LOCALE_SCHEMA_TYPES = [
|
|
23
23
|
"settings",
|
|
24
24
|
"configs",
|
|
@@ -211,8 +211,7 @@ ${spaces}}`;
|
|
|
211
211
|
};
|
|
212
212
|
var LIQUID_DIR_MAP = {
|
|
213
213
|
sections: "sections",
|
|
214
|
-
blocks: "blocks"
|
|
215
|
-
"section-blocks": "snippets"
|
|
214
|
+
blocks: "blocks"
|
|
216
215
|
};
|
|
217
216
|
async function buildLiquidSchema(filePath, schema, type, name, themeDir) {
|
|
218
217
|
const directory = LIQUID_DIR_MAP[type];
|
|
@@ -628,6 +627,8 @@ async function orchestrate(options) {
|
|
|
628
627
|
const paths = getStorePaths(config, store);
|
|
629
628
|
const startTime = Date.now();
|
|
630
629
|
log("info", `Building store: ${store}`);
|
|
630
|
+
const { createJiti } = await import("jiti");
|
|
631
|
+
const jiti = createJiti(config.rootDir);
|
|
631
632
|
const localeAccumulator = {};
|
|
632
633
|
for (const schemaType of SCHEMA_TYPES) {
|
|
633
634
|
const schemaDir = `${paths.schemasDir}/${schemaType}`;
|
|
@@ -646,8 +647,8 @@ async function orchestrate(options) {
|
|
|
646
647
|
batch.map(async (file) => {
|
|
647
648
|
const { name } = pathParse(file);
|
|
648
649
|
try {
|
|
649
|
-
const
|
|
650
|
-
let schema =
|
|
650
|
+
const mod = await jiti.import(resolve3(file));
|
|
651
|
+
let schema = mod.default || mod[formatToName(name, schemaType)];
|
|
651
652
|
if (typeof schema === "function") schema = schema();
|
|
652
653
|
if (!schema) return;
|
|
653
654
|
if (!skipSchemas && LIQUID_SCHEMA_TYPES.includes(schemaType)) {
|
package/dist/vite.js
CHANGED