@superblocksteam/cli 1.10.0 → 1.13.0

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 (56) hide show
  1. package/LICENSE.txt +87 -0
  2. package/README.md +6 -6
  3. package/assets/custom-components/setup/package.json +1 -1
  4. package/assets/custom-components/setup/tsconfig.json +0 -1
  5. package/bin/dev +5 -7
  6. package/bin/run +1 -3
  7. package/dist/appendHotReloadEventPlugin.mjs +43 -0
  8. package/dist/commands/commits.d.mts +18 -0
  9. package/dist/commands/{commits.js → commits.mjs} +59 -67
  10. package/dist/commands/components/{create.d.ts → create.d.mts} +2 -2
  11. package/dist/commands/components/{create.js → create.mjs} +84 -93
  12. package/dist/commands/components/{register.d.ts → register.d.mts} +1 -1
  13. package/dist/commands/components/register.mjs +12 -0
  14. package/dist/commands/components/{upload.d.ts → upload.d.mts} +2 -2
  15. package/dist/commands/components/{upload.js → upload.mjs} +39 -43
  16. package/dist/commands/components/{watch.d.ts → watch.d.mts} +1 -1
  17. package/dist/commands/components/{watch.js → watch.mjs} +29 -36
  18. package/dist/commands/config/{set.d.ts → set.d.mts} +2 -2
  19. package/dist/commands/config/{set.js → set.mjs} +28 -32
  20. package/dist/commands/{init.d.ts → init.d.mts} +4 -4
  21. package/dist/commands/{init.js → init.mjs} +58 -64
  22. package/dist/commands/{login.d.ts → login.d.mts} +1 -1
  23. package/dist/commands/login.mjs +55 -0
  24. package/dist/commands/{migrate.d.ts → migrate.d.mts} +1 -1
  25. package/dist/commands/{migrate.js → migrate.mjs} +34 -42
  26. package/dist/commands/pull.d.mts +17 -0
  27. package/dist/commands/{pull.js → pull.mjs} +72 -80
  28. package/dist/commands/push.d.mts +15 -0
  29. package/dist/commands/{push.js → push.mjs} +81 -90
  30. package/dist/commands/{rm.d.ts → rm.d.mts} +2 -2
  31. package/dist/commands/{rm.js → rm.mjs} +34 -40
  32. package/dist/common/{authenticated-command.js → authenticated-command.mjs} +65 -75
  33. package/dist/common/defaults/{create-component-defaults.js → create-component-defaults.mjs} +2 -7
  34. package/dist/common/{version-control.d.ts → version-control.d.mts} +1 -1
  35. package/dist/common/{version-control.js → version-control.mjs} +170 -202
  36. package/dist/index.js +1 -5
  37. package/dist/{productionCssPlugin.js → productionCssPlugin.mjs} +4 -10
  38. package/dist/{reactShimPlugin.js → reactShimPlugin.mjs} +17 -24
  39. package/dist/util/migrationWarningsForApplications.mjs +47 -0
  40. package/dist/util/{migrationsForDotfiles.js → migrationsForDotfiles.mjs} +10 -17
  41. package/oclif.manifest.json +284 -171
  42. package/package.json +43 -41
  43. package/dist/appendHotReloadEventPlugin.js +0 -48
  44. package/dist/commands/commits.d.ts +0 -18
  45. package/dist/commands/components/register.js +0 -15
  46. package/dist/commands/login.js +0 -61
  47. package/dist/commands/pull.d.ts +0 -17
  48. package/dist/commands/push.d.ts +0 -15
  49. package/dist/util/migrationWarningsForApplications.js +0 -52
  50. /package/dist/{appendHotReloadEventPlugin.d.ts → appendHotReloadEventPlugin.d.mts} +0 -0
  51. /package/dist/common/{authenticated-command.d.ts → authenticated-command.d.mts} +0 -0
  52. /package/dist/common/defaults/{create-component-defaults.d.ts → create-component-defaults.d.mts} +0 -0
  53. /package/dist/{productionCssPlugin.d.ts → productionCssPlugin.d.mts} +0 -0
  54. /package/dist/{reactShimPlugin.d.ts → reactShimPlugin.d.mts} +0 -0
  55. /package/dist/util/{migrationWarningsForApplications.d.ts → migrationWarningsForApplications.d.mts} +0 -0
  56. /package/dist/util/{migrationsForDotfiles.d.ts → migrationsForDotfiles.d.mts} +0 -0
package/LICENSE.txt ADDED
@@ -0,0 +1,87 @@
1
+ Superblocks Community Software License
2
+
3
+ This Superblocks Community License Agreement (the “Agreement”) sets forth the terms on which DayZero
4
+ Software, Inc. d/b/a Superblocks (“Superblocks”) makes available certain software made available by Superblocks
5
+ under this Agreement (the “Software”). BY INSTALLING, DOWNLOADING, ACCESSING, USING OR
6
+ DISTRIBUTING ANY OF THE SOFTWARE, YOU AGREE TO THE TERMS AND CONDITIONS OF THIS
7
+ AGREEMENT.IF YOU DO NOT AGREE TO SUCH TERMS AND CONDITIONS, YOU MUST NOT USE THE
8
+ SOFTWARE. IF YOU ARE RECEIVING THE SOFTWARE ON BEHALF OF A LEGAL ENTITY, YOU
9
+ REPRESENT AND WARRANT THAT YOU HAVE THE ACTUAL AUTHORITY TO AGREE TO THE
10
+ TERMS AND CONDITIONS OF THIS AGREEMENT ON BEHALF OF SUCH ENTITY. “Licensee” means you,
11
+ an individual, or the entity on whose behalf you are receiving the Software.
12
+
13
+ 1. LICENSE GRANT AND CONDITIONS.
14
+
15
+ 1.1 License. Subject to the terms and conditions of this Agreement, Superblocks hereby grants to Licensee a
16
+ non-exclusive, royalty-free, worldwide, non-transferable, non-sublicenseable license during the term of this
17
+ Agreement to: (a) use the Software; (b) prepare modifications and derivative works of the Software; (c)
18
+ distribute the Software (including without limitation in source code or object code form); and (d) reproduce
19
+ copies of the Software (the “License”). Licensee is not granted the right to, and Licensee shall not, exercise the
20
+ License for an Excluded Purpose. For purposes of this Agreement, “Excluded Purpose” means making
21
+ available any software-as-a-service, platform-as-a-service, infrastructure-as-a-service or other similar online
22
+ service that competes with Superblocks’ products or services.
23
+
24
+ 1.2 Conditions. In consideration of the License, Licensee’s distribution of the Software is subject to the
25
+ following conditions:
26
+
27
+ a. Licensee must cause any Software modified by Licensee to carry prominent notices stating that Licensee
28
+ modified the Software.
29
+ b. On each Software copy, Licensee shall reproduce and not remove or alter all Superblocks or third party
30
+ copyright or other proprietary notices contained in the Software, and Licensee must provide the notice
31
+ below with each copy.
32
+
33
+ “This software is made available by DayZero Software, Inc. d/b/a Superblocks, under the terms of the
34
+ Superblocks Community License Agreement. © 2022 DayZero Software, Inc.”
35
+
36
+ 1.3 Licensee Modifications. Licensee may add its own copyright notices to modifications made by Licensee
37
+ and may provide additional or different license terms and conditions for use, reproduction, or distribution of
38
+ Licensee’s modifications. While redistributing the Software or modifications thereof, Licensee may choose to
39
+ offer, for a fee or free of charge, support, warranty, indemnity, or other obligations. Licensee, and not
40
+ Superblocks, will be responsible for any such obligations.
41
+
42
+ 1.4 No Sublicensing. The License does not include the right to sublicense the Software, however, each recipient
43
+ to which Licensee provides the Software may exercise the Licenses so long as such recipient agrees to the terms
44
+ and conditions of this Agreement.
45
+
46
+ 2. TERM AND TERMINATION. This Agreement will continue unless and until earlier terminated as set forth
47
+ herein. If Licensee breaches any of its conditions or obligations under this Agreement, this Agreement will
48
+ terminate automatically and the License will terminate automatically and permanently.
49
+
50
+ 3. INTELLECTUAL PROPERTY. As between the parties, Superblocks will retain all right, title, and interest in
51
+ the Software, and all intellectual property rights therein. Superblocks hereby reserves all rights not expressly
52
+ granted to Licensee in this Agreement. Superblocks hereby reserves all rights in its trademarks and service
53
+ marks, and no licenses therein are granted in this Agreement.
54
+
55
+ 4. DISCLAIMER. SUPERBLOCKS HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND
56
+ CONDITIONS, EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, AND SPECIFICALLY
57
+ DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
58
+ PURPOSE, WITH RESPECT TO THE SOFTWARE.
59
+
60
+ 5. LIMITATION OF LIABILITY. SUPERBLOCKS WILL NOT BE LIABLE FOR ANY DAMAGES OF
61
+ ANY KIND, INCLUDING BUT NOT LIMITED TO, LOST PROFITS OR ANY CONSEQUENTIAL,
62
+ SPECIAL, INCIDENTAL, INDIRECT, OR DIRECT DAMAGES, HOWEVER CAUSED AND ON ANY
63
+ THEORY OF LIABILITY, ARISING OUT OF THIS AGREEMENT. THE FOREGOING SHALL APPLY TO
64
+ THE EXTENT PERMITTED BY APPLICABLE LAW.
65
+
66
+ 6. GENERAL.
67
+
68
+ 6.1  Governing Law. This Agreement will be governed by and interpreted in accordance with the laws of the
69
+ state of California, without reference to its conflict of laws principles. If Licensee is located within the United
70
+ States, all disputes arising out of this Agreement are subject to the exclusive jurisdiction of courts located in San
71
+ Mateo County, California. USA. If Licensee is located outside of the United States, any dispute, controversy or
72
+ claim arising out of or relating to this Agreement will be referred to and finally determined by arbitration in
73
+ accordance with the JAMS International Arbitration Rules. The tribunal will consist of one neutral arbitrator.
74
+ The place of arbitration will be Palo Alto, California. The language to be used in the arbitral proceedings will be
75
+ English. Judgment upon the award rendered by the arbitrator may be entered in any court having jurisdiction
76
+ thereof.
77
+
78
+ 6.2.  Assignment. Licensee may not assign its rights under this Agreement to any third party. Superblocks may
79
+ freely assign its rights under this Agreement to any third party.
80
+
81
+ 6.3.  Other.  This Agreement is the entire agreement between the parties regarding the subject matter hereof.
82
+ No amendment or modification of this Agreement will be valid or binding upon the parties unless made in
83
+ writing and signed by the duly authorized representatives of both parties. In the event that any provision,
84
+ including without limitation any condition, of this Agreement is held to be unenforceable, this Agreement and
85
+ all licenses and rights granted hereunder will immediately terminate. Waiver by Superblocks of a breach of any
86
+ provision of this Agreement or the failure by Superblocks to exercise any right hereunder will not be construed
87
+ as a waiver of any subsequent breach of that right or as a waiver of any other right.
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.10.0 linux-x64 node-v20.18.2
15
+ @superblocksteam/cli/1.13.0 linux-x64 node-v20.19.0
16
16
  $ superblocks --help [COMMAND]
17
17
  USAGE
18
18
  $ superblocks COMMAND
@@ -27,7 +27,7 @@ USAGE
27
27
  * [`superblocks components upload`](#superblocks-components-upload)
28
28
  * [`superblocks components watch`](#superblocks-components-watch)
29
29
  * [`superblocks config set PROPERTY VALUE`](#superblocks-config-set-property-value)
30
- * [`superblocks help [COMMANDS]`](#superblocks-help-commands)
30
+ * [`superblocks help [COMMAND]`](#superblocks-help-command)
31
31
  * [`superblocks init [RESOURCE_URL]`](#superblocks-init-resource_url)
32
32
  * [`superblocks login`](#superblocks-login)
33
33
  * [`superblocks migrate`](#superblocks-migrate)
@@ -150,16 +150,16 @@ EXAMPLES
150
150
  $ superblocks config set domain app.superblocks.com
151
151
  ```
152
152
 
153
- ## `superblocks help [COMMANDS]`
153
+ ## `superblocks help [COMMAND]`
154
154
 
155
155
  Display help for superblocks.
156
156
 
157
157
  ```
158
158
  USAGE
159
- $ superblocks help [COMMANDS] [-n]
159
+ $ superblocks help [COMMAND...] [-n]
160
160
 
161
161
  ARGUMENTS
162
- COMMANDS Command to show help for.
162
+ COMMAND... Command to show help for.
163
163
 
164
164
  FLAGS
165
165
  -n, --nested-commands Include all nested commands in the output.
@@ -168,7 +168,7 @@ DESCRIPTION
168
168
  Display help for superblocks.
169
169
  ```
170
170
 
171
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.16/src/commands/help.ts)_
171
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.26/src/commands/help.ts)_
172
172
 
173
173
  ## `superblocks init [RESOURCE_URL]`
174
174
 
@@ -7,7 +7,7 @@
7
7
  "lint:fix": "npx eslint . --fix"
8
8
  },
9
9
  "dependencies": {
10
- "@superblocksteam/custom-components": "1.10.0",
10
+ "@superblocksteam/custom-components": "1.13.0",
11
11
  "react": "^18",
12
12
  "react-dom": "^18"
13
13
  },
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "noEmit": true,
4
- "importHelpers": true,
5
4
  "module": "CommonJS",
6
5
  "strict": true,
7
6
  "target": "es2019",
package/bin/dev CHANGED
@@ -1,8 +1,6 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env ts-node
2
2
 
3
- // eslint-disable-next-line node/shebang
4
- (async () => {
5
- const oclif = await import("@oclif/core");
6
- // eslint-disable-next-line unicorn/prefer-module
7
- await oclif.execute({ type: "cjs", development: true, dir: __dirname });
8
- })();
3
+ ;(async () => {
4
+ const oclif = await import('@oclif/core')
5
+ await oclif.execute({development: true, dir: __dirname})
6
+ })()
package/bin/run CHANGED
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // eslint-disable-next-line node/shebang
4
3
  (async () => {
5
4
  const oclif = await import("@oclif/core");
6
- // eslint-disable-next-line unicorn/prefer-module
7
- await oclif.execute({ type: "cjs", dir: __dirname });
5
+ await oclif.execute({ dir: __dirname });
8
6
  })();
@@ -0,0 +1,43 @@
1
+ import path from "path";
2
+ import { SuperblocksSdk } from "@superblocksteam/sdk";
3
+ import { getSuperblocksApplicationConfigJson, getComponentConfigs, getLocalTokenWithUrl, COMPONENT_EVENT_HEADER, ComponentEvent, getSuperblocksMonorepoConfigJson, } from "@superblocksteam/util";
4
+ export const appendHotReloadEventPlugin = (getBranch) => {
5
+ return {
6
+ name: "append-code-plugin",
7
+ enforce: "pre",
8
+ apply: "serve", // Apply this plugin only during development (dev server)
9
+ async handleHotUpdate(ctx) {
10
+ const isConfigFile = path.basename(ctx.file) === "config.ts";
11
+ if (!isConfigFile)
12
+ return;
13
+ try {
14
+ const result = await getLocalTokenWithUrl();
15
+ if (!result || !("token" in result)) {
16
+ throw new Error("Please run `superblocks login` to login.");
17
+ }
18
+ const { token, superblocksBaseUrl } = result;
19
+ const resourceConfig = await getSuperblocksApplicationConfigJson();
20
+ const { configs, hasError } = await getComponentConfigs(true);
21
+ if (hasError)
22
+ return;
23
+ const [rootSettings] = await getSuperblocksMonorepoConfigJson(true);
24
+ const sdk = new SuperblocksSdk(token, superblocksBaseUrl, rootSettings.metadata.cliVersion);
25
+ console.log("Registering components...");
26
+ const branch = await getBranch();
27
+ const headers = {
28
+ [COMPONENT_EVENT_HEADER]: ComponentEvent.REGISTER,
29
+ };
30
+ await sdk.registerComponents(resourceConfig.id, configs, branch, headers);
31
+ console.log("Re-registered components!");
32
+ ctx.server.ws.send({
33
+ type: "custom",
34
+ event: "config-reloaded",
35
+ data: {},
36
+ });
37
+ }
38
+ catch (e) {
39
+ console.error(e.message);
40
+ }
41
+ },
42
+ };
43
+ };
@@ -0,0 +1,18 @@
1
+ import { GetCommitsResponseBody } from "@superblocksteam/sdk";
2
+ import { AuthenticatedCommand } from "../common/authenticated-command.mjs";
3
+ export default class Commits extends AuthenticatedCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ branch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
9
+ offset: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
11
+ static args: {
12
+ resource_path: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
13
+ };
14
+ run(): Promise<void>;
15
+ private createTasks;
16
+ private getResourceIdToShowCommits;
17
+ printCommits(commits: GetCommitsResponseBody, branch?: string): void;
18
+ }
@@ -1,20 +1,47 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const node_path_1 = tslib_1.__importDefault(require("node:path"));
5
- const core_1 = require("@oclif/core");
6
- const util_1 = require("@superblocksteam/util");
7
- const listr2_1 = require("listr2");
8
- const authenticated_command_1 = require("../common/authenticated-command");
9
- const version_control_1 = require("../common/version-control");
10
- class Commits extends authenticated_command_1.AuthenticatedCommand {
1
+ import path from "node:path";
2
+ import { Args, Flags } from "@oclif/core";
3
+ import { getSuperblocksMonorepoConfigJson, getSuperblocksResourceConfigIfExists, ComponentEvent, COMPONENT_EVENT_HEADER, NotFoundError, } from "@superblocksteam/util";
4
+ import { Listr } from "listr2";
5
+ import { AuthenticatedCommand } from "../common/authenticated-command.mjs";
6
+ import { DEFAULT_BRANCH, SELECT_PROMPT_HELP, atLeastOneSelection, deleteResourcesAndUpdateRootConfig, getCurrentGitBranchIfGit, } from "../common/version-control.mjs";
7
+ export default class Commits extends AuthenticatedCommand {
8
+ static description = "List Superblocks commits for a resource";
9
+ static examples = [
10
+ "<%= config.bin %> <%= command.id %>",
11
+ "<%= config.bin %> <%= command.id %> apps/my-app",
12
+ "<%= config.bin %> <%= command.id %> apps/my-app -b feature-branch",
13
+ "<%= config.bin %> <%= command.id %> --limit 20",
14
+ "<%= config.bin %> <%= command.id %> --offset 10",
15
+ ];
16
+ static flags = {
17
+ branch: Flags.string({
18
+ char: "b",
19
+ description: "Superblocks branch to show commits for, the current git branch will be used by default",
20
+ }),
21
+ limit: Flags.integer({
22
+ char: "l",
23
+ default: 10,
24
+ description: "Number of commits to be displayed, default is 10",
25
+ }),
26
+ offset: Flags.integer({
27
+ char: "o",
28
+ default: 0,
29
+ description: "Number of commits to be skipped before displaying by creation time, default is 0",
30
+ }),
31
+ };
32
+ static args = {
33
+ resource_path: Args.string({
34
+ description: "Superblocks resource location to show commits for (i.e. apps/my-app)",
35
+ required: false,
36
+ }),
37
+ };
11
38
  async run() {
12
39
  const { flags, args } = await this.parse(Commits);
13
40
  const tasks = this.createTasks(args.resource_path, flags.branch, flags.limit, flags.offset);
14
41
  await tasks.run();
15
42
  }
16
43
  createTasks(resourcePath, branch, limit, offset) {
17
- const tasks = new listr2_1.Listr([
44
+ const tasks = new Listr([
18
45
  {
19
46
  title: "Checking for existing Superblocks project...",
20
47
  task: async (ctx) => {
@@ -24,10 +51,10 @@ class Commits extends authenticated_command_1.AuthenticatedCommand {
24
51
  [
25
52
  ctx.existingSuperblocksRootConfig,
26
53
  ctx.superblocksRootConfigPath,
27
- ] = await (0, util_1.getSuperblocksMonorepoConfigJson)(true);
54
+ ] = await getSuperblocksMonorepoConfigJson(true);
28
55
  ctx.existingSuperblocksResourceConfig =
29
- await (0, util_1.getSuperblocksResourceConfigIfExists)();
30
- ctx.superblocksRootPath = node_path_1.default.resolve(node_path_1.default.dirname(ctx.superblocksRootConfigPath), "..");
56
+ await getSuperblocksResourceConfigIfExists();
57
+ ctx.superblocksRootPath = path.resolve(path.dirname(ctx.superblocksRootConfigPath), "..");
31
58
  }
32
59
  catch {
33
60
  // no existing superblocks config
@@ -41,7 +68,7 @@ class Commits extends authenticated_command_1.AuthenticatedCommand {
41
68
  ctx.branchToShowCommitsFor = new Map();
42
69
  try {
43
70
  ctx.localBranchName =
44
- branch || (await (0, version_control_1.getCurrentGitBranchIfGit)()) || version_control_1.DEFAULT_BRANCH;
71
+ branch || (await getCurrentGitBranchIfGit()) || DEFAULT_BRANCH;
45
72
  }
46
73
  catch (e) {
47
74
  this.error(`Failed to check for existing git repository: ${e.message}. Please make sure to clone or initialize a git repository.`);
@@ -51,10 +78,9 @@ class Commits extends authenticated_command_1.AuthenticatedCommand {
51
78
  {
52
79
  title: "Checking for deleted Superblocks resources...",
53
80
  task: async (ctx, task) => {
54
- var _a, _b;
55
81
  try {
56
- for (const [resourceId, resource] of Object.entries((_b = (_a = ctx.existingSuperblocksRootConfig) === null || _a === void 0 ? void 0 : _a.resources) !== null && _b !== void 0 ? _b : {})) {
57
- switch (resource === null || resource === void 0 ? void 0 : resource.resourceType) {
82
+ for (const [resourceId, resource] of Object.entries(ctx.existingSuperblocksRootConfig?.resources ?? {})) {
83
+ switch (resource?.resourceType) {
58
84
  case "APPLICATION": {
59
85
  try {
60
86
  await this.getSdk().fetchApplication({
@@ -64,7 +90,7 @@ class Commits extends authenticated_command_1.AuthenticatedCommand {
64
90
  });
65
91
  }
66
92
  catch (error) {
67
- if (error instanceof util_1.NotFoundError) {
93
+ if (error instanceof NotFoundError) {
68
94
  ctx.removedResourceIds.push(resourceId);
69
95
  }
70
96
  else {
@@ -82,7 +108,7 @@ class Commits extends authenticated_command_1.AuthenticatedCommand {
82
108
  });
83
109
  }
84
110
  catch (error) {
85
- if (error instanceof util_1.NotFoundError) {
111
+ if (error instanceof NotFoundError) {
86
112
  ctx.removedResourceIds.push(resourceId);
87
113
  }
88
114
  else {
@@ -115,7 +141,7 @@ Would you like to also delete these resources from your filesystem?`,
115
141
  },
116
142
  ]);
117
143
  if (removeResourcesFromDisk) {
118
- await (0, version_control_1.deleteResourcesAndUpdateRootConfig)(ctx.removedResourceIds, ctx.existingSuperblocksRootConfig, ctx.superblocksRootPath, ctx.superblocksRootConfigPath);
144
+ await deleteResourcesAndUpdateRootConfig(ctx.removedResourceIds, ctx.existingSuperblocksRootConfig, ctx.superblocksRootPath, ctx.superblocksRootConfigPath);
119
145
  }
120
146
  }
121
147
  catch (e) {
@@ -131,19 +157,18 @@ Would you like to also delete these resources from your filesystem?`,
131
157
  },
132
158
  {
133
159
  task: async (ctx, task) => {
134
- var _a, _b;
135
160
  task.title = `Get commits for the resource from branch ${ctx.localBranchName}...`;
136
161
  const subtasks = [];
137
162
  const resourceId = ctx.resourceIdToShowCommits;
138
- const resource = (_a = ctx.existingSuperblocksRootConfig) === null || _a === void 0 ? void 0 : _a.resources[resourceId];
139
- const branchName = (_b = ctx.branchToShowCommitsFor.get(resourceId)) !== null && _b !== void 0 ? _b : ctx.localBranchName;
140
- switch (resource === null || resource === void 0 ? void 0 : resource.resourceType) {
163
+ const resource = ctx.existingSuperblocksRootConfig?.resources[resourceId];
164
+ const branchName = ctx.branchToShowCommitsFor.get(resourceId) ?? ctx.localBranchName;
165
+ switch (resource?.resourceType) {
141
166
  case "APPLICATION": {
142
167
  subtasks.push({
143
168
  title: `Fetching commits for application ${resource.location} from branch ${branchName}...`,
144
169
  task: async (_ctx, task) => {
145
170
  const headers = {
146
- [util_1.COMPONENT_EVENT_HEADER]: util_1.ComponentEvent.COMMITS,
171
+ [COMPONENT_EVENT_HEADER]: ComponentEvent.COMMITS,
147
172
  };
148
173
  try {
149
174
  task.title += `: fetched`;
@@ -158,7 +183,7 @@ Would you like to also delete these resources from your filesystem?`,
158
183
  task.title += `: done`;
159
184
  }
160
185
  catch (e) {
161
- if (e instanceof util_1.NotFoundError) {
186
+ if (e instanceof NotFoundError) {
162
187
  task.title += `: not found in this branch. skipped`;
163
188
  }
164
189
  else {
@@ -202,23 +227,22 @@ Would you like to also delete these resources from your filesystem?`,
202
227
  return tasks;
203
228
  }
204
229
  async getResourceIdToShowCommits(ctx, task, resourcePath) {
205
- var _a, _b, _c, _d, _e;
206
230
  if (resourcePath) {
207
- for (const [resourceId, resource] of Object.entries((_b = (_a = ctx.existingSuperblocksRootConfig) === null || _a === void 0 ? void 0 : _a.resources) !== null && _b !== void 0 ? _b : {})) {
231
+ for (const [resourceId, resource] of Object.entries(ctx.existingSuperblocksRootConfig?.resources ?? {})) {
208
232
  if (resource.location === resourcePath) {
209
233
  return resourceId;
210
234
  }
211
235
  }
212
236
  throw new Error(`No resource found with the given location: ${resourcePath}`);
213
237
  }
214
- const resourceConfig = await (0, util_1.getSuperblocksResourceConfigIfExists)();
238
+ const resourceConfig = await getSuperblocksResourceConfigIfExists();
215
239
  if (resourceConfig) {
216
240
  return resourceConfig.id;
217
241
  }
218
242
  const choices = [];
219
243
  const initialSelections = [];
220
244
  let counter = 0;
221
- for (const [resourceId, resource] of Object.entries((_d = (_c = ctx.existingSuperblocksRootConfig) === null || _c === void 0 ? void 0 : _c.resources) !== null && _d !== void 0 ? _d : {})) {
245
+ for (const [resourceId, resource] of Object.entries(ctx.existingSuperblocksRootConfig?.resources ?? {})) {
222
246
  if (ctx.removedResourceIds.includes(resourceId)) {
223
247
  continue;
224
248
  }
@@ -226,7 +250,7 @@ Would you like to also delete these resources from your filesystem?`,
226
250
  name: resourceId,
227
251
  message: resource.location,
228
252
  });
229
- if (((_e = ctx.existingSuperblocksResourceConfig) === null || _e === void 0 ? void 0 : _e.id) === resourceId) {
253
+ if (ctx.existingSuperblocksResourceConfig?.id === resourceId) {
230
254
  initialSelections.push(counter);
231
255
  }
232
256
  counter++;
@@ -240,10 +264,10 @@ Would you like to also delete these resources from your filesystem?`,
240
264
  {
241
265
  type: "Select",
242
266
  name: "resourceIdToShowCommits",
243
- message: `Select a resource to see commits (${version_control_1.SELECT_PROMPT_HELP})`,
267
+ message: `Select a resource to see commits (${SELECT_PROMPT_HELP})`,
244
268
  choices: choices,
245
269
  initial: initialSelections,
246
- validate: version_control_1.atLeastOneSelection,
270
+ validate: atLeastOneSelection,
247
271
  prefix: "▸",
248
272
  indicator: "◉",
249
273
  },
@@ -251,48 +275,16 @@ Would you like to also delete these resources from your filesystem?`,
251
275
  return resourceIdToShowCommitFor;
252
276
  }
253
277
  printCommits(commits, branch) {
254
- var _a;
255
278
  if (commits.commits.length === 0) {
256
279
  console.log("No commits have been created.");
257
280
  return;
258
281
  }
259
282
  for (const commit of commits.commits) {
260
283
  console.log(`commit ${commit.commitId}`, branch ? `(${branch})` : "");
261
- console.log(`Author: ${(_a = commit.committer.name) !== null && _a !== void 0 ? _a : ""} <${commit.committer.email}>`);
284
+ console.log(`Author: ${commit.committer.name ?? ""} <${commit.committer.email}>`);
262
285
  console.log(`Date: ${new Date(commit.commitDate).toLocaleString()}`);
263
286
  console.log(`Message: ${commit.commitMessage}`);
264
287
  console.log("---");
265
288
  }
266
289
  }
267
290
  }
268
- Commits.description = "List Superblocks commits for a resource";
269
- Commits.examples = [
270
- "<%= config.bin %> <%= command.id %>",
271
- "<%= config.bin %> <%= command.id %> apps/my-app",
272
- "<%= config.bin %> <%= command.id %> apps/my-app -b feature-branch",
273
- "<%= config.bin %> <%= command.id %> --limit 20",
274
- "<%= config.bin %> <%= command.id %> --offset 10",
275
- ];
276
- Commits.flags = {
277
- branch: core_1.Flags.string({
278
- char: "b",
279
- description: "Superblocks branch to show commits for, the current git branch will be used by default",
280
- }),
281
- limit: core_1.Flags.integer({
282
- char: "l",
283
- default: 10,
284
- description: "Number of commits to be displayed, default is 10",
285
- }),
286
- offset: core_1.Flags.integer({
287
- char: "o",
288
- default: 0,
289
- description: "Number of commits to be skipped before displaying by creation time, default is 0",
290
- }),
291
- };
292
- Commits.args = {
293
- resource_path: core_1.Args.string({
294
- description: "Superblocks resource location to show commits for (i.e. apps/my-app)",
295
- required: false,
296
- }),
297
- };
298
- exports.default = Commits;
@@ -1,9 +1,9 @@
1
- import { AuthenticatedApplicationCommand } from "../../common/authenticated-command";
1
+ import { AuthenticatedApplicationCommand } from "../../common/authenticated-command.mjs";
2
2
  export default class CreateComponent extends AuthenticatedApplicationCommand {
3
3
  static description: string;
4
4
  private dataTypeToDefaultControlType;
5
5
  static flags: {
6
- example: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
+ example: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
7
  };
8
8
  private initializeComponentByWizard;
9
9
  private initializeComponentByExample;