@syncify/cli 0.3.0-beta → 1.0.0-alpha.1

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 (41) hide show
  1. package/LICENSE +10 -6
  2. package/dist/index.d.cts +1815 -0
  3. package/dist/index.d.ts +1815 -0
  4. package/package.json +101 -103
  5. package/pnpm-lock.yaml +16312 -4430
  6. package/readme.md +76 -2184
  7. package/scripts/hot.js.liquid +25 -0
  8. package/dist/api.js +0 -16
  9. package/dist/cjs.js +0 -236
  10. package/dist/cli.js +0 -11
  11. package/dist/index.js +0 -18
  12. package/hot.js.liquid +0 -3
  13. package/schema/syncify.config.json +0 -676
  14. package/schema/syncify.env.json +0 -58
  15. package/schema/syncify.package.json +0 -11
  16. package/types/api.d.ts +0 -319
  17. package/types/bundle/cache.d.ts +0 -101
  18. package/types/bundle/commands.d.ts +0 -396
  19. package/types/bundle/errors.d.ts +0 -101
  20. package/types/bundle/file.d.ts +0 -285
  21. package/types/bundle/filters.d.ts +0 -81
  22. package/types/bundle/hot.d.ts +0 -185
  23. package/types/bundle/index.d.ts +0 -603
  24. package/types/bundle/plugin.d.ts +0 -127
  25. package/types/bundle/processors.d.ts +0 -54
  26. package/types/bundle/reports.d.ts +0 -123
  27. package/types/bundle/requests.d.ts +0 -374
  28. package/types/bundle/shared.d.ts +0 -124
  29. package/types/cli.d.ts +0 -547
  30. package/types/config/index.d.ts +0 -550
  31. package/types/config/terser.d.ts +0 -319
  32. package/types/config/views.d.ts +0 -191
  33. package/types/index.d.ts +0 -55
  34. package/types/modules/html-minifier-terser.d.ts +0 -218
  35. package/types/stores.d.ts +0 -11
  36. package/types/transforms/image.d.ts +0 -15
  37. package/types/transforms/json.d.ts +0 -51
  38. package/types/transforms/pages.d.ts +0 -254
  39. package/types/transforms/script.d.ts +0 -308
  40. package/types/transforms/style.d.ts +0 -219
  41. package/types/transforms/svg.d.ts +0 -189
@@ -1,550 +0,0 @@
1
- /* eslint-disable no-unused-vars */
2
-
3
- import type { Sections, Snippets } from './views';
4
- import type { HOTConfig } from '../bundle/hot';
5
- import type { ScriptTerse, JSONTerse, MarkupTerse, LiquidTerse } from './terser';
6
- import type { PluginHooks } from '../bundle/plugin';
7
- import type { JSONConfig } from '../transforms/json';
8
- import type { SharpConfig } from '../transforms/image';
9
- import type { PagesConfig } from '../transforms/pages';
10
- import type { ScriptTransformer, ESBuildConfig } from '../transforms/script';
11
- import type { StyleTransformer, SASSConfig, PostCSSConfig } from '../transforms/style';
12
- import type { SVGTransformer, SVGOConfig, SVGSpriteConfig } from '../transforms/svg';
13
-
14
- /* -------------------------------------------- */
15
- /* PROCESSORS */
16
- /* -------------------------------------------- */
17
-
18
- /**
19
- * Processor Default Configurations
20
- *
21
- * Holds reference to default config options for
22
- * each supported processor.
23
- */
24
- export interface Processors {
25
- /**
26
- * JSON File processing - Options defined here are used when
27
- * writing to the file system. Typically in operations like
28
- * `--merge`, `--pull` and `--download`.
29
- *
30
- * > The options will also be used in **development** (`dev`)
31
- * mode when uploading `.json` files to stores/themes.
32
- */
33
- json?: JSONConfig;
34
- /**
35
- * [ESBuild](https://esbuild.github.io/) Config
36
- *
37
- * Syncify uses ESBuild under the hood for JS/TS transpilation.
38
- * Some native ESBuild options are omitted from processing and
39
- * handled internally by Syncify.
40
- */
41
- esbuild?: ESBuildConfig
42
- /**
43
- * [PostCSS](https://postcss.org/) Plugins
44
- */
45
- postcss?: PostCSSConfig[]
46
- /**
47
- * [SASS Dart](https://sass-lang.com/documentation/js-api/) Config
48
- */
49
- sass?: SASSConfig
50
- /**
51
- * [Sharp](https://sharp.pixelplumbing.com) Config
52
- */
53
- sharp?: SharpConfig;
54
- /**
55
- * [SVGO](https://github.com/svg/svgo) Config
56
- *
57
- */
58
- svgo?: SVGOConfig;
59
- /**
60
- * [SVG Sprite](https://github.com/svg-sprite) Config
61
- */
62
- sprite?: SVGSpriteConfig
63
- }
64
-
65
- /* -------------------------------------------- */
66
- /* VIEWS */
67
- /* -------------------------------------------- */
68
-
69
- export interface Views {
70
- /**
71
- * Static page handling
72
- */
73
- pages?: PagesConfig;
74
- /**
75
- * Snippet file handling (ie: sub-directory grouping)
76
- */
77
- snippets?: Snippets;
78
- /**
79
- * Section file handling (ie: sub-directory grouping)
80
- */
81
- sections?: Sections;
82
- }
83
-
84
- /* -------------------------------------------- */
85
- /* TRANSFORMS */
86
- /* -------------------------------------------- */
87
-
88
- export interface Transforms {
89
- /**
90
- * Style File transforms
91
- *
92
- * @example
93
- *
94
- * // OPTION 1 - Rename with single input
95
- * {
96
- * style: {
97
- * 'assets/stylesheet.css': 'path/to/file.scss', // write to assets dir and compile with sass
98
- * 'snippets/style.liquid': 'path/to/foo.css' // write as snippet
99
- * }
100
- * }
101
- *
102
- * // OPTION 2 - Rename with multiple inputs
103
- * {
104
- * style: {
105
- * 'assets/stylesheet.css': [
106
- * 'path/to/source/file-1.scss',
107
- * 'path/to/source/file-2.scss',
108
- * ]
109
- * }
110
- * }
111
- *
112
- * // OPTION 3 - Rename with overrides
113
- * {
114
- * style: {
115
- * 'assets/filename.min.css': {
116
- * input: 'path/to/source/file.scss',
117
- * includePaths: ['node_modules'],
118
- * watch: []
119
- * }
120
- * }
121
- * }
122
- *
123
- * // OPTION 4 - Single config
124
- * {
125
- * style: {
126
- * input: 'path/to/source/file.scss',
127
- * rename: 'filename.min.css',
128
- * postcss: [ plugin() ] // use some postcss plugin with this file
129
- * sass: {
130
- * includePaths: [
131
- * 'node_modules/bootstrap' // include this path
132
- * ]
133
- * }
134
- * }
135
- * }
136
- *
137
- * // OPTION 5 - Multiple configs
138
- * {
139
- * style: [
140
- * {
141
- * input: 'path/to/source/file-1.css',
142
- * snippet: true,
143
- * rename: 'some-name.liquid',
144
- * postcss: [ plugin() ], // use some plugin with this file
145
- * sass: false // do not process with sass
146
- * },
147
- * {
148
- * input: 'path/to/source/file-2.scss',
149
- * postcss: false, // do not process with postcss
150
- * sass: true, // use processor defined settings
151
- * watch: [
152
- * 'path/to/files/*.scss'
153
- * ]
154
- * }
155
- * ]
156
- * }
157
- */
158
- style?: StyleTransformer
159
- /**
160
- * JavaScript/TypeScript Transforms - _Requires [ESBuild](https://esbuild.github.io)_
161
- *
162
- * Script inputs can be defined a few different ways depending on your preference.
163
- * You can also override ESBuild `processor` defined options on a per-file basis.
164
- * Options 1, 2 and 3 are typically the preferred structures.
165
- *
166
- *
167
- * @example
168
- *
169
- * // OPTION 1 - Rename with single input
170
- * {
171
- * script: {
172
- * 'assets/filename.min.js': 'path/to/source/file.ts', // write to assets dir
173
- * 'snippets/js-file.liquid': 'path/to/source/foo.ts' // write as snippet
174
- * }
175
- * }
176
- *
177
- * // OPTION 2 - Rename with multiple inputs
178
- * {
179
- * script: {
180
- * 'assets/[file].min.[ext]': [
181
- * 'path/to/source/file-1.ts', // outputs assets/file-1.min.js
182
- * 'path/to/source/file-2.ts', // outputs assets/file-2.min.js
183
- * ]
184
- * }
185
- * }
186
- *
187
- * // OPTION 3 - Rename with overrides
188
- * {
189
- * script: {
190
- * 'assets/filename.min.js': {
191
- * input: 'path/to/source/file.ts',
192
- * splitting: true,
193
- * treeShaking: false
194
- * }
195
- * }
196
- * }
197
- *
198
- * // OPTION 4 - Single config
199
- * {
200
- * script: {
201
- * input: 'path/to/source/file.ts',
202
- * rename: 'filename.min.js',
203
- * esbuild: {}
204
- * }
205
- * }
206
- *
207
- * // OPTION 5 - Multiple configs
208
- * {
209
- * script: [
210
- * {
211
- * input: 'path/to/source/file-1.ts',
212
- * rename: 'filename.min.js',
213
- * esbuild: {}
214
- * },
215
- * {
216
- * input: 'path/to/source/file-2.ts',
217
- * snippet: true
218
- * }
219
- * ]
220
- * }
221
- */
222
- script?: false | ScriptTransformer
223
- /**
224
- * SVG File transforms
225
- */
226
- svg?: SVGTransformer
227
- }
228
-
229
- /* -------------------------------------------- */
230
- /* MINIFY */
231
- /* -------------------------------------------- */
232
-
233
- export interface Terser {
234
- /**
235
- * JSON minification options. You can disable all JSON files from
236
- * being minified by passing a boolean `false`. Optionally, you can
237
- * exclude certain types of JSON from being minified.
238
- */
239
- json?: boolean | JSONTerse;
240
- /**
241
- * View minification options. You can disable all views from
242
- * being minified by passing a boolean `false`.
243
- *
244
- * Syncify uses HTML Minifier Terser under the hood, it has been
245
- * configured to work with Liquid files so only a limited number
246
- * of options are exposed in order to prevent invalid or broken
247
- * output from being generated.
248
- */
249
- liquid?: boolean | LiquidTerse;
250
- /**
251
- * View minification options. You can disable all views from
252
- * being minified by passing a boolean `false`.
253
- *
254
- * Syncify uses HTML Minifier Terser under the hood, it has been
255
- * configured to work with Liquid files so only a limited number
256
- * of options are exposed in order to prevent invalid or broken
257
- * output from being generated.
258
- */
259
- markup?: boolean | MarkupTerse;
260
- /**
261
- * JavaScript minification options. Script minification is only
262
- * available for projects with `esbuild` installed and configured
263
- * as a processor.
264
- */
265
- script?: boolean | ScriptTerse;
266
- }
267
-
268
- /* -------------------------------------------- */
269
- /* LOGGER */
270
- /* -------------------------------------------- */
271
-
272
- export interface Logger {
273
- /**
274
- * Whether or not file stats should print
275
- *
276
- * > Helpful when building for production (`--prod`)
277
- *
278
- * @default true
279
- */
280
- stats?: boolean;
281
- /**
282
- * Whether or not to print warnings
283
- *
284
- * @default true
285
- */
286
- warnings?: boolean;
287
- /**
288
- * Suppress CLI logs
289
- *
290
- * @default false
291
- */
292
- silent?: boolean;
293
- /**
294
- * Whether or not to clear the screen between changes.
295
- *
296
- * @default true
297
- */
298
- clear?: boolean;
299
- }
300
-
301
- /* -------------------------------------------- */
302
- /* STORES */
303
- /* -------------------------------------------- */
304
-
305
- export interface Stores {
306
- /**
307
- * The store myshopify domain, eg: `store.myshopify.com`
308
- */
309
- domain: string;
310
- /**
311
- * The store theme targets - Theme use a `key > value`
312
- * structure. The `key` values represent target names that
313
- * will be used in the CLI.
314
- */
315
- themes: { [target: string]: number }
316
- }
317
-
318
- /* -------------------------------------------- */
319
- /* BASE DIRECTORIES */
320
- /* -------------------------------------------- */
321
-
322
- export interface Directories {
323
- /**
324
- * The resolved `input` directory path
325
- *
326
- * @default 'source'
327
- */
328
- input?: string;
329
- /**
330
- * The resolved `output` directory path
331
- *
332
- * @default 'theme/'
333
- */
334
- output?: string;
335
- /**
336
- * The resolved `import` directory path for downloaded themes
337
- *
338
- * @default 'import/'
339
- */
340
- import?: string;
341
- /**
342
- * The resolved `export` directory path for packaged `.zip` themes
343
- *
344
- * @default 'export'
345
- */
346
- export?: string;
347
- /**
348
- * The resolved `config` directory path for build tool files
349
- *
350
- * @default '/'
351
- */
352
- config?: string;
353
- /**
354
- * The resolved `cache` directory path for build tool files
355
- *
356
- * @default 'node_modules/.syncify/'
357
- */
358
- cache?: string;
359
- }
360
-
361
- /* -------------------------------------------- */
362
- /* SOURCE PATHS */
363
- /* -------------------------------------------- */
364
-
365
- export interface Paths<T = string | string[]> {
366
- /**
367
- * An array list of files to be uploaded as assets
368
- *
369
- * @default 'source/assets'
370
- */
371
- assets?: T;
372
- /**
373
- * An array list of files to be uploaded as snippets
374
- *
375
- * @default 'source/snippets'
376
- */
377
- snippets?: T
378
- /**
379
- * An array list of files to be uploaded as sections
380
- *
381
- * @default 'source/sections'
382
- */
383
- sections?: T
384
- /**
385
- * An array list of files to be uploaded as layouts
386
- *
387
- * @default 'source/layout'
388
- */
389
- layout?: T
390
- /**
391
- * An array list of files to be uploaded as templates
392
- *
393
- * @default 'source/templates'
394
- */
395
- templates?: T
396
- /**
397
- * An array list of files to be uploaded as metaobject templates
398
- *
399
- * @default 'source/templates/metaobject'
400
- */
401
- metaobject?: T
402
- /**
403
- * An array list of files to be uploaded as template/customers
404
- *
405
- * @default 'source/templates/customers'
406
- */
407
- customers?: T
408
- /**
409
- * An array list of files to be uploaded as configs
410
- *
411
- * @default 'source/config'
412
- */
413
- config?: T
414
- /**
415
- * An array list of files to be uploaded as locales
416
- *
417
- * @default 'source/locales'
418
- */
419
- locales?: T
420
- /**
421
- * **NOT YET AVAILABLE**
422
- *
423
- * > **This option will be available in later versions**
424
- *
425
- * ---
426
- *
427
- * The resolved `metafields` directory path
428
- *
429
- * @default 'source/metafields'
430
- */
431
- metafields?: T
432
- /**
433
- * The resolved `pages` directory path
434
- *
435
- * @default 'source/pages'
436
- */
437
- pages?: T
438
- /**
439
- * **NOT YET AVAILABLE**
440
- *
441
- * > **This option will be available in later versions**
442
- *
443
- * ---
444
- *
445
- * @default 'redirects.yaml'
446
- */
447
- redirects?: `${string}.${'yaml' | 'yml'}`
448
- }
449
-
450
- /* -------------------------------------------- */
451
- /* DEFINE CONFIG */
452
- /* -------------------------------------------- */
453
-
454
- /**
455
- * The Configuration model
456
- */
457
- export interface Config<T = Stores> extends Directories {
458
- /**
459
- * Define your Shopify store/s and thier theme/s
460
- */
461
- stores: T | Stores | Stores[];
462
- /**
463
- * Define customize input structures - Paths resolve to `input`
464
- */
465
- paths?: Paths;
466
- /**
467
- * Whether of not Syncify should clean output before building.
468
- */
469
- clean?: boolean;
470
- /**
471
- * Hot reloading options. Passing boolean `true` will use defaults.
472
- * Set to `false` to disable live reloads. Optionally configure
473
- * reloads by passing configuration _object_.
474
- *
475
- * > Hot reloading is only possible in **watch** mode.
476
- *
477
- * @default false
478
- */
479
- hot?: boolean | HOTConfig;
480
- /**
481
- * Syncify Plugins
482
- */
483
- plugins?: PluginHooks[]
484
- /**
485
- * Spawn child process
486
- */
487
- spawn?: {
488
- /**
489
- * Processes to spawn when running **build** mode, ie: `--build` or `-b`
490
- *
491
- * @default {}
492
- *
493
- * @example
494
- *
495
- * {
496
- * build: {
497
- * rollup: 'rollup -c',
498
- * gulp: ['gulp', 'build-task'] // can also use arrays
499
- * }
500
- * }
501
- */
502
- build?: { [target: string]: string | string[] };
503
- /**
504
- * Processes to spawn when running **watch** mode, ie: `--watch` or `-w`
505
- *
506
- * @default {}
507
- *
508
- * @example
509
- * {
510
- * build: {
511
- * rollup: 'rollup -c --watch',
512
- * gulp: ['gulp', 'watch-task'], // can also use arrays
513
- * }
514
- * }
515
- */
516
- watch?: { [target: string]: string | string[] }
517
- };
518
- /**
519
- * View specific processing configuration
520
- */
521
- views?: Views;
522
- /**
523
- * Console log options
524
- */
525
- logger?: Logger;
526
- /**
527
- * Configurations for the `transform` processors. Define options
528
- * for the transformers to inherit. You can override these on a
529
- * per-transform basis. Optionally, you can use the default presets
530
- * which syncify has pre-configured for optimal output.
531
- */
532
- processors?: Processors;
533
- /**
534
- * Transform pipeline configurations
535
- */
536
- transforms?: Transforms;
537
- /**
538
- * Terse options (minification)
539
- *
540
- * Invoked when in **production** (`--prod`) mode or when the `--terse` flag is passed.
541
- * Options will default to `false`when either of these conditionals are not met.
542
- */
543
- terser?: boolean | Terser;
544
- /**
545
- * @deprecated
546
- *
547
- * Use `terser` option instead
548
- */
549
- minify?: undefined;
550
- }