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