@plasmicapp/cli 0.1.352 → 0.1.353
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/dist/api.d.ts +0 -8
- package/dist/index.js +1 -4319
- package/dist/lib.d.ts +5 -6
- package/dist/lib.js +464 -4742
- package/dist/plasmic.schema.json +0 -21
- package/dist/utils/config-utils.d.ts +0 -5
- package/package.json +2 -2
- package/src/actions/sync.ts +0 -4
- package/src/api.ts +0 -63
- package/src/index.ts +0 -62
- package/src/lib.ts +11 -12
- package/src/utils/code-utils.ts +1 -2
- package/src/utils/config-utils.ts +0 -6
- package/dist/actions/upload-bundle.d.ts +0 -15
- package/src/actions/upload-bundle.ts +0 -38
package/dist/plasmic.schema.json
CHANGED
|
@@ -354,21 +354,6 @@
|
|
|
354
354
|
],
|
|
355
355
|
"type": "object"
|
|
356
356
|
},
|
|
357
|
-
"JsBundleThemeConfig": {
|
|
358
|
-
"properties": {
|
|
359
|
-
"bundleName": {
|
|
360
|
-
"type": "string"
|
|
361
|
-
},
|
|
362
|
-
"themeFilePath": {
|
|
363
|
-
"type": "string"
|
|
364
|
-
}
|
|
365
|
-
},
|
|
366
|
-
"required": [
|
|
367
|
-
"bundleName",
|
|
368
|
-
"themeFilePath"
|
|
369
|
-
],
|
|
370
|
-
"type": "object"
|
|
371
|
-
},
|
|
372
357
|
"ProjectConfig": {
|
|
373
358
|
"properties": {
|
|
374
359
|
"codeComponents": {
|
|
@@ -420,12 +405,6 @@
|
|
|
420
405
|
"description": "True if the project was installed indirectly (as a dependency); if set,\ncodegen will not generate pages.",
|
|
421
406
|
"type": "boolean"
|
|
422
407
|
},
|
|
423
|
-
"jsBundleThemes": {
|
|
424
|
-
"items": {
|
|
425
|
-
"$ref": "#/definitions/JsBundleThemeConfig"
|
|
426
|
-
},
|
|
427
|
-
"type": "array"
|
|
428
|
-
},
|
|
429
408
|
"projectApiToken": {
|
|
430
409
|
"description": "Project API token. Grants read-only sync access to just this specific project and its dependencies.",
|
|
431
410
|
"type": "string"
|
|
@@ -103,10 +103,6 @@ export interface ImagesConfig {
|
|
|
103
103
|
*/
|
|
104
104
|
publicUrlPrefix?: string;
|
|
105
105
|
}
|
|
106
|
-
export interface JsBundleThemeConfig {
|
|
107
|
-
themeFilePath: string;
|
|
108
|
-
bundleName: string;
|
|
109
|
-
}
|
|
110
106
|
export interface CodeComponentConfig {
|
|
111
107
|
id: string;
|
|
112
108
|
name: string;
|
|
@@ -152,7 +148,6 @@ export interface ProjectConfig {
|
|
|
152
148
|
dataTokensFilePath: string;
|
|
153
149
|
/** File location for the project-wide plasmic.ts file. Relative to srcDir */
|
|
154
150
|
projectModuleFilePath: string;
|
|
155
|
-
jsBundleThemes?: JsBundleThemeConfig[];
|
|
156
151
|
codeComponents?: CodeComponentConfig[];
|
|
157
152
|
customFunctions?: CustomFunctionConfig[];
|
|
158
153
|
/** Metadata for each synced component in this project. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicapp/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.353",
|
|
4
4
|
"description": "plasmic cli for syncing local code with Plasmic designs",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=12"
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"wrap-ansi": "^7.0.0",
|
|
83
83
|
"yargs": "^15.4.1"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "dd6c2185b54eaf9af4c74118575c4e912486a5ae"
|
|
86
86
|
}
|
package/src/actions/sync.ts
CHANGED
|
@@ -757,10 +757,6 @@ async function syncProjectConfig(
|
|
|
757
757
|
checksum: checksums.projectCssChecksum,
|
|
758
758
|
});
|
|
759
759
|
|
|
760
|
-
if (projectConfig.jsBundleThemes?.length === 0) {
|
|
761
|
-
delete projectConfig.jsBundleThemes;
|
|
762
|
-
}
|
|
763
|
-
|
|
764
760
|
await syncGlobalContexts(
|
|
765
761
|
context,
|
|
766
762
|
projectBundle,
|
package/src/api.ts
CHANGED
|
@@ -81,12 +81,6 @@ export interface ProjectModuleBundle {
|
|
|
81
81
|
module: string;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
export interface JsBundleTheme {
|
|
85
|
-
themeFileName: string;
|
|
86
|
-
themeModule: string;
|
|
87
|
-
bundleName: string;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
84
|
export interface ProjectMetaBundle {
|
|
91
85
|
projectId: string;
|
|
92
86
|
projectName: string;
|
|
@@ -420,63 +414,6 @@ export class PlasmicApi {
|
|
|
420
414
|
return result.data as string;
|
|
421
415
|
}
|
|
422
416
|
|
|
423
|
-
async uploadBundle(
|
|
424
|
-
projectId: string,
|
|
425
|
-
bundleName: string,
|
|
426
|
-
bundleJs: string,
|
|
427
|
-
css: string[],
|
|
428
|
-
metaJson: string,
|
|
429
|
-
genModulePath: string | undefined,
|
|
430
|
-
genCssPaths: string[],
|
|
431
|
-
pkgVersion: string | undefined,
|
|
432
|
-
extraPropMetaJson: string | undefined,
|
|
433
|
-
themeProviderWrapper: string | undefined,
|
|
434
|
-
themeModule: string | undefined
|
|
435
|
-
): Promise<StyleTokensMap> {
|
|
436
|
-
const result = await this.post(
|
|
437
|
-
`${this.apiHost}/api/v1/projects/${projectId}/jsbundle/upload`,
|
|
438
|
-
{
|
|
439
|
-
projectId,
|
|
440
|
-
bundleName,
|
|
441
|
-
bundleJs,
|
|
442
|
-
css,
|
|
443
|
-
metaJson,
|
|
444
|
-
genModulePath,
|
|
445
|
-
genCssPaths,
|
|
446
|
-
pkgVersion,
|
|
447
|
-
extraPropMetaJson,
|
|
448
|
-
themeProviderWrapper,
|
|
449
|
-
themeModule,
|
|
450
|
-
}
|
|
451
|
-
);
|
|
452
|
-
return result.data as StyleTokensMap;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
async projectStyleTokens(
|
|
456
|
-
projectId: string,
|
|
457
|
-
branchName: string,
|
|
458
|
-
versionRange?: string
|
|
459
|
-
): Promise<StyleTokensMap> {
|
|
460
|
-
const result = await this.post(
|
|
461
|
-
`${this.apiHost}/api/v1/projects/${projectId}/code/tokens?branchName=${branchName}`,
|
|
462
|
-
{ versionRange }
|
|
463
|
-
);
|
|
464
|
-
return result.data as StyleTokensMap;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
async projectIcons(
|
|
468
|
-
projectId: string,
|
|
469
|
-
branchName: string,
|
|
470
|
-
versionRange?: string,
|
|
471
|
-
iconIds?: string[]
|
|
472
|
-
): Promise<ProjectIconsResponse> {
|
|
473
|
-
const result = await this.post(
|
|
474
|
-
`${this.apiHost}/api/v1/projects/${projectId}/code/icons?branchName=${branchName}`,
|
|
475
|
-
{ versionRange, iconIds }
|
|
476
|
-
);
|
|
477
|
-
return result.data as ProjectIconsResponse;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
417
|
connectSocket(): ReturnType<typeof socketio> {
|
|
481
418
|
const socket = socketio(this.studioHost, {
|
|
482
419
|
path: `/api/v1/socket`,
|
package/src/index.ts
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
import * as projectToken from "./actions/project-token";
|
|
14
14
|
import { StatusArgs, showProjectStatus } from "./actions/status";
|
|
15
15
|
import { SyncArgs, sync } from "./actions/sync";
|
|
16
|
-
import { UploadBundleArgs, uploadJsBundle } from "./actions/upload-bundle";
|
|
17
16
|
import { WatchArgs, watchProjects } from "./actions/watch";
|
|
18
17
|
import { handleError } from "./utils/error";
|
|
19
18
|
|
|
@@ -182,67 +181,6 @@ yargs
|
|
|
182
181
|
handleError(printProjectInfo(argv));
|
|
183
182
|
}
|
|
184
183
|
)
|
|
185
|
-
.command<UploadBundleArgs>(
|
|
186
|
-
"upload-bundle",
|
|
187
|
-
false,
|
|
188
|
-
(yargs2) =>
|
|
189
|
-
yargs2
|
|
190
|
-
.option("project", {
|
|
191
|
-
alias: "p",
|
|
192
|
-
describe: "ID of Plasmic project to upload the bundle to.",
|
|
193
|
-
type: "string",
|
|
194
|
-
})
|
|
195
|
-
.option("bundleName", {
|
|
196
|
-
describe: "Name of the bundle",
|
|
197
|
-
type: "string",
|
|
198
|
-
})
|
|
199
|
-
.option("bundleJsFile", {
|
|
200
|
-
describe: "Path of the bundled Javascript file in AMD format",
|
|
201
|
-
type: "string",
|
|
202
|
-
})
|
|
203
|
-
.option("cssFiles", {
|
|
204
|
-
describe: "Path of the bundled css files to load",
|
|
205
|
-
type: "array",
|
|
206
|
-
default: [],
|
|
207
|
-
})
|
|
208
|
-
.option("metaJsonFile", {
|
|
209
|
-
describe:
|
|
210
|
-
"Path of the meta data file (in JSON format) describing the component",
|
|
211
|
-
type: "string",
|
|
212
|
-
})
|
|
213
|
-
.option("extraPropMetaJsonFile", {
|
|
214
|
-
describe:
|
|
215
|
-
"Path of the extra meta data file (in JSON format) describing the component's additional controlled properties and initial properties",
|
|
216
|
-
type: "string",
|
|
217
|
-
})
|
|
218
|
-
.option("pkgVersion", {
|
|
219
|
-
describe:
|
|
220
|
-
"version of the package to include in the generated package.json",
|
|
221
|
-
type: "string",
|
|
222
|
-
default: "latest",
|
|
223
|
-
})
|
|
224
|
-
.option("genModulePath", {
|
|
225
|
-
describe:
|
|
226
|
-
"the path of include when generating import statement and generate package.json for. Default to bundleName.",
|
|
227
|
-
type: "string",
|
|
228
|
-
})
|
|
229
|
-
.option("themeProviderWrapper", {
|
|
230
|
-
describe: "the wrapper that inject theme to the bundle.",
|
|
231
|
-
type: "string",
|
|
232
|
-
})
|
|
233
|
-
.option("themeModuleFile", {
|
|
234
|
-
describe:
|
|
235
|
-
"the typescript file that contains and exports the implementation of themeProviderWrapper. Used for code generation. It must be specified together with themeProviderWrapper.",
|
|
236
|
-
type: "string",
|
|
237
|
-
})
|
|
238
|
-
.option("genCssPaths", {
|
|
239
|
-
describe:
|
|
240
|
-
"the list of css paths to import in generate code whenever a component in this bundle is used",
|
|
241
|
-
type: "array",
|
|
242
|
-
default: [],
|
|
243
|
-
}),
|
|
244
|
-
(argv) => handleError(uploadJsBundle(argv))
|
|
245
|
-
)
|
|
246
184
|
.command<projectToken.ProjectTokenArgs>(
|
|
247
185
|
"project-token <projectId>",
|
|
248
186
|
"Get projectApiToken for a given project",
|
package/src/lib.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { AuthArgs, auth } from "./actions/auth";
|
|
2
|
+
export {
|
|
3
|
+
ExportArgs,
|
|
4
|
+
exportProjectsCli as exportProjects,
|
|
5
|
+
} from "./actions/export";
|
|
6
|
+
export { FixImportsArgs, fixImports } from "./actions/fix-imports";
|
|
3
7
|
export { InitArgs, initPlasmic } from "./actions/init";
|
|
8
|
+
export {
|
|
9
|
+
LocalizationStringsArgs,
|
|
10
|
+
localizationStrings,
|
|
11
|
+
} from "./actions/localization-strings";
|
|
4
12
|
export { getProjectApiToken } from "./actions/project-token";
|
|
5
|
-
export {
|
|
6
|
-
export { UploadBundleArgs, uploadJsBundle } from "./actions/upload-bundle";
|
|
13
|
+
export { SyncArgs, sync } from "./actions/sync";
|
|
7
14
|
export { WatchArgs, watchProjects } from "./actions/watch";
|
|
8
15
|
export { logger } from "./deps";
|
|
9
16
|
export { HandledError, handleError } from "./utils/error";
|
|
10
17
|
export { Metadata, setMetadataEnv } from "./utils/get-context";
|
|
11
|
-
export {
|
|
12
|
-
localizationStrings,
|
|
13
|
-
LocalizationStringsArgs,
|
|
14
|
-
} from "./actions/localization-strings";
|
|
15
|
-
export {
|
|
16
|
-
exportProjectsCli as exportProjects,
|
|
17
|
-
ExportArgs,
|
|
18
|
-
} from "./actions/export";
|
package/src/utils/code-utils.ts
CHANGED
|
@@ -174,7 +174,6 @@ type PlasmicImportType =
|
|
|
174
174
|
| "defaultcss"
|
|
175
175
|
| "icon"
|
|
176
176
|
| "picture"
|
|
177
|
-
| "jsBundle"
|
|
178
177
|
| "codeComponent"
|
|
179
178
|
| "codeComponentHelper"
|
|
180
179
|
| "globalContext"
|
|
@@ -214,7 +213,7 @@ function tryParsePlasmicImportSpec(node: ImportDeclaration) {
|
|
|
214
213
|
"plasmic-import:\\s+([",
|
|
215
214
|
...validJsIdentifierChars,
|
|
216
215
|
"\\.",
|
|
217
|
-
"]+)(?:\\/(component|css|render|globalVariant|projectcss|defaultcss|icon|picture|
|
|
216
|
+
"]+)(?:\\/(component|css|render|globalVariant|projectcss|defaultcss|icon|picture|codeComponent|globalContext|customFunction|splitsProvider|styleTokensProvider|dataTokens|projectModule|rscClient|rscServer))?",
|
|
218
217
|
].join("")
|
|
219
218
|
)
|
|
220
219
|
);
|
|
@@ -148,11 +148,6 @@ export interface ImagesConfig {
|
|
|
148
148
|
publicUrlPrefix?: string;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
export interface JsBundleThemeConfig {
|
|
152
|
-
themeFilePath: string;
|
|
153
|
-
bundleName: string;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
151
|
export interface CodeComponentConfig {
|
|
157
152
|
id: string;
|
|
158
153
|
name: string;
|
|
@@ -203,7 +198,6 @@ export interface ProjectConfig {
|
|
|
203
198
|
|
|
204
199
|
// Code-component-related fields can be treated as optional not to be shown
|
|
205
200
|
// to the users nor appear to be missing in the documentation.
|
|
206
|
-
jsBundleThemes?: JsBundleThemeConfig[];
|
|
207
201
|
codeComponents?: CodeComponentConfig[];
|
|
208
202
|
customFunctions?: CustomFunctionConfig[];
|
|
209
203
|
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { CommonArgs } from "..";
|
|
2
|
-
export interface UploadBundleArgs extends CommonArgs {
|
|
3
|
-
project: string;
|
|
4
|
-
bundleName: string;
|
|
5
|
-
bundleJsFile: string;
|
|
6
|
-
cssFiles: readonly string[];
|
|
7
|
-
metaJsonFile: string;
|
|
8
|
-
genModulePath?: string;
|
|
9
|
-
genCssPaths: string[];
|
|
10
|
-
pkgVersion?: string;
|
|
11
|
-
extraPropMetaJsonFile?: string;
|
|
12
|
-
themeProviderWrapper?: string;
|
|
13
|
-
themeModuleFile?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare function uploadJsBundle(opts: UploadBundleArgs): Promise<void>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import pako from "pako";
|
|
2
|
-
import { CommonArgs } from "..";
|
|
3
|
-
import { readFileText } from "../utils/file-utils";
|
|
4
|
-
import { getContext } from "../utils/get-context";
|
|
5
|
-
|
|
6
|
-
export interface UploadBundleArgs extends CommonArgs {
|
|
7
|
-
project: string;
|
|
8
|
-
bundleName: string;
|
|
9
|
-
bundleJsFile: string;
|
|
10
|
-
cssFiles: readonly string[];
|
|
11
|
-
metaJsonFile: string;
|
|
12
|
-
genModulePath?: string;
|
|
13
|
-
genCssPaths: string[];
|
|
14
|
-
pkgVersion?: string;
|
|
15
|
-
extraPropMetaJsonFile?: string;
|
|
16
|
-
themeProviderWrapper?: string;
|
|
17
|
-
themeModuleFile?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export async function uploadJsBundle(opts: UploadBundleArgs) {
|
|
21
|
-
const context = await getContext(opts);
|
|
22
|
-
const api = context.api;
|
|
23
|
-
await api.uploadBundle(
|
|
24
|
-
opts.project,
|
|
25
|
-
opts.bundleName,
|
|
26
|
-
pako.deflate(readFileText(opts.bundleJsFile), { to: "string" }),
|
|
27
|
-
opts.cssFiles.map((f) => pako.deflate(readFileText(f), { to: "string" })),
|
|
28
|
-
pako.deflate(readFileText(opts.metaJsonFile), { to: "string" }),
|
|
29
|
-
opts.genModulePath,
|
|
30
|
-
opts.genCssPaths,
|
|
31
|
-
opts.pkgVersion,
|
|
32
|
-
opts.extraPropMetaJsonFile
|
|
33
|
-
? readFileText(opts.extraPropMetaJsonFile)
|
|
34
|
-
: undefined,
|
|
35
|
-
opts.themeProviderWrapper,
|
|
36
|
-
opts.themeModuleFile ? readFileText(opts.themeModuleFile) : undefined
|
|
37
|
-
);
|
|
38
|
-
}
|