@syncify/cli 0.1.3-beta → 0.2.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.
package/types/api.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PartialDeep } from 'type-fest';
2
2
  import { Config } from './config';
3
- import { Asset } from './misc/requests';
4
- import { File } from './bundle/file';
3
+ import { Asset } from './internal/requests';
4
+ import { File } from './internal/file';
5
5
 
6
6
  type Download = (
7
7
  this: {
package/types/cli.d.ts CHANGED
@@ -47,6 +47,12 @@ export interface Commands {
47
47
  * @default true
48
48
  */
49
49
  cli?: boolean;
50
+ /**
51
+ * Whether or not syncify interactive command prompt
52
+ *
53
+ * @default false
54
+ */
55
+ interactive?: boolean;
50
56
  /**
51
57
  * The current working directory, this a reference to `process.cwd()`
52
58
  */
@@ -109,22 +115,10 @@ export interface Commands {
109
115
  * Example:
110
116
  *
111
117
  * ```bash
112
- * $ syncify --minify
113
- * ```
114
- */
115
- minify?: boolean
116
- /**
117
- * Show the command prompt interactive shell
118
- *
119
- * ---
120
- *
121
- * Example:
122
- *
123
- * ```bash
124
- * $ syncify --prompt
118
+ * $ syncify --terse
125
119
  * ```
126
120
  */
127
- prompt?: boolean;
121
+ terse?: boolean
128
122
  /**
129
123
  * Run in watch mode (chokidar). This requires a store target be passed.
130
124
  *
@@ -178,7 +172,21 @@ export interface Commands {
178
172
  * Example:
179
173
  *
180
174
  * ```bash
181
- * $ syncify --export
175
+ * $ syncify --import # import to the defined directory in syncify config
176
+ * $ syncify --import -o ./some-dir # override and import to a specific directory
177
+ * ```
178
+ */
179
+ import?: boolean;
180
+ /**
181
+ * Exports the theme and generates a `.zip` compressed directory.
182
+ *
183
+ * ---
184
+ *
185
+ * Example:
186
+ *
187
+ * ```bash
188
+ * $ syncify --import # export to the defined directory in syncify config
189
+ * $ syncify --import -o ./some-dir # override and export to a specific directory
182
190
  * ```
183
191
  */
184
192
  export?: boolean;
@@ -205,7 +213,6 @@ export interface Commands {
205
213
  * Example:
206
214
  *
207
215
  * ```bash
208
- * $ syncify store_1 -m
209
216
  * $ syncify store_1 --metafields
210
217
  * ```
211
218
  */
@@ -219,7 +226,6 @@ export interface Commands {
219
226
  * Example:
220
227
  *
221
228
  * ```bash
222
- * $ syncify store_1 -p
223
229
  * $ syncify store_1 --pages
224
230
  * ```
225
231
  */
@@ -233,7 +239,6 @@ export interface Commands {
233
239
  * Example:
234
240
  *
235
241
  * ```bash
236
- * $ syncify store_1 -r
237
242
  * $ syncify store_1 --redirects
238
243
  * ```
239
244
  */
@@ -247,26 +252,11 @@ export interface Commands {
247
252
  * Example:
248
253
  *
249
254
  * ```bash
250
- * $ syncify store_1 -m --pull
251
- * $ syncify store_1 -p --pull
255
+ * $ syncify store_1 --metafields --pull
256
+ * $ syncify store_1 --pages --pull
252
257
  * ```
253
258
  */
254
259
  pull?: boolean;
255
- /**
256
- * Pushes a resource from local to remote shop. This is different from `-u` or `--upload`
257
- * flags as it can be used to push targets assets, files or resources and can be used
258
- * together with the `-f` filter flag.
259
- *
260
- * ---
261
- *
262
- * Example:
263
- *
264
- * ```bash
265
- * $ syncify store_1 -t dev_theme -f assets/file --push
266
- * $ syncify store_1 -f metafields/namespace/*.json --push
267
- * ```
268
- */
269
- push?: boolean;
270
260
  /**
271
261
  * Generator flag for automatically applying JSON schema specifications
272
262
  * for VS Code users.
@@ -291,13 +281,13 @@ export interface Commands {
291
281
  *
292
282
  * ```bash
293
283
  * # Uploads only .css assets
294
- * $ syncify store_1 -t dev_theme -f assets/*.css --push
284
+ * $ syncify store_1 -t dev_theme -f assets/*.css -u
295
285
  *
296
286
  * # Builds locales in production mode
297
287
  * $ syncify -f locales/*.json --prod
298
288
  *
299
289
  * # Uploads specific page
300
- * $ syncify store_1 -u -f pages/shipping-info.md --prod --push
290
+ * $ syncify store_1 -u -f pages/shipping-info.md --prod
301
291
  * ```
302
292
  */
303
293
  filter?: string;
@@ -367,7 +357,7 @@ export interface Commands {
367
357
  * Example:
368
358
  *
369
359
  * ```bash
370
- * $ syncify --strap dusk
360
+ * $ syncify --strap dawn
371
361
  * $ syncify --strap silk
372
362
  * ```
373
363
  */
@@ -401,6 +391,7 @@ export interface Commands {
401
391
 
402
392
  * $ syncify --spawn spawn-name
403
393
  * $ syncify --spawn spawn-name,some-other-spawn
394
+ *
404
395
  * ```
405
396
  */
406
397
  spawn?: string;
@@ -433,7 +424,7 @@ export interface Commands {
433
424
  * $ syncify --clean -b -i some/directory
434
425
  * ```
435
426
  */
436
- input?: string;
427
+ input?: string;
437
428
  /**
438
429
  * An optional output path. This will overwrite the configuration predefined
439
430
  * in settings.
@@ -447,11 +438,24 @@ export interface Commands {
447
438
  * ```
448
439
  */
449
440
  output?: string;
441
+ /**
442
+ * Force overwrite of a theme file
443
+ *
444
+ * ---
445
+ *
446
+ * Example:
447
+ *
448
+ * ```bash
449
+ * $ syncify store_1 -t dev_theme -f section/file.liquid -u --force
450
+ * ```
451
+ */
452
+ force?: boolean;
450
453
  /**
451
454
  * Version control. The bump flag accepts 3 different arguments.
452
- * Passing `--bump major` bumps main version, eg: `1.0.0` > `2.0,0`
453
- * Passing `--bump minor` bumps minor version, eg: `1.0.0` > `1.1.0`
454
- * Passing `--bump patch` bumps patch version, eg: `1.0.0` > `1.0.1`
455
+ *
456
+ * 1. Passing `--bump major` bumps main version, eg: `1.0.0` > `2.0,0`
457
+ * 2. Passing `--bump minor` bumps minor version, eg: `1.0.0` > `1.1.0`
458
+ * 3. Passing `--bump patch` bumps patch version, eg: `1.0.0` > `1.0.1`
455
459
  *
456
460
  * ---
457
461
  *
@@ -1,9 +1,9 @@
1
1
  /* eslint-disable no-unused-vars */
2
2
 
3
3
  import type { Pages, Sections, Snippets } from './views';
4
- import type { HOTConfig } from '../bundle/hot';
5
- import type { ESBuildMinify, JSONMinify, ViewMinify } from './minify';
6
- import type { PluginHooks } from '../bundle/plugin';
4
+ import type { HOTConfig } from '../internal/hot';
5
+ import type { ScriptTerse, JSONTerse, ViewTerse } from './terser';
6
+ import type { PluginHooks } from '../internal/plugin';
7
7
  import type { JSONConfig } from '../transforms/json';
8
8
  import type { SharpConfig } from '../transforms/image';
9
9
  import type { ScriptTransformer, ESBuildConfig } from '../transforms/script';
@@ -218,7 +218,7 @@ export interface Transforms {
218
218
  * ]
219
219
  * }
220
220
  */
221
- script?: ScriptTransformer
221
+ script?: false | ScriptTransformer
222
222
  /**
223
223
  * SVG File transforms
224
224
  */
@@ -229,13 +229,13 @@ export interface Transforms {
229
229
  /* MINIFY */
230
230
  /* -------------------------------------------- */
231
231
 
232
- export interface MinifyConfig {
232
+ export interface Terser {
233
233
  /**
234
234
  * JSON minification options. You can disable all JSON files from
235
235
  * being minified by passing a boolean `false`. Optionally, you can
236
236
  * exclude certain types of JSON from being minified.
237
237
  */
238
- json?: boolean | JSONMinify;
238
+ json?: boolean | JSONTerse;
239
239
  /**
240
240
  * View minification options. You can disable all views from
241
241
  * being minified by passing a boolean `false`.
@@ -245,13 +245,13 @@ export interface MinifyConfig {
245
245
  * of options are exposed in order to prevent invalid or broken
246
246
  * output from being generated.
247
247
  */
248
- views?: boolean | ViewMinify;
248
+ views?: boolean | ViewTerse;
249
249
  /**
250
250
  * JavaScript minification options. Script minification is only
251
251
  * available for projects with `esbuild` installed and configured
252
252
  * as a processor.
253
253
  */
254
- script?: boolean | ESBuildMinify;
254
+ script?: boolean | ScriptTerse;
255
255
  }
256
256
 
257
257
  /* -------------------------------------------- */
@@ -516,9 +516,15 @@ export interface Config extends Directories {
516
516
  */
517
517
  transforms?: Transforms;
518
518
  /**
519
- * Minify options - Invoked when in **production** `--prod` mode or
520
- * if the `--minify` flag was passed. Options will default to `false`
521
- * when either of these conditionals are not met.
519
+ * Terse options (minification)
520
+ *
521
+ * Invoked when in **production** (`--prod`) mode or when the `--terse` flag is passed.
522
+ * Options will default to `false`when either of these conditionals are not met.
523
+ */
524
+ terser?: boolean | Terser;
525
+ /**
526
+ * @deprecated
527
+ * Use `terser` option instead
522
528
  */
523
- minify?: boolean | MinifyConfig
529
+ minify?: undefined;
524
530
  }
@@ -0,0 +1,267 @@
1
+ import type { BuildOptions } from 'esbuild';
2
+ import type { LiteralUnion, Merge } from 'type-fest';
3
+ import type { OptionsOutput as CleanCSSOptions } from 'clean-css';
4
+ import type { HTMLMinifierTerserOptions } from '../modules/html-minifier-terser';
5
+
6
+ /**
7
+ * ESBuild minification options
8
+ */
9
+ export type ScriptTerse = Merge<Pick<BuildOptions,
10
+ | 'keepNames'
11
+ | 'mangleProps'
12
+ | 'minifyIdentifiers'
13
+ | 'minifySyntax'
14
+ | 'minifyWhitespace'
15
+ | 'mangleQuoted'
16
+ >,
17
+ {
18
+ /**
19
+ * List of input file names to exclude from minification
20
+ *
21
+ * @default 'none'
22
+ */
23
+ legalComments?: LiteralUnion<BuildOptions['legalComments'], string>
24
+ /**
25
+ * List of input file names to exclude from minification
26
+ *
27
+ * @default []
28
+ */
29
+ exclude?: string[];
30
+ }
31
+ >
32
+
33
+ /**
34
+ * JSON File Minification
35
+ */
36
+ export interface JSONTerse {
37
+ /**
38
+ * Minify `.json` files writing to `theme/assets`
39
+ *
40
+ * @default true
41
+ */
42
+ assets: boolean;
43
+ /**
44
+ * Minify `settings_schema.json` and `settings_data.json` config files.
45
+ *
46
+ * @default true
47
+ */
48
+ config: boolean;
49
+ /**
50
+ * Minify `locale` and `.json` files.
51
+ *
52
+ * @default true
53
+ */
54
+ locales: boolean;
55
+ /**
56
+ * Minify `metafield` and `.json` files.
57
+ *
58
+ * @default true
59
+ */
60
+ metafields: boolean;
61
+ /**
62
+ * Minify section group `.json` files
63
+ *
64
+ * @default true
65
+ */
66
+ sectionGroups: boolean;
67
+ /**
68
+ * Minify `template` and `.json` files.
69
+ *
70
+ * @default true
71
+ */
72
+ templates: boolean;
73
+ /**
74
+ * An optional list of paths/files to exclude from minification.
75
+ *
76
+ * @default []
77
+ */
78
+ exclude?: string[]
79
+ }
80
+
81
+ /**
82
+ * Liquid Minification
83
+ */
84
+ export interface ViewTerse {
85
+ /**
86
+ * Minifies inner contents of `<script>` tags
87
+ *
88
+ * @default true
89
+ */
90
+ minifyScript?: boolean;
91
+ /**
92
+ * Minifies inner contents of `<style>` tags
93
+ *
94
+ * @default true
95
+ */
96
+ minifyStyle?: boolean;
97
+ /**
98
+ * Minifies JSON contained within Liquid `{% schema %}` tags.
99
+ *
100
+ * > **NOTE**
101
+ * >
102
+ * > Minifying schema tag contents has no effect on store performance.
103
+ *
104
+ * @default true
105
+ */
106
+ minifySchema?: boolean;
107
+ /**
108
+ * Remove all occurances of Liquid/HTML comments
109
+ *
110
+ * @default true
111
+ */
112
+ removeComments?: boolean;
113
+ /**
114
+ * Collapse all whitespace and newlines
115
+ *
116
+ * @default true
117
+ */
118
+ collapseWhitespace?: boolean;
119
+ /**
120
+ * Removes redundant whitespace Liquid dash trims from Liquid tags and objects.
121
+ *
122
+ * @default true
123
+ */
124
+ stripDashes?: boolean;
125
+ /**
126
+ * **NOT YET AVAILABLE**
127
+ *
128
+ * Removes all whitespace and newline occurances within Liquid syntax.
129
+ *
130
+ * > **NOTE**
131
+ * >
132
+ * > Liquid token minification has no effect on store performance.
133
+ *
134
+ * @default
135
+ * true
136
+ *
137
+ * @example
138
+ *
139
+ * // Assuming that collapseWhitespace is set to true.
140
+ * // Using this option would result in the following
141
+ *
142
+ * // BEFORE
143
+ *
144
+ * {% unless foo == bar %}
145
+ * {{ some.object | filter: 'foo' }}
146
+ * {% endunless %}
147
+ *
148
+ * // AFTER
149
+ *
150
+ * {%unless foo==bar%}{{some.object|filter:'foo'}}{%endunless%}
151
+ */
152
+ collapseInner?: boolean;
153
+ /**
154
+ * Excluded files from minification
155
+ *
156
+ * @default []
157
+ */
158
+ exclude?: string[]
159
+ }
160
+
161
+ /**
162
+ * Style Minification
163
+ */
164
+ export interface StyleTerse extends CleanCSSOptions {
165
+ /**
166
+ * Whether or not to purge unused CSS class names
167
+ *
168
+ * @default false
169
+ */
170
+ purgeUnusedCSS?: boolean;
171
+ /**
172
+ * Whether or not to obfuscate CSS class names
173
+ *
174
+ * @default false
175
+ */
176
+ ofuscateClassNames?: boolean;
177
+ /**
178
+ * List of class names that should be excluded from
179
+ * obfuscation and shortnaming.
180
+ */
181
+ ofuscateWhitelist?: string[];
182
+ /**
183
+ * The alphabet used to generate the new class names.
184
+ *
185
+ * > **NOTE**
186
+ * >
187
+ * > There is no `d` in the default alphabet to avoid adblock issues.
188
+ *
189
+ * @default 'abcefghijklmnopqrstuvwxyz0123456789'
190
+ */
191
+ ofuscateAlphabet?: string;
192
+ /**
193
+ * Excluded files from terser minification
194
+ *
195
+ * @default []
196
+ */
197
+ exclude?: string[]
198
+ }
199
+
200
+ /* -------------------------------------------- */
201
+ /* INTERNAL USE */
202
+ /* -------------------------------------------- */
203
+
204
+ /**
205
+ * **INTERNAL USE**
206
+ *
207
+ * Terser minification configuration
208
+ */
209
+ export interface TerserConfig {
210
+ /**
211
+ * Terse JSON Minification
212
+ */
213
+ json?: JSONTerse;
214
+ /**
215
+ * Terse View (Liquid) Minification
216
+ */
217
+ liquid?: Omit<ViewTerse, 'collapseWhitespace'>;
218
+ /**
219
+ * Terse View (HTML) Minification
220
+ *
221
+ * > Uses [html-minifier-terser](https://github.com/terser/html-minifier-terser)
222
+ */
223
+ html?: HTMLMinifierTerserOptions;
224
+ /**
225
+ * **NOTE YET AVAILABLE**
226
+ *
227
+ * Terse Style (CSS) Minification
228
+ *
229
+ * > Uses [clean-css](https://github.com/clean-css/clean-css) minification
230
+ * > Uses [purge-css](https://github.com/FullHuman/purgecss)
231
+ */
232
+ style?: StyleTerse;
233
+ /**
234
+ * Terse Script (JS/TS) Minification
235
+ *
236
+ * > Uses [esbuild](https://esbuild.github.io/api/#minify) minificiation
237
+ */
238
+ script?: ScriptTerse;
239
+ }
240
+
241
+ /**
242
+ * **INTERNAL USE**
243
+ *
244
+ * Terser minification configuration
245
+ */
246
+ export interface TerserBundle {
247
+ /**
248
+ * Terse JSON Minification
249
+ *
250
+ * @default false
251
+ */
252
+ json: boolean;
253
+ /**
254
+ * View minification
255
+ */
256
+ views: boolean;
257
+ /**
258
+ * **NOTE YET AVAILABLE**
259
+ *
260
+ * Terse Style (CSS) Minification
261
+ */
262
+ style: boolean;
263
+ /**
264
+ * Terse Script (JS/TS) Minification
265
+ */
266
+ script: boolean;
267
+ }
@@ -58,7 +58,9 @@ export interface Snippets {
58
58
  *
59
59
  * @example
60
60
  *
61
- * // Take the following structure
61
+ * // Assuming the separator is '_'
62
+ * // Take the following structure:
63
+ *
62
64
  * snippets
63
65
  * │
64
66
  * ├─ head
@@ -67,7 +69,8 @@ export interface Snippets {
67
69
  * ├─ bar.liquid
68
70
  * └─ baz.liquid
69
71
  *
70
- * // The output result will be
72
+ * // The output result will be:
73
+ *
71
74
  * theme
72
75
  * └─ snippets
73
76
  * ├─ head_foo.liquid
@@ -124,7 +127,9 @@ export interface Sections {
124
127
  *
125
128
  * @example
126
129
  *
127
- * // Take the following structure
130
+ * // Assuming the separator is '_'
131
+ * // Take the following structure:
132
+ *
128
133
  * sections
129
134
  * │
130
135
  * ├─ index
@@ -134,7 +139,8 @@ export interface Sections {
134
139
  * ├─ header.liquid
135
140
  * └─ footer.liquid
136
141
  *
137
- * // The output result will be
142
+ * // The output result will be:
143
+ *
138
144
  * theme
139
145
  * └─ sections
140
146
  * ├─ index_slideshow.liquid
@@ -167,7 +173,9 @@ export interface Sections {
167
173
  * A list section sub-directories or relative files that should
168
174
  * pass through or snip prefixing
169
175
  *
170
- * _cannot contain glob (`*`) stars_
176
+ * **NOTE:**
177
+ *
178
+ * **Cannot contain glob (`*`) stars**
171
179
  *
172
180
  * @default []
173
181
  *
package/types/index.d.ts CHANGED
@@ -2,20 +2,24 @@ import { Config } from './config';
2
2
  import { Syncify as syncify } from './api';
3
3
 
4
4
  export type { Tsconfig } from 'tsconfig-type';
5
- export type { FileKeys } from './bundle/file';
5
+ export type { FileKeys } from './internal/file';
6
6
 
7
7
  export * from './api';
8
8
  export * from './cli';
9
- export * from './bundle';
10
- export * from './bundle/plugin';
11
- export * from './bundle/hot';
12
9
  export * from './config';
13
10
  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';
11
+ export * from './config/terser';
12
+ export * from './internal/cache';
13
+ export * from './internal/filters';
14
+ export * from './internal/markdown';
15
+ export * from './internal/requests';
16
+ export * from './internal/shared';
17
+ export * from './internal/errors';
18
+ export * from './internal/reports';
19
+ export * from './internal/file';
20
+ export * from './internal';
21
+ export * from './internal/plugin';
22
+ export * from './internal/hot';
19
23
  export * from './transforms/image';
20
24
  export * from './transforms/json';
21
25
  export * from './transforms/script';