@syncify/cli 0.3.0-beta → 1.0.0-unstable.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 (42) hide show
  1. package/LICENSE +10 -6
  2. package/dist/api.js +32 -12
  3. package/dist/cli.js +610 -6
  4. package/dist/index.d.ts +2264 -0
  5. package/dist/index.js +10 -10
  6. package/dist/syncify.js +24248 -0
  7. package/hot.js.liquid +13 -2
  8. package/package.json +118 -115
  9. package/readme.md +110 -2176
  10. package/scripts/postinstall.js +116 -0
  11. package/scripts/postversion.js +60 -0
  12. package/dist/cjs.js +0 -236
  13. package/pnpm-lock.yaml +0 -5662
  14. package/schema/syncify.config.json +0 -676
  15. package/schema/syncify.env.json +0 -58
  16. package/schema/syncify.package.json +0 -11
  17. package/types/api.d.ts +0 -319
  18. package/types/bundle/cache.d.ts +0 -101
  19. package/types/bundle/commands.d.ts +0 -396
  20. package/types/bundle/errors.d.ts +0 -101
  21. package/types/bundle/file.d.ts +0 -285
  22. package/types/bundle/filters.d.ts +0 -81
  23. package/types/bundle/hot.d.ts +0 -185
  24. package/types/bundle/index.d.ts +0 -603
  25. package/types/bundle/plugin.d.ts +0 -127
  26. package/types/bundle/processors.d.ts +0 -54
  27. package/types/bundle/reports.d.ts +0 -123
  28. package/types/bundle/requests.d.ts +0 -374
  29. package/types/bundle/shared.d.ts +0 -124
  30. package/types/cli.d.ts +0 -547
  31. package/types/config/index.d.ts +0 -550
  32. package/types/config/terser.d.ts +0 -319
  33. package/types/config/views.d.ts +0 -191
  34. package/types/index.d.ts +0 -55
  35. package/types/modules/html-minifier-terser.d.ts +0 -218
  36. package/types/stores.d.ts +0 -11
  37. package/types/transforms/image.d.ts +0 -15
  38. package/types/transforms/json.d.ts +0 -51
  39. package/types/transforms/pages.d.ts +0 -254
  40. package/types/transforms/script.d.ts +0 -308
  41. package/types/transforms/style.d.ts +0 -219
  42. package/types/transforms/svg.d.ts +0 -189
package/dist/cli.js CHANGED
@@ -1,11 +1,615 @@
1
1
  'use strict';
2
2
 
3
- var cjs_js = require('./cjs.js');
4
- var process$1 = require('process');
5
- var a = require('minimist');
3
+ var syncify_js = require('./syncify.js');
4
+ var node_path = require('node:path');
5
+ var node_process = require('node:process');
6
+ var node_util = require('node:util');
6
7
 
7
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
+ // syncify/cli/help/utils.ts
9
+ function describe(message) {
10
+ return syncify_js.$.terminal.cols < 75 ? "" : syncify_js.gray2(`\u203A ${message}`);
11
+ }
12
+ function highlight(input) {
13
+ return input.replace(/([${}<>])/g, syncify_js.gray2("$1")).replace(/(,)(?= -)/g, syncify_js.gray2("$1")).replace(/(\[options\])/g, `${syncify_js.LSB}options${syncify_js.RSB}`).replace(/(?<= )(-|--)(?=[a-zA-Z]+)/g, syncify_js.gray2("$1"));
14
+ }
15
+ function encase({ banner = false }) {
16
+ const arrow = `${syncify_js.Encase("SB", syncify_js.gray2("\u25B2"))} AND DOWN ${syncify_js.Encase("SB", syncify_js.gray2("\u25BC"))}`;
17
+ const label = syncify_js.gray2(`UP ${arrow} ARROW KEYS TO SCROLL`);
18
+ const header = syncify_js.Create().Break(2).Top(label, false).Newline();
19
+ const footer = syncify_js.Create().Newline(2).End(label, false).Break();
20
+ if (banner) {
21
+ header.Line("\u2588\u2580\u2580 \u2588 \u2588 \u2588\u2580\u2588 \u2588\u2580\u2580 \u2580\u2588\u2580 \u2588\u2580\u2580 \u2588 \u2588", syncify_js.lightGray).Line("\u2580\u2580\u2588 \u2580\u2580\u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2580\u2580 \u2580\u2580\u2588", syncify_js.lightGray).Line("\u2580\u2580\u2580 \u2580\u2580\u2580 \u2580 \u2580 \u2580\u2580\u2580 \u2580\u2580\u2580 \u2580 \u2580\u2580\u2580", syncify_js.lightGray).Newline();
22
+ }
23
+ return [header.toString(), footer];
24
+ }
8
25
 
9
- var a__default = /*#__PURE__*/_interopDefault(a);
26
+ // syncify/cli/help/default.ts
27
+ function Default() {
28
+ syncify_js.Create().Header(`HELP${syncify_js.COL}`, syncify_js.bold2).Line(` $ sy help ${describe("Prints this screen")}`).Line(` $ sy help {mode} ${describe("Pick a mode and view usage guide")}`).Line(` $ sy help examples ${describe("Real world command line examples")}`).Header(`USAGE${syncify_js.COL}`, syncify_js.bold2).Line(` $ sy {mode} ${describe("Command mode is required")}`).Line(` $ sy {mode} --flags ${describe("Flags can be provided to modes")}`).Line(` $ sy {mode} [options] ${describe("Some modes accept positionals")}`).Line(` $ sy {mode} [options] --flags ${describe("Mode with positional and flags")}`).Header("MODES" + syncify_js.COL, syncify_js.bold2).Line(` $ sy init ${describe("Setup Syncify in existing project")}`).Line(` $ sy build ${describe("Build theme from source")}`).Line(` $ sy watch ${describe("Watch and rebuild changes")}`).Line(` $ sy pull ${describe("Download from a store theme")}`).Line(` $ sy push ${describe("Upload to a store theme")}`).Line(` $ sy create ${describe("Create a new Syncify project")}`).Line(` $ sy publish ${describe("Changes a theme role to and makes it main")}`, syncify_js.dim2).Line(` $ sy delete ${describe("Remove files/resources from a store or theme")}`, syncify_js.dim2).Line(` $ sy pack ${describe("Generate a .zip package of the current theme")}`, syncify_js.dim2).Line(` $ sy link ${describe("Link existing themes/s from a store")}`).Line(` $ sy unlink ${describe("Remove a linked theme/s from project")}`, syncify_js.dim2).Line(` $ sy duplicate ${describe("Duplicates an existing theme in a store")}`).Line(` $ sy keychain ${describe("Access the global token keychain")}`).Line(` $ sy git ${describe("Git integration configuration and information")}`, syncify_js.dim2).Line(` $ sy prune ${describe("Clears internal project caches from disk")}`, syncify_js.dim2).Line(` $ sy inspect ${describe("Prints information about Syncify installation")}`).Line(` $ sy projects ${describe("Lists all Syncify projects on this device")}`).Line(` $ sy doctor ${describe("Diagnostics and fixable operations")}`, syncify_js.dim2).Line(` $ sy help ${describe("Print complete command list")}`).Header(`FLAGS${syncify_js.COL}`, syncify_js.bold2).Line(` --input, -i ${describe("Define input (source) directory")}`).Line(` --output, -o ${describe("Define output directory")}`).Line(` --config, -c ${describe("Define config directory")}`).Line(` --hot, -h ${describe("HOT Reload when running watch mode")}`).Line(` --target, -T ${describe("Theme and store targeting")}`).Line(` --filter, -F ${describe("File filtering and globs")}`).Line(` --align ${describe("Subset theme file merge with remote sources")}`).Line(` --new ${describe("Used with sy pull to create a new theme")}`).Line(` --bind ${describe("Live bindings in watch mode")}`).Line(` --dev ${describe("Development environment (default)")}`).Line(` --prod ${describe("Production environment")}`).Line(` --terse ${describe("Terse distribution (minification)")}`).Line(` --clean ${describe("Clean output directory")}`).Line(` --silent ${describe("Suppress logging via stdout")}`).Line(` --patch ${describe("Apply a patch version bump")}`).Line(` --minor ${describe("Apply a minor version bump")}`).Line(` --major ${describe("Apply a major version bump")}`).Line(` --force ${describe("Force overwrite or action (caution)")}`).Line(` --batch ${describe("Control batch limit (default is 10)")}`).Ruler().Append("\xA9 2025 \u039D\u03B9\u03BA\u03BF\u03BB\u03B1\u03C2 \u03A3\u03B1\u03B2\u03B2\u03B9\u03B4\u03B7\u03C2", syncify_js.gray2.bold).Line(`Version${syncify_js.COL} ${syncify_js.$.version}`, syncify_js.gray2).Line(`License${syncify_js.COL} Apache 2.0`, syncify_js.gray2).Line(`Website${syncify_js.COL} ${syncify_js.underline2("https://syncify.sh")}`, syncify_js.gray2).Line(`Github${syncify_js.COL} ${syncify_js.underline2("https://github.com/panoply/syncify")}`, syncify_js.gray2).Line(`Discord${syncify_js.COL} ${syncify_js.underline2("https://discord.gg/shopify-developers-597504637167468564")}`, syncify_js.gray2).Newline().toString((input) => {
29
+ const [header, footer] = encase({ banner: true });
30
+ const heading = syncify_js.Scroll({ input: header, height: 8 });
31
+ const content = syncify_js.Scroll({
32
+ input: highlight(input),
33
+ yPos: 8,
34
+ height: syncify_js.$.terminal.rows - 12
35
+ });
36
+ heading.print();
37
+ content.print();
38
+ content.setKeypress(syncify_js.$.terminal.rows, content.maxHeight);
39
+ footer.toLog();
40
+ });
41
+ }
10
42
 
11
- cjs_js.e(a__default.default(process$1.argv.slice(1),{alias:{config:"c",input:"i",output:"o",build:"b",watch:"w",upload:"u",download:"d",theme:"t",help:"h",spawn:"s",resource:"r",filter:"f",delete:"del"},default:{cwd:process.cwd(),config:".",input:"source",cli:!0,dev:!0,prod:!1,import:!1,export:!1,build:!1,watch:!1,upload:!1,download:!1,terse:!1,hot:!1,help:!1,interactive:!1,views:!1,script:!1,style:!1,svg:!1,image:!1,metafields:!1,pages:!1,redirects:!1,clean:!1,silent:!1,force:!1,setup:!1,strap:!1},boolean:["build","watch","download","upload","import","export","hot","terse","help","interactive","dev","prod","metafields","pages","redirects","clean","silent","pull","force","test","vsc","strap","views","script","style","svg","image"],string:["input","output","config","theme","spawn","del","bump","resource","filter","strap"]})).catch(cjs_js.a.throws);
43
+ // syncify/cli/help/information.ts
44
+ function Inspect() {
45
+ syncify_js.log.clear();
46
+ syncify_js.Create().BR.Top("Inspect").Header(`${syncify_js.white2.bold("@syncify/cli")}`).Line(`${syncify_js.gray2("VERSION")}${syncify_js.COL} v${syncify_js.whiteBright2("1.0.0-alpha.1")}`).Line(`${syncify_js.gray2("HOT")}${syncify_js.COL} v${syncify_js.whiteBright2("0.4.9")}`).Line(`${syncify_js.gray2("LICENSE")}${syncify_js.COL} ${syncify_js.whiteBright2("Apache 2.0")}`).Line(`${syncify_js.gray2("AUTHOR")}${syncify_js.COL} ${syncify_js.whiteBright2("\u039D\u03B9\u03BA\u03BF\u03BB\u03B1\u03C2 \u03A3\u03B1\u03B2\u03B2\u03B9\u03B4\u03B7\u03C2")}`).Line(`${syncify_js.gray2("PM")}${syncify_js.COL} ${syncify_js.whiteBright2(syncify_js.$.pm)}`).Line(`${syncify_js.gray2("OS")}${syncify_js.COL} ${syncify_js.whiteBright2(syncify_js.$.platform)}`).Line(`${syncify_js.gray2("BINARY")}${syncify_js.COL} ${syncify_js.whiteBright2(syncify_js.$.using)}`).Line(`${syncify_js.gray2("CWD")}${syncify_js.COL} ${syncify_js.whiteBright2(syncify_js.$.cwd)}`).Line(`${syncify_js.gray2("HASH")}${syncify_js.COL} ${syncify_js.whiteBright2(syncify_js.$.hash)}`).Line(`${syncify_js.gray2("SCRIPT")}${syncify_js.COL} ${syncify_js.whiteBright2(syncify_js.$.bin)}`).Line(`${syncify_js.gray2("MODULE")}${syncify_js.COL} ${syncify_js.whiteBright2(syncify_js.$.dirs.module)}`).Line(`${syncify_js.gray2("STORE")}${syncify_js.COL} ${syncify_js.whiteBright2(syncify_js.$.home)}`).Line(`${syncify_js.gray2("KEYCHAIN")}${syncify_js.COL} ${syncify_js.whiteBright2(`${syncify_js.$.file.keychain}`)}`).Line(`${syncify_js.gray2("GITHUB")}${syncify_js.COL} ${syncify_js.whiteBright2(syncify_js.$.github)}`).Line(`${syncify_js.gray2("WEBSITE")}${syncify_js.COL} ${syncify_js.whiteBright2("https://syncify.sh")}`).NL.End("Inspect").BR.toLog().Break();
47
+ }
48
+ function Version() {
49
+ syncify_js.log.clear();
50
+ syncify_js.Create().BR.Top("Versions", false).NL.Line(`${syncify_js.whiteBright2("@syncify/cli")} ${syncify_js.ARR} ${syncify_js.whiteBright2("v1.0.0-alpha.1")}`).Line(`${syncify_js.whiteBright2("@syncify/hot")} ${syncify_js.ARR} ${syncify_js.whiteBright2("v0.4.9")}`).NL.End("Versions", false).BR.toLog().Break();
51
+ }
52
+
53
+ // syncify/cli/help/descriptions.ts
54
+ var description = (mode) => ({
55
+ create: {
56
+ reference: "https://syncify.sh/cli/sy-create",
57
+ overview: "The create command is an interactive command prompt. You can (optionally) provide a strap name option to skip choice selection. Options with strikethrough are either deprecated or not yet available for use."
58
+ },
59
+ build: {
60
+ reference: "https://syncify.sh/cli/sy-build",
61
+ overview: "Runs Syncify in build mode, processing files from the input directory to create a Shopify-compliant theme structure in the output directory, ready for deployment."
62
+ },
63
+ watch: {
64
+ reference: "https://syncify.sh/cli/sy-watch",
65
+ overview: "Runs Syncify in watch mode, monitors the input directory for file changes. On modification, it updates the output directory and uploads to a Shopify theme/store, keeping both in sync with local files."
66
+ },
67
+ push: {
68
+ reference: "https://syncify.sh/cli/sy-push",
69
+ overview: "Upload theme files and/or resources to an online store. Use the push command to perform various sync operations with local versions."
70
+ },
71
+ pull: {
72
+ reference: "https://syncify.sh/cli/sy-pull",
73
+ overview: "Download theme files and/or resources from an online store. This command can be used to align remote versions with local ones and carry out merge operations."
74
+ },
75
+ projects: {
76
+ reference: "https://syncify.sh/cli/sy-projects",
77
+ overview: "Lists details of all Syncify projects on the device. Syncify maintains a hard cache in the OS home directory, which is accessed when the command runs. Optionally, specify a project directory name to retrieve info for that project."
78
+ },
79
+ inspect: {
80
+ reference: "https://syncify.sh/cli/sy-inspect",
81
+ overview: "Prints information about the Syncify installation on your device or within your project. This information can be provided when submitting issues or reporting bugs."
82
+ },
83
+ __: null
84
+ })[mode || "__"];
85
+
86
+ // syncify/cli/help/modes.ts
87
+ function Modes(mode) {
88
+ if (mode in Modes) return Modes[mode]();
89
+ const tui = syncify_js.Create().Top(`Syncify ${syncify_js.CHV} Error`, false).Header("NOT YET AVAILABLE", syncify_js.yellowBright2.bold);
90
+ if (syncify_js.COMMAND_MODES.has(mode)) {
91
+ const message = [
92
+ `Help reference for the ${syncify_js.bold2(`sy help ${mode}`)} command is not yet available to`,
93
+ `${syncify_js.bold2("sy help")} but is slated for inclusion in upcoming releases.`,
94
+ "The command itself is valid and functional, only the help information is unavailable."
95
+ ];
96
+ const modes = syncify_js.toArray(syncify_js.COMMAND_MODES).filter((n) => n !== "help").sort((a, b) => a in Modes === b in Modes ? 0 : a in Modes ? -1 : 1);
97
+ const equal = syncify_js.eqWS(modes, { padding: 0 });
98
+ tui.Wrap(message, syncify_js.yellowBright2).Newline().Each(modes, (name) => name in Modes ? tui.Line(`$ sy help ${name} ${equal(name) + syncify_js.CHK}`, syncify_js.whiteBright2) : tui.Line(`$ ${syncify_js.strikethrough2(`sy help ${name}`)}`, syncify_js.gray2));
99
+ }
100
+ tui.Newline().End(`Syncify ${syncify_js.CHV} Error`, false).BR.toLog(highlight);
101
+ }
102
+ Modes.push = () => {
103
+ const info = description("push");
104
+ syncify_js.Create().BR.Top(`help ${syncify_js.TLD} sy push`, false).True(info, (tui) => tui.Header(`DESCRIPTION${syncify_js.COL}`, syncify_js.bold2).Wrap(syncify_js.gray2, info.overview)).True(info, (tui) => tui.Prepend(info.reference, syncify_js.gray2.underline)).Header(`COMMANDS${syncify_js.COL}`, syncify_js.bold2).Line(" $ sy push").Line(" $ sy push --flags").Header(`FLAGS${syncify_js.COL}`, syncify_js.bold2).Line(` --force ${describe("Skips diffing and force overwrites")}`).Line(` --filter, -F ${describe("filter specific files/directories")}`).Line(` --target, -T ${describe("Target a theme or store")}`).Line(` --batch <number> ${describe("Upsert batch limits (default 10)")}`).Newline().End(`help ${syncify_js.TLD} sy push`, false).BR.toLog(highlight);
105
+ syncify_js.kill.exit(0);
106
+ };
107
+ Modes.pull = () => {
108
+ const info = description("pull");
109
+ syncify_js.Create().BR.Top(`help ${syncify_js.TLD} sy pull`, false).True(info, (tui) => tui.Header(`DESCRIPTION${syncify_js.COL}`, syncify_js.bold2).Wrap(syncify_js.gray2, info.overview)).True(info, (tui) => tui.Prepend(info.reference, syncify_js.gray2.underline)).Header(`COMMANDS${syncify_js.COL}`, syncify_js.bold2).Line(" $ sy pull").Line(" $ sy pull --flags").Header(`FLAGS${syncify_js.COL}`, syncify_js.bold2).Line(` --filter, -F ${describe("Filter specific files/directories")}`).Line(` --target, -T ${describe("Target a theme or store")}`).Line(` --merge ${describe(`Merges local ${syncify_js.ARL} remote theme`)}`).Line(` --align ${describe(`Align local ${syncify_js.ARL} remote theme JSON files`)}`).Line(` --force ${describe("Skips diffing and force overwrites")}`).Line(` --output, -o ${describe("Controls where theme file/s are written")}`).Line(` --batch <number> ${describe("Upsert batch limits (default 10)")}`).Line(` --help ${describe("Show this screen")}`).NL.End(`help ${syncify_js.TLD} sy push`, false).BR.toLog(highlight);
110
+ };
111
+ Modes.watch = () => {
112
+ const info = description("watch");
113
+ syncify_js.Create().BR.Top(`help ${syncify_js.TLD} sy watch`, false).True(info, (tui) => tui.Header(`DESCRIPTION${syncify_js.COL}`, syncify_js.bold2).Wrap(syncify_js.gray2, info.overview)).True(info, (tui) => tui.Prepend(info.reference, syncify_js.gray2.underline)).Header(`COMMANDS${syncify_js.COL}`, syncify_js.bold2).Line(" $ sy watch").Line(" $ sy watch --flags").Header(`FLAGS${syncify_js.COL}`, syncify_js.bold2).Line(` --target, -T ${describe("Target a theme or store")}`).Line(` --filter, -F ${describe("Filter specific files/directories")}`).Line(` --hot ${describe("Activates HOT Reloading")}`).Line(` --align ${describe("Align local theme JSON files before watching")}`).Line(` --bind ${describe("Activates 2 way bindings")}`).Line(` --terse ${describe("Terse minification")}`).Line(` --dev ${describe("Development build mode (default)")}`).Line(` --prod ${describe("Production build mode")}`).Line(` --help ${describe("Show this screen")}`).NL.End(`help ${syncify_js.TLD} sy watch`, false).BR.toLog(highlight);
114
+ };
115
+ Modes.inspect = () => {
116
+ const info = description("watch");
117
+ syncify_js.Create().BR.Top(`help ${syncify_js.TLD} sy inspect`, false).True(info, (tui) => tui.Header(`DESCRIPTION${syncify_js.COL}`, syncify_js.bold2).Wrap(syncify_js.gray2, info.overview)).True(info, (tui) => tui.Prepend(info.reference, syncify_js.gray2.underline)).Header(`COMMANDS${syncify_js.COL}`, syncify_js.bold2).Line(" $ sy inspect").NL.End(`help ${syncify_js.TLD} sy inspect`, false).BR.toLog(highlight);
118
+ };
119
+ Modes.create = () => {
120
+ const info = description("build");
121
+ const message = syncify_js.Create().BR.Top(`help ${syncify_js.TLD} sy create`, false).True(info, (tui) => tui.Header(`DESCRIPTION${syncify_js.COL}`, syncify_js.bold2).Wrap(syncify_js.gray2, info.overview)).True(info, (tui) => tui.Prepend(info.reference, syncify_js.gray2.underline)).Header(`COMMANDS${syncify_js.COL}`, syncify_js.bold2).Line(" $ sy create").Line(` $ sy create ${syncify_js.Encase("AN", "strap")}`).Header(`OPTIONS${syncify_js.COL}`, syncify_js.bold2);
122
+ const straps = [...syncify_js.STRAP_THEMES, ...syncify_js.STRAP_EXAMPLES];
123
+ const eq = syncify_js.eqWS(straps.map(([name]) => name), { padding: 2 });
124
+ syncify_js.forEach(([name, desc, unavilable]) => {
125
+ const line = unavilable ? ` $ ${syncify_js.strikethrough2(`sy create ${name}`)}${eq(name)} ${describe("unavilable")}` : ` $ sy create ${name}${eq(name)} ${describe(desc.trim())}`;
126
+ message.Line(line);
127
+ }, straps);
128
+ message.NL.End(`help ${syncify_js.TLD} sy push`, false).BR.toLog(highlight);
129
+ };
130
+ Modes.projects = () => {
131
+ const info = description("projects");
132
+ syncify_js.Create().BR.Top(`help ${syncify_js.TLD} sy projects`, false).True(info, (tui) => tui.Header(`DESCRIPTION${syncify_js.COL}`, syncify_js.bold2).Wrap(syncify_js.gray2, info.overview)).True(info, (tui) => tui.Prepend(info.reference, syncify_js.gray2.underline)).Header(`COMMANDS${syncify_js.COL}`, syncify_js.bold2).Line(" $ sy projects").Line(` $ sy projects ${syncify_js.Encase("AN", syncify_js.magenta2("name"))}`).NL.End(`help ${syncify_js.TLD} sy push`, false).BR.toLog(highlight);
133
+ };
134
+ Modes.build = () => {
135
+ const info = description("build");
136
+ syncify_js.Create().BR.Top(`help ${syncify_js.TLD} sy build`, false).True(info, (tui) => tui.Header(`DESCRIPTION${syncify_js.COL}`, syncify_js.bold2).Wrap(syncify_js.gray2, info.overview)).True(info, (tui) => tui.Prepend(info.reference, syncify_js.gray2.underline)).Header(`COMMANDS${syncify_js.COL}`, syncify_js.bold2).Line(" $ sy build").Line(" $ sy build --flags").Line(` $ sy build ${syncify_js.Encase("SB", "option")}`).Line(` $ sy build ${syncify_js.Encase("SB", "option")} --flags`).Header(`OPTIONS${syncify_js.COL}`, syncify_js.bold2).Line(` $ sy build script ${describe("Run build on script transform")}`).Line(` $ sy build style ${describe("Run build on style transform")}`).Line(` $ sy build svg ${describe("Run build on svg transform")}`).Line(` $ sy build liquid ${describe("Run build on liquid transform")}`).Line(` $ sy build json ${describe("Run build on json transform")}`).Header(`FLAGS${syncify_js.COL}`, syncify_js.bold2).Line(` --terse ${describe("Terse minification")}`).Line(` --dev ${describe("Development build mode (default)")}`).Line(` --prod ${describe("Production build mode")}`).Line(` --help ${describe("Show this screen")}`).NL.End(`help ${syncify_js.TLD} sy build`, false).BR.toLog(highlight);
137
+ };
138
+
139
+ // syncify/cli/help/suggest.ts
140
+ function Suggest() {
141
+ syncify_js.Create().Top(`Syncify ${syncify_js.CHV} Error`, false).Header("1.0.0-alpha.1", syncify_js.gray2).Error("MISSING COMMAND " + syncify_js.BAD, syncify_js.bold2.redBright).Newline("red").Error("Please provide a command line argument", syncify_js.redBright2).Header(`USAGE${syncify_js.COL}`, syncify_js.bold2).Line(` $ sy <${syncify_js.magenta2("mode")}>`).Line(` $ sy <${syncify_js.magenta2("mode")}> --flags`).Line(` $ sy <${syncify_js.magenta2("mode")}> [options]`).Line(` $ sy <${syncify_js.magenta2("mode")}> [options] --flags`).Header(`HELP${syncify_js.COL}`, syncify_js.bold2).Line(" $ sy help").Line(` $ sy <${syncify_js.magenta2("mode")}> --help`).NL.End(`Syncify ${syncify_js.CHV} Error`, false).BR.toLog(highlight).Break();
142
+ }
143
+
144
+ // syncify/mode/help.ts
145
+ function Help(mode) {
146
+ syncify_js.log.clear();
147
+ if (mode.suggest) {
148
+ Suggest();
149
+ } else if (mode.inspect) {
150
+ Inspect();
151
+ } else if (mode.version) {
152
+ Version();
153
+ } else if (syncify_js.isNull(mode._)) {
154
+ Default();
155
+ } else {
156
+ Modes(mode._);
157
+ }
158
+ }
159
+
160
+ // syncify/options/command.ts
161
+ var flags = () => ({
162
+ input: { type: "string", short: "i" },
163
+ output: { type: "string", short: "o" },
164
+ config: { type: "string", short: "c" },
165
+ target: { type: "string", multiple: true, short: "T" },
166
+ filter: { type: "string", multiple: true, short: "F" },
167
+ help: { type: "boolean", short: "h" },
168
+ version: { type: "boolean", short: "v" },
169
+ align: { type: "boolean" },
170
+ merge: { type: "boolean" },
171
+ dev: { type: "boolean" },
172
+ prod: { type: "boolean" },
173
+ terse: { type: "boolean" },
174
+ clean: { type: "boolean" },
175
+ silent: { type: "boolean" },
176
+ batch: { type: "string" },
177
+ hot: { type: "boolean" },
178
+ bind: { type: "boolean" },
179
+ force: { type: "boolean" },
180
+ patch: { type: "boolean" },
181
+ minor: { type: "boolean" },
182
+ major: { type: "boolean" },
183
+ main: { type: "boolean" },
184
+ unpublished: { type: "boolean" }
185
+ });
186
+ function parse(cmd) {
187
+ syncify_js.log.clear();
188
+ const fallback = [
189
+ { mode: "suggest" },
190
+ { values: null, positionals: null, tokens: null }
191
+ ];
192
+ if (node_process.argv.length === 2) {
193
+ syncify_js.$.mode.suggest = true;
194
+ return fallback;
195
+ } else {
196
+ const find = node_process.argv[2];
197
+ switch (find) {
198
+ case "-v":
199
+ case "--version":
200
+ syncify_js.$.mode.help = true;
201
+ syncify_js.$.mode.version = true;
202
+ fallback[0].mode = "version";
203
+ return fallback;
204
+ case "-h":
205
+ case "--help":
206
+ syncify_js.$.mode.help = true;
207
+ fallback[0].mode = "help";
208
+ return fallback;
209
+ }
210
+ let i = -1;
211
+ let s = cmd.length;
212
+ while (++i < s) if (cmd[i].mode === find) break;
213
+ if (i === s) {
214
+ syncify_js.throwCommand([
215
+ `Invalid positional or mode${syncify_js.COL} "${syncify_js.red2.bold(find)}"
216
+ `,
217
+ "You must provide a known and valid execution mode.",
218
+ `For a list of available modes, run the help command${syncify_js.COL}
219
+
220
+ `,
221
+ `${syncify_js.gray2("$")} ${syncify_js.blue2("sy help modes")}`
222
+ ]);
223
+ }
224
+ const flag = flags();
225
+ const mode = cmd[i];
226
+ const options = syncify_js.o();
227
+ if ("flags" in mode) {
228
+ i = -1;
229
+ s = mode.flags.length;
230
+ while (++i < s) {
231
+ if (mode.flags[i] in flag) {
232
+ options[mode.flags[i]] = flag[mode.flags[i]];
233
+ } else {
234
+ syncify_js.throwCommand([
235
+ `Unknown flag expression provided "${syncify_js.bold2(`--${mode.flags[i]}`)}"
236
+ `,
237
+ `Accepted flags for ${syncify_js.bold2(mode.mode)} mode${syncify_js.COL}
238
+
239
+ `,
240
+ `${syncify_js.g.nl(mode.flags.map((v) => syncify_js.gray2("--") + syncify_js.blue2(v)))}`
241
+ ]);
242
+ }
243
+ }
244
+ }
245
+ try {
246
+ const args = node_util.parseArgs({
247
+ args: node_process.argv,
248
+ allowPositionals: true,
249
+ tokens: true,
250
+ options
251
+ });
252
+ return [mode, args];
253
+ } catch (error) {
254
+ syncify_js.throwCommand(error.message.replace(/(--?)([a-z-]+)?/g, syncify_js.red2.bold("$1$2")));
255
+ }
256
+ }
257
+ }
258
+ function positional(cmd, tokens) {
259
+ function parseBuild() {
260
+ if (tokens.length > 1) {
261
+ syncify_js.throwCommand([
262
+ `Invalid positional ${syncify_js.bold2("build")} arguments expression provided. No more than 1 transform`,
263
+ `can be passed. Use comma ${syncify_js.bold2(",")} separated expression instead, e.g:
264
+
265
+ `,
266
+ `${syncify_js.gray2("$")} ${syncify_js.blue2(`sy build ${syncify_js.bold2(tokens.join(syncify_js.gray2(",")))}`)}`
267
+ ]);
268
+ return false;
269
+ } else {
270
+ if (tokens[0].indexOf(",") > -1) {
271
+ for (const transform of tokens[0].split(",")) {
272
+ if (!syncify_js.includes(transform, cmd.accepts)) {
273
+ syncify_js.throwCommand([
274
+ `Invalid ${syncify_js.bold2("sy build")} transform "${syncify_js.bold2(transform)}" provided.`,
275
+ `Must be one of the following${syncify_js.COL}
276
+
277
+ `,
278
+ `${syncify_js.g.nl(cmd.accepts.map((v) => syncify_js.blue2(v)))}`
279
+ ]);
280
+ return false;
281
+ } else {
282
+ syncify_js.$.mode[transform] = true;
283
+ return true;
284
+ }
285
+ }
286
+ } else {
287
+ if (!syncify_js.includes(tokens[0], cmd.accepts)) {
288
+ syncify_js.throwCommand([
289
+ `Invalid ${syncify_js.bold2("sy build")} transform "${syncify_js.bold2(tokens[0])}"`,
290
+ `Must be one of the following${syncify_js.COL}
291
+
292
+ `,
293
+ `${syncify_js.g.nl(cmd.accepts.map((v) => syncify_js.blue2(v)))}`
294
+ ]);
295
+ return false;
296
+ } else {
297
+ syncify_js.$.mode[tokens[0]] = true;
298
+ return true;
299
+ }
300
+ }
301
+ }
302
+ }
303
+ function parseHelp() {
304
+ if (cmd.accepts.includes(tokens[0])) {
305
+ syncify_js.$.mode._ = tokens[0];
306
+ return true;
307
+ } else {
308
+ syncify_js.throwCommand([
309
+ `Invalid ${syncify_js.bold2("sy help")} argument "${syncify_js.bold2(tokens[0])}" ${syncify_js.TLD}`,
310
+ `Must be one of the following${syncify_js.COL}
311
+
312
+ `,
313
+ `${syncify_js.g.nl(cmd.accepts.map((v) => `${syncify_js.DSH} sy help ${v}`))}`
314
+ ]);
315
+ return false;
316
+ }
317
+ }
318
+ function parseKeychain() {
319
+ if (cmd.accepts.includes(tokens[0])) {
320
+ syncify_js.$.mode._ = tokens[0];
321
+ return true;
322
+ } else {
323
+ syncify_js.throwCommand([
324
+ `Invalid ${syncify_js.bold2("keychain")} argument "${syncify_js.bold2(tokens[0])}" ${syncify_js.TLD}`,
325
+ `Must be one of the following${syncify_js.COL}
326
+
327
+ `,
328
+ `${syncify_js.g.nl(cmd.accepts.map((v) => `${syncify_js.DSH} ${syncify_js.blue2(v)}`))}`
329
+ ]);
330
+ return false;
331
+ }
332
+ }
333
+ if (syncify_js.$.mode.build) return parseBuild();
334
+ if (syncify_js.$.mode.help) return parseHelp();
335
+ if (syncify_js.$.mode.keychain) return parseKeychain();
336
+ return true;
337
+ }
338
+ function command(commands) {
339
+ syncify_js.runtime();
340
+ const [cmd, flags2] = parse(commands);
341
+ if (cmd.mode === "suggest") {
342
+ Help(syncify_js.$.mode);
343
+ return syncify_js.NooP;
344
+ }
345
+ const [node, bin] = node_process.argv;
346
+ const position = flags2.positionals ? positional(cmd, flags2.positionals.slice(3)) : false;
347
+ syncify_js.event.mode(cmd.mode);
348
+ syncify_js.$.node = node;
349
+ syncify_js.$.bin = bin;
350
+ syncify_js.$.argv = node_process.argv.slice(2);
351
+ syncify_js.$.dirs.module = bin.slice(0, bin.indexOf("dist/"));
352
+ syncify_js.$.using = syncify_js.$.dirs.module.startsWith(node_path.join(syncify_js.$.cwd, "node_modules")) ? "local" : "global";
353
+ syncify_js.$.terminal.wrap = Math.round(syncify_js.$.terminal.cols - syncify_js.$.terminal.cols / 3);
354
+ syncify_js.$.mode[cmd.mode] = true;
355
+ if (syncify_js.$.mode.build) {
356
+ syncify_js.$.log.mode = 4 /* Build */;
357
+ syncify_js.$.mode.script = true;
358
+ syncify_js.$.mode.style = true;
359
+ syncify_js.$.mode.svg = true;
360
+ syncify_js.$.mode.liquid = true;
361
+ syncify_js.$.mode.json = true;
362
+ } else {
363
+ if (syncify_js.$.mode.watch) syncify_js.$.log.mode = 1 /* Watch */;
364
+ if (syncify_js.isNull(syncify_js.$.log.mode) && syncify_js.$.mode.push) syncify_js.$.log.mode = 6 /* Push */;
365
+ if (syncify_js.isNull(syncify_js.$.log.mode) && syncify_js.$.mode.pull) syncify_js.$.log.mode = 7 /* Pull */;
366
+ if (syncify_js.isNull(syncify_js.$.log.mode) && syncify_js.$.mode.build) syncify_js.$.log.mode = 4 /* Build */;
367
+ if (syncify_js.isNull(syncify_js.$.log.mode) && syncify_js.$.mode.pack) syncify_js.$.log.mode = 8 /* Pack */;
368
+ }
369
+ if (cmd.accepts !== null && syncify_js.$.argv.length > 1 && position === false) return syncify_js.NooP;
370
+ if (syncify_js.$.mode.build) {
371
+ syncify_js.$.mode.script = true;
372
+ syncify_js.$.mode.style = true;
373
+ syncify_js.$.mode.svg = true;
374
+ syncify_js.$.mode.liquid = true;
375
+ syncify_js.$.mode.json = true;
376
+ }
377
+ if (syncify_js.$.mode.help || syncify_js.$.mode.inspect) {
378
+ Help(syncify_js.$.mode);
379
+ return syncify_js.NooP;
380
+ }
381
+ syncify_js.assign(syncify_js.$.cmd, flags2.values);
382
+ syncify_js.forKeys((mode) => mode in syncify_js.$.mode ? syncify_js.$.mode[mode] = true : null, flags2.values);
383
+ if (syncify_js.$.mode.help) {
384
+ syncify_js.$.mode._ = cmd.mode;
385
+ Help(syncify_js.$.mode);
386
+ return syncify_js.NooP;
387
+ }
388
+ syncify_js.$.env.prod = syncify_js.$.mode.prod;
389
+ syncify_js.$.env.dev = syncify_js.$.mode.dev && !syncify_js.$.mode.prod;
390
+ syncify_js.$.env.cli = true;
391
+ node_process.env.SYNCIFY_ENV = syncify_js.$.env.dev ? "dev" : "prod";
392
+ node_process.env.SYNCIFY_WATCH = String(syncify_js.$.mode.watch);
393
+ node_process.env.SYNCIFY_VERSION = "1.0.0-alpha.1";
394
+ return (fn) => fn();
395
+ }
396
+
397
+ // syncify/cli.ts
398
+ command(
399
+ [
400
+ {
401
+ mode: "build",
402
+ accepts: [
403
+ "script",
404
+ "style",
405
+ "svg",
406
+ "liquid",
407
+ "json"
408
+ ],
409
+ flags: [
410
+ "help",
411
+ "input",
412
+ "output",
413
+ "config",
414
+ "filter",
415
+ "dev",
416
+ "prod",
417
+ "terse",
418
+ "clean",
419
+ "silent"
420
+ ]
421
+ },
422
+ {
423
+ mode: "watch",
424
+ accepts: null,
425
+ flags: [
426
+ "help",
427
+ "hot",
428
+ "bind",
429
+ "align",
430
+ "input",
431
+ "output",
432
+ "config",
433
+ "target",
434
+ "filter",
435
+ "dev",
436
+ "prod",
437
+ "terse",
438
+ "clean",
439
+ "silent"
440
+ ]
441
+ },
442
+ {
443
+ mode: "pack",
444
+ accepts: null,
445
+ flags: [
446
+ "help",
447
+ "output",
448
+ "config",
449
+ "clean",
450
+ "dev",
451
+ "prod",
452
+ "terse",
453
+ "patch",
454
+ "minor",
455
+ "major"
456
+ ]
457
+ },
458
+ {
459
+ mode: "delete",
460
+ accepts: null,
461
+ flags: [
462
+ "config",
463
+ "target",
464
+ "filter",
465
+ "force"
466
+ ]
467
+ },
468
+ {
469
+ mode: "push",
470
+ accepts: null,
471
+ flags: [
472
+ "help",
473
+ "input",
474
+ "config",
475
+ "target",
476
+ "align",
477
+ "filter",
478
+ "force",
479
+ "batch"
480
+ ]
481
+ },
482
+ {
483
+ mode: "pull",
484
+ accepts: null,
485
+ flags: [
486
+ "help",
487
+ "output",
488
+ "config",
489
+ "target",
490
+ "filter",
491
+ "align",
492
+ "merge",
493
+ "force",
494
+ "batch"
495
+ ]
496
+ },
497
+ {
498
+ mode: "publish",
499
+ accepts: null,
500
+ flags: [
501
+ "output",
502
+ "config",
503
+ "patch",
504
+ "minor",
505
+ "major",
506
+ "clean",
507
+ "dev",
508
+ "prod",
509
+ "terse",
510
+ "target",
511
+ "main",
512
+ "unpublished"
513
+ ]
514
+ },
515
+ {
516
+ mode: "version",
517
+ accepts: null,
518
+ alias: ["version"],
519
+ flags: [
520
+ "help",
521
+ "patch",
522
+ "minor",
523
+ "major"
524
+ ]
525
+ },
526
+ {
527
+ mode: "create",
528
+ flags: [
529
+ "help"
530
+ ],
531
+ accepts: [
532
+ "dawn",
533
+ "dusk",
534
+ "silk",
535
+ "using-paths",
536
+ "using-rename",
537
+ "using-sass",
538
+ "using-schema",
539
+ "using-tailwind",
540
+ "using-typescript"
541
+ ]
542
+ },
543
+ {
544
+ mode: "keychain",
545
+ flags: [
546
+ "help"
547
+ ],
548
+ accepts: [
549
+ "create",
550
+ "update",
551
+ "associate",
552
+ "migrate",
553
+ "inspect"
554
+ ]
555
+ },
556
+ {
557
+ mode: "help",
558
+ alias: ["help"],
559
+ accepts: [
560
+ "examples",
561
+ // SUPPORTED
562
+ "watch",
563
+ "build",
564
+ "push",
565
+ "pull",
566
+ "create",
567
+ "inspect",
568
+ "projects",
569
+ // TODO
570
+ "export",
571
+ "import",
572
+ "stash",
573
+ "publish",
574
+ "version",
575
+ "keychain",
576
+ "theme",
577
+ "git",
578
+ "setup",
579
+ "prune",
580
+ "doctor"
581
+ ]
582
+ },
583
+ {
584
+ mode: "init",
585
+ accepts: null
586
+ },
587
+ {
588
+ mode: "projects",
589
+ accepts: null,
590
+ flags: [
591
+ "help"
592
+ ]
593
+ },
594
+ {
595
+ mode: "link",
596
+ accepts: null
597
+ },
598
+ {
599
+ mode: "git",
600
+ accepts: null
601
+ },
602
+ {
603
+ mode: "prune",
604
+ accepts: null
605
+ },
606
+ {
607
+ mode: "doctor",
608
+ accepts: null
609
+ },
610
+ {
611
+ mode: "inspect",
612
+ accepts: null
613
+ }
614
+ ]
615
+ )(syncify_js.syncify);