@swell/cli 2.0.12 → 2.0.14

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.
@@ -7,10 +7,10 @@ export default class AppDev extends PushAppCommand {
7
7
  'no-push': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
8
8
  port: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
9
9
  };
10
+ static summary: string;
10
11
  static delayOrientation: boolean;
11
12
  static orientation: {
12
13
  env: string;
13
14
  };
14
- static summary: string;
15
15
  run(): Promise<void>;
16
16
  }
@@ -17,11 +17,11 @@ export default class AppDev extends PushAppCommand {
17
17
  description: 'for storefront apps, prompt to select a storefront to preview',
18
18
  }),
19
19
  };
20
+ static summary = `Run an app in dev mode from your local machine.`;
20
21
  static delayOrientation = true;
21
22
  static orientation = {
22
23
  env: 'test',
23
24
  };
24
- static summary = `Run an app in dev mode from your local machine.`;
25
25
  async run() {
26
26
  await this.config.runCommand('app:frontend:dev', this.argv);
27
27
  }
@@ -6,11 +6,11 @@ export default class AppPush extends PushAppCommand {
6
6
  static description: string;
7
7
  static examples: string[];
8
8
  static flags: any;
9
+ static summary: string;
9
10
  static delayOrientation: boolean;
10
11
  static orientation: {
11
12
  env: string;
12
13
  };
13
- static summary: string;
14
14
  resolvePushPaths(file: string): {
15
15
  filePath: string;
16
16
  relativePath: string;
@@ -38,11 +38,11 @@ ${Object.values(ConfigPaths)
38
38
  description: 'skip deploying app frontend',
39
39
  }),
40
40
  };
41
+ static summary = 'Push local files to your Swell app.';
41
42
  static delayOrientation = true;
42
43
  static orientation = {
43
44
  env: 'test',
44
45
  };
45
- static summary = 'Push local files to your Swell app.';
46
46
  resolvePushPaths(file) {
47
47
  // Join the appPath and file to get the absolute filePath
48
48
  const filePath = path.resolve(process.cwd(), file);
@@ -1,5 +1,6 @@
1
1
  import { CreateAppCommand } from '../../create-app-command.js';
2
2
  export default class CreateApp extends CreateAppCommand {
3
+ appType: string;
3
4
  static args: {
4
5
  id: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
5
6
  };
@@ -9,7 +10,6 @@ export default class CreateApp extends CreateAppCommand {
9
10
  description: string;
10
11
  }[];
11
12
  static flags: any;
12
- appType: string;
13
13
  createSwellConfig({ allowOverwrite, inputId, inputStorefrontApp, inputType, inputYes, nestedPath, }: {
14
14
  allowOverwrite?: boolean;
15
15
  inputId: string;
@@ -7,6 +7,7 @@ import { newConfig, swellConfigFileExists } from '../../lib/app-config.js';
7
7
  import { toAppId, toAppName } from '../../lib/create/index.js';
8
8
  import style from '../../lib/style.js';
9
9
  export default class CreateApp extends CreateAppCommand {
10
+ appType = '';
10
11
  static args = {
11
12
  id: Args.string({
12
13
  default: '',
@@ -45,7 +46,6 @@ export default class CreateApp extends CreateAppCommand {
45
46
  options: ['admin', 'integration', 'storefront', 'theme'],
46
47
  }),
47
48
  };
48
- appType = '';
49
49
  async createSwellConfig({ allowOverwrite = true, inputId, inputStorefrontApp, inputType, inputYes, nestedPath = true, }) {
50
50
  let confirmYes = inputYes;
51
51
  const type = inputType ||
@@ -1,5 +1,6 @@
1
1
  import { PushAppCommand } from '../../push-app-command.js';
2
2
  export default class AppThemeDev extends PushAppCommand {
3
+ appType: string;
3
4
  static examples: string[];
4
5
  static flags: {
5
6
  bundle: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
@@ -11,7 +12,6 @@ export default class AppThemeDev extends PushAppCommand {
11
12
  env: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
12
13
  };
13
14
  static summary: string;
14
- appType: string;
15
15
  logAppLocalUrl(storeId: string, sessionId: string): void;
16
16
  run(): Promise<void>;
17
17
  private findAndInstallDependencies;
@@ -10,6 +10,7 @@ import style from '../../lib/style.js';
10
10
  import { PushAppCommand } from '../../push-app-command.js';
11
11
  const FALLBACK_PORT = 3000;
12
12
  export default class AppThemeDev extends PushAppCommand {
13
+ appType = 'theme';
13
14
  static examples = [
14
15
  'swell theme dev',
15
16
  'swell theme dev --local',
@@ -44,7 +45,6 @@ export default class AppThemeDev extends PushAppCommand {
44
45
  }),
45
46
  };
46
47
  static summary = `Run a theme in dev mode from your local machine.`;
47
- appType = 'theme';
48
48
  logAppLocalUrl(storeId, sessionId) {
49
49
  this.log(`View it at ${style.link(this.localFrontendUrl(storeId, sessionId))}\n`);
50
50
  }
@@ -1,9 +1,9 @@
1
1
  import InitApp from '../app/init.js';
2
2
  export default class InitTheme extends InitApp {
3
+ appType: string;
3
4
  static description: string;
4
5
  static examples: {
5
6
  command: string;
6
7
  description: string;
7
8
  }[];
8
- appType: string;
9
9
  }
@@ -1,5 +1,6 @@
1
1
  import InitApp from '../app/init.js';
2
2
  export default class InitTheme extends InitApp {
3
+ appType = 'theme';
3
4
  static description = 'Initialize theme swell.json in the current directory.';
4
5
  static examples = [
5
6
  {
@@ -11,5 +12,4 @@ export default class InitTheme extends InitApp {
11
12
  description: 'Initialize theme and accept all default values.',
12
13
  },
13
14
  ];
14
- appType = 'theme';
15
15
  }
@@ -1,5 +1,6 @@
1
1
  import AppPull from '../app/pull.js';
2
2
  export default class AppThemePull extends AppPull {
3
+ appType: string;
3
4
  static args: {
4
5
  appId: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
5
6
  targetPath: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
@@ -14,6 +15,6 @@ export default class AppThemePull extends AppPull {
14
15
  'sync-app': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
15
16
  };
16
17
  static summary: string;
17
- appType: string;
18
+ static delayOrientation: boolean;
18
19
  run(): Promise<void>;
19
20
  }
@@ -3,6 +3,7 @@ import { ThemeConfigPaths } from '../../lib/apps/index.js';
3
3
  import style from '../../lib/style.js';
4
4
  import AppPull from '../app/pull.js';
5
5
  export default class AppThemePull extends AppPull {
6
+ appType = 'theme';
6
7
  static args = {
7
8
  appId: Args.string({
8
9
  default: '',
@@ -52,7 +53,7 @@ ${Object.values(ThemeConfigPaths)
52
53
  }),
53
54
  };
54
55
  static summary = 'Pull theme files from Swell to your local machine.';
55
- appType = 'theme';
56
+ static delayOrientation = true;
56
57
  async run() {
57
58
  const { args, flags } = await this.parse(AppThemePull);
58
59
  const { force } = flags;
@@ -1,5 +1,6 @@
1
1
  import AppPush from '../app/push.js';
2
2
  export default class AppThemePush extends AppPush {
3
+ appType: string;
3
4
  static args: {
4
5
  file: import("@oclif/core/lib/interfaces/parser.js").Arg<string | undefined, Record<string, unknown>>;
5
6
  };
@@ -13,6 +14,5 @@ export default class AppThemePush extends AppPush {
13
14
  'sync-app': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
14
15
  };
15
16
  static summary: string;
16
- appType: string;
17
17
  run(): Promise<void>;
18
18
  }
@@ -4,6 +4,7 @@ import { default as localConfig } from '../../lib/config.js';
4
4
  import style from '../../lib/style.js';
5
5
  import AppPush from '../app/push.js';
6
6
  export default class AppThemePush extends AppPush {
7
+ appType = 'theme';
7
8
  static args = {
8
9
  file: Args.string({
9
10
  char: 'f',
@@ -55,7 +56,6 @@ ${Object.values(ThemeConfigPaths)
55
56
  }),
56
57
  };
57
58
  static summary = 'Push local files to your Swell theme.';
58
- appType = 'theme';
59
59
  async run() {
60
60
  const { args, flags } = await this.parse(AppThemePush);
61
61
  const { file } = args;
@@ -171,7 +171,8 @@ export class PushAppCommand extends RemoteAppCommand {
171
171
  this.error('App type not supported for storefront creation');
172
172
  }
173
173
  let name;
174
- if (hasOtherStorefronts) {
174
+ // Leave name blank when syncing theme app to avoid blocking push
175
+ if (hasOtherStorefronts && !this.themeSyncApp) {
175
176
  name = await input({
176
177
  default: this.app.name,
177
178
  message: 'Name your storefront',
@@ -475,7 +476,9 @@ export class PushAppCommand extends RemoteAppCommand {
475
476
  const storefronts = await this.getAllAppStorefronts({
476
477
  type: this.appType,
477
478
  });
478
- if (storefronts.count > 0) {
479
+ // Choose storefront if multiple storefronts exist
480
+ // Except if we are syncing a theme app, then force create new storefront if not found
481
+ if (storefronts.count > 0 && !this.themeSyncApp) {
479
482
  storefrontId = await select({
480
483
  choices: [
481
484
  ...storefronts.results.map((storefront) => ({
@@ -653,8 +656,8 @@ export class PushAppCommand extends RemoteAppCommand {
653
656
  isPathDirectory(path.resolve(process.cwd(), resolvedAppId))) {
654
657
  resolvedPath = resolvedAppId;
655
658
  }
656
- // Reset app config and path if appId is provided
657
- if (resolvedPath && this.appPath === '.') {
659
+ // Reset app path if appId is provided
660
+ if (resolvedPath && this.appPath === process.cwd()) {
658
661
  this.appPath = path.resolve(process.cwd(), resolvedPath);
659
662
  }
660
663
  return this.appPath;
@@ -5,11 +5,11 @@ import { App, AppConfig, AppVersion } from './lib/apps/index.js';
5
5
  * configurations.
6
6
  */
7
7
  export declare abstract class RemoteAppCommand extends AppCommand {
8
+ appType: string;
8
9
  static delayOrientation: boolean;
9
10
  static orientation: AppCommandOrientation;
10
11
  app: App;
11
12
  appCreated: boolean;
12
- appType: string;
13
13
  storefront?: any;
14
14
  storefrontLocalUrl?: string;
15
15
  themeSyncApp?: boolean;
@@ -15,6 +15,7 @@ import style from './lib/style.js';
15
15
  * configurations.
16
16
  */
17
17
  export class RemoteAppCommand extends AppCommand {
18
+ appType = 'any';
18
19
  // allows child commands to set orientation
19
20
  static delayOrientation = false;
20
21
  // most of the times this will be the target environment
@@ -23,7 +24,6 @@ export class RemoteAppCommand extends AppCommand {
23
24
  app = {};
24
25
  // Indicates the app was created during the command execution
25
26
  appCreated = false;
26
- appType = 'any';
27
27
  // API instance of the target storefront, if applicable
28
28
  storefront = null;
29
29
  // Indicates we are syncing with a local app frontend via proxy
@@ -631,7 +631,13 @@ export class RemoteAppCommand extends AppCommand {
631
631
  const orientationOutput = [];
632
632
  const currentStore = localConfig.getDefaultStore();
633
633
  const { env, store } = flags;
634
- orientationOutput.push(`[${this.app.type === 'theme' ? 'theme' : 'app'}] ${style.appName(this.app.name)}${this.app.version ? ` v${this.app.version}` : ''}`);
634
+ if (this.app.name) {
635
+ // Show theme version if not syncing app
636
+ const version = !this.themeSyncApp && this.app.type === 'theme' && this.storefront?.theme_version
637
+ ? this.storefront?.theme_version
638
+ : this.app.version;
639
+ orientationOutput.push(`[${this.app.type === 'theme' ? 'theme' : 'app'}] ${style.appName(this.app.name)}${version ? ` v${version}` : ''}`);
640
+ }
635
641
  if (store) {
636
642
  orientationOutput.push(`[store] ${style.storeId(store)}`);
637
643
  }
@@ -1691,7 +1691,8 @@
1691
1691
  "commands",
1692
1692
  "theme",
1693
1693
  "pull.js"
1694
- ]
1694
+ ],
1695
+ "delayOrientation": true
1695
1696
  },
1696
1697
  "theme:push": {
1697
1698
  "aliases": [],
@@ -1890,5 +1891,5 @@
1890
1891
  ]
1891
1892
  }
1892
1893
  },
1893
- "version": "2.0.12"
1894
+ "version": "2.0.14"
1894
1895
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swell/cli",
3
- "version": "2.0.12",
3
+ "version": "2.0.14",
4
4
  "type": "module",
5
5
  "description": "Swell's command line interface/utility",
6
6
  "keywords": [