@syncify/cli 0.2.3-beta → 0.3.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.
@@ -39,37 +39,43 @@ export interface JSONTerse {
39
39
  *
40
40
  * @default true
41
41
  */
42
- assets: boolean;
42
+ assets?: boolean;
43
43
  /**
44
44
  * Minify `settings_schema.json` and `settings_data.json` config files.
45
45
  *
46
46
  * @default true
47
47
  */
48
- config: boolean;
48
+ config?: boolean;
49
49
  /**
50
50
  * Minify `locale` and `.json` files.
51
51
  *
52
52
  * @default true
53
53
  */
54
- locales: boolean;
54
+ locales?: boolean;
55
55
  /**
56
56
  * Minify `metafield` and `.json` files.
57
57
  *
58
58
  * @default true
59
59
  */
60
- metafields: boolean;
60
+ metafields?: boolean;
61
+ /**
62
+ * Minify `metaobject` and `.json` files.
63
+ *
64
+ * @default true
65
+ */
66
+ metaobject?: boolean;
61
67
  /**
62
68
  * Minify section group `.json` files
63
69
  *
64
70
  * @default true
65
71
  */
66
- sectionGroups: boolean;
72
+ groups?: boolean;
67
73
  /**
68
74
  * Minify `template` and `.json` files.
69
75
  *
70
76
  * @default true
71
77
  */
72
- templates: boolean;
78
+ templates?: boolean;
73
79
  /**
74
80
  * An optional list of paths/files to exclude from minification.
75
81
  *
@@ -81,17 +87,23 @@ export interface JSONTerse {
81
87
  /**
82
88
  * Liquid Minification
83
89
  */
84
- export interface ViewTerse {
90
+ export interface LiquidTerse {
85
91
  /**
86
- * Minifies inner contents of `<script>` tags
92
+ * Minifies inner contents of `{% javascript %}` tags
87
93
  *
88
- * @default true
94
+ * @default false
89
95
  */
90
- minifyScript?: boolean;
96
+ minifyJavascript?: boolean;
91
97
  /**
92
- * Minifies inner contents of `<style>` tags
98
+ * Minifies inner contents of `{% stylesheet %}`` tags
93
99
  *
94
- * @default true
100
+ * @default false
101
+ */
102
+ minifyStylesheet?: boolean;
103
+ /**
104
+ * Minifies inner contents of `{% style %}` tags
105
+ *
106
+ * @default false
95
107
  */
96
108
  minifyStyle?: boolean;
97
109
  /**
@@ -101,11 +113,11 @@ export interface ViewTerse {
101
113
  * >
102
114
  * > Minifying schema tag contents has no effect on store performance.
103
115
  *
104
- * @default true
116
+ * @default false
105
117
  */
106
118
  minifySchema?: boolean;
107
119
  /**
108
- * Remove all occurances of Liquid/HTML comments
120
+ * Remove all occurances of Liquid comments
109
121
  *
110
122
  * @default true
111
123
  */
@@ -158,6 +170,42 @@ export interface ViewTerse {
158
170
  exclude?: string[]
159
171
  }
160
172
 
173
+ /**
174
+ * Liquid Minification
175
+ */
176
+ export interface MarkupTerse {
177
+ /**
178
+ * Minifies inner contents of `<script>` tags
179
+ *
180
+ * @default true
181
+ */
182
+ minifyJS?: boolean;
183
+ /**
184
+ * Minifies inner contents of `<style>` tags
185
+ *
186
+ * @default true
187
+ */
188
+ minifyCSS?: boolean;
189
+ /**
190
+ * Remove all occurances of HTML comments
191
+ *
192
+ * @default true
193
+ */
194
+ removeComments?: boolean;
195
+ /**
196
+ * Collapse all whitespace and newlines
197
+ *
198
+ * @default true
199
+ */
200
+ collapseWhitespace?: boolean;
201
+ /**
202
+ * Excluded files from minification
203
+ *
204
+ * @default []
205
+ */
206
+ exclude?: string[]
207
+ }
208
+
161
209
  /**
162
210
  * Style Minification
163
211
  */
@@ -173,12 +221,12 @@ export interface StyleTerse extends CleanCSSOptions {
173
221
  *
174
222
  * @default false
175
223
  */
176
- ofuscateClassNames?: boolean;
224
+ obfuscateClassNames?: boolean;
177
225
  /**
178
226
  * List of class names that should be excluded from
179
227
  * obfuscation and shortnaming.
180
228
  */
181
- ofuscateWhitelist?: string[];
229
+ obfuscateWhitelist?: string[];
182
230
  /**
183
231
  * The alphabet used to generate the new class names.
184
232
  *
@@ -188,7 +236,7 @@ export interface StyleTerse extends CleanCSSOptions {
188
236
  *
189
237
  * @default 'abcefghijklmnopqrstuvwxyz0123456789'
190
238
  */
191
- ofuscateAlphabet?: string;
239
+ obfuscateAlphabet?: string;
192
240
  /**
193
241
  * Excluded files from terser minification
194
242
  *
@@ -214,13 +262,13 @@ export interface TerserConfig {
214
262
  /**
215
263
  * Terse View (Liquid) Minification
216
264
  */
217
- liquid?: Omit<ViewTerse, 'collapseWhitespace'>;
265
+ liquid?: LiquidTerse;
218
266
  /**
219
- * Terse View (HTML) Minification
267
+ * Terse Markup (HTML) Minification
220
268
  *
221
269
  * > Uses [html-minifier-terser](https://github.com/terser/html-minifier-terser)
222
270
  */
223
- html?: HTMLMinifierTerserOptions;
271
+ markup?: HTMLMinifierTerserOptions;
224
272
  /**
225
273
  * **NOTE YET AVAILABLE**
226
274
  *
@@ -251,9 +299,13 @@ export interface TerserBundle {
251
299
  */
252
300
  json: boolean;
253
301
  /**
254
- * View minification
302
+ * HTML (Markup) Minification
303
+ */
304
+ markup: boolean;
305
+ /**
306
+ * Liquid Minification
255
307
  */
256
- views: boolean;
308
+ liquid: boolean;
257
309
  /**
258
310
  * **NOTE YET AVAILABLE**
259
311
  *
@@ -189,46 +189,3 @@ export interface Sections {
189
189
  */
190
190
  global?: string[];
191
191
  }
192
-
193
- /**
194
- * Static Page publishing
195
- */
196
- export interface Pages {
197
- /**
198
- * Whether the pulled page content should be written
199
- * as HTML or have the HTML converted to Markdown.
200
- *
201
- * @default 'html'
202
- */
203
- language?: 'markdown' | 'html',
204
- /**
205
- * Fallback author name
206
- *
207
- * @default null
208
- */
209
- author?: string;
210
- /**
211
- * Whether pages contained in sub-directories should
212
- * use the directory name as the `template_suffix`
213
- *
214
- * @default false
215
- */
216
- suffixDir?: boolean;
217
- /**
218
- * A list of page sub-directories or relative files that should
219
- * pass through and not apply the directory name as a `template_suffix`
220
- *
221
- * _cannot contain glob (`*`) stars_
222
- *
223
- * @default []
224
- *
225
- * @example
226
- *
227
- * // ✓ This is correct
228
- * { global: ['some-dir/filename.liquid' ] }
229
- *
230
- * // ✗ This is incorrect
231
- * { global: ['some-dir/*.liquid' ] }
232
- */
233
- global?: string[];
234
- }
package/types/index.d.ts CHANGED
@@ -2,24 +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 './internal/file';
5
+ export type { FileKeys } from './bundle/file';
6
6
 
7
7
  export * from './api';
8
8
  export * from './cli';
9
9
  export * from './config';
10
10
  export * from './config/views';
11
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';
12
+ export * from './bundle/cache';
13
+ export * from './bundle/filters';
14
+ export * from './bundle/requests';
15
+ export * from './bundle/shared';
16
+ export * from './bundle/errors';
17
+ export * from './bundle/reports';
18
+ export * from './bundle/file';
19
+ export * from './bundle';
20
+ export * from './bundle/plugin';
21
+ export * from './bundle/hot';
22
+ export * from './transforms/pages';
23
23
  export * from './transforms/image';
24
24
  export * from './transforms/json';
25
25
  export * from './transforms/script';
@@ -27,13 +27,13 @@ export * from './transforms/style';
27
27
  export * from './transforms/svg';
28
28
 
29
29
  /**
30
- * ***Define Config:***
30
+ * **Define Config:**
31
31
  *
32
32
  * Provide to the default export in your `syncify.config.js` file.
33
33
  *
34
34
  * ---
35
35
  *
36
- * ***Supported Files:***
36
+ * **Supported Files:**
37
37
  *
38
38
  * - syncify.config.ts
39
39
  * - syncify.config.js
@@ -51,5 +51,5 @@ export * from './transforms/svg';
51
51
  * });
52
52
  *
53
53
  */
54
- export declare function defineConfig(config: Config): void
54
+ export declare function defineConfig<T>(config: Config<T>): void;
55
55
  export default syncify;
@@ -108,6 +108,7 @@ export interface HTMLMinifierTerserOptions {
108
108
  minifyURLs?: boolean | string | object | ((text: string) => string) | undefined;
109
109
  /**
110
110
  * Never add a newline before a tag that closes an element
111
+ *
111
112
  * @default false
112
113
  */
113
114
  noNewlinesBeforeTagClose?: boolean | undefined;
@@ -154,26 +155,31 @@ export interface HTMLMinifierTerserOptions {
154
155
  removeEmptyAttributes?: boolean | ((attrName: string, tag: string) => boolean) | undefined;
155
156
  /**
156
157
  * Remove all elements with empty contents
158
+ *
157
159
  * @default false
158
160
  */
159
161
  removeEmptyElements?: boolean | undefined;
160
162
  /**
161
163
  * Remove optional tags
164
+ *
162
165
  * @default false
163
166
  */
164
167
  removeOptionalTags?: boolean | undefined;
165
168
  /**
166
169
  * Remove attributes when value matches default
170
+ *
167
171
  * @default false
168
172
  */
169
173
  removeRedundantAttributes?: boolean | undefined;
170
174
  /**
171
175
  * Remove `type="text/javascript"` from `script` tags. Other `type` attribute values are left intact
176
+ *
172
177
  * @default false
173
178
  */
174
179
  removeScriptTypeAttributes?: boolean | undefined;
175
180
  /**
176
181
  * Remove `type="text/css"` from `style` and `link` tags. Other `type` attribute values are left intact
182
+ *
177
183
  * @default false
178
184
  */
179
185
  removeStyleLinkTypeAttributes?: boolean | undefined;
@@ -206,6 +212,7 @@ export interface HTMLMinifierTerserOptions {
206
212
 
207
213
  /**
208
214
  * HTMLMinifier is a highly configurable, well-tested, JavaScript-based HTML minifier.
215
+ *
209
216
  * @async
210
217
  */
211
218
  export function minify(value: string, options?: HTMLMinifierTerserOptions): Promise<string>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Dev Theme ID for syncify.myshopify.com
3
+ */
4
+ declare type DevThemeID = 12345679
5
+
6
+ /**
7
+ * Prod Theme ID for syncify.myshopify.com
8
+ */
9
+ declare type ProdThemeID = 12345679888
10
+
11
+ export type IDS = DevThemeID | ProdThemeID
@@ -1,5 +1,5 @@
1
1
  import type { SharpOptions as SharpConfig } from 'sharp';
2
- import type { GetProcessorConfigs } from '../internal/shared';
2
+ import type { GetProcessorConfigs } from '../bundle/shared';
3
3
 
4
4
  export type { SharpConfig };
5
5
 
@@ -39,4 +39,13 @@ export interface JSONConfig {
39
39
  *
40
40
  * Bundling Configuration
41
41
  */
42
- export type JSONBundle = Merge<JSONConfig, { exclude: Tester }>;
42
+ export type JSONBundle = Merge<JSONConfig, {
43
+ /**
44
+ * Paths to exclude from JSON processing
45
+ */
46
+ exclude: Tester;
47
+ /**
48
+ * The resolved cache path.
49
+ */
50
+ cache: string;
51
+ }>;
@@ -1,3 +1,7 @@
1
+ import { Tester } from 'anymatch';
2
+ import { Merge } from 'type-fest';
3
+ import { PageMetafield } from '../bundle/requests';
4
+
1
5
  /**
2
6
  * **Markdown > HTML**
3
7
  *
@@ -102,3 +106,149 @@ export namespace Markdown {
102
106
  linkReferenceStyle?: 'full' | 'collapsed' | 'shortcut' | undefined;
103
107
  }
104
108
  }
109
+
110
+ /**
111
+ * Static Page publishing
112
+ */
113
+ export interface PagesConfig {
114
+ /**
115
+ * Whether the pulled page content should be written
116
+ * as HTML or have the HTML converted to Markdown.
117
+ *
118
+ * @default 'html'
119
+ */
120
+ importLanguage?: 'markdown' | 'html',
121
+ /**
122
+ * Whether or not to use safe sync. When enabled, Syncify
123
+ * will check remote sources before publishing. If local
124
+ * sources have had edits applied, you will be prompted
125
+ * before an overwrite takes place.
126
+ *
127
+ * @default true
128
+ */
129
+ safeSync?: boolean;
130
+ /**
131
+ * Fallback author name
132
+ *
133
+ * @default ''
134
+ */
135
+ author?: string;
136
+ /**
137
+ * Whether pages contained in sub-directories should
138
+ * use their directory name as the `template_suffix`
139
+ * when publishing to stores
140
+ *
141
+ * @default false
142
+ */
143
+ suffixDir?: boolean;
144
+ /**
145
+ * If `suffixDir` is `true` you can provide alist of page sub-directories
146
+ * or relative files that should pass through without applying the directory
147
+ * name as a `template_suffix` on the page.
148
+ *
149
+ * _cannot contain glob (`*`) stars_
150
+ *
151
+ * @default []
152
+ *
153
+ * @example
154
+ *
155
+ * // ✓ This is correct
156
+ * { global: ['some-dir/filename.md' ] }
157
+ *
158
+ * // ✗ This is incorrect
159
+ * { global: ['some-dir/*.md' ] }
160
+ */
161
+ global?: string[];
162
+ }
163
+
164
+ /* -------------------------------------------- */
165
+ /* INTERNAL USE */
166
+ /* -------------------------------------------- */
167
+
168
+ /**
169
+ * **Internal Use**
170
+ *
171
+ * Describes the frontmatter of a page file
172
+ */
173
+ export interface PageFrontmatter {
174
+ /**
175
+ * Page title
176
+ */
177
+ title?: string;
178
+ /**
179
+ * Page id reference
180
+ */
181
+ id?: number;
182
+ /**
183
+ * Page handle
184
+ */
185
+ handle?: string;
186
+ /**
187
+ * The template suffix
188
+ */
189
+ template?: string;
190
+ /**
191
+ * The template suffix (fallback if user passed explicit ref)
192
+ */
193
+ template_suffix?: string;
194
+ /**
195
+ * The author of the page
196
+ */
197
+ author?: string;
198
+ /**
199
+ * `markdown-it` option
200
+ *
201
+ * Whether or not HTML tags in source are enabled
202
+ */
203
+ html?: boolean;
204
+ /**
205
+ * Whether or not the page should be published
206
+ */
207
+ published?: boolean;
208
+ /**
209
+ * Write the following metafields to the page
210
+ */
211
+ metafields?: PageMetafield[]
212
+ /**
213
+ * Catches invalid reference
214
+ */
215
+ metafield?: PageMetafield[]
216
+ /**
217
+ * `markdown-it` option
218
+ *
219
+ * Applies `linkify` overwrite (Autoconvert URL-like text to links)
220
+ */
221
+ links?: boolean;
222
+ /**
223
+ * `markdown-it` option
224
+ *
225
+ * Applies `breaks` overwrite (Convert '\n' in paragraphs into `<br>`)
226
+ */
227
+ breaks?: boolean;
228
+ }
229
+
230
+ /**
231
+ * **Internal Use**
232
+ */
233
+ export type PageBundle = Merge<PagesConfig, {
234
+ /**
235
+ * Import configuration for Turndown
236
+ */
237
+ import: Markdown.Import;
238
+ /**
239
+ * Export configuration for Markdown-it
240
+ */
241
+ export: Markdown.Export;
242
+ /**
243
+ * Whether or not `safe` is enabled
244
+ */
245
+ safeSync: boolean;
246
+ /**
247
+ * Global passthrough;
248
+ */
249
+ global: RegExp;
250
+ /**
251
+ * Anymatch pattern
252
+ */
253
+ paths?: Tester;
254
+ }>
@@ -3,7 +3,7 @@ import type { Merge } from 'type-fest';
3
3
  import type { Tester } from 'anymatch';
4
4
  import type { Tsconfig } from 'tsconfig-type';
5
5
  import type { BuildOptions as ESBuildOptions } from 'esbuild';
6
- import type { GetProcessorConfigs, RenamePaths } from '../internal/shared';
6
+ import type { GetProcessorConfigs, RenamePaths } from '../bundle/shared';
7
7
 
8
8
  type TargetBrowser = (
9
9
  | 'chrome'
@@ -259,7 +259,7 @@ export type ESBuildProcesser = Merge<GetProcessorConfigs<ESBuildOptions>, {
259
259
  */
260
260
  export interface ScriptBundle {
261
261
  /**
262
- * A UUID reference for this bundle.
262
+ * A UUID reference for this $.
263
263
  */
264
264
  uuid: string;
265
265
  /**
@@ -302,7 +302,7 @@ export interface ScriptBundle {
302
302
  watchCustom: Tester;
303
303
  /**
304
304
  * ESBuild options which will either use the processor defaults or
305
- * if defined on script bundle, will be merged with processor defaults.
305
+ * if defined on script $, will be merged with processor defaults.
306
306
  */
307
307
  esbuild: ESBuildOptions
308
308
  }
@@ -4,7 +4,7 @@ import type { LiteralUnion, Merge } from 'type-fest';
4
4
  import type { Tester } from 'anymatch';
5
5
  import type { Config as TailwindConfig } from 'tailwindcss';
6
6
  import type { Plugin as PostCSSPlugin, Transformer, TransformCallback } from 'postcss';
7
- import type { GetProcessorConfigs, RenamePaths } from '../internal/shared';
7
+ import type { GetProcessorConfigs, RenamePaths } from '../bundle/shared';
8
8
 
9
9
  /* -------------------------------------------- */
10
10
  /* PROCESSOR CONFIGS */
@@ -205,7 +205,7 @@ export type SASSProcesser = GetProcessorConfigs<SASSConfig>
205
205
  */
206
206
  export type StyleBundle = Merge<StyleTransform, {
207
207
  /**
208
- * A UUID reference for this bundle.
208
+ * A UUID reference for this $.
209
209
  */
210
210
  uuid: string;
211
211
  /**
@@ -4,7 +4,7 @@ import type { LiteralUnion, Merge } from 'type-fest';
4
4
  import type { Tester } from 'anymatch';
5
5
  import type { Config as SVGOConfig } from 'svgo';
6
6
  import type { Config as SVGSpriteConfig } from 'svg-sprite';
7
- import type { GetProcessorConfigs, RenamePaths } from '../internal/shared';
7
+ import type { GetProcessorConfigs, RenamePaths } from '../bundle/shared';
8
8
 
9
9
  /* -------------------------------------------- */
10
10
  /* PROCESSOR CONFIGS */
@@ -166,7 +166,7 @@ export type SVGSpriteProcesser = GetProcessorConfigs<SVGSpriteConfig>
166
166
  */
167
167
  export type SVGBundle = Merge<SVGTransform, {
168
168
  /**
169
- * A UUID reference for this bundle.
169
+ * A UUID reference for this $.
170
170
  */
171
171
  uuid: string;
172
172
  /**
@@ -1,97 +0,0 @@
1
- export interface Cache {
2
- /**
3
- * The last time cache was updated at (timestamp)
4
- */
5
- updated: number;
6
- /**
7
- * When the cache was created (timestamp)
8
- */
9
- created: number;
10
- /**
11
- * Page related cache records, this reference typically
12
- * holds `path > id` object references. Page ids are
13
- * cached for lookup when changes occur. The `map` object
14
- * holds the references and applied to model on initialization.
15
- */
16
- pages: {
17
- /**
18
- * The URI cache map location
19
- *
20
- * @default 'node_modules/.syncify/pages'
21
- */
22
- uri: string;
23
- /**
24
- * Page output name and Buffer
25
- */
26
- data: { [outputName: string]: Buffer }
27
- },
28
- /**
29
- * Section related cache records, this reference typically
30
- * holds output filename reference and used to prevent
31
- * duplicated sections from being written.
32
- */
33
- sections: string[];
34
- /**
35
- * JavaScript related cache records, typically source maps
36
- */
37
- script: {
38
- /**
39
- * The URI cache map location
40
- *
41
- * @default 'node_modules/.syncify/script'
42
- */
43
- uri: string;
44
- /**
45
- * Metafield pathname > id cache references.
46
- */
47
- data: { [outputName: string]: Buffer }
48
- },
49
- /**
50
- * Stylesheet related cache records, typically source maps
51
- */
52
- style: {
53
- /**
54
- * The URI cache map location
55
- *
56
- * @default 'node_modules/.syncify/styles'
57
- */
58
- uri: string;
59
- /**
60
- * Stylesheet output name and Buffer
61
- */
62
- data: { [outputName: string]: Buffer }
63
- },
64
- /**
65
- * Metafields related cache records. Metafield source maps
66
- * are `path > id` object references. Metafield ids are
67
- * cached for lookup when changes occur. The `map` object
68
- * holds the references and applied to model on initialization.
69
- */
70
- metafields: {
71
- /**
72
- * The URI cache reference location
73
- *
74
- * @default 'node_modules/.syncify/metafields'
75
- */
76
- uri: string,
77
- /**
78
- * Metafield pathname > id cache references.
79
- */
80
- data: { [path: string]: number }
81
- },
82
- /**
83
- * Specification JSON for vscode
84
- */
85
- vscode: {
86
- /**
87
- * The URI vscode reference location
88
- *
89
- * @default 'node_modules/.syncify/vscode'
90
- */
91
- uri: string;
92
- /**
93
- * vscode file maps
94
- */
95
- data: { icons?: string; }
96
- }
97
- }
File without changes