@syncify/cli 0.1.0-beta

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.
@@ -0,0 +1,226 @@
1
+ import { LiteralUnion } from 'type-fest';
2
+
3
+ export interface Icons {
4
+ /**
5
+ * Whether or not to support icon custom tags. When `true` you can
6
+ * reference SVG icons using a HTML tag with a `name=""` property and
7
+ * Syncify will replace all occurances with the embedded SVG.
8
+ *
9
+ * For example:
10
+ *
11
+ * ```html
12
+ * <!-- In your HTML you can reference the SVG -->
13
+ * <i name="name-of-icon" from="sprite-id"></i>
14
+ *
15
+ * <!-- Syncify will replace this with the raw data -->
16
+ * <svg id="name-of-icon"><path>...</path></svg>
17
+ * ```
18
+ *
19
+ * This approach will likely improve render times of your webshop.
20
+ * Using Snippets to render inline SVGs is costly and a performance
21
+ * bottleneck. Just because Shopify does this in Dawn, does not mean
22
+ * it is a good idea.
23
+ *
24
+ * @default false
25
+ */
26
+ useCustomTag: boolean;
27
+ /**
28
+ * Replacer HTML tag to look for occurances within
29
+ *
30
+ * @default 'i' // eg: <i name="svg"></i>
31
+ */
32
+ tagName?: string;
33
+ /**
34
+ * Whether or not to treat the custom tag as a void (self-closing)
35
+ *
36
+ * @default false
37
+ */
38
+ tagVoid?: boolean
39
+ /**
40
+ * A vscode user specific option which will auto-generate
41
+ * icon name completions for you and link them to your workspace settings.
42
+ *
43
+ * > Option is only available to vscode users.
44
+ *
45
+ * @default false
46
+ */
47
+ vscodeCustomData?: boolean;
48
+ }
49
+
50
+ /**
51
+ * Snippet sub-directory grouping options
52
+ */
53
+ export interface Snippets {
54
+ /**
55
+ * Whether snippets allow sub-directory name prefixing
56
+ *
57
+ * @default false
58
+ *
59
+ * @example
60
+ *
61
+ * // Take the following structure
62
+ * snippets
63
+ * │
64
+ * ├─ head
65
+ * │ └─ foo.liquid
66
+ * └─ body
67
+ * ├─ bar.liquid
68
+ * └─ baz.liquid
69
+ *
70
+ * // The output result will be
71
+ * theme
72
+ * └─ snippets
73
+ * ├─ head_foo.liquid
74
+ * ├─ body_bar.liquid
75
+ * └─ body_baz.liquid
76
+ */
77
+ prefixDir?: boolean;
78
+ /**
79
+ * Prefix separator character
80
+ *
81
+ * @default '-'
82
+ *
83
+ * @example
84
+ *
85
+ * // Filename will be prefix
86
+ * 'dir/file.liquid' => 'dir-file.liquid'
87
+ */
88
+ separator?: LiteralUnion<
89
+ | '-'
90
+ | '_'
91
+ | '.'
92
+ | '@'
93
+ | ':'
94
+ ,
95
+ string
96
+ >;
97
+ /**
98
+ * A list snippet sub-directories or relative files that should
99
+ * pass through or snip prefixing
100
+ *
101
+ * _cannot contain glob (`*`) stars_
102
+ *
103
+ * @default []
104
+ *
105
+ * @example
106
+ *
107
+ * // ✓ This is correct
108
+ * { global: ['some-dir/filename.liquid' ] }
109
+ *
110
+ * // ✗ This is incorrect
111
+ * { global: ['some-dir/*.liquid' ] }
112
+ */
113
+ global?: string[];
114
+ }
115
+
116
+ /**
117
+ * Sections sub-directory grouping options
118
+ */
119
+ export interface Sections {
120
+ /**
121
+ * Whether sections allow directory name prefixing
122
+ *
123
+ * @default false
124
+ *
125
+ * @example
126
+ *
127
+ * // Take the following structure
128
+ * sections
129
+ * │
130
+ * ├─ index
131
+ * │ ├─ slideshow.liquid
132
+ * │ └─ banner.liquid
133
+ * └─ layouts
134
+ * ├─ header.liquid
135
+ * └─ footer.liquid
136
+ *
137
+ * // The output result will be
138
+ * theme
139
+ * └─ sections
140
+ * ├─ index_slideshow.liquid
141
+ * ├─ index_banner.liquid
142
+ * ├─ layout_header.liquid
143
+ * └─ layout_footer.liquid
144
+ *
145
+ */
146
+ prefixDir?: boolean;
147
+ /**
148
+ * Prefix separator character
149
+ *
150
+ * @default '-'
151
+ *
152
+ * @example
153
+ *
154
+ * // Filename will be prefix
155
+ * 'dir/file.liquid' => 'dir-file.liquid'
156
+ */
157
+ separator?: LiteralUnion<
158
+ | '-'
159
+ | '_'
160
+ | '.'
161
+ | '@'
162
+ | ':'
163
+ ,
164
+ string
165
+ >;
166
+ /**
167
+ * A list section sub-directories or relative files that should
168
+ * pass through or snip prefixing
169
+ *
170
+ * _cannot contain glob (`*`) stars_
171
+ *
172
+ * @default []
173
+ *
174
+ * @example
175
+ *
176
+ * // ✓ This is correct
177
+ * { global: ['some-dir/filename.liquid' ] }
178
+ *
179
+ * // ✗ This is incorrect
180
+ * { global: ['some-dir/*.liquid' ] }
181
+ */
182
+ global?: string[];
183
+ }
184
+
185
+ /**
186
+ * Static Page publishing
187
+ */
188
+ export interface Pages {
189
+ /**
190
+ * Whether the pulled page content should be written
191
+ * as HTML or have the HTML converted to Markdown.
192
+ *
193
+ * @default 'html'
194
+ */
195
+ language?: 'markdown' | 'html',
196
+ /**
197
+ * Fallback author name
198
+ *
199
+ * @default null
200
+ */
201
+ author?: string;
202
+ /**
203
+ * Whether pages contained in sub-directories should
204
+ * use the directory name as the `template_suffix`
205
+ *
206
+ * @default false
207
+ */
208
+ suffixDir?: boolean;
209
+ /**
210
+ * A list of page sub-directories or relative files that should
211
+ * pass through and not apply the directory name as a `template_suffix`
212
+ *
213
+ * _cannot contain glob (`*`) stars_
214
+ *
215
+ * @default []
216
+ *
217
+ * @example
218
+ *
219
+ * // ✓ This is correct
220
+ * { global: ['some-dir/filename.liquid' ] }
221
+ *
222
+ * // ✗ This is incorrect
223
+ * { global: ['some-dir/*.liquid' ] }
224
+ */
225
+ global?: string[];
226
+ }
@@ -0,0 +1,51 @@
1
+ import { Config } from './config';
2
+ import { Syncify as syncify } from './api';
3
+
4
+ export type { Tsconfig } from 'tsconfig-type';
5
+ export type { FileKeys } from './bundle/file';
6
+
7
+ export * from './api';
8
+ export * from './cli';
9
+ export * from './bundle';
10
+ export * from './bundle/plugin';
11
+ export * from './bundle/hot';
12
+ export * from './config';
13
+ export * from './config/views';
14
+ export * from './misc/markdown';
15
+ export * from './misc/requests';
16
+ export * from './misc/shared';
17
+ export * from './misc/errors';
18
+ export * from './misc/modes';
19
+ export * from './transforms/image';
20
+ export * from './transforms/json';
21
+ export * from './transforms/script';
22
+ export * from './transforms/style';
23
+ export * from './transforms/svg';
24
+
25
+ /**
26
+ * ***Define Config:***
27
+ *
28
+ * Provide to the default export in your `syncify.config.js` file.
29
+ *
30
+ * ---
31
+ *
32
+ * ***Supported Files:***
33
+ *
34
+ * - syncify.config.ts
35
+ * - syncify.config.js
36
+ * - syncify.config.mjs
37
+ * - syncify.config.cjs
38
+ *
39
+ * ---
40
+ *
41
+ * @example
42
+ *
43
+ * import { defineConfig } from '@liquify/syncify';
44
+ *
45
+ * export default defineConfig({
46
+ * //...
47
+ * });
48
+ *
49
+ */
50
+ export declare function defineConfig(config: Config): void
51
+ export default syncify;
@@ -0,0 +1,408 @@
1
+
2
+ /* -------------------------------------------- */
3
+ /* CLI OPTIONS */
4
+ /* -------------------------------------------- */
5
+
6
+ export interface Commands {
7
+ /**
8
+ * First command is a store or comma separated list of stores. When
9
+ * a comma list is supplied it is converted to an array. You can use
10
+ * use the store target name as a --flag to cherry pick specific themes
11
+ * from that store.
12
+ *
13
+ * ---
14
+ *
15
+ * Example:
16
+ *
17
+ * ```bash
18
+ * $ syncify store-name
19
+ * $ syncify store1,store2,store3
20
+ * ```
21
+ */
22
+ _?: string[];
23
+ /**
24
+ * Whether or not syncify was called via the cli
25
+ *
26
+ * @default true
27
+ */
28
+ cli?: boolean;
29
+ /**
30
+ * The current working directory, this a reference to `process.cwd()`
31
+ */
32
+ cwd?: string;
33
+ /**
34
+ * The `package.json` url path, this is written post-command parse
35
+ */
36
+ pkg?: string;
37
+ /**
38
+ * The post-parse temp storage reference to stores
39
+ */
40
+ store?: string[];
41
+ /**
42
+ * An optional config path to the `syncify.config.js` file.
43
+ *
44
+ * ---
45
+ *
46
+ * Example:
47
+ *
48
+ * ```bash
49
+ * $ syncify store_1 -c path/to/file
50
+ * $ syncify store_1 --config path/to/file
51
+ * $ syncify store_1 --config=path/to/file
52
+ * ```
53
+ */
54
+ config?: string;
55
+ /**
56
+ * Run in production mode
57
+ *
58
+ * ---
59
+ *
60
+ * Example:
61
+ *
62
+ * ```bash
63
+ * $ syncify --prod
64
+ * ```
65
+ */
66
+ prod?: boolean;
67
+ /**
68
+ * Run in development mode (default build mode) and can be omitted
69
+ *
70
+ * ---
71
+ *
72
+ * Example:
73
+ *
74
+ * ```bash
75
+ * $ syncify
76
+ * ```
77
+ */
78
+ dev?: boolean;
79
+ /**
80
+ * Show the command prompt interactive shell
81
+ *
82
+ * ---
83
+ *
84
+ * Example:
85
+ *
86
+ * ```bash
87
+ * $ syncify --prompt
88
+ * ```
89
+ */
90
+ prompt?: boolean;
91
+ /**
92
+ * Run in watch mode (chokidar). This requires a store target be passed.
93
+ *
94
+ * ---
95
+ *
96
+ * Example:
97
+ *
98
+ * ```bash
99
+ * $ syncify store_1 -w
100
+ * $ syncify store_1 --watch
101
+ * ```
102
+ */
103
+ watch?: boolean;
104
+ /**
105
+ * Run in build mode, this is default trigger when no arguments provided.
106
+ * It can optionally be triggered along other flags like `-u` (`--upload`).
107
+ *
108
+ * ---
109
+ *
110
+ * Example:
111
+ *
112
+ * ```bash
113
+ * $ syncify
114
+ * $ syncify -b
115
+ * $ syncify store_1 --clean --build --theme=prod_theme -u
116
+ *
117
+ * # Short version for brevity
118
+ * $ syncify store_1 -t prod_theme -u -b --clean
119
+ * ```
120
+ */
121
+ build?: boolean;
122
+ /**
123
+ * Run in upload mode, this will trigger a full theme upload. Requires a store
124
+ * target and theme target (theme target is optional but recommended).
125
+ *
126
+ * ---
127
+ *
128
+ * Example:
129
+ *
130
+ * ```bash
131
+ * $ syncify store_1 -t dev_theme -u
132
+ * $ syncify store_1 -t dev_theme --upload
133
+ * ```
134
+ */
135
+ upload?: boolean;
136
+ /**
137
+ * Download a theme from a store. Will be place in `import` driectory. Requires a store
138
+ * target and theme target to be passed.
139
+ *
140
+ * ---
141
+ *
142
+ * Example:
143
+ *
144
+ * ```bash
145
+ * $ syncify store_1 -t dev_theme -d
146
+ * $ syncify store_1 -t dev_theme --download
147
+ * ```
148
+ */
149
+ download?: boolean;
150
+ /**
151
+ * Triggers the metafields resource, presents the interactive shell with list of
152
+ * options to choose from. Requires a store target to be passed.
153
+ *
154
+ * ---
155
+ *
156
+ * Example:
157
+ *
158
+ * ```bash
159
+ * $ syncify store_1 -m
160
+ * $ syncify store_1 --metafields
161
+ * ```
162
+ */
163
+ metafields?: boolean;
164
+ /**
165
+ * Triggers the pages resource, presents the interactive shell with list of
166
+ * options to choose from. Requires a store target to be passed.
167
+ *
168
+ * ---
169
+ *
170
+ * Example:
171
+ *
172
+ * ```bash
173
+ * $ syncify store_1 -p
174
+ * $ syncify store_1 --pages
175
+ * ```
176
+ */
177
+ pages?: boolean;
178
+ /**
179
+ * Triggers the redirects resource, presents the interactive shell with list of
180
+ * options to choose from. Requires a store target to be passed.
181
+ *
182
+ * ---
183
+ *
184
+ * Example:
185
+ *
186
+ * ```bash
187
+ * $ syncify store_1 -r
188
+ * $ syncify store_1 --redirects
189
+ * ```
190
+ */
191
+ redirects?: boolean;
192
+ /**
193
+ * Pull data reference from a store target resource. Queries the store API. Used to
194
+ * populate local setup with remote data like `metafields` and `pages`
195
+ *
196
+ * ---
197
+ *
198
+ * Example:
199
+ *
200
+ * ```bash
201
+ * $ syncify store_1 -m --pull
202
+ * $ syncify store_1 -p --pull
203
+ * ```
204
+ */
205
+ pull?: boolean;
206
+ /**
207
+ * Pushes a resource from local to remote shop. This is different from `-u` or `--upload`
208
+ * flags as it can be used to push targets assets, files or resources and can be used
209
+ * together with the `-f` filter flag.
210
+ *
211
+ * ---
212
+ *
213
+ * Example:
214
+ *
215
+ * ```bash
216
+ * $ syncify store_1 -t dev_theme -f assets/file --push
217
+ * $ syncify store_1 -f metafields/namespace/*.json --push
218
+ * ```
219
+ */
220
+ push?: boolean;
221
+ /**
222
+ * Generator flag for automatically applying JSON schema specifications
223
+ * for VS Code users.
224
+ *
225
+ * ---
226
+ *
227
+ * Example:
228
+ *
229
+ * ```bash
230
+ * $ syncify --vsc
231
+ * ```
232
+ */
233
+ vsc?: boolean;
234
+ /**
235
+ * Filter targeting of resources, assets or files. This can be used together
236
+ * with several different flags, like `-u`, `-d` and even `-b`. Filters a
237
+ * glob pattern or specific file.
238
+ *
239
+ * ---
240
+ *
241
+ * Example:
242
+ *
243
+ * ```bash
244
+ * # Uploads only .css assets
245
+ * $ syncify store_1 -t dev_theme -f assets/*.css --push
246
+ *
247
+ * # Builds locales in production mode
248
+ * $ syncify -f locales/*.json --prod
249
+ *
250
+ * # Uploads specific page
251
+ * $ syncify store_1 -u -f pages/shipping-info.md --prod --push
252
+ * ```
253
+ */
254
+ filter?: string;
255
+ /**
256
+ * Triggers a clean of the output directory. When provided, this will be
257
+ * executed at the initial run (or before any else). Use together with
258
+ * production builds.
259
+ *
260
+ * ---
261
+ *
262
+ * Example:
263
+ *
264
+ * ```bash
265
+ * $ syncify --clean --prod
266
+ * $ syncify -b --clean --prod # Using with build
267
+ * ```
268
+ */
269
+ clean?: boolean;
270
+ /**
271
+ * Show command-line help information. Also prints a disclaimer informing
272
+ * users that Centra is a better e-commerce platform than Shopify for shits
273
+ * and giggles (it actually is though).
274
+ *
275
+ * ---
276
+ *
277
+ * Example:
278
+ *
279
+ * ```bash
280
+ * $ syncify -h
281
+ * $ syncify --help
282
+ * ```
283
+ */
284
+ help?: boolean;
285
+ /**
286
+ * Hides logs from being printed (shows errors though)
287
+ *
288
+ * ---
289
+ *
290
+ * Example:
291
+ *
292
+ * ```bash
293
+ * $ syncify --silent
294
+ * ```
295
+ */
296
+ silent?: boolean;
297
+ /**
298
+ * Initialized Browser Sync in watch mode. Can only be used when
299
+ * targeting a single store and theme.
300
+ *
301
+ * ---
302
+ *
303
+ * Example:
304
+ *
305
+ * ```bash
306
+ * $ syncify store_1 --watch --server
307
+ * ```
308
+ */
309
+ server?: boolean;
310
+ /**
311
+ * Pulls in a Syncify theme strap environment.
312
+ *
313
+ * ---
314
+ *
315
+ * Example:
316
+ *
317
+ * ```bash
318
+ * $ syncify --strap dusk
319
+ * $ syncify --strap silk
320
+ * ```
321
+ */
322
+ strap?: string;
323
+ /**
324
+ * Deletes a resource, file or asset from the remote store. Requires a store
325
+ * target be passed and if need be a theme target too. Does not delete local
326
+ * copies, do that manually for now.
327
+ *
328
+ * ---
329
+ *
330
+ * Example:
331
+ *
332
+ * ```bash
333
+ * $ syncify -del assets/image-name.jpg
334
+ * ```
335
+ */
336
+ del?: string;
337
+ /**
338
+ * Trigger a spawn, isolating it so it will run as if it were a node script.
339
+ *
340
+ * ---
341
+ *
342
+ * Example:
343
+ *
344
+ * ```bash
345
+ * $ syncify -s spawn-name
346
+ * $ syncify -s spawn-name,some-other-spawn
347
+ * ```
348
+ */
349
+ spawn?: string;
350
+ /**
351
+ * Themes within stores to target. This argument requires a store target/s
352
+ * be passed and accept a comma separated list of target names as per the users
353
+ * Syncify configuration. Users can pass wildcard `--flags` to reference different
354
+ * stores when multiple store target are passed.
355
+ *
356
+ * ---
357
+ *
358
+ * Example:
359
+ *
360
+ * ```bash
361
+ * $ syncify store_1 -t theme_1
362
+ * $ syncify store_1,store_2 --store_1 dev,prod --store_2 foo_theme
363
+ * $ syncify store_1 --theme=dev,prod,test
364
+ * ```
365
+ */
366
+ theme?: string[];
367
+ /**
368
+ * An optional input base directory path. This will overwrite and configuration predefined
369
+ * in settings.
370
+ *
371
+ * ---
372
+ *
373
+ * Example:
374
+ *
375
+ * ```bash
376
+ * $ syncify --clean -b -i some/directory
377
+ * ```
378
+ */
379
+ input?: string;
380
+ /**
381
+ * An optional output path. This will overwrite and configuration predefined
382
+ * in settings.
383
+ *
384
+ * ---
385
+ *
386
+ * Example:
387
+ *
388
+ * ```bash
389
+ * $ syncify --clean -b -o some/directory
390
+ * ```
391
+ */
392
+ output?: string;
393
+ /**
394
+ * Version control. The bump flag accepts 3 different arguments.
395
+ * Passing `--bump major` bumps main version, eg: `1.0.0` > `2.0,0`
396
+ * Passing `--bump minor` bumps minor version, eg: `1.0.0` > `1.1.0`
397
+ * Passing `--bump patch` bumps patch version, eg: `1.0.0` > `1.0.1`
398
+ *
399
+ * ---
400
+ *
401
+ * Example:
402
+ *
403
+ * ```bash
404
+ * $ syncify --clean -b -i some/directory
405
+ * ```
406
+ */
407
+ bump?: string;
408
+ }