@superblocksteam/cli 0.0.21 → 0.0.23
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 +5 -2
- package/assets/custom-components/example/component.tsx +1 -1
- package/assets/custom-components/setup/gitignore_will_rename +2 -0
- package/assets/custom-components/setup/package.json +2 -1
- package/dist/commands/components/create.d.ts +3 -0
- package/dist/commands/components/create.js +35 -10
- package/dist/commands/components/register.js +5 -1
- package/dist/commands/components/upload.js +20 -4
- package/dist/commands/components/watch.js +5 -1
- package/dist/commands/init.js +16 -3
- package/dist/commands/pull.js +8 -1
- package/dist/common/authenticated-command.d.ts +1 -1
- package/dist/common/authenticated-command.js +6 -3
- package/dist/common/defaults/create-component-defaults.js +9 -3
- package/dist/util/migrationWarningsForApplications.js +16 -2
- package/oclif.manifest.json +9 -2
- package/package.json +10 -8
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/0.0.
|
|
15
|
+
@superblocksteam/cli/0.0.23 linux-x64 node-v18.17.1
|
|
16
16
|
$ superblocks --help [COMMAND]
|
|
17
17
|
USAGE
|
|
18
18
|
$ superblocks COMMAND
|
|
@@ -38,7 +38,10 @@ Creates a new Superblocks component in the current application folder
|
|
|
38
38
|
|
|
39
39
|
```
|
|
40
40
|
USAGE
|
|
41
|
-
$ superblocks components create
|
|
41
|
+
$ superblocks components create [--example]
|
|
42
|
+
|
|
43
|
+
FLAGS
|
|
44
|
+
--example Create example component
|
|
42
45
|
|
|
43
46
|
DESCRIPTION
|
|
44
47
|
Creates a new Superblocks component in the current application folder
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
2
|
import { useSuperblocksContext } from "@superblocksteam/custom-components";
|
|
3
3
|
import { type Props, type EventTriggers } from "./types";
|
|
4
4
|
import { Task, ErrorComponent, validateTasks } from "./validation";
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"lint:fix": "npx eslint . --fix"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@superblocksteam/custom-components": "0.0.
|
|
10
|
+
"@superblocksteam/custom-components": "0.0.23",
|
|
11
11
|
"react": "^18",
|
|
12
12
|
"react-dom": "^18"
|
|
13
13
|
},
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"eslint-config-prettier": "^8.8.0",
|
|
20
20
|
"eslint-plugin-prettier": "^5.0.0",
|
|
21
21
|
"eslint-plugin-react": "^7.32.2",
|
|
22
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
22
23
|
"prettier": "3.0.0",
|
|
23
24
|
"sass": "^1.64.2",
|
|
24
25
|
"typescript": "^5.1.6"
|
|
@@ -2,6 +2,9 @@ import { AuthenticatedApplicationCommand } from "../../common/authenticated-comm
|
|
|
2
2
|
export default class CreateComponent extends AuthenticatedApplicationCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
private dataTypeToDefaultControlType;
|
|
5
|
+
static flags: {
|
|
6
|
+
example: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
5
8
|
private initializeComponentByWizard;
|
|
6
9
|
private initializeComponentByExample;
|
|
7
10
|
run(): Promise<void>;
|
|
@@ -111,13 +111,16 @@ class CreateComponent extends authenticated_command_1.AuthenticatedApplicationCo
|
|
|
111
111
|
label: propertyLabel,
|
|
112
112
|
controlType: this.dataTypeToDefaultControlType(propertyType),
|
|
113
113
|
};
|
|
114
|
+
this.log(`You can configure the remaining display attributes (placeholder, etc) in the config.ts file directly.`);
|
|
114
115
|
}
|
|
115
116
|
properties.push({
|
|
116
117
|
path: propertyPath,
|
|
117
118
|
dataType: propertyType,
|
|
118
119
|
propertiesPanelDisplay,
|
|
120
|
+
// Optional but include them by default
|
|
121
|
+
isExternallyReadable: true,
|
|
122
|
+
isExternallySettable: true,
|
|
119
123
|
});
|
|
120
|
-
this.log(`You can configure the remaining display attributes (tooltip, placeholder, etc) in the config.ts file directly.`);
|
|
121
124
|
this.log();
|
|
122
125
|
const addAnotherProperty = (await (0, enquirer_1.prompt)({
|
|
123
126
|
type: "confirm",
|
|
@@ -190,6 +193,9 @@ class CreateComponent extends authenticated_command_1.AuthenticatedApplicationCo
|
|
|
190
193
|
const componentTsx = (0, create_component_defaults_1.getDefaultComponentTsx)(properties, events.map((prop) => prop.path));
|
|
191
194
|
if (isFirstTimeCreate) {
|
|
192
195
|
await fs.copy(DEFAULT_PACKAGE_JSON_TEMPLATE_PATH, ".");
|
|
196
|
+
// There is a very old npm bug where it won't publish .gitignore files
|
|
197
|
+
// https://github.com/npm/npm/issues/3763
|
|
198
|
+
await fs.move("./gitignore_will_rename", "./.gitignore");
|
|
193
199
|
}
|
|
194
200
|
await fs.ensureDir("components/" + name);
|
|
195
201
|
await fs.writeFile(`components/${name}/config.ts`, configTs);
|
|
@@ -202,6 +208,9 @@ class CreateComponent extends authenticated_command_1.AuthenticatedApplicationCo
|
|
|
202
208
|
};
|
|
203
209
|
}
|
|
204
210
|
async initializeComponentByExample() {
|
|
211
|
+
if (await fs.exists("components/ToDoList")) {
|
|
212
|
+
this.error("Example component ToDoList already exists", { exit: 1 });
|
|
213
|
+
}
|
|
205
214
|
const response = {
|
|
206
215
|
displayName: "To-Do List (Example)",
|
|
207
216
|
name: "ToDoList",
|
|
@@ -214,6 +223,8 @@ class CreateComponent extends authenticated_command_1.AuthenticatedApplicationCo
|
|
|
214
223
|
placeholder: "{ taskId: { taskName: 'Task Name', taskStatus: 'complete' | 'todo' } }",
|
|
215
224
|
controlType: "js-expr",
|
|
216
225
|
},
|
|
226
|
+
isExternallyReadable: true,
|
|
227
|
+
isExternallySettable: true,
|
|
217
228
|
},
|
|
218
229
|
],
|
|
219
230
|
events: [
|
|
@@ -239,6 +250,11 @@ class CreateComponent extends authenticated_command_1.AuthenticatedApplicationCo
|
|
|
239
250
|
.join(""),
|
|
240
251
|
});
|
|
241
252
|
await fs.copy(DEFAULT_PACKAGE_JSON_TEMPLATE_PATH, ".");
|
|
253
|
+
// There is a very old npm bug where it won't publish .gitignore files
|
|
254
|
+
// https://github.com/npm/npm/issues/3763
|
|
255
|
+
await fs.move("./gitignore_will_rename", "./.gitignore", {
|
|
256
|
+
overwrite: true,
|
|
257
|
+
});
|
|
242
258
|
await fs.ensureDir("components/" + response.name);
|
|
243
259
|
await fs.copy(DEFAULT_EXAMPLE_COMPONENT_TEMPLATE_PATH, `./components/${response.name}/`);
|
|
244
260
|
await fs.writeFile(`components/${response.name}/config.ts`, configTs);
|
|
@@ -246,26 +262,27 @@ class CreateComponent extends authenticated_command_1.AuthenticatedApplicationCo
|
|
|
246
262
|
}
|
|
247
263
|
async run() {
|
|
248
264
|
this.log();
|
|
265
|
+
const { flags: parsedFlags } = await this.parse(CreateComponent);
|
|
249
266
|
const isFirstTimeCreate = !(await fs.exists("package.json"));
|
|
250
|
-
let response;
|
|
251
267
|
if (isFirstTimeCreate) {
|
|
252
268
|
this.log(`${(0, colorette_1.cyanBright)("ℹ")} Welcome to Custom Components! In order to help you get started, we’ve built an example To-Do List Component. You can use this component as a template as you build your own Custom Component. To work with this component, we recommend following along with our quickstart guide: ${(0, colorette_1.magenta)("https://docs.superblocks.com/applications/custom-components/quickstart")}`);
|
|
253
269
|
this.log();
|
|
270
|
+
}
|
|
271
|
+
let initExampleComponent = parsedFlags.example;
|
|
272
|
+
if (!parsedFlags.example && isFirstTimeCreate) {
|
|
273
|
+
// if the example component flag is not set and this is the first time the user is creating a component, prompt the user
|
|
254
274
|
this.log(`If you choose to generate the example component, you will not have to provide any additional inputs. You can re-run superblocks components create once you are ready to create your own component from scratch. `);
|
|
255
275
|
this.log();
|
|
256
|
-
|
|
276
|
+
initExampleComponent = (await (0, enquirer_1.prompt)({
|
|
257
277
|
name: "value",
|
|
258
278
|
type: "confirm",
|
|
259
279
|
message: "Would you like to generate an example custom component?",
|
|
260
280
|
initial: false,
|
|
261
281
|
})).value;
|
|
262
|
-
response = initExampleComponent
|
|
263
|
-
? await this.initializeComponentByExample()
|
|
264
|
-
: await this.initializeComponentByWizard(isFirstTimeCreate);
|
|
265
|
-
}
|
|
266
|
-
else {
|
|
267
|
-
response = await this.initializeComponentByWizard(isFirstTimeCreate);
|
|
268
282
|
}
|
|
283
|
+
const response = initExampleComponent
|
|
284
|
+
? await this.initializeComponentByExample()
|
|
285
|
+
: await this.initializeComponentByWizard(isFirstTimeCreate);
|
|
269
286
|
this.log((0, colorette_1.green)("Successfully created component! Added the following files:"));
|
|
270
287
|
this.log();
|
|
271
288
|
const tree = core_1.ux.tree();
|
|
@@ -292,8 +309,16 @@ class CreateComponent extends authenticated_command_1.AuthenticatedApplicationCo
|
|
|
292
309
|
}
|
|
293
310
|
core_1.ux.action.stop();
|
|
294
311
|
}
|
|
295
|
-
|
|
312
|
+
const headers = {
|
|
313
|
+
[util_1.COMPONENT_EVENT_HEADER]: util_1.ComponentEvent.CREATE,
|
|
314
|
+
};
|
|
315
|
+
this.registerComponents(headers);
|
|
296
316
|
}
|
|
297
317
|
}
|
|
298
318
|
CreateComponent.description = "Creates a new Superblocks component in the current application folder";
|
|
319
|
+
CreateComponent.flags = {
|
|
320
|
+
example: core_1.Flags.boolean({
|
|
321
|
+
description: "Create example component",
|
|
322
|
+
}),
|
|
323
|
+
};
|
|
299
324
|
exports.default = CreateComponent;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const util_1 = require("@superblocksteam/util");
|
|
3
4
|
const authenticated_command_1 = require("../../common/authenticated-command");
|
|
4
5
|
class Register extends authenticated_command_1.AuthenticatedApplicationCommand {
|
|
5
6
|
async run() {
|
|
6
|
-
|
|
7
|
+
const headers = {
|
|
8
|
+
[util_1.COMPONENT_EVENT_HEADER]: util_1.ComponentEvent.REGISTER,
|
|
9
|
+
};
|
|
10
|
+
await this.registerComponents(headers);
|
|
7
11
|
}
|
|
8
12
|
}
|
|
9
13
|
Register.description = "Registers all local component config files";
|
|
@@ -20,7 +20,10 @@ class Upload extends authenticated_command_1.AuthenticatedApplicationCommand {
|
|
|
20
20
|
exit: 1,
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const headers = {
|
|
24
|
+
[util_1.COMPONENT_EVENT_HEADER]: util_1.ComponentEvent.REGISTER,
|
|
25
|
+
};
|
|
26
|
+
const configs = await this.registerComponents(headers);
|
|
24
27
|
if (!configs)
|
|
25
28
|
return;
|
|
26
29
|
// Map component name to component path- each name is a separate entry point
|
|
@@ -49,7 +52,20 @@ class Upload extends authenticated_command_1.AuthenticatedApplicationCommand {
|
|
|
49
52
|
write: true,
|
|
50
53
|
},
|
|
51
54
|
customLogger: viteLogger,
|
|
52
|
-
plugins: [
|
|
55
|
+
plugins: [
|
|
56
|
+
(0, plugin_react_1.default)(),
|
|
57
|
+
(0, react_shim_1.injectReactVersionsPlugin)(),
|
|
58
|
+
(0, css_plugin_1.productionCssPlugin)(),
|
|
59
|
+
{
|
|
60
|
+
name: "remove-node-module-maps",
|
|
61
|
+
apply: "build",
|
|
62
|
+
transform(code, id) {
|
|
63
|
+
if (id.includes("node_modules")) {
|
|
64
|
+
return { code, map: { mappings: "" } }; // removes these sourcemaps
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
],
|
|
53
69
|
});
|
|
54
70
|
})();
|
|
55
71
|
core_1.ux.action.stop();
|
|
@@ -65,6 +81,7 @@ class Upload extends authenticated_command_1.AuthenticatedApplicationCommand {
|
|
|
65
81
|
const fileRelativePaths = [];
|
|
66
82
|
const excluded = [
|
|
67
83
|
".superblocks",
|
|
84
|
+
".git",
|
|
68
85
|
"node_modules",
|
|
69
86
|
"apis",
|
|
70
87
|
"page.yaml",
|
|
@@ -77,8 +94,7 @@ class Upload extends authenticated_command_1.AuthenticatedApplicationCommand {
|
|
|
77
94
|
}
|
|
78
95
|
catch (e) {
|
|
79
96
|
core_1.ux.action.stop();
|
|
80
|
-
this.
|
|
81
|
-
this.error("Failed to upload components", { exit: 1 });
|
|
97
|
+
this.error(`Failed to upload components - ${e.message}`, { exit: 1 });
|
|
82
98
|
}
|
|
83
99
|
this.log("You can now disable local dev mode and test your production assets");
|
|
84
100
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.healthEndpointMiddleware = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_shim_1 = require("@superblocksteam/react-shim");
|
|
6
|
+
const util_1 = require("@superblocksteam/util");
|
|
6
7
|
const vite_custom_component_reload_plugin_1 = require("@superblocksteam/vite-custom-component-reload-plugin");
|
|
7
8
|
const plugin_react_1 = tslib_1.__importDefault(require("@vitejs/plugin-react"));
|
|
8
9
|
const colorette_1 = require("colorette");
|
|
@@ -29,7 +30,10 @@ function healthEndpointMiddleware() {
|
|
|
29
30
|
exports.healthEndpointMiddleware = healthEndpointMiddleware;
|
|
30
31
|
class Watch extends authenticated_command_1.AuthenticatedApplicationCommand {
|
|
31
32
|
async run() {
|
|
32
|
-
|
|
33
|
+
const headers = {
|
|
34
|
+
[util_1.COMPONENT_EVENT_HEADER]: util_1.ComponentEvent.REGISTER,
|
|
35
|
+
};
|
|
36
|
+
await this.registerComponents(headers);
|
|
33
37
|
this.log((0, colorette_1.yellow)("Remember to refresh your application to see any newly registered components."));
|
|
34
38
|
this.log();
|
|
35
39
|
const port = 3002;
|
package/dist/commands/init.js
CHANGED
|
@@ -28,7 +28,7 @@ class Initialize extends authenticated_command_1.AuthenticatedCommand {
|
|
|
28
28
|
ctx.writtenResources = {};
|
|
29
29
|
ctx.now = new Date().toISOString();
|
|
30
30
|
try {
|
|
31
|
-
ctx.existingSuperblocksConfig = (await (0, util_1.getSuperblocksMonorepoConfigJson)())[0];
|
|
31
|
+
ctx.existingSuperblocksConfig = (await (0, util_1.getSuperblocksMonorepoConfigJson)(true))[0];
|
|
32
32
|
}
|
|
33
33
|
catch {
|
|
34
34
|
// no existing superblocks config
|
|
@@ -62,7 +62,13 @@ class Initialize extends authenticated_command_1.AuthenticatedCommand {
|
|
|
62
62
|
task: async (ctx, task) => {
|
|
63
63
|
const [resourceId, resourceType] = getResourceIdFromUrl(args.resourceUrl);
|
|
64
64
|
if (resourceType === "APPLICATION") {
|
|
65
|
-
const
|
|
65
|
+
const headers = {
|
|
66
|
+
[util_1.COMPONENT_EVENT_HEADER]: util_1.ComponentEvent.INIT,
|
|
67
|
+
};
|
|
68
|
+
const application = await this.getSdk().fetchApplication({
|
|
69
|
+
applicationId: resourceId,
|
|
70
|
+
headers,
|
|
71
|
+
});
|
|
66
72
|
ctx.fetchedResources[application.application.id] = {
|
|
67
73
|
resourceType,
|
|
68
74
|
name: application.application.name,
|
|
@@ -104,7 +110,14 @@ class Initialize extends authenticated_command_1.AuthenticatedCommand {
|
|
|
104
110
|
subtasks.push({
|
|
105
111
|
title: `Fetching application ${resource.name}...`,
|
|
106
112
|
task: async (_ctx, task) => {
|
|
107
|
-
const
|
|
113
|
+
const headers = {
|
|
114
|
+
[util_1.COMPONENT_EVENT_HEADER]: util_1.ComponentEvent.INIT,
|
|
115
|
+
};
|
|
116
|
+
const application = await this.getSdk().fetchApplication({
|
|
117
|
+
applicationId: resourceId,
|
|
118
|
+
viewMode: ctx.viewMode,
|
|
119
|
+
headers,
|
|
120
|
+
});
|
|
108
121
|
task.title += `: fetched`;
|
|
109
122
|
ctx.writtenResources[resourceId] =
|
|
110
123
|
await (0, version_control_1.writeResourceToDisk)("APPLICATION", resourceId, application, now, process.cwd());
|
package/dist/commands/pull.js
CHANGED
|
@@ -51,7 +51,14 @@ class Pull extends authenticated_command_1.AuthenticatedCommand {
|
|
|
51
51
|
subtasks.push({
|
|
52
52
|
title: `Pulling application ${resource.location}...`,
|
|
53
53
|
task: async (_ctx, task) => {
|
|
54
|
-
const
|
|
54
|
+
const headers = {
|
|
55
|
+
[util_1.COMPONENT_EVENT_HEADER]: util_1.ComponentEvent.PULL,
|
|
56
|
+
};
|
|
57
|
+
const application = await this.getSdk().fetchApplication({
|
|
58
|
+
applicationId: resourceId,
|
|
59
|
+
viewMode,
|
|
60
|
+
headers,
|
|
61
|
+
});
|
|
55
62
|
task.title += `: fetched`;
|
|
56
63
|
ctx.writtenResources[resourceId] =
|
|
57
64
|
await (0, version_control_1.writeResourceToDisk)("APPLICATION", resourceId, application, now, superblocksRootPath, resource.location);
|
|
@@ -12,5 +12,5 @@ export declare abstract class AuthenticatedApplicationCommand extends Authentica
|
|
|
12
12
|
applicationConfig: SuperblocksApplicationConfig;
|
|
13
13
|
protected getEditModeUrl(): Promise<string>;
|
|
14
14
|
protected init(): Promise<void>;
|
|
15
|
-
protected registerComponents(): Promise<Record<string, any> | undefined>;
|
|
15
|
+
protected registerComponents(injectedHeaders?: Record<string, string>): Promise<Record<string, any> | undefined>;
|
|
16
16
|
}
|
|
@@ -139,7 +139,7 @@ class AuthenticatedApplicationCommand extends AuthenticatedCommand {
|
|
|
139
139
|
this.warn(`Could not read page.yaml to determine version compatibility: ${e.message}`);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
async registerComponents() {
|
|
142
|
+
async registerComponents(injectedHeaders) {
|
|
143
143
|
var _a;
|
|
144
144
|
core_1.ux.action.start("Checking CLI version compatibility...");
|
|
145
145
|
try {
|
|
@@ -150,7 +150,10 @@ class AuthenticatedApplicationCommand extends AuthenticatedCommand {
|
|
|
150
150
|
|
|
151
151
|
${(0, colorette_1.cyan)("superblocks migrate")}`);
|
|
152
152
|
}
|
|
153
|
-
if (
|
|
153
|
+
if (versionStr.startsWith("file:")) {
|
|
154
|
+
this.warn(`You are using a local version of the @superblocksteam/custom-components library. It is not possible to check its version compatibility with the CLI.`);
|
|
155
|
+
}
|
|
156
|
+
else if (!semver_1.default.satisfies(this.config.version, versionStr)) {
|
|
154
157
|
throw new Error(`You must upgrade the @superblocksteam/custom-components library. You are using ${versionStr} but the CLI is ${this.config.version}. Run:
|
|
155
158
|
|
|
156
159
|
${(0, colorette_1.cyan)("superblocks migrate")}`);
|
|
@@ -185,7 +188,7 @@ ${(0, colorette_1.cyan)("superblocks migrate")}`);
|
|
|
185
188
|
core_1.ux.action.stop();
|
|
186
189
|
try {
|
|
187
190
|
core_1.ux.action.start("Registering components...");
|
|
188
|
-
await this.getSdk().registerComponents(this.applicationConfig.id, configs);
|
|
191
|
+
await this.getSdk().registerComponents(this.applicationConfig.id, configs, injectedHeaders);
|
|
189
192
|
core_1.ux.action.stop();
|
|
190
193
|
}
|
|
191
194
|
catch (e) {
|
|
@@ -18,16 +18,22 @@ export default {
|
|
|
18
18
|
componentPath: "components/${name}/component.tsx",
|
|
19
19
|
properties: [${indent(propertiesRendered, 4).trim()}],
|
|
20
20
|
events: [${indent(eventHandlersRendered, 4).trim()}],
|
|
21
|
+
gridDimensions: {
|
|
22
|
+
initialColumns: 50,
|
|
23
|
+
initialRows: 30,
|
|
24
|
+
},
|
|
21
25
|
} satisfies ComponentConfig;
|
|
22
26
|
`;
|
|
23
27
|
exports.getDefaultConfigTs = getDefaultConfigTs;
|
|
24
|
-
const getDefaultComponentTsx = (properties, eventHandlers) => `import
|
|
25
|
-
import { useSuperblocksContext } from "@superblocksteam/custom-components";
|
|
28
|
+
const getDefaultComponentTsx = (properties, eventHandlers) => `import { useSuperblocksContext, useSuperblocksIsLoading } from "@superblocksteam/custom-components";
|
|
26
29
|
import { type Props, type EventTriggers } from "./types";
|
|
27
30
|
|
|
28
31
|
export default function Component({${properties.length === 0
|
|
29
32
|
? ""
|
|
30
33
|
: "\n" + properties.map((v) => indent(v.path, 2) + ",\n").join("")}}: Props) {
|
|
34
|
+
// If any of your component's properties are connected to APIs, you might want to show a loading indicator while the data is
|
|
35
|
+
// loading. The \`useSuperblocksIsLoading\` hook returns a boolean that indicates whether this is the case.
|
|
36
|
+
const isLoading = useSuperblocksIsLoading();
|
|
31
37
|
const {
|
|
32
38
|
updateProperties,
|
|
33
39
|
events: {${"\n" + eventHandlers.map((v) => indent(v, 6) + ",\n").join("")} },
|
|
@@ -44,7 +50,7 @@ export default function Component({${properties.length === 0
|
|
|
44
50
|
backgroundColor: "#a7aebe",
|
|
45
51
|
}}
|
|
46
52
|
>
|
|
47
|
-
<h1 style={{ color: "white" }}>{"<Insert Component Here>"}</h1>
|
|
53
|
+
<h1 style={{ color: "white" }}>{isLoading ? <div>Loading...</div> : "<Insert Component Here>"}</h1>
|
|
48
54
|
</div>
|
|
49
55
|
);
|
|
50
56
|
}
|
|
@@ -17,8 +17,8 @@ const BREAKING_APPLICATION_VERSIONS = [
|
|
|
17
17
|
version: "0.0.21",
|
|
18
18
|
// This is an example message because 0.0.21 does not have a docs page for any migrations. This will be added
|
|
19
19
|
// in a future release
|
|
20
|
-
message: `${(0, colorette_1.red)("
|
|
21
|
-
due to breaking changes in the config.ts format and
|
|
20
|
+
message: `${(0, colorette_1.red)("Error")}: This version of the CLI is incompatible with any Custom Components you've previously used,
|
|
21
|
+
due to breaking changes introduced in the config.ts format and Custom Components React API.
|
|
22
22
|
|
|
23
23
|
${(0, colorette_1.bold)("Your existing components are safe.")}
|
|
24
24
|
|
|
@@ -26,6 +26,20 @@ To manually migrate:
|
|
|
26
26
|
|
|
27
27
|
1. Rename "eventHandlers" to "events".
|
|
28
28
|
2. Update your properties to use the new format: ${(0, colorette_1.magenta)("https://docs.superblocks.com/applications/custom-components/development-lifecycle#configts")}
|
|
29
|
+
`,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
version: "0.0.23",
|
|
33
|
+
message: `${(0, colorette_1.red)("Warning")}: Type definitions for custom components have changed to include null values,
|
|
34
|
+
which were missing from previous types. The previous types were not accurate.
|
|
35
|
+
Superblocks represents missing/undefined properties as null.
|
|
36
|
+
|
|
37
|
+
To manually update, you should follow Typescript errors in your IDE and update your code
|
|
38
|
+
to handle null values.
|
|
39
|
+
|
|
40
|
+
${(0, colorette_1.bold)("Your existing components are safe.")}
|
|
41
|
+
|
|
42
|
+
See changelog: ${(0, colorette_1.magenta)("https://github.com/superblocksteam/superblocks-cli/blob/main/CHANGELOG.md")}
|
|
29
43
|
`,
|
|
30
44
|
},
|
|
31
45
|
];
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.23",
|
|
3
3
|
"commands": {
|
|
4
4
|
"init": {
|
|
5
5
|
"id": "init",
|
|
@@ -113,7 +113,14 @@
|
|
|
113
113
|
"pluginAlias": "@superblocksteam/cli",
|
|
114
114
|
"pluginType": "core",
|
|
115
115
|
"aliases": [],
|
|
116
|
-
"flags": {
|
|
116
|
+
"flags": {
|
|
117
|
+
"example": {
|
|
118
|
+
"name": "example",
|
|
119
|
+
"type": "boolean",
|
|
120
|
+
"description": "Create example component",
|
|
121
|
+
"allowNo": false
|
|
122
|
+
}
|
|
123
|
+
},
|
|
117
124
|
"args": {}
|
|
118
125
|
},
|
|
119
126
|
"components:register": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superblocksteam/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"description": "Official Superblocks CLI",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superblocks": "bin/run"
|
|
@@ -18,12 +18,12 @@
|
|
|
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": "
|
|
22
|
-
"@superblocksteam/react-shim": "
|
|
23
|
-
"@superblocksteam/sdk": "
|
|
24
|
-
"@superblocksteam/util": "
|
|
25
|
-
"@superblocksteam/vite-custom-component-reload-plugin": "
|
|
26
|
-
"@vitejs/plugin-react": "^4.0.
|
|
21
|
+
"@superblocksteam/css-plugin": "0.0.23",
|
|
22
|
+
"@superblocksteam/react-shim": "0.0.23",
|
|
23
|
+
"@superblocksteam/sdk": "0.0.23",
|
|
24
|
+
"@superblocksteam/util": "0.0.23",
|
|
25
|
+
"@superblocksteam/vite-custom-component-reload-plugin": "0.0.23",
|
|
26
|
+
"@vitejs/plugin-react": "^4.0.4",
|
|
27
27
|
"colorette": "^2.0.19",
|
|
28
28
|
"enquirer": "^2.3.6",
|
|
29
29
|
"fs-extra": "^11.1.1",
|
|
@@ -68,10 +68,12 @@
|
|
|
68
68
|
"posttest": "npm run lint",
|
|
69
69
|
"prepack": "npm run build && oclif manifest && oclif readme",
|
|
70
70
|
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
|
|
71
|
+
"typecheck": "tsc --noEmit",
|
|
71
72
|
"update-readme": "oclif readme"
|
|
72
73
|
},
|
|
73
74
|
"engines": {
|
|
74
|
-
"node": ">=
|
|
75
|
+
"node": ">=16.0.0",
|
|
76
|
+
"npm": ">=8.0.0"
|
|
75
77
|
},
|
|
76
78
|
"keywords": [
|
|
77
79
|
"oclif"
|