@swell/cli 2.0.11 → 2.0.12

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.
@@ -1,6 +1,5 @@
1
1
  import { PushAppCommand } from '../../push-app-command.js';
2
2
  export default class AppDev extends PushAppCommand {
3
- static delayOrientation: boolean;
4
3
  static examples: string[];
5
4
  static flags: {
6
5
  'storefront-id': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
@@ -8,6 +7,7 @@ export default class AppDev extends PushAppCommand {
8
7
  'no-push': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
9
8
  port: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
10
9
  };
10
+ static delayOrientation: boolean;
11
11
  static orientation: {
12
12
  env: string;
13
13
  };
@@ -2,7 +2,6 @@ import { Flags } from '@oclif/core';
2
2
  import { PushAppCommand } from '../../push-app-command.js';
3
3
  import AppFrontendDev from './frontend/dev.js';
4
4
  export default class AppDev extends PushAppCommand {
5
- static delayOrientation = true;
6
5
  static examples = [
7
6
  'swell app dev',
8
7
  'swell app dev --storefront-id <id>',
@@ -18,6 +17,7 @@ export default class AppDev extends PushAppCommand {
18
17
  description: 'for storefront apps, prompt to select a storefront to preview',
19
18
  }),
20
19
  };
20
+ static delayOrientation = true;
21
21
  static orientation = {
22
22
  env: 'test',
23
23
  };
@@ -76,7 +76,7 @@ Without a store specified, install the app in the Live environment of the curren
76
76
  this.error(`You cannot install an app in the test environment of the same store.`);
77
77
  }
78
78
  config.ensureLoggedIn(storeToInstall);
79
- this.api.setStoreEnv(storeToInstall, envToInstall);
79
+ await this.api.setStoreEnv(storeToInstall, envToInstall);
80
80
  // check if app is already installed on store
81
81
  const existingInstalledApp = await this.getInstalledApp();
82
82
  const existingVersion = existingInstalledApp?.id
@@ -9,7 +9,10 @@ export default class AppPull extends PushAppCommand {
9
9
  static flags: {
10
10
  force: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
11
11
  };
12
+ static orientation: {
13
+ env: string;
14
+ };
12
15
  static summary: string;
13
- logPulledChanges(pulled: string[], removed: string[]): void;
14
16
  run(): Promise<void>;
17
+ logPulledChanges(pulled: string[], removed: string[]): void;
15
18
  }
@@ -32,13 +32,10 @@ ${Object.values(ConfigPaths)
32
32
  description: 'force pull all files',
33
33
  }),
34
34
  };
35
+ static orientation = {
36
+ env: 'test',
37
+ };
35
38
  static summary = 'Pull app files from Swell to your local machine.';
36
- logPulledChanges(pulled, removed) {
37
- const typeLabel = this.appType === 'theme' ? 'theme' : 'app';
38
- const changeCount = pulled.length + removed.length;
39
- const pluralFiles = changeCount === 1 ? 'file' : 'files';
40
- this.log(`Pulled ${changeCount} ${pluralFiles} from ${style.appConfigValue(this.app.name)} ${typeLabel} in ${style.path(path.resolve(this.appPath))}.`);
41
- }
42
39
  async run() {
43
40
  const { args, flags } = await this.parse(AppPull);
44
41
  const { force } = flags;
@@ -47,4 +44,10 @@ ${Object.values(ConfigPaths)
47
44
  const { pulled, removed } = await this.pullAppConfigs(force);
48
45
  this.logPulledChanges(pulled, removed);
49
46
  }
47
+ logPulledChanges(pulled, removed) {
48
+ const typeLabel = this.appType === 'theme' ? 'theme' : 'app';
49
+ const changeCount = pulled.length + removed.length;
50
+ const pluralFiles = changeCount === 1 ? 'file' : 'files';
51
+ this.log(`Pulled ${changeCount} ${pluralFiles} from ${style.appConfigValue(this.app.name)} ${typeLabel} in ${style.path(path.resolve(this.appPath))}.`);
52
+ }
50
53
  }
@@ -3,11 +3,13 @@ export default class AppPush extends PushAppCommand {
3
3
  static args: {
4
4
  file: import("@oclif/core/lib/interfaces/parser.js").Arg<string | undefined, Record<string, unknown>>;
5
5
  };
6
- static delayOrientation: boolean;
7
6
  static description: string;
8
7
  static examples: string[];
9
8
  static flags: any;
10
- static orientation: any;
9
+ static delayOrientation: boolean;
10
+ static orientation: {
11
+ env: string;
12
+ };
11
13
  static summary: string;
12
14
  resolvePushPaths(file: string): {
13
15
  filePath: string;
@@ -10,7 +10,6 @@ export default class AppPush extends PushAppCommand {
10
10
  description: 'relative path to a configuration file or directory to push',
11
11
  }),
12
12
  };
13
- static delayOrientation = true;
14
13
  static description = `Push all app files, a specific file, or a specific configuration
15
14
  type to an app in your store's test environment.
16
15
 
@@ -39,6 +38,7 @@ ${Object.values(ConfigPaths)
39
38
  description: 'skip deploying app frontend',
40
39
  }),
41
40
  };
41
+ static delayOrientation = true;
42
42
  static orientation = {
43
43
  env: 'test',
44
44
  };
@@ -7,6 +7,9 @@ export default class AppRelease extends PushAppCommand {
7
7
  static examples: string[];
8
8
  static flags: any;
9
9
  static summary: string;
10
+ static orientation: {
11
+ env: string;
12
+ };
10
13
  run(): Promise<void>;
11
14
  validateReleaseDetails(): void;
12
15
  private validateCreateVersion;
@@ -57,6 +57,9 @@ The app must be connected to a partner account with access to publish.`;
57
57
  }),
58
58
  };
59
59
  static summary = 'Release a new version of your an app for publishing to the App Store.';
60
+ static orientation = {
61
+ env: 'test',
62
+ };
60
63
  async run() {
61
64
  const { args, flags } = await this.parse(AppRelease);
62
65
  const { amend, message, 'not-supported': notSupported, 'release-notes': releaseNotesFile, yes, } = flags;
@@ -12,6 +12,9 @@ export default class AppVersion extends PushAppCommand {
12
12
  yes: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
13
13
  };
14
14
  static summary: string;
15
+ static orientation: {
16
+ env: string;
17
+ };
15
18
  run(): Promise<void>;
16
19
  private createRemoteVersion;
17
20
  private gitCommit;
@@ -68,6 +68,9 @@ behavior by using the --no-git-tag option.`;
68
68
  }),
69
69
  };
70
70
  static summary = 'Increment the version of your Swell app.';
71
+ static orientation = {
72
+ env: 'test',
73
+ };
71
74
  async run() {
72
75
  const { args, flags } = await this.parse(AppVersion);
73
76
  const { amend, 'no-git-tag': noGitTag, yes } = flags;
@@ -44,7 +44,7 @@ have available for logging in to.
44
44
  }
45
45
  }
46
46
  const [sessionId, storeId] = await getSessionIdOrLoginInBrowser(store);
47
- this.api.setStoreEnv(storeId);
47
+ await this.api.setStoreEnv(storeId);
48
48
  user = await this.api.get({ adminPath: 'user' }, { sessionId });
49
49
  await this.getAndSetStoreConfig({ sessionId, storeId });
50
50
  await modifyDefaultStore({ currentStoreId, storeId }, force);
@@ -8,9 +8,7 @@ export default class AppThemeDev extends PushAppCommand {
8
8
  'no-push': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
9
9
  'storefront-id': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
10
10
  'storefront-select': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
11
- };
12
- static orientation: {
13
- env: string;
11
+ env: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
14
12
  };
15
13
  static summary: string;
16
14
  appType: string;
@@ -38,9 +38,10 @@ export default class AppThemeDev extends PushAppCommand {
38
38
  default: false,
39
39
  description: 'prompt to select a storefront to preview and push theme files to',
40
40
  }),
41
- };
42
- static orientation = {
43
- env: 'test',
41
+ env: Flags.string({
42
+ char: 'e',
43
+ description: 'target environment to push to, defaults to live',
44
+ }),
44
45
  };
45
46
  static summary = `Run a theme in dev mode from your local machine.`;
46
47
  appType = 'theme';
@@ -51,6 +52,10 @@ export default class AppThemeDev extends PushAppCommand {
51
52
  const { flags } = await this.parse(AppThemeDev);
52
53
  const { force, local } = flags;
53
54
  const noPush = flags['no-push'];
55
+ await this.ensureLoggedIn();
56
+ // Set env from default storefront first
57
+ const defaultStorefront = localConfig.getDefaultStorefront(this.appPath);
58
+ await this.setStorefrontEnv(flags, defaultStorefront);
54
59
  if (!(await this.ensureAppExists(undefined, false))) {
55
60
  return;
56
61
  }
@@ -59,12 +64,13 @@ export default class AppThemeDev extends PushAppCommand {
59
64
  const sessionId = localConfig.getSessionId(currentStore);
60
65
  this.storefrontLocalUrl = this.localFrontendUrl(currentStore, sessionId);
61
66
  }
62
- if (!noPush) {
63
- await this.pushAppConfigs(force);
64
- }
65
67
  await this.getStorefrontToPush(flags);
68
+ await this.logOrientation({ env: this.api.envId || 'live' });
66
69
  this.logStorefrontConnected();
67
70
  this.saveCurrentStorefront();
71
+ if (!noPush) {
72
+ await this.pushAppConfigs(force);
73
+ }
68
74
  await this.startThemeDevServer(local);
69
75
  }
70
76
  async findAndInstallDependencies() {
@@ -4,16 +4,15 @@ export default class AppThemePull extends AppPull {
4
4
  appId: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
5
5
  targetPath: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
6
6
  };
7
- static delayOrientation: boolean;
8
7
  static description: string;
9
8
  static examples: string[];
10
9
  static flags: {
11
10
  force: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
12
11
  'storefront-id': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
13
12
  'storefront-select': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
13
+ env: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
14
14
  'sync-app': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
15
15
  };
16
- static orientation: {};
17
16
  static summary: string;
18
17
  appType: string;
19
18
  run(): Promise<void>;
@@ -13,7 +13,6 @@ export default class AppThemePull extends AppPull {
13
13
  description: 'path to download theme files into',
14
14
  }),
15
15
  };
16
- static delayOrientation = true;
17
16
  static description = `Pull all theme files, a specific file, or a specific configuration
18
17
  type from a theme in your store's test environment to your local machine.
19
18
 
@@ -43,12 +42,15 @@ ${Object.values(ThemeConfigPaths)
43
42
  default: false,
44
43
  description: 'prompt to select a storefront to pull theme files to',
45
44
  }),
45
+ env: Flags.string({
46
+ char: 'e',
47
+ description: 'target environment to pull from, defaults to live',
48
+ }),
46
49
  'sync-app': Flags.boolean({
47
50
  default: false,
48
51
  description: 'pull app files in addition to theme files to',
49
52
  }),
50
53
  };
51
- static orientation = {};
52
54
  static summary = 'Pull theme files from Swell to your local machine.';
53
55
  appType = 'theme';
54
56
  async run() {
@@ -3,16 +3,15 @@ export default class AppThemePush extends AppPush {
3
3
  static args: {
4
4
  file: import("@oclif/core/lib/interfaces/parser.js").Arg<string | undefined, Record<string, unknown>>;
5
5
  };
6
- static delayOrientation: boolean;
7
6
  static description: string;
8
7
  static examples: string[];
9
8
  static flags: {
10
9
  force: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
11
10
  'storefront-id': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
12
11
  'storefront-select': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
12
+ env: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
13
13
  'sync-app': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
14
14
  };
15
- static orientation: {};
16
15
  static summary: string;
17
16
  appType: string;
18
17
  run(): Promise<void>;
@@ -1,5 +1,6 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
2
  import { ThemeConfigPaths, filePathExists, isPathDirectory, } from '../../lib/apps/index.js';
3
+ import { default as localConfig } from '../../lib/config.js';
3
4
  import style from '../../lib/style.js';
4
5
  import AppPush from '../app/push.js';
5
6
  export default class AppThemePush extends AppPush {
@@ -9,7 +10,6 @@ export default class AppThemePush extends AppPush {
9
10
  description: 'relative path to a configuration file or directory to push',
10
11
  }),
11
12
  };
12
- static delayOrientation = true;
13
13
  static description = `Push all theme files, a specific file, or a specific configuration
14
14
  type to an theme in your store's test environment.
15
15
 
@@ -45,12 +45,15 @@ ${Object.values(ThemeConfigPaths)
45
45
  default: false,
46
46
  description: 'prompt to select a storefront to push theme files to',
47
47
  }),
48
+ env: Flags.string({
49
+ char: 'e',
50
+ description: 'target environment to push to, defaults to live',
51
+ }),
48
52
  'sync-app': Flags.boolean({
49
53
  default: false,
50
54
  description: 'push app files in addition to theme files',
51
55
  }),
52
56
  };
53
- static orientation = {};
54
57
  static summary = 'Push local files to your Swell theme.';
55
58
  appType = 'theme';
56
59
  async run() {
@@ -58,6 +61,15 @@ ${Object.values(ThemeConfigPaths)
58
61
  const { file } = args;
59
62
  const { force } = flags;
60
63
  this.themeSyncApp = flags['sync-app'];
64
+ // Set default storefront env only if not syncing app, then it must be test env only
65
+ if (this.themeSyncApp) {
66
+ const currentStore = localConfig.getDefaultStore();
67
+ await this.api.setStoreEnv(currentStore, 'test');
68
+ }
69
+ else {
70
+ const defaultStorefront = localConfig.getDefaultStorefront(this.appPath);
71
+ await this.setStorefrontEnv(flags, defaultStorefront);
72
+ }
61
73
  if (!(await this.ensureAppExists(file, this.themeSyncApp))) {
62
74
  return;
63
75
  }
@@ -74,9 +86,10 @@ ${Object.values(ThemeConfigPaths)
74
86
  this.error(`Path ${style.path(file)} does not exist.`);
75
87
  }
76
88
  // Targeting a directory
77
- await (isPathDirectory(filePath)
89
+ const pushPromise = isPathDirectory(filePath)
78
90
  ? this.pushFilePath(relativePath, force)
79
- : this.pushFile(relativePath));
91
+ : this.pushFile(relativePath);
92
+ await pushPromise;
80
93
  this.log();
81
94
  this.logStorefrontFrontendUrl(this.storefront);
82
95
  return;
package/dist/lib/api.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export default class Api {
2
- private envId;
3
- private secretKey;
4
- private storeId;
2
+ envId: string | undefined;
3
+ secretKey: string | undefined;
4
+ storeId: string | undefined;
5
5
  constructor(storeId?: string, envId?: string, secretKey?: string);
6
6
  api(pathOpts: Api.Paths, options: Api.RequestOptions): Promise<any>;
7
7
  delete(pathOpts: Api.Paths, options?: Api.RequestOptions): Promise<any>;
@@ -9,7 +9,8 @@ export default class Api {
9
9
  isAdmin(): boolean;
10
10
  post(pathOpts: Api.Paths, options?: Api.RequestOptions): Promise<any>;
11
11
  put(pathOpts: Api.Paths, options?: Api.RequestOptions): Promise<any>;
12
- setStoreEnv(storeId: string, envId?: string): void;
12
+ setStoreEnv(storeId: string, envId?: string): Promise<void>;
13
+ isTestEnvEnabled(): Promise<boolean>;
13
14
  truncatePath(path: string | undefined): string | undefined;
14
15
  waitForAsyncResponse(response: any, pathOpts: Api.Paths, options?: Api.RequestOptions): Promise<any>;
15
16
  }
package/dist/lib/api.js CHANGED
@@ -123,10 +123,22 @@ export default class Api {
123
123
  });
124
124
  return this.waitForAsyncResponse(response, pathOpts, options);
125
125
  }
126
- setStoreEnv(storeId, envId) {
126
+ async setStoreEnv(storeId, envId) {
127
+ if (envId) {
128
+ const hasTestEnv = await this.isTestEnvEnabled();
129
+ if (!hasTestEnv) {
130
+ throw new Error('Test environment is not enabled for this store.');
131
+ }
132
+ }
127
133
  this.storeId = storeId;
128
134
  this.envId = envId;
129
135
  }
136
+ async isTestEnvEnabled() {
137
+ const clientRecord = await this.get({
138
+ adminPath: `/client`,
139
+ });
140
+ return clientRecord.test_enabled !== false;
141
+ }
130
142
  truncatePath(path) {
131
143
  return path?.startsWith('/') ? path.slice(1) : path;
132
144
  }
@@ -135,8 +147,9 @@ export default class Api {
135
147
  if (!response?.async_progressing || !onAsyncGetPath) {
136
148
  return response;
137
149
  }
138
- /* eslint-disable-next-line no-promise-executor-return */
139
- await new Promise((resolve) => setTimeout(resolve, 1000));
150
+ await new Promise((resolve) => {
151
+ setTimeout(resolve, 1000);
152
+ });
140
153
  const asyncResponse = await this.api(onAsyncGetPath(response), {
141
154
  method: 'GET',
142
155
  onAsyncGetPath,
@@ -1,13 +1,13 @@
1
1
  /// <reference types="node" />
2
2
  import { ConfigType } from './index.js';
3
- declare class IgnoringFileError extends Error {
3
+ export declare class IgnoringFileError extends Error {
4
4
  constructor(message: string);
5
5
  }
6
- declare class FunctionProcessingError extends Error {
6
+ export declare class FunctionProcessingError extends Error {
7
7
  originalError: Error;
8
8
  constructor(message: string, error: Error);
9
9
  }
10
- type AppConfigFile = {
10
+ interface AppConfigFile {
11
11
  content_type?: string;
12
12
  data?: string;
13
13
  date_uploaded?: string;
@@ -16,12 +16,12 @@ type AppConfigFile = {
16
16
  length?: number;
17
17
  md5?: string;
18
18
  url?: string;
19
- };
19
+ }
20
20
  /**
21
21
  * An app configuration as defined by the Swell API. This implies that the
22
22
  * app & the configuration are saved to the API.
23
23
  */
24
- declare abstract class AppConfig {
24
+ export declare abstract class AppConfig {
25
25
  appConfigId?: string;
26
26
  appPath: string;
27
27
  byteSize?: number;
@@ -53,4 +53,4 @@ declare abstract class AppConfig {
53
53
  protected abstract preparePostData(postData: any): Promise<any>;
54
54
  abstract type: ConfigType;
55
55
  }
56
- export { AppConfig, FunctionProcessingError, IgnoringFileError };
56
+ export {};
@@ -4,14 +4,14 @@ import { detectFilenameMime } from 'mime-detect';
4
4
  import * as fs from 'node:fs';
5
5
  import * as path from 'node:path';
6
6
  import { bundleFunction } from '../bundle.js';
7
- import { ConfigPaths, ConfigType, filePathExists, hashFile } from './index.js';
8
- class IgnoringFileError extends Error {
7
+ import { ConfigPaths, ConfigType, filePathExists, hashFile, } from './index.js';
8
+ export class IgnoringFileError extends Error {
9
9
  constructor(message) {
10
10
  super(message);
11
11
  this.name = 'IgnoringFileError';
12
12
  }
13
13
  }
14
- class FunctionProcessingError extends Error {
14
+ export class FunctionProcessingError extends Error {
15
15
  originalError;
16
16
  constructor(message, error) {
17
17
  super(message);
@@ -23,7 +23,7 @@ class FunctionProcessingError extends Error {
23
23
  * An app configuration as defined by the Swell API. This implies that the
24
24
  * app & the configuration are saved to the API.
25
25
  */
26
- class AppConfig {
26
+ export class AppConfig {
27
27
  // Used when pushing a theme and the app config is considered
28
28
  appConfigId;
29
29
  // Full local path of remote AppConfig
@@ -295,4 +295,3 @@ class AppConfigTheme extends AppConfigDefault {
295
295
  return postData;
296
296
  }
297
297
  }
298
- export { AppConfig, FunctionProcessingError, IgnoringFileError };
@@ -1,11 +1,13 @@
1
1
  /// <reference types="node" />
2
2
  import { AppConfig } from './app-config.js';
3
- declare const PUSH_CONCURRENCY = 3;
3
+ export { AppConfig, FunctionProcessingError, IgnoringFileError, } from './app-config.js';
4
+ export { allBaseFilesInDir, allConfigDirsPaths, allConfigFilesInDir, allConfigFilesPaths, allConfigFilesPathsByType, getAllConfigPaths, globAllFilesByPath, isPathDirectory, } from './paths.js';
5
+ export declare const PUSH_CONCURRENCY = 3;
4
6
  /**
5
7
  * An app as defined by the Swell API. This is different than an app
6
8
  * configuration that developers define.
7
9
  */
8
- type App = {
10
+ export interface App {
9
11
  categories?: Array<string>;
10
12
  client?: any;
11
13
  client_id?: string;
@@ -62,8 +64,8 @@ type App = {
62
64
  type?: string;
63
65
  use_cases?: Array<string>;
64
66
  version?: string;
65
- };
66
- declare enum SwellJsonFields {
67
+ }
68
+ export declare enum SwellJsonFields {
67
69
  DESCRIPTION = "description",
68
70
  EXTENSIONS = "extensions",
69
71
  ID = "id",
@@ -75,7 +77,7 @@ declare enum SwellJsonFields {
75
77
  TYPE = "type",
76
78
  VERSION = "version"
77
79
  }
78
- type AppVersion = {
80
+ export interface AppVersion {
79
81
  date_created: string;
80
82
  description?: string;
81
83
  id: string;
@@ -85,8 +87,8 @@ type AppVersion = {
85
87
  released?: boolean;
86
88
  supported?: boolean;
87
89
  version: string;
88
- };
89
- declare enum ConfigType {
90
+ }
91
+ export declare enum ConfigType {
90
92
  ASSET = "asset",
91
93
  CONTENT = "content",
92
94
  FILE = "file",
@@ -98,22 +100,23 @@ declare enum ConfigType {
98
100
  THEME = "theme",
99
101
  WEBHOOK = "webhook"
100
102
  }
101
- declare const StorefrontConfigTypes: string[];
102
- declare const ThemeConfigTypes: string[];
103
- type ConfigPathsType = {
104
- [key in ConfigType]: string;
103
+ export type ConfigTypeKey = keyof typeof ConfigType;
104
+ export declare const StorefrontConfigTypes: ConfigTypeKey[];
105
+ export declare const ThemeConfigTypes: ConfigTypeKey[];
106
+ export type ConfigPathsType = {
107
+ [key in ConfigTypeKey]: string;
105
108
  };
106
- declare const ConfigPaths: ConfigPathsType;
107
- declare const StorefrontConfigPaths: ConfigPathsType;
108
- declare const ThemeConfigPaths: ConfigPathsType;
109
- declare enum ConfigInputFields {
109
+ export declare const ConfigPaths: ConfigPathsType;
110
+ export declare const StorefrontConfigPaths: ConfigPathsType;
111
+ export declare const ThemeConfigPaths: ConfigPathsType;
112
+ export declare enum ConfigInputFields {
110
113
  FILE = "file",
111
114
  NAME = "name",
112
115
  TYPE = "type",
113
116
  VALUES = "values",
114
117
  VERSION = "version"
115
118
  }
116
- type FrontendProjectType = {
119
+ export interface FrontendProjectType {
117
120
  buildCommand: string;
118
121
  configFileName: string;
119
122
  deployPath: string;
@@ -121,21 +124,22 @@ type FrontendProjectType = {
121
124
  installCommand: string;
122
125
  name: string;
123
126
  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;
128
- declare function getConfigTypeFromPath(path: string): ConfigType | undefined;
129
- declare function getConfigTypeKeyFromValue(value: string): string | undefined;
130
- declare function filePathExists(filePath: string): boolean;
131
- declare function writeFile(file: string, data: string): Promise<void>;
132
- declare function deleteFile(file: string): Promise<void>;
133
- declare function writeJsonFile(file: string, data?: any): Promise<void>;
134
- declare function hashFile(filePath: string, fileContents?: Buffer, relativePath?: string): string;
135
- declare function hashString(...contents: (Buffer | 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;
127
+ }
128
+ export declare const FrontendProjectTypes: FrontendProjectType[];
129
+ export declare function getAppSlugId(app: App): string | undefined;
130
+ export declare function getFrontendProjectType(appPath: string): FrontendProjectType | undefined;
131
+ export declare function getConfigTypeFromPath(path: string): ConfigType | undefined;
132
+ export declare function getConfigTypeKeyFromValue(value: string): string | undefined;
133
+ export declare function filePathExists(filePath: string): boolean;
134
+ export declare function filePathExistsAsync(filePath: string): Promise<boolean>;
135
+ export declare function writeFile(file: string, data: string): Promise<void>;
136
+ export declare function deleteFile(file: string): Promise<void>;
137
+ export declare function writeJsonFile(file: string, data?: any): Promise<void>;
138
+ export declare function hashFile(filePath: string, fileContents?: Buffer, relativePath?: string): string;
139
+ export declare function hashString(...contents: (Buffer | string)[]): string;
140
+ export declare function appAssetImage(appPath: string, fileName: string): string | undefined;
141
+ export declare function appConfigFromFile(filePath: string, configType: ConfigType, appPath: string): AppConfig;
142
+ export declare function findAppConfig(app: App, filePath: string, configType: ConfigType): AppConfig | undefined;
139
143
  interface BatchAppFiles {
140
144
  configs: AppConfig[];
141
145
  type: ConfigType;
@@ -148,7 +152,4 @@ interface BatchAppFiles {
148
152
  * @param {AppConfig[]} configs - List of app configs
149
153
  * @returns {BatchAppFiles[]} Batches of files to push
150
154
  */
151
- declare function batchAppFilesByType(configs: AppConfig[]): BatchAppFiles[];
152
- 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, };
153
- export { AppConfig, FunctionProcessingError, IgnoringFileError, } from './app-config.js';
154
- export { allBaseFilesInDir, allConfigDirsPaths, allConfigFilesInDir, allConfigFilesPaths, allConfigFilesPathsByType, getAllConfigPaths, globAllFilesByPath, isPathDirectory, } from './paths.js';
155
+ export declare function batchAppFilesByType(configs: AppConfig[]): BatchAppFiles[];