@plasmicapp/cli 0.1.190 → 0.1.192

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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Plasmic
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/build.sh CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  set -o errexit -o nounset
4
4
 
5
- yarn eslint 'src/**'
5
+ ./node_modules/.bin/eslint 'src/**'
6
6
  tsc
7
7
  cp ./tsconfig-transform.json ./dist
8
8
  typescript-json-schema tsconfig.json 'PlasmicConfig' --excludePrivate --required > ./dist/plasmic.schema.json
@@ -277,11 +277,6 @@ class PlasmicApi {
277
277
  throw new Error("Unimplemented");
278
278
  });
279
279
  }
280
- projectSyncMetadata(projectId, revision, rethrowAppError) {
281
- return __awaiter(this, void 0, void 0, function* () {
282
- throw new Error("Unimplemented");
283
- });
284
- }
285
280
  latestCodegenVersion() {
286
281
  return __awaiter(this, void 0, void 0, function* () {
287
282
  return "0.0.1";
@@ -346,7 +346,6 @@ function _CodeSandboxDialogContent(props) {
346
346
  canEdit: !sc.canEditProject() ? "no" : undefined,
347
347
  scheme: codeScheme === "direct" ? "direct" : "blackbox",
348
348
  };
349
-
350
349
  const args = {};
351
350
  // The following code block is fully managed by Plasmic. Don't edit - it will
352
351
  // be overwritten after every "plasmic sync".
@@ -3,7 +3,7 @@ export interface InitArgs extends CommonArgs {
3
3
  host: string;
4
4
  platform: "" | "react" | "nextjs" | "gatsby";
5
5
  codeLang: "" | "ts" | "js";
6
- codeScheme: "" | "blackbox" | "direct";
6
+ codeScheme: "" | "blackbox";
7
7
  styleScheme: "" | "css" | "css-modules";
8
8
  imagesScheme: "" | "inlined" | "files" | "public-files";
9
9
  imagesPublicDir: string;
@@ -6,6 +6,6 @@ export interface LocalizationStringsArgs extends CommonArgs {
6
6
  format: "po" | "json" | "lingui";
7
7
  output: string;
8
8
  forceOverwrite: boolean;
9
- keyScheme: "content" | "hash";
9
+ keyScheme: "content" | "hash" | undefined;
10
10
  }
11
11
  export declare function localizationStrings(opts: LocalizationStringsArgs): Promise<void>;
@@ -24,7 +24,7 @@ const file_utils_1 = require("../utils/file-utils");
24
24
  const get_context_1 = require("../utils/get-context");
25
25
  const user_utils_1 = require("../utils/user-utils");
26
26
  function localizationStrings(opts) {
27
- var _a;
27
+ var _a, _b;
28
28
  return __awaiter(this, void 0, void 0, function* () {
29
29
  if (!opts.projects || opts.projects.length === 0) {
30
30
  throw new lib_1.HandledError(`Missing projects.`);
@@ -46,6 +46,7 @@ function localizationStrings(opts) {
46
46
  ? "data.po"
47
47
  : "data.json"
48
48
  : opts.output;
49
+ let keyScheme = opts.keyScheme;
49
50
  const projectTokensFromConfig = [];
50
51
  const auth = yield auth_utils_1.getCurrentAuth(opts.auth);
51
52
  const maybeConfigFile = opts.config || config_utils_1.findConfigFile(opts.baseDir, { traverseParents: true });
@@ -54,6 +55,9 @@ function localizationStrings(opts) {
54
55
  context.config.projects.forEach((p) => {
55
56
  projectTokensFromConfig.push(lodash_1.pick(p, "projectId", "projectApiToken"));
56
57
  });
58
+ if (!keyScheme) {
59
+ keyScheme = (_b = context.config.i18n) === null || _b === void 0 ? void 0 : _b.keyScheme;
60
+ }
57
61
  }
58
62
  const projectIdsAndTokens = [
59
63
  ...parsedProjectTokens,
@@ -66,7 +70,7 @@ function localizationStrings(opts) {
66
70
  token: "",
67
71
  });
68
72
  deps_1.logger.info(`Generating localization strings for ${chalk_1.default.bold(opts.projects.join(", "))}...`);
69
- const data = yield api.genLocalizationStrings(opts.projects, opts.format, opts.keyScheme, projectIdsAndTokens);
73
+ const data = yield api.genLocalizationStrings(opts.projects, opts.format, keyScheme !== null && keyScheme !== void 0 ? keyScheme : "content", projectIdsAndTokens);
70
74
  if (file_utils_1.existsBuffered(output)) {
71
75
  const overwrite = yield user_utils_1.confirmWithUser(`File ${output} already exists. Do you want to overwrite?`, opts.forceOverwrite);
72
76
  if (!overwrite) {
@@ -1,10 +1,4 @@
1
1
  import { ChecksumBundle, ComponentBundle } from "../api";
2
2
  import { ComponentUpdateSummary } from "../utils/code-utils";
3
3
  import { PlasmicContext, ProjectConfig, ProjectLock } from "../utils/config-utils";
4
- export interface ComponentPendingMerge {
5
- skeletonModulePath: string;
6
- editedSkeletonFile: string;
7
- newSkeletonFile: string;
8
- merge: (resolvedNewSkeletonFile: string, resolvedEditedSkeletonFile: string) => Promise<void>;
9
- }
10
- export declare function syncProjectComponents(context: PlasmicContext, project: ProjectConfig, version: string, componentBundles: ComponentBundle[], forceOverwrite: boolean, appendJsxOnMissingBase: boolean, summary: Map<string, ComponentUpdateSummary>, pendingMerge: ComponentPendingMerge[], projectLock: ProjectLock, checksums: ChecksumBundle, baseDir: string): Promise<void>;
4
+ export declare function syncProjectComponents(context: PlasmicContext, project: ProjectConfig, version: string, componentBundles: ComponentBundle[], forceOverwrite: boolean, summary: Map<string, ComponentUpdateSummary>, projectLock: ProjectLock, checksums: ChecksumBundle, baseDir: string): Promise<void>;
@@ -13,59 +13,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.syncProjectComponents = void 0;
16
- const code_merger_1 = require("@plasmicapp/code-merger");
17
16
  const lodash_1 = __importDefault(require("lodash"));
18
17
  const upath_1 = __importDefault(require("upath"));
19
- const api_1 = require("../api");
20
18
  const deps_1 = require("../deps");
21
19
  const code_utils_1 = require("../utils/code-utils");
22
20
  const config_utils_1 = require("../utils/config-utils");
23
- const error_1 = require("../utils/error");
24
21
  const file_utils_1 = require("../utils/file-utils");
25
22
  const lang_utils_1 = require("../utils/lang-utils");
26
23
  const user_utils_1 = require("../utils/user-utils");
27
- const updateDirectSkeleton = (newFileContent, editedFileContent, context, compConfig, forceOverwrite, nameInIdToUuid, appendJsxOnMissingBase) => __awaiter(void 0, void 0, void 0, function* () {
28
- // merge code!
29
- const componentByUuid = new Map();
30
- componentByUuid.set(compConfig.id, {
31
- editedFile: editedFileContent,
32
- newFile: newFileContent,
33
- newNameInIdToUuid: new Map(nameInIdToUuid),
34
- });
35
- const mergedFiles = yield code_merger_1.mergeFiles(componentByUuid, compConfig.projectId, code_merger_1.makeCachedProjectSyncDataProvider((projectId, revision) => __awaiter(void 0, void 0, void 0, function* () {
36
- try {
37
- return yield context.api.projectSyncMetadata(projectId, "main", revision, true);
38
- }
39
- catch (e) {
40
- if (e instanceof api_1.AppServerError &&
41
- /revision \d+ not found/.test(e.message)) {
42
- throw e;
43
- }
44
- else {
45
- lang_utils_1.assert(e instanceof Error);
46
- throw new error_1.HandledError(e.message);
47
- }
48
- }
49
- })), () => { }, appendJsxOnMissingBase);
50
- const merged = mergedFiles === null || mergedFiles === void 0 ? void 0 : mergedFiles.get(compConfig.id);
51
- if (merged) {
52
- yield file_utils_1.writeFileContent(context, compConfig.importSpec.modulePath, merged, {
53
- force: true,
54
- });
55
- }
56
- else {
57
- if (!forceOverwrite) {
58
- throw new error_1.HandledError(`Cannot merge ${compConfig.importSpec.modulePath}. If you just switched the code scheme for the component from blackbox to direct, use --force-overwrite option to force the switch.`);
59
- }
60
- else {
61
- deps_1.logger.warn(`Overwrite ${compConfig.importSpec.modulePath} despite merge failure`);
62
- yield file_utils_1.writeFileContent(context, compConfig.importSpec.modulePath, newFileContent, {
63
- force: true,
64
- });
65
- }
66
- }
67
- });
68
- function syncProjectComponents(context, project, version, componentBundles, forceOverwrite, appendJsxOnMissingBase, summary, pendingMerge, projectLock, checksums, baseDir) {
24
+ function syncProjectComponents(context, project, version, componentBundles, forceOverwrite, summary, projectLock, checksums, baseDir) {
69
25
  return __awaiter(this, void 0, void 0, function* () {
70
26
  const componentsFromChecksums = new Set([
71
27
  ...checksums.cssRulesChecksums.map(([id, _]) => id),
@@ -181,16 +137,7 @@ function syncProjectComponents(context, project, version, componentBundles, forc
181
137
  }
182
138
  compConfig.plumeType = plumeType;
183
139
  if (scheme === "direct") {
184
- // We cannot merge right now, but wait until all the imports are resolved
185
- pendingMerge.push({
186
- skeletonModulePath: compConfig.importSpec.modulePath,
187
- editedSkeletonFile: editedFile,
188
- newSkeletonFile: skeletonModule,
189
- merge: (resolvedNewFile, resolvedEditedFile) => __awaiter(this, void 0, void 0, function* () {
190
- return updateDirectSkeleton(resolvedNewFile, resolvedEditedFile, context, compConfig, forceOverwrite, nameInIdToUuid, appendJsxOnMissingBase);
191
- }),
192
- });
193
- skeletonModuleModified = true;
140
+ throw new Error(`Direct update codegen scheme is no longer supported`);
194
141
  }
195
142
  else if (/\/\/\s*plasmic-managed-jsx\/\d+/.test(editedFile)) {
196
143
  if (forceOverwrite) {
@@ -3,8 +3,6 @@ import { Metadata } from "../utils/get-context";
3
3
  export interface SyncArgs extends CommonArgs {
4
4
  projects: readonly string[];
5
5
  forceOverwrite: boolean;
6
- newComponentScheme?: "blackbox" | "direct";
7
- appendJsxOnMissingBase?: boolean;
8
6
  yes?: boolean;
9
7
  force?: boolean;
10
8
  nonRecursive?: boolean;
@@ -208,7 +208,6 @@ function sync(opts, metadataDefaults) {
208
208
  return;
209
209
  }
210
210
  const summary = new Map();
211
- const pendingMerge = new Array();
212
211
  // The resolveSync call returns the project API tokens for all relevant projects (sources and dependencies).
213
212
  // resolveSync is what does this because it's what is computing all concrete versions to sync, and the dependency
214
213
  // graph can change with any version. Subsequent API calls require the exact API tokens, not to redo this work on each
@@ -229,7 +228,7 @@ function sync(opts, metadataDefaults) {
229
228
  // Sync in sequence (no parallelism)
230
229
  // going in reverse to get leaves of the dependency tree first
231
230
  for (const projectMeta of projectsToSync) {
232
- yield syncProject(context, opts, projectIdsAndTokens, projectMeta.projectId, projectMeta.branchName, projectMeta.componentIds, projectMeta.version, projectMeta.dependencies, summary, pendingMerge, projectMeta.indirect, externalNpmPackages, externalCssImports, metadataDefaults);
231
+ yield syncProject(context, opts, projectIdsAndTokens, projectMeta.projectId, projectMeta.branchName, projectMeta.componentIds, projectMeta.version, projectMeta.dependencies, summary, projectMeta.indirect, externalNpmPackages, externalCssImports, metadataDefaults);
233
232
  }
234
233
  // Materialize scheme into each component config.
235
234
  context.config.projects.forEach((p) => p.components.forEach((c) => {
@@ -253,13 +252,6 @@ function sync(opts, metadataDefaults) {
253
252
  }
254
253
  });
255
254
  }
256
- // Fix imports
257
- const fixImportContext = code_utils_1.mkFixImportContext(context.config);
258
- for (const m of pendingMerge) {
259
- const resolvedEditedFile = code_utils_1.replaceImports(context, m.editedSkeletonFile, m.skeletonModulePath, fixImportContext, true, baseDir);
260
- const resolvedNewFile = code_utils_1.replaceImports(context, m.newSkeletonFile, m.skeletonModulePath, fixImportContext, true, baseDir);
261
- yield m.merge(resolvedNewFile, resolvedEditedFile);
262
- }
263
255
  // Now we know config.components are all correct, so we can go ahead and fix up all the import statements
264
256
  yield code_utils_1.fixAllImportStatements(context, opts.baseDir, summary);
265
257
  if (process.env.PLASMIC_LOADER) {
@@ -344,10 +336,9 @@ function fixFileExtension(context) {
344
336
  });
345
337
  });
346
338
  }
347
- function syncProject(context, opts, projectIdsAndTokens, projectId, branchName, componentIds, projectVersion, dependencies, summary, pendingMerge, indirect, externalNpmPackages, externalCssImports, metadataDefaults) {
339
+ function syncProject(context, opts, projectIdsAndTokens, projectId, branchName, componentIds, projectVersion, dependencies, summary, indirect, externalNpmPackages, externalCssImports, metadataDefaults) {
348
340
  var _a;
349
341
  return __awaiter(this, void 0, void 0, function* () {
350
- const newComponentScheme = opts.newComponentScheme || context.config.code.scheme;
351
342
  const existingProject = context.config.projects.find((p) => p.projectId === projectId);
352
343
  const existingCompScheme = ((existingProject === null || existingProject === void 0 ? void 0 : existingProject.components) || []).map((c) => [c.id, c.scheme]);
353
344
  const projectApiToken = lang_utils_1.ensure((_a = projectIdsAndTokens.find((p) => p.projectId === projectId)) === null || _a === void 0 ? void 0 : _a.projectApiToken, `Could not find the API token for project ${projectId} in list: ${JSON.stringify(projectIdsAndTokens)}`);
@@ -355,12 +346,11 @@ function syncProject(context, opts, projectIdsAndTokens, projectId, branchName,
355
346
  // Server-side code-gen
356
347
  const projectBundle = yield context.api.projectComponents(projectId, branchName, {
357
348
  platform: context.config.platform,
358
- newCompScheme: newComponentScheme,
359
- existingCompScheme,
360
349
  componentIdOrNames: componentIds,
361
350
  version: projectVersion,
362
351
  imageOpts: context.config.images,
363
352
  stylesOpts: context.config.style,
353
+ i18nOpts: context.config.i18n,
364
354
  checksums: existingChecksums,
365
355
  codeOpts: context.config.code,
366
356
  metadata: get_context_1.generateMetadata(Object.assign(Object.assign({}, metadataDefaults), { platform: context.config.platform }), opts.metadata),
@@ -384,7 +374,7 @@ function syncProject(context, opts, projectIdsAndTokens, projectId, branchName,
384
374
  });
385
375
  }
386
376
  yield sync_global_variants_1.syncGlobalVariants(context, projectBundle.projectConfig, projectBundle.globalVariants, projectBundle.checksums, branchName, opts.baseDir);
387
- yield syncProjectConfig(context, projectBundle.projectConfig, projectApiToken, branchName, projectVersion, dependencies, projectBundle.components, opts.forceOverwrite, !!opts.appendJsxOnMissingBase, summary, pendingMerge, projectBundle.checksums, opts.baseDir, indirect);
377
+ yield syncProjectConfig(context, projectBundle.projectConfig, projectApiToken, branchName, projectVersion, dependencies, projectBundle.components, opts.forceOverwrite, summary, projectBundle.checksums, opts.baseDir, indirect);
388
378
  syncCodeComponentsMeta(context, projectId, projectBundle.codeComponentMetas);
389
379
  yield sync_styles_1.upsertStyleTokens(context, projectBundle.usedTokens, projectBundle.projectConfig.projectId);
390
380
  yield sync_icons_1.syncProjectIconAssets(context, projectId, branchName, projectVersion, projectBundle.iconAssets, projectBundle.checksums, opts.baseDir);
@@ -403,7 +393,7 @@ function syncStyleConfig(context, response) {
403
393
  });
404
394
  });
405
395
  }
406
- function syncProjectConfig(context, projectBundle, projectApiToken, branchName, version, dependencies, componentBundles, forceOverwrite, appendJsxOnMissingBase, summary, pendingMerge, checksums, baseDir, indirect) {
396
+ function syncProjectConfig(context, projectBundle, projectApiToken, branchName, version, dependencies, componentBundles, forceOverwrite, summary, checksums, baseDir, indirect) {
407
397
  return __awaiter(this, void 0, void 0, function* () {
408
398
  const defaultCssFilePath = file_utils_1.defaultResourcePath(context, projectBundle.projectName, projectBundle.cssFileName);
409
399
  const isNew = !context.config.projects.find((p) => p.projectId === projectBundle.projectId);
@@ -470,7 +460,7 @@ function syncProjectConfig(context, projectBundle, projectApiToken, branchName,
470
460
  }
471
461
  yield sync_global_contexts_1.syncGlobalContexts(context, projectBundle, projectConfig, projectLock, checksums, baseDir);
472
462
  // Write out components
473
- yield sync_components_1.syncProjectComponents(context, projectConfig, version, componentBundles, forceOverwrite, appendJsxOnMissingBase, summary, pendingMerge, projectLock, checksums, baseDir);
463
+ yield sync_components_1.syncProjectComponents(context, projectConfig, version, componentBundles, forceOverwrite, summary, projectLock, checksums, baseDir);
474
464
  });
475
465
  }
476
466
  function syncCodeComponentsMeta(context, projectId, codeComponentBundles) {
package/dist/api.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { ProjectSyncMetadataModel } from "@plasmicapp/code-merger";
2
1
  import { Socket } from "socket.io-client";
3
- import { AuthConfig, CodeConfig, ImagesConfig, StyleConfig } from "./utils/config-utils";
2
+ import { AuthConfig, CodeConfig, I18NConfig, ImagesConfig, StyleConfig } from "./utils/config-utils";
4
3
  import { Metadata } from "./utils/get-context";
5
4
  export declare class AppServerError extends Error {
6
5
  constructor(message: string);
@@ -179,12 +178,11 @@ export declare class PlasmicApi {
179
178
  */
180
179
  projectComponents(projectId: string, branchName: string, opts: {
181
180
  platform: string;
182
- newCompScheme: "blackbox" | "direct";
183
- existingCompScheme: Array<[string, "blackbox" | "direct"]>;
184
181
  componentIdOrNames: readonly string[] | undefined;
185
182
  version: string;
186
183
  imageOpts: ImagesConfig;
187
184
  stylesOpts: StyleConfig;
185
+ i18nOpts?: I18NConfig;
188
186
  codeOpts: CodeConfig;
189
187
  checksums: ChecksumBundle;
190
188
  indirect: boolean;
@@ -196,7 +194,6 @@ export declare class PlasmicApi {
196
194
  uploadBundle(projectId: string, bundleName: string, bundleJs: string, css: string[], metaJson: string, genModulePath: string | undefined, genCssPaths: string[], pkgVersion: string | undefined, extraPropMetaJson: string | undefined, themeProviderWrapper: string | undefined, themeModule: string | undefined): Promise<StyleTokensMap>;
197
195
  projectStyleTokens(projectId: string, branchName: string, versionRange?: string): Promise<StyleTokensMap>;
198
196
  projectIcons(projectId: string, branchName: string, versionRange?: string, iconIds?: string[]): Promise<ProjectIconsResponse>;
199
- projectSyncMetadata(projectId: string, branchName: string, revision: number, rethrowAppError: boolean): Promise<ProjectSyncMetadataModel>;
200
197
  connectSocket(): Socket;
201
198
  private post;
202
199
  private get;
package/dist/api.js CHANGED
@@ -13,7 +13,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.PlasmicApi = exports.AppServerError = void 0;
16
- const code_merger_1 = require("@plasmicapp/code-merger");
17
16
  const axios_1 = __importDefault(require("axios"));
18
17
  const socket_io_client_1 = __importDefault(require("socket.io-client"));
19
18
  const config_utils_1 = require("./utils/config-utils");
@@ -142,12 +141,6 @@ class PlasmicApi {
142
141
  return result.data;
143
142
  });
144
143
  }
145
- projectSyncMetadata(projectId, branchName, revision, rethrowAppError) {
146
- return __awaiter(this, void 0, void 0, function* () {
147
- const result = yield this.post(`${this.codegenHost}/api/v1/projects/${projectId}/code/project-sync-metadata?branchName=${branchName}`, { revision }, rethrowAppError);
148
- return code_merger_1.ProjectSyncMetadataModel.fromJson(result.data);
149
- });
150
- }
151
144
  connectSocket() {
152
145
  const socket = socket_io_client_1.default(this.studioHost, {
153
146
  path: `/api/v1/socket`,
package/dist/index.js CHANGED
@@ -205,10 +205,9 @@ yargs_1.default
205
205
  default: "json",
206
206
  })
207
207
  .option("key-scheme", {
208
- describe: "What value to use as message keys; either the message content itself, or a hash of it",
208
+ describe: "What value to use as message keys; either the message content itself, or a hash of it. Defaults to whatever is specified in plasmic.json, or `content`",
209
209
  type: "string",
210
210
  choices: ["content", "hash"],
211
- default: "content",
212
211
  })
213
212
  .option("output", {
214
213
  alias: "o",
@@ -257,16 +256,6 @@ function configureSyncArgs(yags, includeQuietOption = true) {
257
256
  type: "boolean",
258
257
  describe: "Overwrite the skeleton file with newly generated version. Useful when switching between codegen schemes.",
259
258
  default: false,
260
- })
261
- .option("append-jsx-on-missing-base", {
262
- type: "boolean",
263
- describe: "When the base metadata is missing to perform the three-way merge for direct edit component, append the jsx of the new version so that user can perform manual merge.",
264
- default: false,
265
- })
266
- .option("new-component-scheme", {
267
- type: "string",
268
- choices: ["blackbox", "direct"],
269
- describe: "Sync the new components using this code scheme rather than the default code scheme.",
270
259
  })
271
260
  .option("ignore-post-sync", {
272
261
  type: "boolean",
@@ -40,8 +40,7 @@
40
40
  "scheme": {
41
41
  "description": "The default code generation scheme. Each component can override the scheme.",
42
42
  "enum": [
43
- "blackbox",
44
- "direct"
43
+ "blackbox"
45
44
  ],
46
45
  "type": "string"
47
46
  }
@@ -161,6 +160,22 @@
161
160
  ],
162
161
  "type": "object"
163
162
  },
163
+ "I18NConfig": {
164
+ "properties": {
165
+ "keyScheme": {
166
+ "description": "For localization, whether the extracted strings are keyed by its content\nor by a hash of its content",
167
+ "enum": [
168
+ "content",
169
+ "hash"
170
+ ],
171
+ "type": "string"
172
+ }
173
+ },
174
+ "required": [
175
+ "keyScheme"
176
+ ],
177
+ "type": "object"
178
+ },
164
179
  "IconConfig": {
165
180
  "properties": {
166
181
  "id": {
@@ -414,6 +429,10 @@
414
429
  "$ref": "#/definitions/GlobalVariantsConfig",
415
430
  "description": "Metadata for global variant groups"
416
431
  },
432
+ "i18n": {
433
+ "$ref": "#/definitions/I18NConfig",
434
+ "description": "Configuration for localization"
435
+ },
417
436
  "images": {
418
437
  "$ref": "#/definitions/ImagesConfig",
419
438
  "description": "Config for pictures"
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.expectProjectAndDepPlasmicJson = exports.expectProject1PlasmicJson = exports.project1Config = exports.expectProject1Components = exports.standardTestTeardown = exports.standardTestSetup = exports.defaultPlasmicJson = exports.tmpRepo = exports.opts = exports.mockApi = void 0;
7
+ /// <reference types="@types/jest" />
7
8
  const lodash_1 = __importDefault(require("lodash"));
8
9
  const test_utils_1 = require("../utils/test-utils");
9
10
  jest.mock("../api");
@@ -91,8 +92,6 @@ function standardTestSetup(includeDep = true) {
91
92
  nonRecursive: false,
92
93
  skipUpgradeCheck: true,
93
94
  forceOverwrite: true,
94
- newComponentScheme: "blackbox",
95
- appendJsxOnMissingBase: false,
96
95
  config: exports.tmpRepo.plasmicJsonPath(),
97
96
  auth: exports.tmpRepo.plasmicAuthPath(),
98
97
  loaderConfig: exports.tmpRepo.plasmicLoaderJsonPath(),
@@ -60,6 +60,8 @@ export interface PlasmicConfig {
60
60
  wrapPagesWithGlobalContexts: boolean;
61
61
  /** The version of cli when this file was written */
62
62
  cliVersion?: string;
63
+ /** Configuration for localization */
64
+ i18n?: I18NConfig;
63
65
  /** Arbitrary command to run after `plasmic sync` has run; useful for linting and code formatting synced files */
64
66
  postSyncCommands?: string[];
65
67
  }
@@ -67,7 +69,7 @@ export interface CodeConfig {
67
69
  /** Language to generate code in */
68
70
  lang: "ts" | "js";
69
71
  /** The default code generation scheme. Each component can override the scheme. */
70
- scheme: "blackbox" | "direct";
72
+ scheme: "blackbox";
71
73
  reactRuntime: "classic" | "automatic";
72
74
  }
73
75
  export interface StyleConfig {
@@ -235,6 +237,13 @@ export interface ProjectLock {
235
237
  fileLocks: FileLock[];
236
238
  codegenVersion?: string;
237
239
  }
240
+ export interface I18NConfig {
241
+ /**
242
+ * For localization, whether the extracted strings are keyed by its content
243
+ * or by a hash of its content
244
+ */
245
+ keyScheme: "content" | "hash";
246
+ }
238
247
  export interface PlasmicLock {
239
248
  projects: ProjectLock[];
240
249
  cliVersion?: string;
@@ -10,14 +10,14 @@ export declare const latestTag = "latest";
10
10
  export declare const isLatest: (v: string) => boolean;
11
11
  export declare const valid: (v: string) => string | null;
12
12
  export declare const inc: (v: string, release: semverlib.ReleaseType) => string | null;
13
- export declare const prerelease: (v: string) => readonly string[] | null;
13
+ export declare const prerelease: (v: string) => readonly (string | number)[] | null;
14
14
  export declare const major: (v: string) => number | "latest";
15
15
  export declare const minor: (v: string) => number | "latest";
16
16
  export declare const patch: (v: string) => number | "latest";
17
17
  export declare const eq: (v1: string, v2: string) => boolean;
18
18
  export declare const gt: (v1: string, v2: string) => boolean;
19
19
  export declare const lt: (v1: string, v2: string) => boolean;
20
- export declare const validRange: (range: string) => string;
20
+ export declare const validRange: (range: string) => string | null;
21
21
  export declare const satisfies: (v: string, range: string) => boolean;
22
22
  export declare const toTildeRange: (v: string) => string | null;
23
23
  export declare const toCaretRange: (v: string) => string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicapp/cli",
3
- "version": "0.1.190",
3
+ "version": "0.1.192",
4
4
  "description": "plasmic cli for syncing local code with Plasmic designs",
5
5
  "engines": {
6
6
  "node": ">=12"
@@ -51,7 +51,6 @@
51
51
  "@babel/generator": "^7.12.1",
52
52
  "@babel/parser": "^7.12.3",
53
53
  "@babel/traverse": "^7.12.1",
54
- "@plasmicapp/code-merger": "^0.0.33",
55
54
  "@sentry/node": "^5.19.2",
56
55
  "axios": "^0.21.1",
57
56
  "chalk": "^4.1.0",
@@ -77,5 +76,6 @@
77
76
  "winston": "^3.3.3",
78
77
  "wrap-ansi": "^7.0.0",
79
78
  "yargs": "^15.4.1"
80
- }
79
+ },
80
+ "gitHead": "e282c9cca3a168a822b34a1a5e6de3a6a072c00f"
81
81
  }
@@ -1,4 +1,3 @@
1
- import { ProjectSyncMetadataModel } from "@plasmicapp/code-merger";
2
1
  import L from "lodash";
3
2
  import {
4
3
  ChecksumBundle,
@@ -386,14 +385,6 @@ class PlasmicApi {
386
385
  throw new Error("Unimplemented");
387
386
  }
388
387
 
389
- async projectSyncMetadata(
390
- projectId: string,
391
- revision: number,
392
- rethrowAppError: boolean
393
- ): Promise<ProjectSyncMetadataModel> {
394
- throw new Error("Unimplemented");
395
- }
396
-
397
388
  async latestCodegenVersion(): Promise<string> {
398
389
  return "0.0.1";
399
390
  }
@@ -351,7 +351,6 @@ function _CodeSandboxDialogContent(props) {
351
351
  canEdit: !sc.canEditProject() ? "no" : undefined,
352
352
  scheme: codeScheme === "direct" ? "direct" : "blackbox",
353
353
  };
354
-
355
354
  const args = {};
356
355
  // The following code block is fully managed by Plasmic. Don't edit - it will
357
356
  // be overwritten after every "plasmic sync".
@@ -543,7 +542,7 @@ function _CodeSandboxDialogContent(props) {
543
542
  "/tmp/CodeSandbox.tsx",
544
543
  fixImportContext,
545
544
  false,
546
- process.cwd(),
545
+ process.cwd()
547
546
  );
548
547
  const expectedCode = `// This is a skeleton starter React component generated by Plasmic.
549
548
  import React, { ReactNode } from "react";
@@ -622,7 +621,7 @@ function _CodeSandboxDialogContent(props) {
622
621
  "/tmp/CodeSandbox.tsx",
623
622
  fixImportContext,
624
623
  true,
625
- process.cwd(),
624
+ process.cwd()
626
625
  );
627
626
  const expectedCode = `// This is a skeleton starter React component generated by Plasmic.
628
627
  import React, { ReactNode } from "react";
@@ -702,7 +701,7 @@ function _CodeSandboxDialogContent(props) {
702
701
  "/tmp/CodeSandbox.tsx",
703
702
  fixImportContext,
704
703
  false,
705
- process.cwd(),
704
+ process.cwd()
706
705
  );
707
706
  const expectedCode = `// This is a skeleton starter React component generated by Plasmic.
708
707
  import React, { ReactNode } from "react";
@@ -34,7 +34,7 @@ export interface InitArgs extends CommonArgs {
34
34
  host: string;
35
35
  platform: "" | "react" | "nextjs" | "gatsby";
36
36
  codeLang: "" | "ts" | "js";
37
- codeScheme: "" | "blackbox" | "direct";
37
+ codeScheme: "" | "blackbox";
38
38
  styleScheme: "" | "css" | "css-modules";
39
39
  imagesScheme: "" | "inlined" | "files" | "public-files";
40
40
  imagesPublicDir: string;
@@ -17,7 +17,7 @@ export interface LocalizationStringsArgs extends CommonArgs {
17
17
  format: "po" | "json" | "lingui";
18
18
  output: string;
19
19
  forceOverwrite: boolean;
20
- keyScheme: "content" | "hash";
20
+ keyScheme: "content" | "hash" | undefined;
21
21
  }
22
22
 
23
23
  export async function localizationStrings(
@@ -46,6 +46,7 @@ export async function localizationStrings(
46
46
  ? "data.po"
47
47
  : "data.json"
48
48
  : opts.output;
49
+ let keyScheme = opts.keyScheme;
49
50
  const projectTokensFromConfig: ProjectIdAndToken[] = [];
50
51
  const auth = await getCurrentAuth(opts.auth);
51
52
  const maybeConfigFile =
@@ -55,6 +56,9 @@ export async function localizationStrings(
55
56
  context.config.projects.forEach((p) => {
56
57
  projectTokensFromConfig.push(pick(p, "projectId", "projectApiToken"));
57
58
  });
59
+ if (!keyScheme) {
60
+ keyScheme = context.config.i18n?.keyScheme;
61
+ }
58
62
  }
59
63
 
60
64
  const projectIdsAndTokens = [
@@ -78,7 +82,7 @@ export async function localizationStrings(
78
82
  const data = await api.genLocalizationStrings(
79
83
  opts.projects,
80
84
  opts.format,
81
- opts.keyScheme,
85
+ keyScheme ?? "content",
82
86
  projectIdsAndTokens
83
87
  );
84
88
  if (existsBuffered(output)) {
@@ -1,22 +1,15 @@
1
- import {
2
- ComponentInfoForMerge,
3
- makeCachedProjectSyncDataProvider,
4
- mergeFiles,
5
- } from "@plasmicapp/code-merger";
6
1
  import L from "lodash";
7
2
  import path from "upath";
8
- import { AppServerError, ChecksumBundle, ComponentBundle } from "../api";
3
+ import { ChecksumBundle, ComponentBundle } from "../api";
9
4
  import { logger } from "../deps";
10
5
  import { ComponentUpdateSummary, formatAsLocal } from "../utils/code-utils";
11
6
  import {
12
- ComponentConfig,
13
7
  CONFIG_FILE_NAME,
14
8
  isPageAwarePlatform,
15
9
  PlasmicContext,
16
10
  ProjectConfig,
17
11
  ProjectLock,
18
12
  } from "../utils/config-utils";
19
- import { HandledError } from "../utils/error";
20
13
  import {
21
14
  defaultPagePath,
22
15
  defaultResourcePath,
@@ -30,96 +23,13 @@ import {
30
23
  import { assert, ensure } from "../utils/lang-utils";
31
24
  import { confirmWithUser } from "../utils/user-utils";
32
25
 
33
- export interface ComponentPendingMerge {
34
- // path of the skeleton module
35
- skeletonModulePath: string;
36
- editedSkeletonFile: string;
37
- newSkeletonFile: string;
38
- // function to perform code merger using input whose import has been resolved.
39
- merge: (
40
- resolvedNewSkeletonFile: string,
41
- resolvedEditedSkeletonFile: string
42
- ) => Promise<void>;
43
- }
44
-
45
- const updateDirectSkeleton = async (
46
- newFileContent: string,
47
- editedFileContent: string,
48
- context: PlasmicContext,
49
- compConfig: ComponentConfig,
50
- forceOverwrite: boolean,
51
- nameInIdToUuid: [string, string][],
52
- appendJsxOnMissingBase: boolean
53
- ) => {
54
- // merge code!
55
- const componentByUuid = new Map<string, ComponentInfoForMerge>();
56
-
57
- componentByUuid.set(compConfig.id, {
58
- editedFile: editedFileContent,
59
- newFile: newFileContent,
60
- newNameInIdToUuid: new Map(nameInIdToUuid),
61
- });
62
- const mergedFiles = await mergeFiles(
63
- componentByUuid,
64
- compConfig.projectId,
65
- makeCachedProjectSyncDataProvider(async (projectId, revision) => {
66
- try {
67
- return await context.api.projectSyncMetadata(
68
- projectId,
69
- "main",
70
- revision,
71
- true
72
- );
73
- } catch (e) {
74
- if (
75
- e instanceof AppServerError &&
76
- /revision \d+ not found/.test(e.message)
77
- ) {
78
- throw e;
79
- } else {
80
- assert(e instanceof Error);
81
- throw new HandledError(e.message);
82
- }
83
- }
84
- }),
85
- () => {},
86
- appendJsxOnMissingBase
87
- );
88
- const merged = mergedFiles?.get(compConfig.id);
89
- if (merged) {
90
- await writeFileContent(context, compConfig.importSpec.modulePath, merged, {
91
- force: true,
92
- });
93
- } else {
94
- if (!forceOverwrite) {
95
- throw new HandledError(
96
- `Cannot merge ${compConfig.importSpec.modulePath}. If you just switched the code scheme for the component from blackbox to direct, use --force-overwrite option to force the switch.`
97
- );
98
- } else {
99
- logger.warn(
100
- `Overwrite ${compConfig.importSpec.modulePath} despite merge failure`
101
- );
102
- await writeFileContent(
103
- context,
104
- compConfig.importSpec.modulePath,
105
- newFileContent,
106
- {
107
- force: true,
108
- }
109
- );
110
- }
111
- }
112
- };
113
-
114
26
  export async function syncProjectComponents(
115
27
  context: PlasmicContext,
116
28
  project: ProjectConfig,
117
29
  version: string,
118
30
  componentBundles: ComponentBundle[],
119
31
  forceOverwrite: boolean,
120
- appendJsxOnMissingBase: boolean,
121
32
  summary: Map<string, ComponentUpdateSummary>,
122
- pendingMerge: ComponentPendingMerge[],
123
33
  projectLock: ProjectLock,
124
34
  checksums: ChecksumBundle,
125
35
  baseDir: string
@@ -324,23 +234,7 @@ export async function syncProjectComponents(
324
234
  compConfig.plumeType = plumeType;
325
235
 
326
236
  if (scheme === "direct") {
327
- // We cannot merge right now, but wait until all the imports are resolved
328
- pendingMerge.push({
329
- skeletonModulePath: compConfig.importSpec.modulePath,
330
- editedSkeletonFile: editedFile,
331
- newSkeletonFile: skeletonModule,
332
- merge: async (resolvedNewFile, resolvedEditedFile) =>
333
- updateDirectSkeleton(
334
- resolvedNewFile,
335
- resolvedEditedFile,
336
- context,
337
- compConfig,
338
- forceOverwrite,
339
- nameInIdToUuid,
340
- appendJsxOnMissingBase
341
- ),
342
- });
343
- skeletonModuleModified = true;
237
+ throw new Error(`Direct update codegen scheme is no longer supported`);
344
238
  } else if (/\/\/\s*plasmic-managed-jsx\/\d+/.test(editedFile)) {
345
239
  if (forceOverwrite) {
346
240
  skeletonModuleModified = true;
@@ -18,8 +18,6 @@ import {
18
18
  fixAllImportStatements,
19
19
  formatAsLocal,
20
20
  maybeConvertTsxToJsx,
21
- mkFixImportContext,
22
- replaceImports,
23
21
  } from "../utils/code-utils";
24
22
  import {
25
23
  CONFIG_FILE_NAME,
@@ -56,10 +54,7 @@ import {
56
54
  import { checkVersionResolution } from "../utils/resolve-utils";
57
55
  import * as semver from "../utils/semver";
58
56
  import { confirmWithUser } from "../utils/user-utils";
59
- import {
60
- ComponentPendingMerge,
61
- syncProjectComponents,
62
- } from "./sync-components";
57
+ import { syncProjectComponents } from "./sync-components";
63
58
  import { syncGlobalContexts } from "./sync-global-contexts";
64
59
  import { syncGlobalVariants } from "./sync-global-variants";
65
60
  import { syncProjectIconAssets } from "./sync-icons";
@@ -69,8 +64,6 @@ import { upsertStyleTokens } from "./sync-styles";
69
64
  export interface SyncArgs extends CommonArgs {
70
65
  projects: readonly string[];
71
66
  forceOverwrite: boolean;
72
- newComponentScheme?: "blackbox" | "direct";
73
- appendJsxOnMissingBase?: boolean;
74
67
  yes?: boolean;
75
68
  force?: boolean;
76
69
  nonRecursive?: boolean;
@@ -315,7 +308,6 @@ export async function sync(
315
308
  return;
316
309
  }
317
310
  const summary = new Map<string, ComponentUpdateSummary>();
318
- const pendingMerge = new Array<ComponentPendingMerge>();
319
311
 
320
312
  // The resolveSync call returns the project API tokens for all relevant projects (sources and dependencies).
321
313
  // resolveSync is what does this because it's what is computing all concrete versions to sync, and the dependency
@@ -348,7 +340,6 @@ export async function sync(
348
340
  projectMeta.version,
349
341
  projectMeta.dependencies,
350
342
  summary,
351
- pendingMerge,
352
343
  projectMeta.indirect,
353
344
  externalNpmPackages,
354
345
  externalCssImports,
@@ -388,27 +379,6 @@ export async function sync(
388
379
  });
389
380
  }
390
381
 
391
- // Fix imports
392
- const fixImportContext = mkFixImportContext(context.config);
393
- for (const m of pendingMerge) {
394
- const resolvedEditedFile = replaceImports(
395
- context,
396
- m.editedSkeletonFile,
397
- m.skeletonModulePath,
398
- fixImportContext,
399
- true,
400
- baseDir
401
- );
402
- const resolvedNewFile = replaceImports(
403
- context,
404
- m.newSkeletonFile,
405
- m.skeletonModulePath,
406
- fixImportContext,
407
- true,
408
- baseDir
409
- );
410
- await m.merge(resolvedNewFile, resolvedEditedFile);
411
- }
412
382
  // Now we know config.components are all correct, so we can go ahead and fix up all the import statements
413
383
  await fixAllImportStatements(context, opts.baseDir, summary);
414
384
 
@@ -565,14 +535,11 @@ async function syncProject(
565
535
  projectVersion: string,
566
536
  dependencies: { [projectId: string]: string },
567
537
  summary: Map<string, ComponentUpdateSummary>,
568
- pendingMerge: ComponentPendingMerge[],
569
538
  indirect: boolean,
570
539
  externalNpmPackages: Set<string>,
571
540
  externalCssImports: Set<string>,
572
541
  metadataDefaults?: Metadata
573
542
  ): Promise<void> {
574
- const newComponentScheme =
575
- opts.newComponentScheme || context.config.code.scheme;
576
543
  const existingProject = context.config.projects.find(
577
544
  (p) => p.projectId === projectId
578
545
  );
@@ -600,12 +567,11 @@ async function syncProject(
600
567
  branchName,
601
568
  {
602
569
  platform: context.config.platform,
603
- newCompScheme: newComponentScheme,
604
- existingCompScheme,
605
570
  componentIdOrNames: componentIds,
606
571
  version: projectVersion,
607
572
  imageOpts: context.config.images,
608
573
  stylesOpts: context.config.style,
574
+ i18nOpts: context.config.i18n,
609
575
  checksums: existingChecksums,
610
576
  codeOpts: context.config.code,
611
577
  metadata: generateMetadata(
@@ -674,9 +640,7 @@ async function syncProject(
674
640
  dependencies,
675
641
  projectBundle.components,
676
642
  opts.forceOverwrite,
677
- !!opts.appendJsxOnMissingBase,
678
643
  summary,
679
- pendingMerge,
680
644
  projectBundle.checksums,
681
645
  opts.baseDir,
682
646
  indirect
@@ -737,9 +701,7 @@ async function syncProjectConfig(
737
701
  dependencies: { [projectId: string]: string },
738
702
  componentBundles: ComponentBundle[],
739
703
  forceOverwrite: boolean,
740
- appendJsxOnMissingBase: boolean,
741
704
  summary: Map<string, ComponentUpdateSummary>,
742
- pendingMerge: ComponentPendingMerge[],
743
705
  checksums: ChecksumBundle,
744
706
  baseDir: string,
745
707
  indirect: boolean
@@ -858,9 +820,7 @@ async function syncProjectConfig(
858
820
  version,
859
821
  componentBundles,
860
822
  forceOverwrite,
861
- appendJsxOnMissingBase,
862
823
  summary,
863
- pendingMerge,
864
824
  projectLock,
865
825
  checksums,
866
826
  baseDir
package/src/api.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { ProjectSyncMetadataModel } from "@plasmicapp/code-merger";
2
1
  import axios, { AxiosError } from "axios";
3
2
  import socketio, { Socket } from "socket.io-client";
4
3
  import {
5
4
  AuthConfig,
6
5
  CodeConfig,
7
6
  DEFAULT_HOST,
7
+ I18NConfig,
8
8
  ImagesConfig,
9
9
  StyleConfig,
10
10
  } from "./utils/config-utils";
@@ -261,13 +261,11 @@ export class PlasmicApi {
261
261
  branchName: string,
262
262
  opts: {
263
263
  platform: string;
264
- newCompScheme: "blackbox" | "direct";
265
- // The list of existing components as [componentUuid, codeScheme]
266
- existingCompScheme: Array<[string, "blackbox" | "direct"]>;
267
264
  componentIdOrNames: readonly string[] | undefined;
268
265
  version: string;
269
266
  imageOpts: ImagesConfig;
270
267
  stylesOpts: StyleConfig;
268
+ i18nOpts?: I18NConfig;
271
269
  codeOpts: CodeConfig;
272
270
  checksums: ChecksumBundle;
273
271
  indirect: boolean;
@@ -373,20 +371,6 @@ export class PlasmicApi {
373
371
  return result.data as ProjectIconsResponse;
374
372
  }
375
373
 
376
- async projectSyncMetadata(
377
- projectId: string,
378
- branchName: string,
379
- revision: number,
380
- rethrowAppError: boolean
381
- ): Promise<ProjectSyncMetadataModel> {
382
- const result = await this.post(
383
- `${this.codegenHost}/api/v1/projects/${projectId}/code/project-sync-metadata?branchName=${branchName}`,
384
- { revision },
385
- rethrowAppError
386
- );
387
- return ProjectSyncMetadataModel.fromJson(result.data);
388
- }
389
-
390
374
  connectSocket(): Socket {
391
375
  const socket = socketio(this.studioHost, {
392
376
  path: `/api/v1/socket`,
package/src/index.ts CHANGED
@@ -254,10 +254,9 @@ yargs
254
254
  })
255
255
  .option("key-scheme", {
256
256
  describe:
257
- "What value to use as message keys; either the message content itself, or a hash of it",
257
+ "What value to use as message keys; either the message content itself, or a hash of it. Defaults to whatever is specified in plasmic.json, or `content`",
258
258
  type: "string",
259
259
  choices: ["content", "hash"],
260
- default: "content",
261
260
  })
262
261
  .option("output", {
263
262
  alias: "o",
@@ -318,18 +317,6 @@ function configureSyncArgs(
318
317
  "Overwrite the skeleton file with newly generated version. Useful when switching between codegen schemes.",
319
318
  default: false,
320
319
  })
321
- .option("append-jsx-on-missing-base", {
322
- type: "boolean",
323
- describe:
324
- "When the base metadata is missing to perform the three-way merge for direct edit component, append the jsx of the new version so that user can perform manual merge.",
325
- default: false,
326
- })
327
- .option("new-component-scheme", {
328
- type: "string",
329
- choices: ["blackbox", "direct"],
330
- describe:
331
- "Sync the new components using this code scheme rather than the default code scheme.",
332
- })
333
320
  .option("ignore-post-sync", {
334
321
  type: "boolean",
335
322
  describe: "Ignore post-sync commands in plasmic.json",
@@ -1,3 +1,4 @@
1
+ /// <reference types="@types/jest" />
1
2
  import L from "lodash";
2
3
  import { SyncArgs } from "../actions/sync";
3
4
  import { PlasmicConfig, ProjectConfig } from "../utils/config-utils";
@@ -96,8 +97,6 @@ export function standardTestSetup(includeDep = true) {
96
97
  nonRecursive: false,
97
98
  skipUpgradeCheck: true,
98
99
  forceOverwrite: true,
99
- newComponentScheme: "blackbox",
100
- appendJsxOnMissingBase: false,
101
100
  config: tmpRepo.plasmicJsonPath(),
102
101
  auth: tmpRepo.plasmicAuthPath(),
103
102
  loaderConfig: tmpRepo.plasmicLoaderJsonPath(),
@@ -91,6 +91,9 @@ export interface PlasmicConfig {
91
91
  /** The version of cli when this file was written */
92
92
  cliVersion?: string;
93
93
 
94
+ /** Configuration for localization */
95
+ i18n?: I18NConfig;
96
+
94
97
  /** Arbitrary command to run after `plasmic sync` has run; useful for linting and code formatting synced files */
95
98
  postSyncCommands?: string[];
96
99
  }
@@ -100,7 +103,7 @@ export interface CodeConfig {
100
103
  lang: "ts" | "js";
101
104
 
102
105
  /** The default code generation scheme. Each component can override the scheme. */
103
- scheme: "blackbox" | "direct";
106
+ scheme: "blackbox";
104
107
 
105
108
  reactRuntime: "classic" | "automatic";
106
109
  }
@@ -334,6 +337,14 @@ export interface ProjectLock {
334
337
  codegenVersion?: string;
335
338
  }
336
339
 
340
+ export interface I18NConfig {
341
+ /**
342
+ * For localization, whether the extracted strings are keyed by its content
343
+ * or by a hash of its content
344
+ */
345
+ keyScheme: "content" | "hash";
346
+ }
347
+
337
348
  export interface PlasmicLock {
338
349
  // One for each project that has been synced
339
350
  projects: ProjectLock[];
package/tsconfig.json CHANGED
@@ -60,6 +60,8 @@
60
60
  // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
61
61
  // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
62
62
 
63
+ "skipLibCheck": true,
64
+
63
65
  /* Advanced Options */
64
66
  "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
65
67
  },