@syncify/cli 0.1.3-beta → 0.2.1-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.
@@ -1,4 +1,3 @@
1
-
2
1
  /* -------------------------------------------- */
3
2
  /* CLI OPTIONS */
4
3
  /* -------------------------------------------- */
@@ -84,10 +83,10 @@ export interface Commands {
84
83
  * Example:
85
84
  *
86
85
  * ```bash
87
- * $ syncify --prompt
86
+ * $ syncify --interactive
88
87
  * ```
89
88
  */
90
- prompt?: boolean;
89
+ interactive?: boolean;
91
90
  /**
92
91
  * Run in watch mode (chokidar). This requires a store target be passed.
93
92
  *
@@ -204,20 +203,19 @@ export interface Commands {
204
203
  */
205
204
  pull?: boolean;
206
205
  /**
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.
206
+ * Force uploads a resource from local to remote shop. This will instruct
207
+ * syncify to overwrite any remote versions.
210
208
  *
211
209
  * ---
212
210
  *
213
211
  * Example:
214
212
  *
215
213
  * ```bash
216
- * $ syncify store_1 -t dev_theme -f assets/file --push
217
- * $ syncify store_1 -f metafields/namespace/*.json --push
214
+ * $ syncify store_1 -t dev_theme -f assets/file -u --force
215
+ * $ syncify store_1 -f metafields/namespace/*.json -u --force
218
216
  * ```
219
217
  */
220
- push?: boolean;
218
+ force?: boolean;
221
219
  /**
222
220
  * Generator flag for automatically applying JSON schema specifications
223
221
  * for VS Code users.
@@ -294,19 +292,6 @@ export interface Commands {
294
292
  * ```
295
293
  */
296
294
  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
295
  /**
311
296
  * Pulls in a Syncify theme strap environment.
312
297
  *
@@ -315,7 +300,7 @@ export interface Commands {
315
300
  * Example:
316
301
  *
317
302
  * ```bash
318
- * $ syncify --strap dusk
303
+ * $ syncify --strap dawn
319
304
  * $ syncify --strap silk
320
305
  * ```
321
306
  */
@@ -378,7 +363,7 @@ export interface Commands {
378
363
  */
379
364
  input?: string;
380
365
  /**
381
- * An optional output path. This will overwrite and configuration predefined
366
+ * An optional output path. This will overwrite any configuration predefined
382
367
  * in settings.
383
368
  *
384
369
  * ---
@@ -392,16 +377,19 @@ export interface Commands {
392
377
  output?: string;
393
378
  /**
394
379
  * 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`
380
+ *
381
+ * 1. Passing `--bump major` bumps main version, eg: `1.0.0` > `2.0,0`
382
+ * 2. Passing `--bump minor` bumps minor version, eg: `1.0.0` > `1.1.0`
383
+ * 3. Passing `--bump patch` bumps patch version, eg: `1.0.0` > `1.0.1`
398
384
  *
399
385
  * ---
400
386
  *
401
387
  * Example:
402
388
  *
403
389
  * ```bash
404
- * $ syncify --clean -b -i some/directory
390
+ * $ syncify --bump major
391
+ * $ syncify --bump minor
392
+ * $ syncify --bump patch
405
393
  * ```
406
394
  */
407
395
  bump?: string;
@@ -1,13 +1,12 @@
1
1
  /* eslint-disable no-unused-vars */
2
2
 
3
- import { ParsedPath } from 'path';
4
- import { LiteralUnion } from 'type-fest';
3
+ import { LiteralUnion, Merge } from 'type-fest';
5
4
 
6
5
  /**
7
6
  * File types are represented as numeric values.
8
7
  * The infer the following:
9
8
  */
10
- export enum Types {
9
+ export enum FileTypes {
11
10
  Template = 1,
12
11
  Layout,
13
12
  Snippet,
@@ -16,9 +15,9 @@ export enum Types {
16
15
  Locale,
17
16
  Style,
18
17
  Script,
18
+ Svg,
19
19
  Redirect,
20
20
  File,
21
- Svg,
22
21
  Asset,
23
22
  Metafield,
24
23
  Page,
@@ -26,9 +25,10 @@ export enum Types {
26
25
  }
27
26
 
28
27
  /**
29
- * File Kinds - Applied to `file.kind` context.
28
+ * File Kinds
30
29
  *
31
- * _Used to describe of file being handled._
30
+ * Applied to `file.kind` context. The is a text value
31
+ * Used to describe of file being handled.
32
32
  */
33
33
  export type FileKinds = LiteralUnion<
34
34
  | 'style'
@@ -47,26 +47,39 @@ export type FileKinds = LiteralUnion<
47
47
  >
48
48
 
49
49
  /**
50
- * Shopify Asset Key - Applied to `file.key` context
50
+ * Shopify Asset Key
51
+ *
52
+ * Applied to `file.key` context and required in theme asset
53
+ * requests. The `key` represents to the file and directory
54
+ * structure.
55
+ *
56
+ * > Used in REST API request payload
57
+ *
58
+ * @example
59
+ *
60
+ * 'snippets/filename.liquid'
51
61
  *
52
- * _Used in REST API request payload_
53
62
  */
54
63
  export type FileKeys = LiteralUnion<
55
64
  | `templates/${string}${'.liquid' | '.json'}`
56
65
  | `templates/customer/${string}${'.liquid' | '.json'}`
57
66
  | `assets/${string}`
58
- | `sections/${string}${'.liquid'}`
67
+ | `sections/${string}${'.liquid' | '-group.json'}`
59
68
  | `snippets/${string}${'.liquid'}`
60
69
  | `layout/${string}${'.liquid'}`
61
70
  | `locales/${string}${'.json'}`
62
71
  | `config/settings_${'data' | 'schema'}${'.json'}`
63
72
  , string
64
- >
73
+ >
65
74
 
66
75
  /**
67
- * File Namespace - Applied to `file.namespace` context
76
+ * File Namespace
68
77
  *
69
- * _Used in logs, reports and other logic_
78
+ * Applied to `file.namespace` context. This value represents the
79
+ * the output theme directory where a file should be written, but
80
+ * may also represent an endpoint.
81
+ *
82
+ * > Used in logs, reports and other logic
70
83
  */
71
84
  export type FileNamespaces = LiteralUnion<
72
85
  | 'template'
@@ -87,8 +100,8 @@ export type FileNamespaces = LiteralUnion<
87
100
  /**
88
101
  * File Resource - Applied to `file.resource` context
89
102
  *
90
- * _Infers the REST API endpoint excepts for `files` which
91
- * will use the insufferable Shopify GraphQL endpoint (yuck 🤮)_
103
+ * Applied to `file.resource` context. Infers the REST API endpoint
104
+ * excluding `files` which will use the insufferable Shopify GraphQL endpoint.
92
105
  */
93
106
  export type FileResources = LiteralUnion<
94
107
  | 'pages'
@@ -101,22 +114,33 @@ export type FileResources = LiteralUnion<
101
114
  >
102
115
 
103
116
  /**
104
- * File context generated when passed to a sync
105
- * resource and used to dispatch to correct transform
106
- * process.
117
+ * File context generated when passed to a sync resource and used
118
+ * to dispatch to correct transform process.
107
119
  */
108
- interface File<T = any> extends ParsedPath {
120
+ interface File<T = any> {
121
+ /**
122
+ * A unique UUID reference for this file - This option can change
123
+ * where required and when dealing with multiple stores at the request level.
124
+ *
125
+ * @example
126
+ *
127
+ * 'ABD41WX'
128
+ */
129
+ uuid: string;
109
130
  /**
110
131
  * The file type that was intercepted. This is an enum number value.
111
- * The number value will infer on how the file should be handled.
132
+ * The number value will infer on how the file should be handled and uses
133
+ * the `FileType` enum for checks.
112
134
  *
113
135
  * @example
114
136
  *
115
- * 1
137
+ * file.type === FileType.Template
138
+ *
116
139
  */
117
140
  type: number;
118
141
  /**
119
- * The resource endpoint to which the file will be published
142
+ * The resource API endpoint to which the file will be synced.
143
+ * This will be passed to the request client.
120
144
  *
121
145
  * @example
122
146
  *
@@ -124,9 +148,41 @@ interface File<T = any> extends ParsedPath {
124
148
  * 'redirects'
125
149
  */
126
150
  resource: FileResources;
151
+ /**
152
+ * The root of the file path
153
+ *
154
+ * > Value is obtained via the native `path.parse()` method
155
+ *
156
+ * @example
157
+ *
158
+ * '/' OR 'c:\'
159
+ */
160
+ root: string;
161
+ /**
162
+ * The full directory path such.
163
+ *
164
+ * > Value is obtained via the native `path.parse()` method
165
+ *
166
+ * @example
167
+ *
168
+ * '/home/user/dir' OR 'c:\path\dir'
169
+ */
170
+ dir: string;
171
+ /**
172
+ * The file name without extension (if any).
173
+ *
174
+ * > Value is obtained via the native `path.parse()` method
175
+ *
176
+ * @example
177
+ *
178
+ * 'filename' // filename.ext
179
+ */
180
+ name: string;
127
181
  /**
128
182
  * The filename extension including the dot, eg: `.liquid`
129
183
  *
184
+ * > Value is obtained via the native `path.parse()` method
185
+ *
130
186
  * @example
131
187
  *
132
188
  * '.ext'
@@ -135,6 +191,8 @@ interface File<T = any> extends ParsedPath {
135
191
  /**
136
192
  * The input base filename including file extension.
137
193
  *
194
+ * > Value is obtained via the native `path.parse()` method
195
+ *
138
196
  * @example
139
197
  *
140
198
  * 'filename.ext'
@@ -195,10 +253,9 @@ interface File<T = any> extends ParsedPath {
195
253
  */
196
254
  input: string;
197
255
  /**
198
- * The output path location which files will be written.
199
- * Only theme specific files have an output path location,
200
- * when a file write from source (like metafield) this will
201
- * have a `null` value.
256
+ * The output path location which files will be written. Only theme specific files
257
+ * have an output path location, when a file writes from its source (like a metafield) or
258
+ * if the file is handled in an asset pipeline transform then this will have a `null` value.
202
259
  *
203
260
  * @example
204
261
  *
@@ -210,7 +267,8 @@ interface File<T = any> extends ParsedPath {
210
267
  */
211
268
  output: string;
212
269
  /**
213
- * The file size in bytes before any augmentation is applied.
270
+ * The file size in bytes before any augmentation is applied. This
271
+ * value will assigned post-context, typically in a transform.
214
272
  *
215
273
  * @example
216
274
  *
@@ -218,11 +276,10 @@ interface File<T = any> extends ParsedPath {
218
276
  */
219
277
  size?: number;
220
278
  /**
221
- * Configuration reference. This will hold a reference
222
- * to additional data. Typically, this is used for
223
- * transforms, wherein it holds the indexed config.
279
+ * Configuration reference. This will hold a reference to additional data.
280
+ * Typically, this is used for transforms, wherein it holds the indexed config.
224
281
  *
225
282
  * @default undefined // getter when required
226
283
  */
227
- config: T
284
+ get data(): T
228
285
  }
@@ -0,0 +1,81 @@
1
+ export interface Filters {
2
+ /**
3
+ * Theme Asset filters
4
+ *
5
+ * @example
6
+ * '--filter assets/*'
7
+ */
8
+ assets?: string[];
9
+ /**
10
+ * Theme Config filters
11
+ *
12
+ * @example
13
+ * '--filter config/*'
14
+ */
15
+ config?: string[];
16
+ /**
17
+ * Theme Layout filters
18
+ *
19
+ * @example
20
+ * '--filter layout/*'
21
+ */
22
+ layout?: string[];
23
+ /**
24
+ * Theme Locales filters
25
+ *
26
+ * @example
27
+ * '--filter locales/*'
28
+ */
29
+ locales?: string[];
30
+ /**
31
+ * Theme Templates filters
32
+ *
33
+ * @example
34
+ * '--filter assets/*'
35
+ */
36
+ templates?: string[];
37
+ /**
38
+ * Theme Customers filters
39
+ *
40
+ * @example
41
+ * '--filter assets/*'
42
+ */
43
+ customers?: string[];
44
+ /**
45
+ * Theme Snippets filters
46
+ *
47
+ * @example
48
+ * '--filter snippets/*'
49
+ */
50
+ snippets?: string[];
51
+ /**
52
+ * Theme sections filters
53
+ *
54
+ * @example
55
+ * '--filter sections/*'
56
+ */
57
+ sections?: string[];
58
+ /**
59
+ * Store Metafields filters
60
+ *
61
+ * @example
62
+ * '--filter assets/*'
63
+ */
64
+ metafields?: string[];
65
+ /**
66
+ * Store pages filters
67
+ *
68
+ * @example
69
+ * '--filter pages/*'
70
+ */
71
+ pages?: string[];
72
+ /**
73
+ * Terse filters
74
+ *
75
+ * @example
76
+ * '--filter terse:script'
77
+ * '--filter terse:style'
78
+ * '--filter terse:views'
79
+ */
80
+ terse?: string[];
81
+ }
@@ -1,9 +1,15 @@
1
-
2
1
  /* -------------------------------------------- */
3
2
  /* LIVE RELOADS */
4
3
  /* -------------------------------------------- */
5
4
 
6
- export interface HOTSockets {
5
+ import type { Server, WebSocket } from 'ws';
6
+ import type { IncomingMessage } from 'http';
7
+
8
+ export interface WSS {
9
+ /**
10
+ * The `wss` instance
11
+ */
12
+ get http(): Server<typeof WebSocket, typeof IncomingMessage>
7
13
  /**
8
14
  * Hot Socket for `<script>` tags
9
15
  */
@@ -35,13 +41,24 @@ export interface HOTSockets {
35
41
 
36
42
  }
37
43
 
38
- export interface HOT {
44
+ /**
45
+ * **INTERNAL USE**
46
+ */
47
+ export interface HOTBundle {
39
48
  /**
40
49
  * Whether or not Syncify hot reloads UI labels should render.
41
50
  *
42
51
  * @default true
43
52
  */
44
53
  label?: 'visible' | 'hidden';
54
+ /**
55
+ * **NOT YET AVAILABLE**
56
+ *
57
+ * Whether or not to record changes. When enabled, Syncify
58
+ * will keep track of the last 25 changes applied and allow
59
+ * you to walk through the stack.
60
+ */
61
+ history?: boolean;
45
62
  /**
46
63
  * Whether or not Syncify should inject the required HOT snippet
47
64
  * at runtime layout/s. When `false` you will need to manually place
@@ -126,7 +143,7 @@ export interface HOT {
126
143
  alive?: { [template: string]: boolean; };
127
144
  }
128
145
 
129
- export type HOTConfig = Pick<HOT,
146
+ export type HOTConfig = Pick<HOTBundle,
130
147
  | 'inject'
131
148
  | 'label'
132
149
  | 'layouts'