@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
@@ -1,54 +0,0 @@
1
- import type { JSONConfig } from '../transforms/json';
2
- import type { SharpConfig } from '../transforms/image';
3
- import type { BuildOptions } from 'esbuild';
4
- import type { SASSConfig, PostCSSConfig } from '../transforms/style';
5
- import type { SVGOConfig, SVGSpriteConfig } from '../transforms/svg';
6
-
7
- /**
8
- * **Internal Use**
9
- *
10
- * Processor Default Configurations
11
- *
12
- * Holds reference to default config options for
13
- * each supported processor.
14
- */
15
- export interface ProcessorsBundle {
16
- /**
17
- * JSON File processing - Options defined here are used when
18
- * writing to the file system. Typically in operations like
19
- * `--merge`, `--pull` and `--download`.
20
- *
21
- * > The options will also be used in **development** (`dev`)
22
- * mode when uploading `.json` files to stores/themes.
23
- */
24
- json?: JSONConfig;
25
- /**
26
- * [ESBuild](https://esbuild.github.io/) Config
27
- *
28
- * Syncify uses ESBuild under the hood for JS/TS transpilation.
29
- * Some native ESBuild options are omitted from processing and
30
- * handled internally by Syncify.
31
- */
32
- esbuild?: BuildOptions;
33
- /**
34
- * [PostCSS](https://postcss.org/) Plugins
35
- */
36
- postcss?: PostCSSConfig[]
37
- /**
38
- * [SASS Dart](https://sass-lang.com/documentation/js-api/) Config
39
- */
40
- sass?: SASSConfig
41
- /**
42
- * [Sharp](https://sharp.pixelplumbing.com) Config
43
- */
44
- sharp?: SharpConfig;
45
- /**
46
- * [SVGO](https://github.com/svg/svgo) Config
47
- *
48
- */
49
- svgo?: SVGOConfig;
50
- /**
51
- * [SVG Sprite](https://github.com/svg-sprite) Config
52
- */
53
- sprite?: SVGSpriteConfig
54
- }
@@ -1,123 +0,0 @@
1
- import { File } from './file';
2
-
3
- export interface UploadModeReport {
4
- /**
5
- * The file name that was build (including extension)
6
- *
7
- * @example
8
- * 'index.liquid'
9
- */
10
- name: string;
11
- /**
12
- * The upload time for this specific file
13
- *
14
- * @example
15
- * '1ms'
16
- */
17
- time: string;
18
- /**
19
- * The upload error (if occurred)
20
- *
21
- * @default
22
- * null
23
- */
24
- error: any;
25
- }
26
-
27
- export interface UploadReport {
28
- /**
29
- * List of files in the upload group
30
- */
31
- files: File[];
32
- /**
33
- * The amount of time the group took to upload
34
- */
35
- time: string;
36
- /**
37
- * The upload report for each file handled
38
- */
39
- report: UploadModeReport[]
40
- }
41
-
42
- /* -------------------------------------------- */
43
- /* BUILD MODE REPORTING */
44
- /* -------------------------------------------- */
45
-
46
- export interface BuildModeReport {
47
- /**
48
- * The file name that was build (including extension)
49
- *
50
- * @example
51
- * 'index.liquid'
52
- */
53
- name: string;
54
- /**
55
- * The relative input path of the file
56
- *
57
- * @example
58
- * 'src/template/index.liquid'
59
- */
60
- input: string;
61
- /**
62
- * The relative output directory path of the file
63
- *
64
- * @example
65
- * 'templates/index.liquid'
66
- */
67
- output: string;
68
- /**
69
- * The processing time it took to build
70
- *
71
- * @example
72
- * '1ms'
73
- */
74
- time: string;
75
- /**
76
- * A readable error string inferring any issues which may have occured.
77
- *
78
- * @example
79
- * 'skipped file'
80
- *
81
- * @default
82
- * null
83
- */
84
- error: string;
85
- /**
86
- * Output size stack
87
- *
88
- * _Undefined if `error` exists._
89
- */
90
- size?: {
91
- /**
92
- * Before transformation, returns ansi string
93
- */
94
- before: string;
95
- /**
96
- * After transformation, returns ansi string
97
- */
98
- after: string;
99
- /**
100
- * The saving amount, returns ansi string
101
- */
102
- saved: string;
103
- /**
104
- * The gzipped size, returns ansi string
105
- */
106
- gzip: string;
107
- }
108
- }
109
-
110
- export interface BuildReport {
111
- /**
112
- * List of files in the transform group
113
- */
114
- files: File[]
115
- /**
116
- * The amount of time the transform group took to process.
117
- */
118
- time: string;
119
- /**
120
- * The build report of each file transform
121
- */
122
- report: BuildModeReport[]
123
- }
@@ -1,374 +0,0 @@
1
- import { AxiosRequestConfig } from 'axios';
2
- import { File, FileKeys } from './file';
3
- import { LiteralUnion } from 'type-fest';
4
-
5
- /**
6
- * Metafield Types
7
- */
8
- export type MetafieldTypes = LiteralUnion<(
9
- | 'boolean'
10
- | 'color'
11
- | 'date'
12
- | 'date_time'
13
- | 'dimension'
14
- | 'json'
15
- | 'money'
16
- | 'multi_line_text_field'
17
- | 'number_decimal'
18
- | 'number_integer'
19
- | 'rating'
20
- | 'rich_text_field'
21
- | 'single_line_text_field'
22
- | 'url'
23
- | 'volume'
24
- | 'weight'
25
- ), string>
26
-
27
- /**
28
- * Axios Request Methods
29
- */
30
- export type Methods = 'get' | 'post' | 'put' | 'delete'
31
-
32
- /**
33
- * Client Request
34
- */
35
- export type Client = (method: Methods, file: File, content?: string) => Promise<void>
36
-
37
- /**
38
- * Client Request as parameter
39
- */
40
- export type ClientParam<T = any> = (method: Methods, file: File<T>, content?: string) => Promise<void>
41
-
42
- /**
43
- * Resources
44
- */
45
- export type Resource = 'build' | 'watch' | 'upload' |'download'
46
-
47
- /**
48
- * Chokidor Event Names
49
- */
50
- export type ChokidorEvents = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir'
51
-
52
- /**
53
- * Shopify theme asset paths, we use this to when re-pathing
54
- * custom directories.
55
- */
56
- export type GetAsset = (
57
- `templates/${string}${'.liquid' | '.json'}` |
58
- `templates/customer/${string}${'.liquid' | '.json'}` |
59
- `templates/metaobject/${string}${'.liquid' | '.json'}` |
60
- `assets/${string}` |
61
- `sections/${string}${'-group.json' | '.liquid'}` |
62
- `snippets/${string}${'.liquid'}` |
63
- `layout/${string}${'.liquid'}` |
64
- `locales/${string}${'.json'}` |
65
- `config/settings_${'data' | 'schema'}${'.json'}`
66
- )
67
-
68
- /* -------------------------------------------- */
69
- /* ASSETS */
70
- /* -------------------------------------------- */
71
-
72
- /**
73
- * Return response for Shopify theme assets
74
- */
75
- export interface AssetResource {
76
- /**
77
- * The asset path
78
- */
79
- key: string;
80
- /**
81
- * The public-facing URL of the asset.
82
- */
83
- public_url: string;
84
- /**
85
- * The date and time (ISO 8601 format) when the
86
- * asset was created.
87
- */
88
- created_at: string;
89
- /**
90
- * The date and time (ISO 8601 format) when an
91
- * asset was last updated.
92
- */
93
- updated_at: string;
94
- /**
95
- * The MIME representation of the content, consisting
96
- * of the type and subtype of the asset.
97
- */
98
- content_type: string;
99
- /**
100
- * The asset size in bytes.
101
- */
102
- size: number;
103
- /**
104
- * The MD5 representation of the content, consisting
105
- * of a string of 32 hexadecimal digits. May be null
106
- * if an asset has not been updated recently.
107
- */
108
- checksum: string;
109
- /**
110
- * The ID for the theme that an asset belongs to.
111
- */
112
- theme_id: number;
113
- /**
114
- * The text content of the asset, such as the HTML
115
- * and Liquid markup of a template file.
116
- */
117
- value?: string;
118
- }
119
-
120
- export interface Asset {
121
- /**
122
- * The asset path
123
- */
124
- key?: string;
125
- /**
126
- * Base64 Encoded File
127
- */
128
- attachment?: string;
129
- /**
130
- * Value file string
131
- */
132
- value?: string;
133
- /**
134
- * The date and time (ISO 8601 format) when the
135
- * asset was created.
136
- */
137
- created_at?: string;
138
- /**
139
- * The date and time (ISO 8601 format) when an
140
- * asset was last updated.
141
- */
142
- updated_at?: string;
143
- /**
144
- * The MIME representation of the content, consisting
145
- * of the type and subtype of the asset.
146
- */
147
- content_type?: string;
148
- /**
149
- * The asset size in bytes.
150
- */
151
- size?: number;
152
- /**
153
- * The MD5 representation of the content, consisting of a
154
- * string of 32 hexadecimal digits. May be null if an asset
155
- * has not been updated recently.
156
- */
157
- checksum?: string;
158
- /**
159
- * The ID for the theme that an asset belongs to.
160
- */
161
- theme_id?: number;
162
- }
163
-
164
- export interface PageMetafield {
165
- /**
166
- * An identifier for the metafield. (maximum: 30 characters)
167
- */
168
- key: string;
169
- /**
170
- * The information to be stored as metadata.
171
- */
172
- type: MetafieldTypes;
173
- /**
174
- * The information to be stored as metadata.
175
- */
176
- value: string;
177
- /**
178
- * A container for a set of metadata. Namespaces help distinguish
179
- * between metadata created by different apps. (maximum: 20 characters)
180
- */
181
- namespace:string;
182
- /**
183
- * Additional information about the metafield.
184
- */
185
- description?: string;
186
- }
187
-
188
- export namespace Requests {
189
-
190
- /**
191
- * Return response for Shopify theme asset resources
192
- */
193
- export interface Assets {
194
- /**
195
- * The assets resource
196
- */
197
- assets: AssetResource[]
198
- }
199
-
200
- /**
201
- * The request body for Shopify theme assets
202
- */
203
- export interface Asset {
204
- /**
205
- * The theme asset
206
- */
207
- asset: {
208
- key: FileKeys,
209
- value: string,
210
- attachment?: string;
211
- }
212
- }
213
-
214
- /* -------------------------------------------- */
215
- /* PAGES */
216
- /* -------------------------------------------- */
217
-
218
- export interface Page {
219
- /**
220
- * The name of the person who created the page.
221
- */
222
- author?: string;
223
- /**
224
- * The text content of the page, complete with HTML markup.
225
- */
226
- body_html?: string;
227
- /**
228
- * The date and time (ISO 8601 format) when the page was created.
229
- */
230
- readonly created_at?: string;
231
- /**
232
- * A unique, human-friendly string for the page,
233
- * generated automatically from its title. In themes, the Liquid templating language refers to a page by its handle.
234
- */
235
- handle?: string;
236
- /**
237
- * The unique numeric identifier for the page.
238
- */
239
- id?: number;
240
- /**
241
- * Additional information attached to the Page object.
242
- */
243
- metafields?: PageMetafield | PageMetafield[];
244
- /**
245
- * The date and time (ISO 8601 format) when the page was published.
246
- * Returns null when the page is hidden.
247
- */
248
- published_at?:string;
249
- /**
250
- * Published boolean
251
- */
252
- published?: boolean;
253
- /**
254
- * The ID of the shop to which the page belongs.
255
- */
256
- shop_id?: number
257
- /**
258
- * The suffix of the template that is used to render the page.
259
- * If the value is an empty string or null, then the default page template is used.
260
- */
261
- template_suffix?: string;
262
- /**
263
- * The title of the page.
264
- */
265
- title?: string;
266
- /**
267
- * The date and time (ISO 8601 format) when the page was last updated.
268
- */
269
- updated_at?: string;
270
- /**
271
- * The GraphQL GID of the page.
272
- */
273
- readonly admin_graphql_api_id?: string
274
- }
275
- /* -------------------------------------------- */
276
- /* METAFIELDS */
277
- /* -------------------------------------------- */
278
-
279
- /**
280
- * The request body for Shopify metafields
281
- */
282
- export interface Metafield {
283
- /**
284
- * The metafield ID
285
- */
286
- id?: number;
287
- /**
288
- * The parent directory name
289
- */
290
- namespace?: string;
291
- /**
292
- * The JSON file name with extension
293
- */
294
- key?: string;
295
- /**
296
- * The stringified JSON value
297
- */
298
- value?: string;
299
- /**
300
- * Type is JSON
301
- */
302
- type?: MetafieldTypes;
303
- /**
304
- * Value Type (this is legacy but we assert it anyway)
305
- */
306
- value_type?: 'json_string';
307
- /**
308
- * Last updated date
309
- */
310
- updated_at?: string;
311
- }
312
-
313
- /* -------------------------------------------- */
314
- /* REDIRECTS */
315
- /* -------------------------------------------- */
316
-
317
- export interface Redirect {
318
- /**
319
- * Redirect ID
320
- */
321
- id?: number;
322
- /**
323
- * The redirect from path
324
- */
325
- path?: string;
326
- /**
327
- * The redirect to path
328
- */
329
- target?: string;
330
- }
331
-
332
- export interface File {
333
- /**
334
- * File ID
335
- */
336
- id?: number;
337
- /**
338
- * The filename
339
- */
340
- filename?: string;
341
- /**
342
- * The mimeType of the file
343
- */
344
- mimeType?: string;
345
- /**
346
- * The file content type.
347
- */
348
- contentType?: string;
349
- /**
350
- * An external URL or a signed upload URL of the file object.
351
- */
352
- originalSource?: string;
353
- }
354
- }
355
-
356
- /**
357
- * Extended request options passed to axios when
358
- * uploading, downloading or interfacing with the Shopify
359
- * API themes, metafields or other endpoints.
360
- */
361
- export interface Request extends AxiosRequestConfig {
362
- url?: string;
363
- method?: Methods;
364
- responseType?: 'json',
365
- data?: (
366
- Requests.Asset |
367
- { metafield?: Requests.Metafield } |
368
- { redirect?: Requests.Redirect }
369
- )
370
- params?: {
371
- 'asset[key]'?: string;
372
- fields?: string
373
- }
374
- }
@@ -1,124 +0,0 @@
1
- import { Config } from '../config';
2
-
3
- export type Namespacing = (
4
- | '[dir]'
5
- | '[file]'
6
- | '[ext]'
7
- )
8
-
9
- /**
10
- * Namespaced Paths
11
- */
12
- export type NamespacePaths = `${'assets' | 'snippets'}/${string}`
13
-
14
- /**
15
- * Directory Paths
16
- */
17
- export type DirPaths = `${'assets' | 'snippets'}/${string}`
18
-
19
- /**
20
- * Rename Paths
21
- */
22
- export type RenamePaths = NamespacePaths;
23
-
24
- /**
25
- * Rename input type
26
- */
27
- export type RenameInput = {
28
- [filename: string]: string | string[]
29
- }
30
-
31
- /**
32
- * Rename input paths type
33
- */
34
- export type RenameInputPaths = { [filename: RenamePaths]: string | string[] }
35
-
36
- /**
37
- * Rename config type
38
- */
39
- export type RenameConfig<T> = { [filename: RenamePaths]: string | string[] | T}
40
-
41
- /**
42
- * Processor Configuration
43
- */
44
- export type GetProcessorConfigs<T> = {
45
- /**
46
- * Whether or not the processor is installed
47
- */
48
- installed: boolean;
49
- /**
50
- * Whether or not the module was loaded, ie: imported.
51
- * This will be `false` until the the import was loaded.
52
- */
53
- loaded: boolean;
54
- /**
55
- * Whether or not a config file exists for the processor,
56
- * When one exists the URI path location to the file will
57
- * be applied as the value.
58
- */
59
- file: boolean | string;
60
- /**
61
- * Configuration of the processor, Initialized with defaults
62
- */
63
- config: T;
64
- }
65
-
66
- /**
67
- * Picked `package.json` fields
68
- */
69
- export interface Package {
70
- version?: string;
71
- syncify?: Config;
72
- dependencies?: { [module: string]: string; };
73
- devDependencies?: { [module: string]: string };
74
- peerDependencies?: { [module: string]: string };
75
- optionalDependencies?: { [module: string]: string };
76
- }
77
-
78
- export namespace ENV {
79
-
80
- /**
81
- * Auth using `key` and `secret` in `.syncifyrc` file
82
- *
83
- * > _Single store_
84
- */
85
- export interface RCSecret {
86
- domain: string,
87
- key: string,
88
- secret: string
89
- }
90
-
91
- /**
92
- * Auth using `key` and `secret` in `.syncifyrc` File
93
- *
94
- * > _Array of stores_
95
- */
96
- export type RCSecrets = RCSecret[]
97
-
98
- /**
99
- * Auth using `token` in `.env.syncify.json` file
100
- *
101
- * > _Single store_
102
- */
103
- export interface RCToken {
104
- domain: string,
105
- token: string
106
- }
107
-
108
- /**
109
- * Auth using `token` in `.syncifyrc` file
110
- *
111
- * > _Array of stores_
112
- */
113
- export type RCTokens = RCToken[]
114
-
115
- /**
116
- * Using a `.syncifyrc` file for authorizations
117
- */
118
- export type RCFile =
119
- | RCSecret
120
- | RCSecret[]
121
- | RCToken
122
- | RCToken[]
123
-
124
- }