@plasmicapp/cli 0.1.189 → 0.1.190

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.
@@ -6,5 +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
10
  }
10
11
  export declare function localizationStrings(opts: LocalizationStringsArgs): Promise<void>;
@@ -66,7 +66,7 @@ function localizationStrings(opts) {
66
66
  token: "",
67
67
  });
68
68
  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, projectIdsAndTokens);
69
+ const data = yield api.genLocalizationStrings(opts.projects, opts.format, opts.keyScheme, projectIdsAndTokens);
70
70
  if (file_utils_1.existsBuffered(output)) {
71
71
  const overwrite = yield user_utils_1.confirmWithUser(`File ${output} already exists. Do you want to overwrite?`, opts.forceOverwrite);
72
72
  if (!overwrite) {
package/dist/api.d.ts CHANGED
@@ -192,7 +192,7 @@ export declare class PlasmicApi {
192
192
  metadata?: Metadata;
193
193
  }): Promise<ProjectBundle>;
194
194
  projectMeta(projectId: string): Promise<ProjectMetaInfo>;
195
- genLocalizationStrings(projects: readonly string[], format: "po" | "json" | "lingui", projectIdsAndTokens: ProjectIdAndToken[]): Promise<string>;
195
+ genLocalizationStrings(projects: readonly string[], format: "po" | "json" | "lingui", keyScheme: "content" | "hash", projectIdsAndTokens: ProjectIdAndToken[]): Promise<string>;
196
196
  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
197
  projectStyleTokens(projectId: string, branchName: string, versionRange?: string): Promise<StyleTokensMap>;
198
198
  projectIcons(projectId: string, branchName: string, versionRange?: string, iconIds?: string[]): Promise<ProjectIconsResponse>;
package/dist/api.js CHANGED
@@ -100,9 +100,9 @@ class PlasmicApi {
100
100
  return result.data;
101
101
  });
102
102
  }
103
- genLocalizationStrings(projects, format, projectIdsAndTokens) {
103
+ genLocalizationStrings(projects, format, keyScheme, projectIdsAndTokens) {
104
104
  return __awaiter(this, void 0, void 0, function* () {
105
- const result = yield this.get(`${this.codegenHost}/api/v1/localization/gen-texts?format=${format}&preview=true&${projects
105
+ const result = yield this.get(`${this.codegenHost}/api/v1/localization/gen-texts?format=${format}&keyScheme=${keyScheme}&preview=true&${projects
106
106
  .map((p) => `projectId=${p}`)
107
107
  .join("&")}`, undefined, {
108
108
  "x-plasmic-api-project-tokens": projectIdsAndTokens
package/dist/index.js CHANGED
@@ -203,6 +203,12 @@ yargs_1.default
203
203
  type: "string",
204
204
  choices: ["json", "po", "lingui"],
205
205
  default: "json",
206
+ })
207
+ .option("key-scheme", {
208
+ describe: "What value to use as message keys; either the message content itself, or a hash of it",
209
+ type: "string",
210
+ choices: ["content", "hash"],
211
+ default: "content",
206
212
  })
207
213
  .option("output", {
208
214
  alias: "o",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicapp/cli",
3
- "version": "0.1.189",
3
+ "version": "0.1.190",
4
4
  "description": "plasmic cli for syncing local code with Plasmic designs",
5
5
  "engines": {
6
6
  "node": ">=12"
@@ -4,12 +4,8 @@ import { CommonArgs } from "..";
4
4
  import { PlasmicApi, ProjectIdAndToken } from "../api";
5
5
  import { logger } from "../deps";
6
6
  import { HandledError } from "../lib";
7
- import { getCurrentAuth, getOrStartAuth } from "../utils/auth-utils";
8
- import {
9
- DEFAULT_HOST,
10
- findConfigFile,
11
- PlasmicContext,
12
- } from "../utils/config-utils";
7
+ import { getCurrentAuth } from "../utils/auth-utils";
8
+ import { DEFAULT_HOST, findConfigFile } from "../utils/config-utils";
13
9
  import { existsBuffered, writeFileText } from "../utils/file-utils";
14
10
  import { getContext } from "../utils/get-context";
15
11
  import { confirmWithUser } from "../utils/user-utils";
@@ -21,6 +17,7 @@ export interface LocalizationStringsArgs extends CommonArgs {
21
17
  format: "po" | "json" | "lingui";
22
18
  output: string;
23
19
  forceOverwrite: boolean;
20
+ keyScheme: "content" | "hash";
24
21
  }
25
22
 
26
23
  export async function localizationStrings(
@@ -81,6 +78,7 @@ export async function localizationStrings(
81
78
  const data = await api.genLocalizationStrings(
82
79
  opts.projects,
83
80
  opts.format,
81
+ opts.keyScheme,
84
82
  projectIdsAndTokens
85
83
  );
86
84
  if (existsBuffered(output)) {
package/src/api.ts CHANGED
@@ -294,12 +294,13 @@ export class PlasmicApi {
294
294
  async genLocalizationStrings(
295
295
  projects: readonly string[],
296
296
  format: "po" | "json" | "lingui",
297
+ keyScheme: "content" | "hash",
297
298
  projectIdsAndTokens: ProjectIdAndToken[]
298
299
  ) {
299
300
  const result = await this.get(
300
301
  `${
301
302
  this.codegenHost
302
- }/api/v1/localization/gen-texts?format=${format}&preview=true&${projects
303
+ }/api/v1/localization/gen-texts?format=${format}&keyScheme=${keyScheme}&preview=true&${projects
303
304
  .map((p) => `projectId=${p}`)
304
305
  .join("&")}`,
305
306
  undefined,
package/src/index.ts CHANGED
@@ -252,6 +252,13 @@ yargs
252
252
  choices: ["json", "po", "lingui"],
253
253
  default: "json",
254
254
  })
255
+ .option("key-scheme", {
256
+ describe:
257
+ "What value to use as message keys; either the message content itself, or a hash of it",
258
+ type: "string",
259
+ choices: ["content", "hash"],
260
+ default: "content",
261
+ })
255
262
  .option("output", {
256
263
  alias: "o",
257
264
  describe: "Output file",