@swell/cli 2.9.12 → 2.9.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.
@@ -17,8 +17,8 @@ type to an app in your store's test environment.
17
17
  If the app does not exist, it will be created and its global ID saved to a .swellrc file.
18
18
 
19
19
  - If no file is specified, all configuration files will be pushed to the store.
20
- This includes the app icon (assets/icon.png), cover image (assets/image.png),
21
- and swell.json.
20
+ This includes the app icon (assets/icon.png), screenshots (assets/screenshots/),
21
+ README.md, and swell.json.
22
22
  - If a file is specified, only that file will be pushed to the store.
23
23
  - If a directory is specified, only files in that directory will be pushed.
24
24
 
@@ -140,15 +140,26 @@ behavior by using the --no-git-tag option.`;
140
140
  spinner.start('Creating version');
141
141
  try {
142
142
  await this.createRemoteVersion(nextVersion, message, spinner, forceCreateFiles);
143
- await this.gitCommit(message);
144
- if (!noGitTag)
145
- await this.gitTag(nextVersion);
146
143
  }
147
144
  catch (error) {
148
145
  spinner.fail(error.stderr || error.message);
149
146
  return;
150
147
  }
151
148
  spinner.succeed(`${style.appConfigValue(this.app.name)} version ${nextVersion} created.`);
149
+ // git is optional: commit and tag only when the app is inside a repository
150
+ if (await git.find({ cwd: this.appPath })) {
151
+ try {
152
+ await this.gitCommit(message);
153
+ if (!noGitTag)
154
+ await this.gitTag(nextVersion);
155
+ }
156
+ catch (error) {
157
+ this.log(style.funcWarn(`Git commit/tag failed: ${(error.stderr || error.message).trim()}`));
158
+ }
159
+ }
160
+ else {
161
+ this.log(style.dim('Not a git repository, skipping git commit and tag.'));
162
+ }
152
163
  }
153
164
  async createRemoteVersion(nextVersion, message, spinner, forceCreateFiles = false) {
154
165
  const body = {
@@ -173,23 +184,24 @@ behavior by using the --no-git-tag option.`;
173
184
  this.swellConfig.set('version', nextVersion);
174
185
  }
175
186
  async gitCommit(message) {
187
+ const cwd = this.appPath;
176
188
  // check if there are changes in the app config file
177
189
  // if there are no changes, there is nothing to commit
178
190
  const configStatus = await git.spawn(['status', this.swellConfig.path], {
179
- cwd: this.swellConfig.cwd,
191
+ cwd,
180
192
  });
181
193
  if (configStatus.stdout.includes('nothing to commit')) {
182
194
  return;
183
195
  }
184
196
  // add the app config file to commit - this will contain the new version
185
- await git.spawn(['add', this.swellConfig.path]);
197
+ await git.spawn(['add', this.swellConfig.path], { cwd });
186
198
  // commit the version change to git. It skips the git hooks with -n
187
- await git.spawn(['commit', '-n', '-m', message]);
199
+ await git.spawn(['commit', '-n', '-m', message], { cwd });
188
200
  }
189
201
  async gitTag(nextVersion) {
190
202
  const tag = nextVersion;
191
203
  // tag the version in git
192
- await git.spawn(['tag', tag], { cwd: process.cwd() });
204
+ await git.spawn(['tag', tag], { cwd: this.appPath });
193
205
  }
194
206
  validateAndComputeVersion(nextVersion, localVersion) {
195
207
  let version = nextVersion;
@@ -46,6 +46,10 @@ have available for logging in to.
46
46
  const [sessionId, storeId] = await getSessionIdOrLoginInBrowser(store);
47
47
  await this.api.setStoreEnv(storeId);
48
48
  user = await this.api.get({ adminPath: 'user' }, { sessionId });
49
+ const authorization = user?.authorizations?.find((authorization) => authorization.client_id === storeId);
50
+ if (authorization?.client_inactive === true) {
51
+ this.error(`Store "${storeId}" has been deactivated and cannot be used with the CLI. Reactivate it in the dashboard or run \`swell login --force\` to choose another store.`, { exit: 1 });
52
+ }
49
53
  await this.getAndSetStoreConfig({ sessionId, storeId });
50
54
  await modifyDefaultStore({ currentStoreId, storeId }, force);
51
55
  config.setUser(user);
@@ -16,7 +16,6 @@ export interface App {
16
16
  [key: string]: string;
17
17
  };
18
18
  configs?: AppConfig[];
19
- cover_image?: unknown;
20
19
  date_created?: string;
21
20
  date_updated?: string;
22
21
  demo_url?: string;
@@ -39,6 +38,10 @@ export interface App {
39
38
  title: string;
40
39
  }>;
41
40
  id?: string;
41
+ images?: Array<{
42
+ file?: unknown;
43
+ id: string;
44
+ }>;
42
45
  installed?: {
43
46
  date_created: string;
44
47
  id: string;
@@ -32,6 +32,7 @@ function createServer(onSessionId, storeId) {
32
32
  },
33
33
  async onStart(loginUrl) {
34
34
  spinner.start([
35
+ 'Complete login in your browser. Press Ctrl+C to cancel.',
35
36
  "Open this link if your browser doesn't launch it automatically:",
36
37
  `${style.link(loginUrl)}`,
37
38
  ].join(' '));
@@ -72,6 +72,7 @@ export interface User {
72
72
  export interface UserAuthorization {
73
73
  client_id: string;
74
74
  client_name: string;
75
+ client_inactive?: boolean;
75
76
  }
76
77
  export interface App {
77
78
  id: string;
@@ -1180,7 +1180,7 @@
1180
1180
  "name": "file"
1181
1181
  }
1182
1182
  },
1183
- "description": "Push all app files, a specific file, or a specific configuration\ntype to an app in your store's test environment.\n\nIf the app does not exist, it will be created and its global ID saved to a .swellrc file.\n\n- If no file is specified, all configuration files will be pushed to the store.\n This includes the app icon (assets/icon.png), cover image (assets/image.png),\n and swell.json.\n- If a file is specified, only that file will be pushed to the store.\n- If a directory is specified, only files in that directory will be pushed.\n\nApp file directories:\nassets/\ncontent/\nfrontend/\ncomponents/\nfunctions/\nmodels/\nnotifications/\nsettings/\ntheme/\nwebhooks/",
1183
+ "description": "Push all app files, a specific file, or a specific configuration\ntype to an app in your store's test environment.\n\nIf the app does not exist, it will be created and its global ID saved to a .swellrc file.\n\n- If no file is specified, all configuration files will be pushed to the store.\n This includes the app icon (assets/icon.png), screenshots (assets/screenshots/),\n README.md, and swell.json.\n- If a file is specified, only that file will be pushed to the store.\n- If a directory is specified, only files in that directory will be pushed.\n\nApp file directories:\nassets/\ncontent/\nfrontend/\ncomponents/\nfunctions/\nmodels/\nnotifications/\nsettings/\ntheme/\nwebhooks/",
1184
1184
  "examples": [
1185
1185
  "swell app push",
1186
1186
  "swell app push content",
@@ -3594,5 +3594,5 @@
3594
3594
  ]
3595
3595
  }
3596
3596
  },
3597
- "version": "2.9.12"
3597
+ "version": "2.9.14"
3598
3598
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swell/cli",
3
- "version": "2.9.12",
3
+ "version": "2.9.14",
4
4
  "type": "module",
5
5
  "description": "Swell's command line interface/utility",
6
6
  "keywords": [