@swell/cli 2.0.1-alpha.9 → 2.0.2

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 (102) hide show
  1. package/dist/app-command.d.ts +1 -1
  2. package/dist/app-command.js +9 -9
  3. package/dist/commands/app/dev.d.ts +16 -0
  4. package/dist/commands/app/dev.js +28 -0
  5. package/dist/commands/app/frontend/deploy.d.ts +15 -0
  6. package/dist/commands/app/frontend/deploy.js +41 -0
  7. package/dist/commands/app/frontend/dev.d.ts +19 -0
  8. package/dist/commands/app/frontend/dev.js +108 -0
  9. package/dist/commands/app/info.js +14 -9
  10. package/dist/commands/app/init.d.ts +12 -0
  11. package/dist/commands/app/init.js +34 -0
  12. package/dist/commands/app/install.d.ts +4 -4
  13. package/dist/commands/app/install.js +36 -42
  14. package/dist/commands/app/pull.d.ts +15 -0
  15. package/dist/commands/app/pull.js +50 -0
  16. package/dist/commands/app/push.d.ts +11 -14
  17. package/dist/commands/app/push.js +64 -138
  18. package/dist/commands/app/release.d.ts +13 -0
  19. package/dist/commands/app/release.js +148 -0
  20. package/dist/commands/app/version.d.ts +5 -4
  21. package/dist/commands/app/version.js +63 -42
  22. package/dist/commands/app/watch.d.ts +2 -4
  23. package/dist/commands/app/watch.js +3 -83
  24. package/dist/commands/create/app.d.ts +35 -11
  25. package/dist/commands/create/app.js +143 -137
  26. package/dist/commands/create/content.d.ts +2 -2
  27. package/dist/commands/create/content.js +10 -10
  28. package/dist/commands/create/frontend.d.ts +12 -0
  29. package/dist/commands/create/frontend.js +38 -0
  30. package/dist/commands/create/function.d.ts +3 -3
  31. package/dist/commands/create/function.js +22 -22
  32. package/dist/commands/create/model.d.ts +2 -2
  33. package/dist/commands/create/model.js +11 -11
  34. package/dist/commands/create/notification.d.ts +4 -4
  35. package/dist/commands/create/notification.js +38 -40
  36. package/dist/commands/env.d.ts +12 -0
  37. package/dist/commands/env.js +31 -0
  38. package/dist/commands/login.d.ts +1 -1
  39. package/dist/commands/login.js +18 -24
  40. package/dist/commands/logs.js +0 -1
  41. package/dist/commands/theme/dev.d.ts +21 -0
  42. package/dist/commands/theme/dev.js +164 -0
  43. package/dist/commands/theme/init.d.ts +9 -0
  44. package/dist/commands/theme/init.js +15 -0
  45. package/dist/commands/theme/pull.d.ts +20 -0
  46. package/dist/commands/theme/pull.js +65 -0
  47. package/dist/commands/theme/push.d.ts +19 -0
  48. package/dist/commands/theme/push.js +89 -0
  49. package/dist/create-app-command.d.ts +20 -0
  50. package/dist/create-app-command.js +253 -0
  51. package/dist/create-collection-command.d.ts +9 -9
  52. package/dist/create-collection-command.js +23 -23
  53. package/dist/{create-command.d.ts → create-config-command.d.ts} +1 -1
  54. package/dist/{create-command.js → create-config-command.js} +7 -7
  55. package/dist/env/local.d.ts +8 -0
  56. package/dist/env/local.js +7 -0
  57. package/dist/env/production.d.ts +8 -0
  58. package/dist/env/production.js +7 -0
  59. package/dist/env/review.d.ts +8 -0
  60. package/dist/env/review.js +7 -0
  61. package/dist/env/staging.d.ts +8 -0
  62. package/dist/env/staging.js +7 -0
  63. package/dist/lib/api.d.ts +4 -2
  64. package/dist/lib/api.js +50 -21
  65. package/dist/lib/app-config.d.ts +13 -5
  66. package/dist/lib/app-config.js +62 -24
  67. package/dist/lib/apps/app-config.d.ts +17 -3
  68. package/dist/lib/apps/app-config.js +194 -66
  69. package/dist/lib/apps/index.d.ts +93 -12
  70. package/dist/lib/apps/index.js +155 -50
  71. package/dist/lib/apps/paths.d.ts +14 -7
  72. package/dist/lib/apps/paths.js +73 -28
  73. package/dist/lib/bundle.js +15 -3
  74. package/dist/lib/config.d.ts +9 -2
  75. package/dist/lib/config.js +49 -1
  76. package/dist/lib/constants.d.ts +5 -0
  77. package/dist/lib/constants.js +24 -6
  78. package/dist/lib/create/content.d.ts +2 -2
  79. package/dist/lib/create/content.js +1 -1
  80. package/dist/lib/create/function.d.ts +2 -2
  81. package/dist/lib/create/function.js +2 -2
  82. package/dist/lib/create/index.d.ts +1 -1
  83. package/dist/lib/create/index.js +11 -7
  84. package/dist/lib/create/model.d.ts +2 -2
  85. package/dist/lib/create/notification.d.ts +2 -2
  86. package/dist/lib/info.js +2 -2
  87. package/dist/lib/logs/index.js +1 -1
  88. package/dist/lib/sessions.js +2 -2
  89. package/dist/lib/stores.d.ts +9 -4
  90. package/dist/lib/stores.js +13 -8
  91. package/dist/lib/style.d.ts +2 -0
  92. package/dist/lib/style.js +2 -0
  93. package/dist/lib/swell-function-wrapper.d.ts +40 -1
  94. package/dist/lib/swell-function-wrapper.js +107 -22
  95. package/dist/push-app-command.d.ts +73 -0
  96. package/dist/push-app-command.js +743 -0
  97. package/dist/remote-app-command.d.ts +37 -11
  98. package/dist/remote-app-command.js +432 -169
  99. package/oclif.manifest.json +872 -123
  100. package/package.json +14 -1
  101. package/dist/commands/app/_pull.d.ts +0 -8
  102. package/dist/commands/app/_pull.js +0 -45
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import { ConfigType } from './index.js';
2
3
  declare class IgnoringFileError extends Error {
3
4
  constructor(message: string);
@@ -7,6 +8,7 @@ declare class FunctionProcessingError extends Error {
7
8
  constructor(message: string, error: Error);
8
9
  }
9
10
  type AppConfigFile = {
11
+ content_type?: string;
10
12
  data?: string;
11
13
  date_uploaded?: string;
12
14
  ext?: string;
@@ -20,21 +22,33 @@ type AppConfigFile = {
20
22
  * app & the configuration are saved to the API.
21
23
  */
22
24
  declare abstract class AppConfig {
25
+ appConfigId?: string;
26
+ appPath: string;
27
+ byteSize?: number;
23
28
  date_created?: string;
29
+ date_updated?: string;
24
30
  file?: AppConfigFile;
25
- fileData?: string;
31
+ file_path?: string;
32
+ fileContent?: string;
33
+ fileData?: Buffer;
34
+ fileHash?: string;
35
+ filePath: string;
36
+ hash?: string;
26
37
  id?: string;
27
- /** The local path of a remote AppConfig */
28
- localPath?: string;
38
+ mbSize?: number;
29
39
  name?: string;
30
40
  parent_id?: string;
31
41
  slug?: string;
32
42
  values: {
33
43
  [key: string]: any;
34
44
  };
45
+ version?: string;
35
46
  constructor(attrs?: Partial<AppConfig>);
36
47
  static create(attrs?: Partial<AppConfig>): AppConfig;
48
+ isRootConfig(configDir: string): boolean;
37
49
  postData(): Promise<any>;
50
+ prepareFileData(): any;
51
+ abstract hasValues: boolean;
38
52
  /** build the JSON used when making requests (usually push) to the API */
39
53
  protected abstract preparePostData(postData: any): Promise<any>;
40
54
  abstract type: ConfigType;
@@ -1,9 +1,10 @@
1
- /* eslint-disable camelcase */
1
+ import { getEncoding } from 'istextorbinary';
2
2
  import isEmpty from 'lodash/isEmpty.js';
3
+ import { detectFilenameMime } from 'mime-detect';
3
4
  import * as fs from 'node:fs';
4
5
  import * as path from 'node:path';
5
6
  import { bundleFunction } from '../bundle.js';
6
- import { ConfigType } from './index.js';
7
+ import { ConfigPaths, ConfigType, filePathExists, hashFile } from './index.js';
7
8
  class IgnoringFileError extends Error {
8
9
  constructor(message) {
9
10
  super(message);
@@ -23,21 +24,68 @@ class FunctionProcessingError extends Error {
23
24
  * app & the configuration are saved to the API.
24
25
  */
25
26
  class AppConfig {
27
+ // Used when pushing a theme and the app config is considered
28
+ appConfigId;
29
+ // Full local path of remote AppConfig
30
+ appPath;
31
+ // Size of local file in bytes and mb
32
+ byteSize;
26
33
  date_created;
34
+ date_updated;
27
35
  file;
36
+ file_path;
37
+ // UTF8 content of local file
38
+ fileContent;
39
+ // Buffer of local file data
28
40
  fileData;
41
+ fileHash;
42
+ // Relative path of remote AppConfig, same as file_path if defined
43
+ filePath;
44
+ hash;
45
+ // Server-side props
29
46
  id;
30
- /** The local path of a remote AppConfig */
31
- localPath;
47
+ mbSize;
32
48
  name;
33
49
  parent_id;
34
50
  slug;
35
51
  values = {};
52
+ version;
36
53
  constructor(attrs = {}) {
37
54
  Object.assign(this, attrs);
38
- const { localPath } = attrs;
39
- if (localPath) {
40
- this.fileData = fs.readFileSync(localPath, 'utf8');
55
+ let { appPath, file_path, filePath, name, type } = attrs;
56
+ this.appPath = appPath || '';
57
+ this.filePath = filePath || '';
58
+ if (!type || !name) {
59
+ throw new Error('Missing app config type or name.');
60
+ }
61
+ if (!appPath) {
62
+ throw new Error('Missing app path to initialize config.');
63
+ }
64
+ // Make sure file path is set from server prop or type/name
65
+ if (!filePath) {
66
+ if (file_path) {
67
+ filePath = file_path;
68
+ }
69
+ else {
70
+ // Note this shouldn't be necessary unless the config was created before file_path was added
71
+ const typePath = ConfigPaths[String(type).toUpperCase()];
72
+ filePath = `${typePath}/${name}`;
73
+ if (!typePath) {
74
+ throw new Error(`Missing path for app config type: ${type}`);
75
+ }
76
+ }
77
+ this.filePath = filePath;
78
+ }
79
+ if (!appPath.endsWith(filePath)) {
80
+ this.appPath = path.join(appPath, filePath);
81
+ }
82
+ if (filePathExists(this.appPath)) {
83
+ this.fileHash = hashFile(this.appPath);
84
+ this.hash = this.hash || this.fileHash;
85
+ this.fileData = fs.readFileSync(this.appPath);
86
+ this.fileContent = this.fileData.toString('utf8');
87
+ this.byteSize = Buffer.byteLength(this.fileContent);
88
+ this.mbSize = this.byteSize / 1024 / 1024;
41
89
  }
42
90
  }
43
91
  static create(attrs = {}) {
@@ -51,120 +99,200 @@ class AppConfig {
51
99
  case ConfigType.MODEL: {
52
100
  return new AppConfigModel(attrs);
53
101
  }
102
+ case ConfigType.CONTENT: {
103
+ return new AppConfigContent(attrs);
104
+ }
54
105
  case ConfigType.NOTIFICATION: {
55
- // the path can be a tpl file or a json file as we can use the `create`
56
- // function when watching for changes. We need to make sure that we
57
- // always use the json file for AppConfig.
58
- attrs.localPath = AppConfigNotification.actualConfigPath(attrs.localPath);
59
106
  return new AppConfigNotification(attrs);
60
107
  }
108
+ case ConfigType.SETTING: {
109
+ return new AppConfigSetting(attrs);
110
+ }
111
+ case ConfigType.WEBHOOK: {
112
+ return new AppConfigWebhook(attrs);
113
+ }
114
+ case ConfigType.FRONTEND: {
115
+ return new AppConfigFrontend(attrs);
116
+ }
117
+ case ConfigType.THEME: {
118
+ return new AppConfigTheme(attrs);
119
+ }
61
120
  default: {
62
- // the default type is content so we want to make sure
63
- // that we set the expected type
121
+ // the default type is file
64
122
  const defaultConfig = new AppConfigDefault(attrs);
65
123
  defaultConfig.type = attrs.type;
66
124
  return defaultConfig;
67
125
  }
68
126
  }
69
127
  }
128
+ isRootConfig(configDir) {
129
+ return !this.filePath
130
+ ?.replace(new RegExp(`^${configDir}/`), '')
131
+ .includes('/');
132
+ }
70
133
  async postData() {
71
- if (!this.localPath) {
72
- throw new Error('Missing local config path');
73
- }
74
- if (!this.fileData) {
134
+ if (this.fileContent === undefined) {
75
135
  return;
76
136
  }
77
- if (this.localPath.endsWith('.json')) {
137
+ if (this.hasValues && this.filePath.endsWith('.json')) {
78
138
  try {
79
- this.values = JSON.parse(this.fileData);
139
+ this.values = JSON.parse(this.fileContent);
80
140
  }
81
141
  catch {
82
- throw new IgnoringFileError('invalid JSON');
142
+ throw new IgnoringFileError('Invalid JSON');
83
143
  }
84
144
  if (isEmpty(this.values)) {
85
- throw new IgnoringFileError('empty JSON');
145
+ throw new IgnoringFileError('Empty JSON');
86
146
  }
87
147
  }
148
+ // Detect file content type
149
+ const contentType = this.filePath.endsWith('.liquid') || this.filePath.endsWith('.liquidx')
150
+ ? 'application/liquid'
151
+ : detectFilenameMime(this.filePath);
88
152
  const postData = {
153
+ file: {
154
+ content_type: contentType,
155
+ data: this.prepareFileData(),
156
+ },
157
+ file_path: this.filePath,
158
+ hash: this.hash,
159
+ // Name is either configured or the last part of the path without extension
89
160
  name: this.values?.name || this.name,
90
161
  type: this.type,
91
- values: this.values,
92
162
  };
163
+ if (this.hasValues) {
164
+ postData.values = this.values || {};
165
+ }
93
166
  return this.preparePostData(postData);
94
167
  }
168
+ prepareFileData() {
169
+ if (!this.fileData) {
170
+ return null;
171
+ }
172
+ return getEncoding(this.fileData) === 'binary'
173
+ ? { $base64: this.fileData.toString('base64') }
174
+ : this.fileData?.toString('utf8');
175
+ }
95
176
  }
96
177
  class AppConfigDefault extends AppConfig {
97
- type = ConfigType.CONTENT;
178
+ hasValues = false;
179
+ type = ConfigType.FILE;
98
180
  preparePostData(postData) {
99
181
  return postData;
100
182
  }
101
183
  }
102
184
  class AppConfigModel extends AppConfig {
185
+ hasValues = true;
103
186
  type = ConfigType.MODEL;
104
187
  preparePostData(postData) {
105
- postData.values.collection = this.name;
188
+ postData.values.collection =
189
+ postData.values.collection || postData.values.model || this.name;
190
+ return postData;
191
+ }
192
+ }
193
+ class AppConfigContent extends AppConfig {
194
+ hasValues = true;
195
+ type = ConfigType.CONTENT;
196
+ preparePostData(postData) {
197
+ postData.values.collection = postData.values.collection || this.name;
106
198
  return postData;
107
199
  }
108
200
  }
109
201
  class AppConfigNotification extends AppConfig {
202
+ hasValues = true;
110
203
  type = ConfigType.NOTIFICATION;
111
- /**
112
- * The actual config path is the path to the JSON file that is used to
113
- * configure the notification. This function ensures that the path is
114
- * correct.
115
- *
116
- * @param localPath - json or tpl file path
117
- * @returns - json file path
118
- */
119
- static actualConfigPath(localPath) {
120
- return localPath?.replace('.tpl', '.json');
121
- }
122
204
  preparePostData(postData) {
123
- if (!this.localPath) {
124
- throw new Error('Missing local config path');
125
- }
126
- const templateFile = this.localPath.replace('.json', '.tpl');
127
- this.fileData = fs.readFileSync(templateFile, 'utf8');
128
- if (this.fileData) {
129
- postData.values.content = {
130
- html: {
131
- data: this.fileData.replaceAll('\r\n', '\n'),
132
- },
205
+ const isTemplate = this.isRootConfig('notifications') &&
206
+ (this.filePath.endsWith('.tpl') || this.filePath.endsWith('.liquid'));
207
+ if (isTemplate) {
208
+ // Get json config to match collection/model name
209
+ let jsonData;
210
+ try {
211
+ const jsonPath = this.filePath
212
+ .replace('.tpl', '.json')
213
+ .replace('.liquid', '.json');
214
+ jsonData = JSON.parse(fs.readFileSync(jsonPath, 'utf8'));
215
+ postData.values.collection = jsonData?.collection || jsonData?.model;
216
+ }
217
+ catch {
218
+ // noop
219
+ }
220
+ postData.file = {
221
+ content_type: 'text/plain',
222
+ data: this.fileContent?.replaceAll('\r\n', '\n'),
133
223
  };
134
224
  }
135
225
  return postData;
136
226
  }
137
227
  }
228
+ class AppConfigSetting extends AppConfig {
229
+ hasValues = true;
230
+ type = ConfigType.SETTING;
231
+ preparePostData(postData) {
232
+ return postData;
233
+ }
234
+ }
235
+ class AppConfigWebhook extends AppConfig {
236
+ hasValues = true;
237
+ type = ConfigType.WEBHOOK;
238
+ preparePostData(postData) {
239
+ return postData;
240
+ }
241
+ }
138
242
  class AppConfigFunction extends AppConfig {
243
+ hasValues = true;
139
244
  type = ConfigType.FUNCTION;
140
245
  async preparePostData(postData) {
141
- if (!this.localPath) {
142
- throw new Error('Missing local config path');
143
- }
144
- try {
145
- const { code, config } = await bundleFunction(this.localPath);
146
- if (!config) {
147
- throw new IgnoringFileError('Function must export a `config` object.');
246
+ const isFunction = this.isRootConfig('functions') &&
247
+ (this.filePath.endsWith('.js') || this.filePath.endsWith('.ts'));
248
+ if (isFunction) {
249
+ try {
250
+ const { code, config } = await bundleFunction(this.filePath);
251
+ if (!config) {
252
+ throw new IgnoringFileError('Function must export a `config` object.');
253
+ }
254
+ // Save the original file and the bundled version
255
+ postData.file = {
256
+ data: this.prepareFileData(),
257
+ };
258
+ postData.build_file = {
259
+ content_type: 'text/javascript',
260
+ data: code,
261
+ };
262
+ postData.values = config;
263
+ }
264
+ catch (error) {
265
+ throw new FunctionProcessingError(`Unable to compile function ${this.name}`, error);
148
266
  }
149
- const fileName = path.basename(this.localPath);
150
- postData.file = {
151
- data: code,
152
- // we keep the file extension so we can easily identify the file path
153
- // when we need to delete the function
154
- ext: fileName.replace(this.name, ''),
155
- };
156
- postData.values = config;
157
- }
158
- catch (error) {
159
- throw new FunctionProcessingError(`Unable to compile function ${this.name}`, error);
160
267
  }
161
268
  return postData;
162
269
  }
163
270
  }
164
- class AppConfigAsset extends AppConfig {
271
+ // Assets do not get installed but saved as plain files
272
+ class AppConfigAsset extends AppConfigDefault {
273
+ hasValues = false;
165
274
  type = ConfigType.ASSET;
166
- preparePostData(_postData) {
167
- throw new Error('Assets not yet supported');
275
+ }
276
+ class AppConfigFrontend extends AppConfigDefault {
277
+ hasValues = false;
278
+ type = ConfigType.FRONTEND;
279
+ }
280
+ class AppConfigTheme extends AppConfigDefault {
281
+ hasValues = false;
282
+ type = ConfigType.THEME;
283
+ preparePostData(postData) {
284
+ const isConfigJson = this.filePath?.match(/^theme\/config\/[^./]+\.json$/);
285
+ // Files in theme/config/*.json are treated as settings with values
286
+ if (isConfigJson) {
287
+ try {
288
+ const jsonData = JSON.parse(fs.readFileSync(this.filePath, 'utf8'));
289
+ postData.values = jsonData;
290
+ }
291
+ catch {
292
+ // noop
293
+ }
294
+ }
295
+ return postData;
168
296
  }
169
297
  }
170
298
  export { AppConfig, FunctionProcessingError, IgnoringFileError };
@@ -1,43 +1,111 @@
1
+ /// <reference types="node" />
1
2
  import { AppConfig } from './app-config.js';
3
+ declare const PUSH_CONCURRENCY = 3;
2
4
  /**
3
5
  * An app as defined by the Swell API. This is different than an app
4
6
  * configuration that developers define.
5
7
  */
6
8
  type App = {
9
+ categories?: Array<string>;
7
10
  client?: any;
8
11
  client_id?: string;
12
+ compatibilities?: {
13
+ [key: string]: string;
14
+ };
9
15
  configs?: AppConfig[];
10
16
  date_created?: string;
11
17
  date_updated?: string;
12
18
  description?: string;
19
+ extensions?: Array<any>;
20
+ features?: Array<string>;
21
+ frontend?: {
22
+ deployment?: null | object;
23
+ deployment_hash?: string;
24
+ deployment_id?: string;
25
+ framework?: string;
26
+ service?: string;
27
+ url?: string;
28
+ };
29
+ highlights?: Array<{
30
+ id: string;
31
+ image_src?: unknown;
32
+ title: string;
33
+ }>;
13
34
  id?: string;
14
- installed?: boolean;
35
+ installed?: {
36
+ date_created: string;
37
+ id: string;
38
+ };
39
+ kind?: string;
40
+ logo_icon?: unknown;
15
41
  name?: string;
42
+ preview_image?: unknown;
43
+ preview_mobile_image?: unknown;
16
44
  private_id?: string;
17
45
  public_id?: string;
18
46
  published?: boolean;
47
+ purchase_options?: Array<string>;
48
+ storefront?: {
49
+ [key: string]: any;
50
+ };
51
+ styles?: Array<{
52
+ color: string;
53
+ color_alt?: string;
54
+ id: string;
55
+ label: string;
56
+ preview_image?: unknown;
57
+ preview_mobile_image?: unknown;
58
+ }>;
59
+ theme?: {
60
+ [key: string]: any;
61
+ };
62
+ type?: string;
63
+ use_cases?: Array<string>;
19
64
  version?: string;
20
65
  };
66
+ declare enum SwellJsonFields {
67
+ DESCRIPTION = "description",
68
+ EXTENSIONS = "extensions",
69
+ ID = "id",
70
+ KIND = "kind",
71
+ NAME = "name",
72
+ PERMISSIONS = "permissions",
73
+ STOREFRONT = "storefront",
74
+ THEME = "theme",
75
+ TYPE = "type",
76
+ VERSION = "version"
77
+ }
21
78
  type AppVersion = {
22
79
  date_created: string;
80
+ description?: string;
23
81
  id: string;
24
82
  name: string;
25
- notes: string;
83
+ published?: boolean;
84
+ release_notes?: string;
85
+ released?: boolean;
86
+ supported?: boolean;
26
87
  version: string;
27
88
  };
28
89
  declare enum ConfigType {
29
90
  ASSET = "asset",
30
91
  CONTENT = "content",
92
+ FILE = "file",
93
+ FRONTEND = "frontend",
31
94
  FUNCTION = "function",
32
95
  MODEL = "model",
33
96
  NOTIFICATION = "notification",
34
97
  SETTING = "setting",
98
+ THEME = "theme",
35
99
  WEBHOOK = "webhook"
36
100
  }
101
+ declare const StorefrontConfigTypes: string[];
102
+ declare const ThemeConfigTypes: string[];
37
103
  type ConfigPathsType = {
38
104
  [key in ConfigType]: string;
39
105
  };
40
106
  declare const ConfigPaths: ConfigPathsType;
107
+ declare const StorefrontConfigPaths: ConfigPathsType;
108
+ declare const ThemeConfigPaths: ConfigPathsType;
41
109
  declare enum ConfigInputFields {
42
110
  FILE = "file",
43
111
  NAME = "name",
@@ -45,23 +113,36 @@ declare enum ConfigInputFields {
45
113
  VALUES = "values",
46
114
  VERSION = "version"
47
115
  }
48
- declare function hasAllowedFileExtension(file: string, configType?: ConfigType): boolean;
116
+ type FrontendProjectType = {
117
+ buildCommand: string;
118
+ configFileName: string;
119
+ deployPath: string;
120
+ devCommand: string;
121
+ installCommand: string;
122
+ name: string;
123
+ slug: string;
124
+ };
125
+ declare const FrontendProjectTypes: Array<FrontendProjectType>;
126
+ declare function getAppSlugId(app: App): string | undefined;
127
+ declare function getFrontendProjectType(appPath: string): FrontendProjectType | undefined;
49
128
  declare function getConfigTypeFromPath(path: string): ConfigType | undefined;
50
129
  declare function getConfigTypeKeyFromValue(value: string): string | undefined;
51
- declare function fileExists(filePath: string): boolean;
130
+ declare function filePathExists(filePath: string): boolean;
52
131
  declare function writeFile(file: string, data: string): Promise<void>;
132
+ declare function deleteFile(file: string): Promise<void>;
53
133
  declare function writeJsonFile(file: string, data?: any): Promise<void>;
54
- declare function appLogoIcon(appPath: string): string | undefined;
55
- declare function isAppLogoIcon(file: string): boolean;
56
- declare function appConfigFromFile(configFile: string, configType: ConfigType): AppConfig;
57
- declare function findAppConfig(app: App, file: string, configType: ConfigType): AppConfig | undefined;
134
+ declare function hashFile(filePath: string, fileContents?: Buffer): string;
135
+ declare function hashString(contents: string): string;
136
+ declare function appAssetImage(appPath: string, fileName: string): string | undefined;
137
+ declare function appConfigFromFile(filePath: string, configType: ConfigType, appPath: string): AppConfig;
138
+ declare function findAppConfig(app: App, filePath: string, configType: ConfigType): AppConfig | undefined;
58
139
  /**
59
140
  * Get files to push in batches prioritized by dependencies
60
141
  *
61
- * @param appConfigs - List of app configs
142
+ * @param configs - List of app configs
62
143
  * @returns {Array} Batches of files to push
63
144
  */
64
- declare function batchAppConfigsByType(appConfigs: AppConfig[]): Array<any>;
65
- export { App, AppVersion, ConfigInputFields, ConfigPaths, ConfigPathsType, ConfigType, appConfigFromFile, appLogoIcon, batchAppConfigsByType, fileExists, findAppConfig, getConfigTypeFromPath, getConfigTypeKeyFromValue, hasAllowedFileExtension, isAppLogoIcon, writeFile, writeJsonFile, };
145
+ declare function batchAppFilesByType(configs: AppConfig[]): Array<any>;
146
+ export { PUSH_CONCURRENCY, App, AppVersion, ConfigInputFields, ConfigPaths, ConfigPathsType, ConfigType, FrontendProjectType, FrontendProjectTypes, StorefrontConfigPaths, StorefrontConfigTypes, SwellJsonFields, ThemeConfigPaths, ThemeConfigTypes, appAssetImage, appConfigFromFile, batchAppFilesByType, deleteFile, filePathExists, findAppConfig, getAppSlugId, getConfigTypeFromPath, getConfigTypeKeyFromValue, getFrontendProjectType, hashFile, hashString, writeFile, writeJsonFile, };
66
147
  export { AppConfig, FunctionProcessingError, IgnoringFileError, } from './app-config.js';
67
- export { allConfigDirsPaths, allConfigFilesPaths, allConfigFilesPathsByType, getAllConfigPaths, configFilePath, } from './paths.js';
148
+ export { allBaseFilesInDir, allConfigDirsPaths, allConfigFilesInDir, allConfigFilesPaths, allConfigFilesPathsByType, getAllConfigPaths, globAllFilesByPath, isPathDirectory, } from './paths.js';