@syncify/cli 1.0.0-unstable.1 → 1.0.0-unstable.3
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.
- package/dist/cli.js +119 -112
- package/dist/index.d.ts +225 -128
- package/dist/syncify.js +10769 -6211
- package/hot.js.liquid +2 -2
- package/package.json +32 -29
- package/readme.md +67 -21
- package/scripts/postinstall.js +9 -0
- package/scripts/postuninstall.js +104 -0
- package/scripts/postversion.js +4 -1
- package/scripts/prepublish.js +63 -0
package/dist/cli.js
CHANGED
@@ -7,35 +7,35 @@ var node_util = require('node:util');
|
|
7
7
|
|
8
8
|
// syncify/cli/help/utils.ts
|
9
9
|
function describe(message) {
|
10
|
-
return syncify_js
|
10
|
+
return syncify_js.$2.terminal.cols < 75 ? "" : syncify_js.F(`\u203A ${message}`);
|
11
11
|
}
|
12
12
|
function highlight(input) {
|
13
|
-
return input.replace(/([${}<>])/g, syncify_js.
|
13
|
+
return input.replace(/([${}<>])/g, syncify_js.F("$1")).replace(/(,)(?= -)/g, syncify_js.F("$1")).replace(/(\[options\])/g, `${syncify_js.It}options${syncify_js.Lt}`).replace(/(?<= )(-|--)(?=[a-zA-Z]+)/g, syncify_js.F("$1"));
|
14
14
|
}
|
15
15
|
function encase({ banner = false }) {
|
16
|
-
const arrow = `${syncify_js
|
17
|
-
const label = syncify_js.
|
18
|
-
const header = syncify_js.
|
19
|
-
const footer = syncify_js.
|
16
|
+
const arrow = `${syncify_js.qD("SB", syncify_js.F("\u25B2"))} AND DOWN ${syncify_js.qD("SB", syncify_js.F("\u25BC"))}`;
|
17
|
+
const label = syncify_js.F(`UP ${arrow} ARROW KEYS TO SCROLL`);
|
18
|
+
const header = syncify_js.Ft().Break(2).Top(label, false).Newline();
|
19
|
+
const footer = syncify_js.Ft().Newline(2).End(label, false).Break();
|
20
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.
|
21
|
+
header.Line("\u2588\u2580\u2580 \u2588 \u2588 \u2588\u2580\u2588 \u2588\u2580\u2580 \u2580\u2588\u2580 \u2588\u2580\u2580 \u2588 \u2588", syncify_js.h).Line("\u2580\u2580\u2588 \u2580\u2580\u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2580\u2580 \u2580\u2580\u2588", syncify_js.h).Line("\u2580\u2580\u2580 \u2580\u2580\u2580 \u2580 \u2580 \u2580\u2580\u2580 \u2580\u2580\u2580 \u2580 \u2580\u2580\u2580", syncify_js.h).Newline();
|
22
22
|
}
|
23
23
|
return [header.toString(), footer];
|
24
24
|
}
|
25
25
|
|
26
26
|
// syncify/cli/help/default.ts
|
27
27
|
function Default() {
|
28
|
-
syncify_js.
|
28
|
+
syncify_js.Ft().Header(`HELP${syncify_js.M}`, syncify_js.$).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.M}`, syncify_js.$).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.M, syncify_js.$).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 publish ${describe("Changes a theme role to and makes it main")}`, syncify_js.cu).Line(` $ sy delete ${describe("Remove files/resources from a store or theme")}`, syncify_js.cu).Line(` $ sy pack ${describe("Generate a .zip package of the current theme")}`, syncify_js.cu).Line(` $ sy link ${describe("Link existing themes/s from a store")}`).Line(` $ sy unlink ${describe("Remove a linked theme/s from project")}`, syncify_js.cu).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.cu).Line(` $ sy prune ${describe("Clears internal project caches from disk")}`, syncify_js.cu).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.cu).Line(` $ sy help ${describe("Print complete command list")}`).Header(`FLAGS${syncify_js.M}`, syncify_js.$).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.F.bold).Line(`Version${syncify_js.M} ${syncify_js.$2.version}`, syncify_js.F).Line(`License${syncify_js.M} Apache 2.0`, syncify_js.F).Line(`Website${syncify_js.M} ${syncify_js.Ee("https://syncify.sh")}`, syncify_js.F).Line(`Github${syncify_js.M} ${syncify_js.Ee("https://github.com/panoply/syncify")}`, syncify_js.F).Line(`Discord${syncify_js.M} ${syncify_js.Ee("https://discord.gg/shopify-developers-597504637167468564")}`, syncify_js.F).Newline().toString((input) => {
|
29
29
|
const [header, footer] = encase({ banner: true });
|
30
|
-
const heading = syncify_js.
|
31
|
-
const content = syncify_js.
|
30
|
+
const heading = syncify_js.Go({ input: header, height: 8 });
|
31
|
+
const content = syncify_js.Go({
|
32
32
|
input: highlight(input),
|
33
33
|
yPos: 8,
|
34
|
-
height: syncify_js
|
34
|
+
height: syncify_js.$2.terminal.rows - 12
|
35
35
|
});
|
36
36
|
heading.print();
|
37
37
|
content.print();
|
38
|
-
content.setKeypress(syncify_js
|
38
|
+
content.setKeypress(syncify_js.$2.terminal.rows, content.maxHeight);
|
39
39
|
footer.toLog();
|
40
40
|
});
|
41
41
|
}
|
@@ -43,11 +43,11 @@ function Default() {
|
|
43
43
|
// syncify/cli/help/information.ts
|
44
44
|
function Inspect() {
|
45
45
|
syncify_js.log.clear();
|
46
|
-
syncify_js.
|
46
|
+
syncify_js.Ft().BR.Top("Inspect").Header(`${syncify_js.He.bold("@syncify/cli")}`).Line(`${syncify_js.F("VERSION")}${syncify_js.M} v${syncify_js.I("1.0.0-unstable.2")}`).Line(`${syncify_js.F("HOT")}${syncify_js.M} v${syncify_js.I("0.6.0")}`).Line(`${syncify_js.F("LICENSE")}${syncify_js.M} ${syncify_js.I("Apache 2.0")}`).Line(`${syncify_js.F("AUTHOR")}${syncify_js.M} ${syncify_js.I("\u039D\u03B9\u03BA\u03BF\u03BB\u03B1\u03C2 \u03A3\u03B1\u03B2\u03B2\u03B9\u03B4\u03B7\u03C2")}`).Line(`${syncify_js.F("PM")}${syncify_js.M} ${syncify_js.I(syncify_js.$2.pm)}`).Line(`${syncify_js.F("OS")}${syncify_js.M} ${syncify_js.I(syncify_js.$2.platform)}`).Line(`${syncify_js.F("BINARY")}${syncify_js.M} ${syncify_js.I(syncify_js.$2.using)}`).Line(`${syncify_js.F("CWD")}${syncify_js.M} ${syncify_js.I(syncify_js.$2.cwd)}`).Line(`${syncify_js.F("HASH")}${syncify_js.M} ${syncify_js.I(syncify_js.$2.hash)}`).Line(`${syncify_js.F("SCRIPT")}${syncify_js.M} ${syncify_js.I(syncify_js.$2.bin)}`).Line(`${syncify_js.F("MODULE")}${syncify_js.M} ${syncify_js.I(syncify_js.$2.dirs.module)}`).Line(`${syncify_js.F("STORE")}${syncify_js.M} ${syncify_js.I(syncify_js.$2.home)}`).Line(`${syncify_js.F("KEYCHAIN")}${syncify_js.M} ${syncify_js.I(`${syncify_js.$2.file.keychain}`)}`).Line(`${syncify_js.F("GITHUB")}${syncify_js.M} ${syncify_js.I(syncify_js.$2.github)}`).Line(`${syncify_js.F("WEBSITE")}${syncify_js.M} ${syncify_js.I("https://syncify.sh")}`).NL.End("Inspect").BR.toLog().Break();
|
47
47
|
}
|
48
48
|
function Version() {
|
49
49
|
syncify_js.log.clear();
|
50
|
-
syncify_js.
|
50
|
+
syncify_js.Ft().BR.Top("Versions", false).NL.Line(`${syncify_js.I("@syncify/cli")} ${syncify_js.Z} ${syncify_js.I("v1.0.0-unstable.2")}`).Line(`${syncify_js.I("@syncify/hot")} ${syncify_js.Z} ${syncify_js.I("v0.6.0")}`).NL.End("Versions", false).BR.toLog().Break();
|
51
51
|
}
|
52
52
|
|
53
53
|
// syncify/cli/help/descriptions.ts
|
@@ -90,63 +90,63 @@ var description = (mode) => ({
|
|
90
90
|
// syncify/cli/help/modes.ts
|
91
91
|
function Modes(mode) {
|
92
92
|
if (mode in Modes) return Modes[mode]();
|
93
|
-
const
|
93
|
+
const write = syncify_js.Ft().Top(`Syncify ${syncify_js.Nu} Error`, false).Header("NOT YET AVAILABLE", syncify_js.P.bold);
|
94
94
|
if (syncify_js.COMMAND_MODES.has(mode)) {
|
95
95
|
const message = [
|
96
|
-
`Help reference for the ${syncify_js
|
97
|
-
`${syncify_js
|
96
|
+
`Help reference for the ${syncify_js.$(`sy help ${mode}`)} command is not yet available to`,
|
97
|
+
`${syncify_js.$("sy help")} but is slated for inclusion in upcoming releases.`,
|
98
98
|
"The command itself is valid and functional, only the help information is unavailable."
|
99
99
|
];
|
100
|
-
const modes = syncify_js.toArray(syncify_js.COMMAND_MODES).filter((n) => n !== "help").sort((
|
100
|
+
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);
|
101
101
|
const equal = syncify_js.eqWS(modes, { padding: 0 });
|
102
|
-
|
102
|
+
write.Wrap(message, syncify_js.P).Newline().Each(modes, (name) => name in Modes ? write.Line(`$ sy help ${name} ${equal(name) + syncify_js.Ru}`, syncify_js.I) : write.Line(`$ ${syncify_js.du(`sy help ${name}`)}`, syncify_js.F));
|
103
103
|
}
|
104
|
-
|
104
|
+
write.NL.End(`Syncify ${syncify_js.Nu} Error`, false).BR.toLog(highlight);
|
105
105
|
}
|
106
106
|
Modes.init = () => {
|
107
107
|
const info = description("init");
|
108
|
-
syncify_js.
|
108
|
+
syncify_js.Ft().BR.Top(`help ${syncify_js.Be} sy inspect`, false).True(info, (tui) => tui.Header(`DESCRIPTION${syncify_js.M}`, syncify_js.$).Wrap(syncify_js.F, info.overview)).True(info, (tui) => tui.Prepend(info.reference, syncify_js.F.underline)).Header(`COMMANDS${syncify_js.M}`, syncify_js.$).Line(" $ sy init").NL.End(`help ${syncify_js.Be} sy inspect`, false).BR.toLog(highlight);
|
109
109
|
};
|
110
110
|
Modes.push = () => {
|
111
111
|
const info = description("push");
|
112
|
-
syncify_js.
|
112
|
+
syncify_js.Ft().BR.Top(`help ${syncify_js.Be} sy push`, false).True(info, (tui) => tui.Header(`DESCRIPTION${syncify_js.M}`, syncify_js.$).Wrap(syncify_js.F, info.overview)).True(info, (tui) => tui.Prepend(info.reference, syncify_js.F.underline)).Header(`COMMANDS${syncify_js.M}`, syncify_js.$).Line(" $ sy push").Line(" $ sy push --flags").Header(`FLAGS${syncify_js.M}`, syncify_js.$).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.Be} sy push`, false).BR.toLog(highlight);
|
113
113
|
syncify_js.i.exit(0);
|
114
114
|
};
|
115
115
|
Modes.pull = () => {
|
116
116
|
const info = description("pull");
|
117
|
-
syncify_js.
|
117
|
+
syncify_js.Ft().BR.Top(`help ${syncify_js.Be} sy pull`, false).True(info, (tui) => tui.Header(`DESCRIPTION${syncify_js.M}`, syncify_js.$).Wrap(syncify_js.F, info.overview)).True(info, (tui) => tui.Prepend(info.reference, syncify_js.F.underline)).Header(`COMMANDS${syncify_js.M}`, syncify_js.$).Line(" $ sy pull").Line(" $ sy pull --flags").Header(`FLAGS${syncify_js.M}`, syncify_js.$).Line(` --filter, -F ${describe("Filter specific files/directories")}`).Line(` --target, -T ${describe("Target a theme or store")}`).Line(` --merge ${describe(`Merges local ${syncify_js.Mu} remote theme`)}`).Line(` --align ${describe(`Align local ${syncify_js.Mu} 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.Be} sy push`, false).BR.toLog(highlight);
|
118
118
|
};
|
119
119
|
Modes.watch = () => {
|
120
120
|
const info = description("watch");
|
121
|
-
syncify_js.
|
121
|
+
syncify_js.Ft().BR.Top(`help ${syncify_js.Be} sy watch`, false).True(info, (tui) => tui.Header(`DESCRIPTION${syncify_js.M}`, syncify_js.$).Wrap(syncify_js.F, info.overview)).True(info, (tui) => tui.Prepend(info.reference, syncify_js.F.underline)).Header(`COMMANDS${syncify_js.M}`, syncify_js.$).Line(" $ sy watch").Line(" $ sy watch --flags").Header(`FLAGS${syncify_js.M}`, syncify_js.$).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.Be} sy watch`, false).BR.toLog(highlight);
|
122
122
|
};
|
123
123
|
Modes.inspect = () => {
|
124
124
|
const info = description("watch");
|
125
|
-
syncify_js.
|
125
|
+
syncify_js.Ft().BR.Top(`help ${syncify_js.Be} sy inspect`, false).True(info, (tui) => tui.Header(`DESCRIPTION${syncify_js.M}`, syncify_js.$).Wrap(syncify_js.F, info.overview)).True(info, (tui) => tui.Prepend(info.reference, syncify_js.F.underline)).Header(`COMMANDS${syncify_js.M}`, syncify_js.$).Line(" $ sy inspect").NL.End(`help ${syncify_js.Be} sy inspect`, false).BR.toLog(highlight);
|
126
126
|
};
|
127
127
|
Modes.create = () => {
|
128
128
|
const info = description("build");
|
129
|
-
const message = syncify_js.
|
129
|
+
const message = syncify_js.Ft().BR.Top(`help ${syncify_js.Be} sy create`, false).True(info, (tui) => tui.Header(`DESCRIPTION${syncify_js.M}`, syncify_js.$).Wrap(syncify_js.F, info.overview)).True(info, (tui) => tui.Prepend(info.reference, syncify_js.F.underline)).Header(`COMMANDS${syncify_js.M}`, syncify_js.$).Line(" $ sy create").Line(` $ sy create ${syncify_js.qD("AN", "strap")}`).Header(`OPTIONS${syncify_js.M}`, syncify_js.$);
|
130
130
|
const straps = [...syncify_js.STRAP_THEMES, ...syncify_js.STRAP_EXAMPLES];
|
131
131
|
const eq = syncify_js.eqWS(straps.map(([name]) => name), { padding: 2 });
|
132
132
|
syncify_js.forEach(([name, desc, unavilable]) => {
|
133
|
-
const line = unavilable ? ` $ ${syncify_js.
|
133
|
+
const line = unavilable ? ` $ ${syncify_js.du(`sy create ${name}`)}${eq(name)} ${describe("unavilable")}` : ` $ sy create ${name}${eq(name)} ${describe(desc.trim())}`;
|
134
134
|
message.Line(line);
|
135
135
|
}, straps);
|
136
|
-
message.NL.End(`help ${syncify_js.
|
136
|
+
message.NL.End(`help ${syncify_js.Be} sy push`, false).BR.toLog(highlight);
|
137
137
|
};
|
138
138
|
Modes.projects = () => {
|
139
139
|
const info = description("projects");
|
140
|
-
syncify_js.
|
140
|
+
syncify_js.Ft().BR.Top(`help ${syncify_js.Be} sy projects`, false).True(info, (tui) => tui.Header(`DESCRIPTION${syncify_js.M}`, syncify_js.$).Wrap(syncify_js.F, info.overview)).True(info, (tui) => tui.Prepend(info.reference, syncify_js.F.underline)).Header(`COMMANDS${syncify_js.M}`, syncify_js.$).Line(" $ sy projects").Line(` $ sy projects ${syncify_js.qD("AN", syncify_js.au("name"))}`).NL.End(`help ${syncify_js.Be} sy push`, false).BR.toLog(highlight);
|
141
141
|
};
|
142
142
|
Modes.build = () => {
|
143
143
|
const info = description("build");
|
144
|
-
syncify_js.
|
144
|
+
syncify_js.Ft().BR.Top(`help ${syncify_js.Be} sy build`, false).True(info, (tui) => tui.Header(`DESCRIPTION${syncify_js.M}`, syncify_js.$).Wrap(syncify_js.F, info.overview)).True(info, (tui) => tui.Prepend(info.reference, syncify_js.F.underline)).Header(`COMMANDS${syncify_js.M}`, syncify_js.$).Line(" $ sy build").Line(" $ sy build --flags").Line(` $ sy build ${syncify_js.qD("SB", "option")}`).Line(` $ sy build ${syncify_js.qD("SB", "option")} --flags`).Header(`OPTIONS${syncify_js.M}`, syncify_js.$).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.M}`, syncify_js.$).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.Be} sy build`, false).BR.toLog(highlight);
|
145
145
|
};
|
146
146
|
|
147
147
|
// syncify/cli/help/suggest.ts
|
148
148
|
function Suggest() {
|
149
|
-
syncify_js.
|
149
|
+
syncify_js.Ft().Top(`Syncify ${syncify_js.Nu} Error`, false).Header("1.0.0-unstable.2", syncify_js.F).Error("MISSING COMMAND " + syncify_js.Tt, syncify_js.$.redBright).Newline("red").Error("Please provide a command line argument", syncify_js.k).Header(`USAGE${syncify_js.M}`, syncify_js.$).Line(` $ sy <${syncify_js.au("mode")}>`).Line(` $ sy <${syncify_js.au("mode")}> --flags`).Line(` $ sy <${syncify_js.au("mode")}> [options]`).Line(` $ sy <${syncify_js.au("mode")}> [options] --flags`).Header(`HELP${syncify_js.M}`, syncify_js.$).Line(" $ sy help").Line(` $ sy <${syncify_js.au("mode")}> --help`).NL.End(`Syncify ${syncify_js.Nu} Error`, false).BR.toLog(highlight).Break();
|
150
150
|
}
|
151
151
|
|
152
152
|
// syncify/mode/help.ts
|
@@ -175,6 +175,7 @@ var flags = () => ({
|
|
175
175
|
help: { type: "boolean", short: "h" },
|
176
176
|
version: { type: "boolean", short: "v" },
|
177
177
|
align: { type: "boolean" },
|
178
|
+
new: { type: "boolean" },
|
178
179
|
merge: { type: "boolean" },
|
179
180
|
dev: { type: "boolean" },
|
180
181
|
prod: { type: "boolean" },
|
@@ -198,20 +199,20 @@ function parse(cmd) {
|
|
198
199
|
{ values: null, positionals: null, tokens: null }
|
199
200
|
];
|
200
201
|
if (node_process.argv.length === 2) {
|
201
|
-
syncify_js
|
202
|
+
syncify_js.$2.mode.suggest = true;
|
202
203
|
return fallback;
|
203
204
|
} else {
|
204
205
|
const find = node_process.argv[2];
|
205
206
|
switch (find) {
|
206
207
|
case "-v":
|
207
208
|
case "--version":
|
208
|
-
syncify_js
|
209
|
-
syncify_js
|
209
|
+
syncify_js.$2.mode.help = true;
|
210
|
+
syncify_js.$2.mode.version = true;
|
210
211
|
fallback[0].mode = "version";
|
211
212
|
return fallback;
|
212
213
|
case "-h":
|
213
214
|
case "--help":
|
214
|
-
syncify_js
|
215
|
+
syncify_js.$2.mode.help = true;
|
215
216
|
fallback[0].mode = "help";
|
216
217
|
return fallback;
|
217
218
|
}
|
@@ -219,19 +220,19 @@ function parse(cmd) {
|
|
219
220
|
let s = cmd.length;
|
220
221
|
while (++i2 < s) if (cmd[i2].mode === find) break;
|
221
222
|
if (i2 === s) {
|
222
|
-
|
223
|
-
`Invalid positional or mode${syncify_js.
|
223
|
+
CommandError([
|
224
|
+
`Invalid positional or mode${syncify_js.M} "${syncify_js.S.bold(find)}"
|
224
225
|
`,
|
225
226
|
"You must provide a known and valid execution mode.",
|
226
|
-
`For a list of available modes, run the help command${syncify_js.
|
227
|
+
`For a list of available modes, run the help command${syncify_js.M}
|
227
228
|
|
228
229
|
`,
|
229
|
-
`${syncify_js.
|
230
|
+
`${syncify_js.F("$")} ${syncify_js.Fu("sy help modes")}`
|
230
231
|
]);
|
231
232
|
}
|
232
233
|
const flag = flags();
|
233
234
|
const mode = cmd[i2];
|
234
|
-
const options = syncify_js.
|
235
|
+
const options = syncify_js.o2();
|
235
236
|
if ("flags" in mode) {
|
236
237
|
i2 = -1;
|
237
238
|
s = mode.flags.length;
|
@@ -239,13 +240,13 @@ function parse(cmd) {
|
|
239
240
|
if (mode.flags[i2] in flag) {
|
240
241
|
options[mode.flags[i2]] = flag[mode.flags[i2]];
|
241
242
|
} else {
|
242
|
-
|
243
|
-
`Unknown flag expression provided "${syncify_js
|
243
|
+
CommandError([
|
244
|
+
`Unknown flag expression provided "${syncify_js.$(`--${mode.flags[i2]}`)}"
|
244
245
|
`,
|
245
|
-
`Accepted flags for ${syncify_js
|
246
|
+
`Accepted flags for ${syncify_js.$(mode.mode)} mode${syncify_js.M}
|
246
247
|
|
247
248
|
`,
|
248
|
-
`${syncify_js.g.nl(mode.flags.map((v) => syncify_js.
|
249
|
+
`${syncify_js.g.nl(mode.flags.map((v) => syncify_js.F("--") + syncify_js.Fu(v)))}`
|
249
250
|
]);
|
250
251
|
}
|
251
252
|
}
|
@@ -259,50 +260,50 @@ function parse(cmd) {
|
|
259
260
|
});
|
260
261
|
return [mode, args];
|
261
262
|
} catch (error) {
|
262
|
-
|
263
|
+
CommandError(error.message.replace(/(--?)([a-z-]+)?/g, syncify_js.S.bold("$1$2")));
|
263
264
|
}
|
264
265
|
}
|
265
266
|
}
|
266
267
|
function positional(cmd, tokens) {
|
267
268
|
function parseBuild() {
|
268
269
|
if (tokens.length > 1) {
|
269
|
-
|
270
|
-
`Invalid positional ${syncify_js
|
271
|
-
`can be passed. Use comma ${syncify_js
|
270
|
+
CommandError([
|
271
|
+
`Invalid positional ${syncify_js.$("build")} arguments expression provided. No more than 1 transform`,
|
272
|
+
`can be passed. Use comma ${syncify_js.$(",")} separated expression instead, e.g:
|
272
273
|
|
273
274
|
`,
|
274
|
-
`${syncify_js.
|
275
|
+
`${syncify_js.F("$")} ${syncify_js.Fu(`sy build ${syncify_js.$(tokens.join(syncify_js.F(",")))}`)}`
|
275
276
|
]);
|
276
277
|
return false;
|
277
278
|
} else {
|
278
279
|
if (tokens[0].indexOf(",") > -1) {
|
279
280
|
for (const transform of tokens[0].split(",")) {
|
280
281
|
if (!syncify_js.includes(transform, cmd.accepts)) {
|
281
|
-
|
282
|
-
`Invalid ${syncify_js
|
283
|
-
`Must be one of the following${syncify_js.
|
282
|
+
CommandError([
|
283
|
+
`Invalid ${syncify_js.$("sy build")} transform "${syncify_js.$(transform)}" provided.`,
|
284
|
+
`Must be one of the following${syncify_js.M}
|
284
285
|
|
285
286
|
`,
|
286
|
-
`${syncify_js.g.nl(cmd.accepts.map((v) => syncify_js.
|
287
|
+
`${syncify_js.g.nl(cmd.accepts.map((v) => syncify_js.Fu(v)))}`
|
287
288
|
]);
|
288
289
|
return false;
|
289
290
|
} else {
|
290
|
-
syncify_js
|
291
|
+
syncify_js.$2.mode[transform] = true;
|
291
292
|
return true;
|
292
293
|
}
|
293
294
|
}
|
294
295
|
} else {
|
295
296
|
if (!syncify_js.includes(tokens[0], cmd.accepts)) {
|
296
|
-
|
297
|
-
`Invalid ${syncify_js
|
298
|
-
`Must be one of the following${syncify_js.
|
297
|
+
CommandError([
|
298
|
+
`Invalid ${syncify_js.$("sy build")} transform "${syncify_js.$(tokens[0])}"`,
|
299
|
+
`Must be one of the following${syncify_js.M}
|
299
300
|
|
300
301
|
`,
|
301
|
-
`${syncify_js.g.nl(cmd.accepts.map((v) => syncify_js.
|
302
|
+
`${syncify_js.g.nl(cmd.accepts.map((v) => syncify_js.Fu(v)))}`
|
302
303
|
]);
|
303
304
|
return false;
|
304
305
|
} else {
|
305
|
-
syncify_js
|
306
|
+
syncify_js.$2.mode[tokens[0]] = true;
|
306
307
|
return true;
|
307
308
|
}
|
308
309
|
}
|
@@ -310,97 +311,101 @@ function positional(cmd, tokens) {
|
|
310
311
|
}
|
311
312
|
function parseHelp() {
|
312
313
|
if (cmd.accepts.includes(tokens[0])) {
|
313
|
-
syncify_js
|
314
|
+
syncify_js.$2.mode._ = tokens[0];
|
314
315
|
return true;
|
315
316
|
} else {
|
316
|
-
|
317
|
-
`Invalid ${syncify_js
|
318
|
-
`Must be one of the following${syncify_js.
|
317
|
+
CommandError([
|
318
|
+
`Invalid ${syncify_js.$("sy help")} argument "${syncify_js.$(tokens[0])}" ${syncify_js.Be}`,
|
319
|
+
`Must be one of the following${syncify_js.M}
|
319
320
|
|
320
321
|
`,
|
321
|
-
`${syncify_js.g.nl(cmd.accepts.map((v) => `${syncify_js.
|
322
|
+
`${syncify_js.g.nl(cmd.accepts.map((v) => `${syncify_js.St} sy help ${v}`))}`
|
322
323
|
]);
|
323
324
|
return false;
|
324
325
|
}
|
325
326
|
}
|
326
327
|
function parseKeychain() {
|
327
328
|
if (cmd.accepts.includes(tokens[0])) {
|
328
|
-
syncify_js
|
329
|
+
syncify_js.$2.mode._ = tokens[0];
|
329
330
|
return true;
|
330
331
|
} else {
|
331
|
-
|
332
|
-
`Invalid ${syncify_js
|
333
|
-
`Must be one of the following${syncify_js.
|
332
|
+
CommandError([
|
333
|
+
`Invalid ${syncify_js.$("keychain")} argument "${syncify_js.$(tokens[0])}" ${syncify_js.Be}`,
|
334
|
+
`Must be one of the following${syncify_js.M}
|
334
335
|
|
335
336
|
`,
|
336
|
-
`${syncify_js.g.nl(cmd.accepts.map((v) => `${syncify_js.
|
337
|
+
`${syncify_js.g.nl(cmd.accepts.map((v) => `${syncify_js.St} ${syncify_js.Fu(v)}`))}`
|
337
338
|
]);
|
338
339
|
return false;
|
339
340
|
}
|
340
341
|
}
|
341
|
-
if (syncify_js
|
342
|
-
if (syncify_js
|
343
|
-
if (syncify_js
|
342
|
+
if (syncify_js.$2.mode.build) return parseBuild();
|
343
|
+
if (syncify_js.$2.mode.help) return parseHelp();
|
344
|
+
if (syncify_js.$2.mode.keychain) return parseKeychain();
|
344
345
|
return true;
|
345
346
|
}
|
346
347
|
function command(commands) {
|
347
348
|
syncify_js.runtime();
|
348
349
|
const [cmd, flags2] = parse(commands);
|
349
350
|
if (cmd.mode === "suggest") {
|
350
|
-
Help(syncify_js
|
351
|
+
Help(syncify_js.$2.mode);
|
351
352
|
return syncify_js.NooP;
|
352
353
|
}
|
353
354
|
const [node, bin] = node_process.argv;
|
354
355
|
const position = flags2.positionals ? positional(cmd, flags2.positionals.slice(3)) : false;
|
355
356
|
syncify_js.event.mode(cmd.mode);
|
356
|
-
syncify_js
|
357
|
-
syncify_js
|
358
|
-
syncify_js
|
359
|
-
syncify_js
|
360
|
-
syncify_js
|
361
|
-
syncify_js
|
362
|
-
syncify_js
|
363
|
-
if (syncify_js
|
364
|
-
syncify_js
|
365
|
-
syncify_js
|
366
|
-
syncify_js
|
367
|
-
syncify_js
|
368
|
-
syncify_js
|
369
|
-
syncify_js
|
357
|
+
syncify_js.$2.node = node;
|
358
|
+
syncify_js.$2.bin = bin;
|
359
|
+
syncify_js.$2.argv = node_process.argv.slice(2);
|
360
|
+
syncify_js.$2.dirs.module = bin.slice(0, bin.indexOf("dist/"));
|
361
|
+
syncify_js.$2.using = syncify_js.$2.dirs.module.startsWith(node_path.join(syncify_js.$2.cwd, "node_modules")) ? "local" : "global";
|
362
|
+
syncify_js.$2.terminal.wrap = Math.round(syncify_js.$2.terminal.cols - syncify_js.$2.terminal.cols / 3);
|
363
|
+
syncify_js.$2.mode[cmd.mode] = true;
|
364
|
+
if (syncify_js.$2.mode.build) {
|
365
|
+
syncify_js.$2.log.mode = 5 /* Build */;
|
366
|
+
syncify_js.$2.mode.script = true;
|
367
|
+
syncify_js.$2.mode.style = true;
|
368
|
+
syncify_js.$2.mode.svg = true;
|
369
|
+
syncify_js.$2.mode.liquid = true;
|
370
|
+
syncify_js.$2.mode.json = true;
|
370
371
|
} else {
|
371
|
-
if (syncify_js
|
372
|
-
if (syncify_js.isNull(syncify_js
|
373
|
-
if (syncify_js.isNull(syncify_js
|
374
|
-
if (syncify_js.isNull(syncify_js
|
375
|
-
if (syncify_js.isNull(syncify_js
|
372
|
+
if (syncify_js.$2.mode.watch) syncify_js.$2.log.mode = 1 /* Watch */;
|
373
|
+
if (syncify_js.isNull(syncify_js.$2.log.mode) && syncify_js.$2.mode.push) syncify_js.$2.log.mode = 7 /* Push */;
|
374
|
+
if (syncify_js.isNull(syncify_js.$2.log.mode) && syncify_js.$2.mode.pull) syncify_js.$2.log.mode = 8 /* Pull */;
|
375
|
+
if (syncify_js.isNull(syncify_js.$2.log.mode) && syncify_js.$2.mode.build) syncify_js.$2.log.mode = 5 /* Build */;
|
376
|
+
if (syncify_js.isNull(syncify_js.$2.log.mode) && syncify_js.$2.mode.pack) syncify_js.$2.log.mode = 9 /* Pack */;
|
376
377
|
}
|
377
|
-
if (cmd.accepts !== null && syncify_js
|
378
|
-
if (syncify_js
|
379
|
-
syncify_js
|
380
|
-
syncify_js
|
381
|
-
syncify_js
|
382
|
-
syncify_js
|
383
|
-
syncify_js
|
378
|
+
if (cmd.accepts !== null && syncify_js.$2.argv.length > 1 && position === false) return syncify_js.NooP;
|
379
|
+
if (syncify_js.$2.mode.build) {
|
380
|
+
syncify_js.$2.mode.script = true;
|
381
|
+
syncify_js.$2.mode.style = true;
|
382
|
+
syncify_js.$2.mode.svg = true;
|
383
|
+
syncify_js.$2.mode.liquid = true;
|
384
|
+
syncify_js.$2.mode.json = true;
|
384
385
|
}
|
385
|
-
if (syncify_js
|
386
|
-
Help(syncify_js
|
386
|
+
if (syncify_js.$2.mode.help || syncify_js.$2.mode.inspect) {
|
387
|
+
Help(syncify_js.$2.mode);
|
387
388
|
return syncify_js.NooP;
|
388
389
|
}
|
389
|
-
syncify_js.assign(syncify_js
|
390
|
-
syncify_js.forKeys((mode) => mode in syncify_js
|
391
|
-
if (syncify_js
|
392
|
-
syncify_js
|
393
|
-
Help(syncify_js
|
390
|
+
syncify_js.assign(syncify_js.$2.cmd, flags2.values);
|
391
|
+
syncify_js.forKeys((mode) => mode in syncify_js.$2.mode ? syncify_js.$2.mode[mode] = true : null, flags2.values);
|
392
|
+
if (syncify_js.$2.mode.help) {
|
393
|
+
syncify_js.$2.mode._ = cmd.mode;
|
394
|
+
Help(syncify_js.$2.mode);
|
394
395
|
return syncify_js.NooP;
|
395
396
|
}
|
396
|
-
syncify_js
|
397
|
-
syncify_js
|
398
|
-
syncify_js
|
399
|
-
node_process.env.SYNCIFY_ENV = syncify_js
|
400
|
-
node_process.env.SYNCIFY_WATCH = String(syncify_js
|
401
|
-
node_process.env.SYNCIFY_VERSION = "1.0.0-unstable.
|
397
|
+
syncify_js.$2.env.prod = syncify_js.$2.mode.prod;
|
398
|
+
syncify_js.$2.env.dev = syncify_js.$2.mode.dev && !syncify_js.$2.mode.prod;
|
399
|
+
syncify_js.$2.env.cli = true;
|
400
|
+
node_process.env.SYNCIFY_ENV = syncify_js.$2.env.dev ? "dev" : "prod";
|
401
|
+
node_process.env.SYNCIFY_WATCH = String(syncify_js.$2.mode.watch);
|
402
|
+
node_process.env.SYNCIFY_VERSION = "1.0.0-unstable.2";
|
402
403
|
return (fn) => fn();
|
403
404
|
}
|
405
|
+
function CommandError(message) {
|
406
|
+
syncify_js.Ft({ type: "error" }).Top(`Syncify ${syncify_js.Nu} Error`, false).Newline(syncify_js.o.trim).Line(`COMMAND LINE ERROR ${syncify_js.Tt}`, syncify_js.$).Newline().Wrap(message).Tree("info").NL.Line("Need Help?", syncify_js.F.bold).Line("Refer to the usage documentation for more information:", syncify_js.F).Prepend(`${syncify_js.Nu} ${syncify_js.Ee("https://syncify.sh/usage/syncify-cli")}`, syncify_js.F).NL.End(`Syncify ${syncify_js.Nu} Error`, false).BR.toLog();
|
407
|
+
syncify_js.$2.running ? syncify_js.i.exit(0) : process.exit(0);
|
408
|
+
}
|
404
409
|
|
405
410
|
// syncify/cli.ts
|
406
411
|
command(
|
@@ -492,6 +497,7 @@ command(
|
|
492
497
|
accepts: null,
|
493
498
|
flags: [
|
494
499
|
"help",
|
500
|
+
"new",
|
495
501
|
"output",
|
496
502
|
"config",
|
497
503
|
"target",
|
@@ -537,6 +543,7 @@ command(
|
|
537
543
|
"help"
|
538
544
|
],
|
539
545
|
accepts: [
|
546
|
+
"skeleton",
|
540
547
|
"dawn",
|
541
548
|
"dusk",
|
542
549
|
"silk",
|