@superblocksteam/cli 1.7.0 → 1.8.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.
package/README.md CHANGED
@@ -12,7 +12,7 @@ $ npm install -g @superblocksteam/cli
12
12
  $ superblocks COMMAND
13
13
  running command...
14
14
  $ superblocks (--version)
15
- @superblocksteam/cli/1.7.0 linux-x64 node-v18.20.2
15
+ @superblocksteam/cli/1.8.2 linux-x64 node-v18.20.3
16
16
  $ superblocks --help [COMMAND]
17
17
  USAGE
18
18
  $ superblocks COMMAND
@@ -7,7 +7,7 @@
7
7
  "lint:fix": "npx eslint . --fix"
8
8
  },
9
9
  "dependencies": {
10
- "@superblocksteam/custom-components": "1.7.0",
10
+ "@superblocksteam/custom-components": "1.8.2",
11
11
  "react": "^18",
12
12
  "react-dom": "^18"
13
13
  },
@@ -122,7 +122,7 @@ class Migrate extends authenticated_command_1.AuthenticatedCommand {
122
122
  async migrateSinglePageApplicationToMultiPage(applicationResource, superblocksRootPath) {
123
123
  const fileStructure = await (0, version_control_1.getFileStructureType)(superblocksRootPath, applicationResource.location);
124
124
  if (fileStructure == version_control_1.FileStructureType.SINGLE_PAGE &&
125
- (await this.getSdk().fetchCurrentUser()).flagBootstrap["server.multipage.enabled"]) {
125
+ (await this.getSdk().fetchCurrentUser()).flagBootstrap["ui.multi-page.enabled"]) {
126
126
  this.log(`Migrating single page application at ${applicationResource.location} to multi-page application...`);
127
127
  const singlePageApplication = await (0, version_control_1.readApplicationFromDisk)(superblocksRootPath, applicationResource.location);
128
128
  const multiPageApplication = {
@@ -143,11 +143,11 @@ Would you like to also delete these resources from your filesystem?`,
143
143
  catch (error) {
144
144
  if ((0, version_control_1.isCI)() && error instanceof sdk_1.ValidateGitSetupError) {
145
145
  this.log(`WARN: Failed to validate git setup for ${resourceTitle}. Skipping pull.\n\n${error.message}.`);
146
+ ctx.resourceIdsToSkip.add(resourceId);
146
147
  }
147
148
  else {
148
149
  throw error;
149
150
  }
150
- ctx.resourceIdsToSkip.add(resourceId);
151
151
  }
152
152
  },
153
153
  });
@@ -157,13 +157,25 @@ Would you like to also delete these resources from your filesystem?`,
157
157
  });
158
158
  },
159
159
  },
160
+ {
161
+ task: async (ctx, task) => {
162
+ return task.newListr([
163
+ {
164
+ title: `Filtering out resources with git validation errors...`,
165
+ enabled: () => ctx.resourceIdsToSkip.size > 0,
166
+ task: () => {
167
+ // Remove resources to skip from list of resources to pull
168
+ ctx.resourceIdsToPull = ctx.resourceIdsToPull.filter((id) => !ctx.resourceIdsToSkip.has(id));
169
+ },
170
+ },
171
+ ]);
172
+ },
173
+ },
160
174
  {
161
175
  task: async (ctx, task) => {
162
176
  var _a, _b;
163
177
  task.title = `Pulling resources from branch ${ctx.localBranchName}...`;
164
178
  const viewMode = await (0, version_control_1.getMode)(task, mode);
165
- // Remove resources to skip from list of resources to push
166
- ctx.resourceIdsToPull = ctx.resourceIdsToPull.filter((id) => !ctx.resourceIdsToSkip.has(id));
167
179
  const subtasks = [];
168
180
  for (const resourceId of ctx.resourceIdsToPull) {
169
181
  const resource = (_a = ctx.existingSuperblocksRootConfig) === null || _a === void 0 ? void 0 : _a.resources[resourceId];
@@ -180,7 +192,7 @@ Would you like to also delete these resources from your filesystem?`,
180
192
  task.title += `: fetched`;
181
193
  const fileStructureType = await (0, version_control_1.getFileStructureType)(ctx.superblocksRootPath, resource.location);
182
194
  if (fileStructureType === version_control_1.FileStructureType.SINGLE_PAGE) {
183
- const multiPageEnabled = (await this.getSdk().fetchCurrentUser()).flagBootstrap["server.multipage.enabled"];
195
+ const multiPageEnabled = (await this.getSdk().fetchCurrentUser()).flagBootstrap["ui.multi-page.enabled"];
184
196
  if (multiPageEnabled) {
185
197
  this.error(`Application files at ${resource.location} are in single page format, but the multi-page feature is enabled for your account. Please run superblocks migrate to convert your application to multi-page format and commit the changes before pulling.`);
186
198
  }
@@ -150,11 +150,11 @@ Would you like to also delete these resources from your filesystem?`,
150
150
  catch (error) {
151
151
  if ((0, version_control_1.isCI)() && error instanceof sdk_1.ValidateGitSetupError) {
152
152
  this.log(`WARN: Failed to validate git setup for ${resourceTitle}. Skipping push.\n\n${error.message}.`);
153
+ ctx.resourceIdsToSkip.add(resourceId);
153
154
  }
154
155
  else {
155
156
  throw error;
156
157
  }
157
- ctx.resourceIdsToSkip.add(resourceId);
158
158
  }
159
159
  },
160
160
  });
@@ -164,6 +164,20 @@ Would you like to also delete these resources from your filesystem?`,
164
164
  });
165
165
  },
166
166
  },
167
+ {
168
+ task: async (ctx, task) => {
169
+ return task.newListr([
170
+ {
171
+ title: `Filtering out resources with git validation errors...`,
172
+ enabled: () => ctx.resourceIdsToSkip.size > 0,
173
+ task: () => {
174
+ // Remove resources to skip from list of resources to push
175
+ ctx.resourceIdsToPush = ctx.resourceIdsToPush.filter((id) => !ctx.resourceIdsToSkip.has(id));
176
+ },
177
+ },
178
+ ]);
179
+ },
180
+ },
167
181
  {
168
182
  task: async (ctx, task) => {
169
183
  var _a, _b;
@@ -192,8 +206,6 @@ Would you like to also delete these resources from your filesystem?`,
192
206
  task: async (ctx, task) => {
193
207
  var _a;
194
208
  task.title = `Pushing resources to branch ${ctx.localBranchName}...`;
195
- // Remove resources to skip from list of resources to push
196
- ctx.resourceIdsToPush = ctx.resourceIdsToPush.filter((id) => !ctx.resourceIdsToSkip.has(id));
197
209
  const subtasks = [];
198
210
  const superblocksRootPath = node_path_1.default.resolve(node_path_1.default.dirname(ctx.superblocksRootConfigPath), "..");
199
211
  for (const resourceId of ctx.resourceIdsToPush) {
@@ -206,19 +218,22 @@ Would you like to also delete these resources from your filesystem?`,
206
218
  var _a;
207
219
  const fileStructureType = await (0, version_control_1.getFileStructureType)(superblocksRootPath, resource.location);
208
220
  if (fileStructureType === version_control_1.FileStructureType.SINGLE_PAGE &&
209
- (await this.getSdk().fetchCurrentUser()).flagBootstrap["server.multipage.enabled"]) {
210
- this.error(`Application files at ${resource.location} are in single page format, but the multi-page feature is enabled for your account. Please run \`superblocks migrate\` to convert your application to multi-page format and commit the changes before pushing.`);
221
+ (await this.getSdk().fetchCurrentUser()).flagBootstrap["ui.multi-page.enabled"]) {
222
+ this.error(`Application files at ${resource.location} are in single page format, but the multi-page feature is enabled for your account. To resolve this issue, you can make a commit to this branch from Superblocks to convert the file structure to multi-page format (See docs: https://docs.superblocks.com/applications/multi-page/converting-single-page-to-multi-page#handling-outstanding-branches-created-before-multi-page). Alternatively, you can run \`superblocks migrate\` to convert your file structure and commit the changes before pushing.`);
211
223
  }
224
+ const localGitRepoState = await (0, version_control_1.getLocalGitRepoState)(ctx.localBranchName);
212
225
  const applicationConfig = fileStructureType === version_control_1.FileStructureType.SINGLE_PAGE
213
226
  ? {
214
227
  ...(await (0, version_control_1.readApplicationFromDisk)(superblocksRootPath, resource.location)),
215
228
  commitId: ctx.headCommitId,
216
229
  commitMessage: ctx.headCommitMessage,
230
+ gitState: localGitRepoState,
217
231
  }
218
232
  : {
219
233
  ...(await (0, version_control_1.readMultiPageApplicationFromDisk)(superblocksRootPath, resource.location)),
220
234
  commitId: ctx.headCommitId,
221
235
  commitMessage: ctx.headCommitMessage,
236
+ gitState: localGitRepoState,
222
237
  };
223
238
  task.title += `: read from disk`;
224
239
  try {
@@ -253,10 +268,12 @@ Would you like to also delete these resources from your filesystem?`,
253
268
  title: `Pushing workflow/scheduled job ${resource.location}...`,
254
269
  task: async (_ctx, task) => {
255
270
  var _a;
271
+ const localGitRepoState = await (0, version_control_1.getLocalGitRepoState)(ctx.localBranchName);
256
272
  const apiConfig = {
257
273
  ...(await (0, version_control_1.readApiFromDisk)(superblocksRootPath, resource.location)),
258
274
  commitId: ctx.headCommitId,
259
275
  commitMessage: ctx.headCommitMessage,
276
+ gitState: localGitRepoState,
260
277
  };
261
278
  task.title += `: read from disk`;
262
279
  try {
@@ -335,11 +352,12 @@ Would you like to also delete these resources from your filesystem?`,
335
352
  ? [choices[0].name]
336
353
  : await task.prompt([
337
354
  {
338
- type: "MultiSelect",
355
+ type: "AutoComplete",
339
356
  name: "resourceIdsToPush",
340
357
  message: `Select resources to push (${version_control_1.MULTI_SELECT_PROMPT_HELP})`,
341
358
  choices: choices,
342
359
  initial: initialSelections,
360
+ multiple: true,
343
361
  validate: version_control_1.atLeastOneSelection,
344
362
  prefix: "▸",
345
363
  indicator: "◉",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.7.0",
2
+ "version": "1.8.2",
3
3
  "commands": {
4
4
  "init": {
5
5
  "id": "init",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superblocksteam/cli",
3
- "version": "1.7.0",
3
+ "version": "1.8.2",
4
4
  "description": "Official Superblocks CLI",
5
5
  "bin": {
6
6
  "superblocks": "bin/run"
@@ -18,11 +18,11 @@
18
18
  "@oclif/core": "^2.11.7",
19
19
  "@oclif/plugin-help": "^5.2.16",
20
20
  "@oclif/plugin-plugins": "^3.1.10",
21
- "@superblocksteam/css-plugin": "1.7.0",
22
- "@superblocksteam/react-shim": "1.7.0",
23
- "@superblocksteam/sdk": "1.7.0",
24
- "@superblocksteam/util": "1.7.0",
25
- "@superblocksteam/vite-custom-component-reload-plugin": "1.7.0",
21
+ "@superblocksteam/css-plugin": "1.8.2",
22
+ "@superblocksteam/react-shim": "1.8.2",
23
+ "@superblocksteam/sdk": "1.8.2",
24
+ "@superblocksteam/util": "1.8.2",
25
+ "@superblocksteam/vite-custom-component-reload-plugin": "1.8.2",
26
26
  "@vitejs/plugin-react": "^4.1.0",
27
27
  "colorette": "^2.0.19",
28
28
  "enquirer": "^2.3.6",