@superblocksteam/cli 0.0.21 → 0.0.22
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 +1 -1
- package/assets/custom-components/setup/gitignore_will_rename +2 -0
- package/assets/custom-components/setup/package.json +1 -1
- package/dist/commands/components/create.js +13 -2
- package/dist/commands/components/register.js +5 -1
- package/dist/commands/components/upload.js +4 -1
- package/dist/commands/components/watch.js +5 -1
- package/dist/commands/init.js +15 -2
- package/dist/commands/pull.js +8 -1
- package/dist/common/authenticated-command.d.ts +1 -1
- package/dist/common/authenticated-command.js +2 -2
- package/dist/util/migrationWarningsForApplications.js +2 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
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.22 linux-x64 node-v18.17.0
|
|
16
16
|
$ superblocks --help [COMMAND]
|
|
17
17
|
USAGE
|
|
18
18
|
$ superblocks COMMAND
|
|
@@ -116,8 +116,11 @@ class CreateComponent extends authenticated_command_1.AuthenticatedApplicationCo
|
|
|
116
116
|
path: propertyPath,
|
|
117
117
|
dataType: propertyType,
|
|
118
118
|
propertiesPanelDisplay,
|
|
119
|
+
// Optional but include them by default
|
|
120
|
+
isExternallyReadable: true,
|
|
121
|
+
isExternallySettable: true,
|
|
119
122
|
});
|
|
120
|
-
this.log(`You can configure the remaining display attributes (
|
|
123
|
+
this.log(`You can configure the remaining display attributes (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);
|
|
@@ -214,6 +220,8 @@ class CreateComponent extends authenticated_command_1.AuthenticatedApplicationCo
|
|
|
214
220
|
placeholder: "{ taskId: { taskName: 'Task Name', taskStatus: 'complete' | 'todo' } }",
|
|
215
221
|
controlType: "js-expr",
|
|
216
222
|
},
|
|
223
|
+
isExternallyReadable: true,
|
|
224
|
+
isExternallySettable: true,
|
|
217
225
|
},
|
|
218
226
|
],
|
|
219
227
|
events: [
|
|
@@ -292,7 +300,10 @@ class CreateComponent extends authenticated_command_1.AuthenticatedApplicationCo
|
|
|
292
300
|
}
|
|
293
301
|
core_1.ux.action.stop();
|
|
294
302
|
}
|
|
295
|
-
|
|
303
|
+
const headers = {
|
|
304
|
+
[util_1.COMPONENT_EVENT_HEADER]: util_1.ComponentEvent.CREATE,
|
|
305
|
+
};
|
|
306
|
+
this.registerComponents(headers);
|
|
296
307
|
}
|
|
297
308
|
}
|
|
298
309
|
CreateComponent.description = "Creates a new Superblocks component in the current application folder";
|
|
@@ -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
|
|
@@ -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
|
@@ -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 {
|
|
@@ -185,7 +185,7 @@ ${(0, colorette_1.cyan)("superblocks migrate")}`);
|
|
|
185
185
|
core_1.ux.action.stop();
|
|
186
186
|
try {
|
|
187
187
|
core_1.ux.action.start("Registering components...");
|
|
188
|
-
await this.getSdk().registerComponents(this.applicationConfig.id, configs);
|
|
188
|
+
await this.getSdk().registerComponents(this.applicationConfig.id, configs, injectedHeaders);
|
|
189
189
|
core_1.ux.action.stop();
|
|
190
190
|
}
|
|
191
191
|
catch (e) {
|
|
@@ -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
|
|
package/oclif.manifest.json
CHANGED