@superblocksteam/cli 1.0.0 → 1.1.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.
- package/README.md +49 -18
- package/assets/custom-components/setup/package.json +1 -1
- package/dist/commands/components/create.js +11 -8
- package/dist/commands/components/upload.d.ts +3 -0
- package/dist/commands/components/upload.js +16 -2
- package/dist/commands/components/watch.js +20 -3
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.js +26 -15
- package/dist/commands/login.js +3 -5
- package/dist/commands/pull.d.ts +2 -1
- package/dist/commands/pull.js +53 -23
- package/dist/commands/push.d.ts +14 -0
- package/dist/commands/push.js +240 -0
- package/dist/commands/rm.d.ts +1 -1
- package/dist/commands/rm.js +4 -4
- package/dist/common/authenticated-command.js +2 -0
- package/dist/common/version-control.d.ts +13 -1
- package/dist/common/version-control.js +93 -12
- package/oclif.manifest.json +56 -12
- package/package.json +9 -7
- package/dist/util/identifiers.d.ts +0 -7
- package/dist/util/identifiers.js +0 -37
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.1.0",
|
|
3
3
|
"commands": {
|
|
4
4
|
"init": {
|
|
5
5
|
"id": "init",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"args": {
|
|
31
|
-
"
|
|
32
|
-
"name": "
|
|
31
|
+
"resource_url": {
|
|
32
|
+
"name": "resource_url",
|
|
33
33
|
"description": "Superblocks resource URL (i.e. https://app.superblocks.com/applications/<application_id>/pages/<page_id>)",
|
|
34
34
|
"required": false
|
|
35
35
|
}
|
|
@@ -79,8 +79,7 @@
|
|
|
79
79
|
"examples": [
|
|
80
80
|
"<%= config.bin %> <%= command.id %>",
|
|
81
81
|
"<%= config.bin %> <%= command.id %> apps/my-app",
|
|
82
|
-
"<%= config.bin %> <%= command.id %>
|
|
83
|
-
"<%= config.bin %> <%= command.id %> backends/my-scheduled-job"
|
|
82
|
+
"<%= config.bin %> <%= command.id %> apps/my-app -b feature-branch"
|
|
84
83
|
],
|
|
85
84
|
"flags": {
|
|
86
85
|
"mode": {
|
|
@@ -95,16 +94,52 @@
|
|
|
95
94
|
"deployed"
|
|
96
95
|
],
|
|
97
96
|
"default": "latest-edits"
|
|
97
|
+
},
|
|
98
|
+
"branch": {
|
|
99
|
+
"name": "branch",
|
|
100
|
+
"type": "option",
|
|
101
|
+
"char": "b",
|
|
102
|
+
"description": "Superblocks branch to pull from, the current git branch will be used by default",
|
|
103
|
+
"multiple": false
|
|
98
104
|
}
|
|
99
105
|
},
|
|
100
106
|
"args": {
|
|
101
|
-
"
|
|
102
|
-
"name": "
|
|
103
|
-
"description": "Superblocks resource location to pull (i.e. apps/my-app
|
|
107
|
+
"resource_path": {
|
|
108
|
+
"name": "resource_path",
|
|
109
|
+
"description": "Superblocks resource location to pull (i.e. apps/my-app)",
|
|
104
110
|
"required": false
|
|
105
111
|
}
|
|
106
112
|
}
|
|
107
113
|
},
|
|
114
|
+
"push": {
|
|
115
|
+
"id": "push",
|
|
116
|
+
"description": "Import objects from local filesystem to Superblocks",
|
|
117
|
+
"strict": true,
|
|
118
|
+
"pluginName": "@superblocksteam/cli",
|
|
119
|
+
"pluginAlias": "@superblocksteam/cli",
|
|
120
|
+
"pluginType": "core",
|
|
121
|
+
"aliases": [],
|
|
122
|
+
"examples": [
|
|
123
|
+
"<%= config.bin %> <%= command.id %>",
|
|
124
|
+
"<%= config.bin %> <%= command.id %> apps/my-app",
|
|
125
|
+
"<%= config.bin %> <%= command.id %> apps/my-app -b feature-branch"
|
|
126
|
+
],
|
|
127
|
+
"flags": {
|
|
128
|
+
"branch": {
|
|
129
|
+
"name": "branch",
|
|
130
|
+
"type": "option",
|
|
131
|
+
"char": "b",
|
|
132
|
+
"description": "Superblocks branch to push to, the current git branch will be used by default",
|
|
133
|
+
"multiple": false
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"args": {
|
|
137
|
+
"resource_path": {
|
|
138
|
+
"name": "resource_path",
|
|
139
|
+
"description": "Superblocks resource location to push (e.g. apps/my-app)"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
},
|
|
108
143
|
"rm": {
|
|
109
144
|
"id": "rm",
|
|
110
145
|
"description": "Remove a Superblocks resource from the local Superblocks project and delete the resource folder directory locally (if it exists)",
|
|
@@ -119,8 +154,8 @@
|
|
|
119
154
|
],
|
|
120
155
|
"flags": {},
|
|
121
156
|
"args": {
|
|
122
|
-
"
|
|
123
|
-
"name": "
|
|
157
|
+
"resource_path": {
|
|
158
|
+
"name": "resource_path",
|
|
124
159
|
"description": "Superblocks resource location (i.e. apps/my-spectacular-app)"
|
|
125
160
|
}
|
|
126
161
|
}
|
|
@@ -166,9 +201,18 @@
|
|
|
166
201
|
"pluginType": "core",
|
|
167
202
|
"aliases": [],
|
|
168
203
|
"examples": [
|
|
169
|
-
"<%= config.bin %> components upload"
|
|
204
|
+
"<%= config.bin %> components upload",
|
|
205
|
+
"<%= config.bin %> components upload -b feature-branch"
|
|
170
206
|
],
|
|
171
|
-
"flags": {
|
|
207
|
+
"flags": {
|
|
208
|
+
"branch": {
|
|
209
|
+
"name": "branch",
|
|
210
|
+
"type": "option",
|
|
211
|
+
"char": "b",
|
|
212
|
+
"description": "Superblocks branch to push to, the current (local) git branch will be used by default",
|
|
213
|
+
"multiple": false
|
|
214
|
+
}
|
|
215
|
+
},
|
|
172
216
|
"args": {}
|
|
173
217
|
},
|
|
174
218
|
"components:watch": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superblocksteam/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
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.
|
|
22
|
-
"@superblocksteam/react-shim": "1.
|
|
23
|
-
"@superblocksteam/sdk": "1.
|
|
24
|
-
"@superblocksteam/util": "1.
|
|
25
|
-
"@superblocksteam/vite-custom-component-reload-plugin": "1.
|
|
21
|
+
"@superblocksteam/css-plugin": "1.1.0",
|
|
22
|
+
"@superblocksteam/react-shim": "1.1.0",
|
|
23
|
+
"@superblocksteam/sdk": "1.1.0",
|
|
24
|
+
"@superblocksteam/util": "1.1.0",
|
|
25
|
+
"@superblocksteam/vite-custom-component-reload-plugin": "1.1.0",
|
|
26
26
|
"@vitejs/plugin-react": "^4.0.4",
|
|
27
27
|
"colorette": "^2.0.19",
|
|
28
28
|
"enquirer": "^2.3.6",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"listr2": "6.6.0",
|
|
31
31
|
"lodash": "^4.17.21",
|
|
32
32
|
"semver": "^7.5.4",
|
|
33
|
+
"simple-git": "^3.20.0",
|
|
33
34
|
"slugify": "^1.6.6",
|
|
34
35
|
"vite": "^4.4.8",
|
|
35
36
|
"vite-plugin-inspect": "^0.7.28",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"@typescript-eslint/eslint-plugin": "^5.60.1",
|
|
46
47
|
"@typescript-eslint/parser": "^5.60.1",
|
|
47
48
|
"chai": "^4",
|
|
48
|
-
"eslint": "^8.
|
|
49
|
+
"eslint": "^8.48.0",
|
|
49
50
|
"eslint-config-prettier": "8.8.0",
|
|
50
51
|
"eslint-plugin-import": "2.27.5",
|
|
51
52
|
"eslint-plugin-prettier": "4.2.1",
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
"typescript": "^5.1.6"
|
|
60
61
|
},
|
|
61
62
|
"scripts": {
|
|
63
|
+
"preinstall": "node -e \"if (process.versions.node.split('.')[0] < 16) { console.error('Incompatible Node version: Please use Node.js v16 or higher'); process.exit(1);}\"",
|
|
62
64
|
"build": "tsc --build",
|
|
63
65
|
"clean": "npm run clean:build && rm -rf node_modules",
|
|
64
66
|
"clean:build": "tsc --build --clean && rm -rf dist tsconfig.tsbuildinfo",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Suggest an identifier based on a label, e.g. `My Component` -> `myComponent`.
|
|
3
|
-
* @param label The label to suggest an identifier for.
|
|
4
|
-
* @param capitalizeFirst Whether to capitalize the first letter of the identifier.
|
|
5
|
-
*/
|
|
6
|
-
export declare function suggestIdentifier(label: string, capitalizeFirst?: boolean): string;
|
|
7
|
-
export declare function isValidIdentifier(str: string): boolean;
|
package/dist/util/identifiers.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isValidIdentifier = exports.suggestIdentifier = void 0;
|
|
4
|
-
// convert a string to upper camel case, e.g. "123 & this is my component, foo-bar" -> "123ThisIsMyComponentFooBar"
|
|
5
|
-
function wordsToUpperCamelCase(str) {
|
|
6
|
-
return str
|
|
7
|
-
.split(/[^A-Za-z0-9_]+/)
|
|
8
|
-
.filter(Boolean)
|
|
9
|
-
.map((word) => word[0].toUpperCase() + word.slice(1))
|
|
10
|
-
.join("");
|
|
11
|
-
}
|
|
12
|
-
const digits = "Zero One Two Three Four Five Six Seven Eight Nine".split(" ");
|
|
13
|
-
// convert digits to words, e.g. "123" -> "OneTwoThree"
|
|
14
|
-
function digitsToWords(str) {
|
|
15
|
-
return str.replace(/\d/g, (char) => { var _a; return (_a = digits[parseInt(char, 10)]) !== null && _a !== void 0 ? _a : char; });
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Suggest an identifier based on a label, e.g. `My Component` -> `myComponent`.
|
|
19
|
-
* @param label The label to suggest an identifier for.
|
|
20
|
-
* @param capitalizeFirst Whether to capitalize the first letter of the identifier.
|
|
21
|
-
*/
|
|
22
|
-
function suggestIdentifier(label, capitalizeFirst = false) {
|
|
23
|
-
const upperCamelCase = wordsToUpperCamelCase(label)
|
|
24
|
-
// convert any digits at the start of the string to words as these are not valid in identifiers
|
|
25
|
-
.replace(/^\d+/, digitsToWords);
|
|
26
|
-
if (capitalizeFirst) {
|
|
27
|
-
return upperCamelCase;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
return upperCamelCase[0].toLowerCase() + upperCamelCase.slice(1);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.suggestIdentifier = suggestIdentifier;
|
|
34
|
-
function isValidIdentifier(str) {
|
|
35
|
-
return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(str);
|
|
36
|
-
}
|
|
37
|
-
exports.isValidIdentifier = isValidIdentifier;
|