@plasmicapp/cli 0.1.292 → 0.1.293

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.
@@ -8,5 +8,6 @@ export interface LocalizationStringsArgs extends CommonArgs {
8
8
  forceOverwrite: boolean;
9
9
  keyScheme: "content" | "hash" | "path" | undefined;
10
10
  tagPrefix: string | undefined;
11
+ excludeDeps: boolean | undefined;
11
12
  }
12
13
  export declare function localizationStrings(opts: LocalizationStringsArgs): Promise<void>;
@@ -74,7 +74,7 @@ function localizationStrings(opts) {
74
74
  token: "",
75
75
  });
76
76
  deps_1.logger.info(`Generating localization strings for ${chalk_1.default.bold(opts.projects.join(", "))}...`);
77
- const data = yield api.genLocalizationStrings(opts.projects, opts.format, keyScheme !== null && keyScheme !== void 0 ? keyScheme : "content", tagPrefix, projectIdsAndTokens);
77
+ const data = yield api.genLocalizationStrings(opts.projects, opts.format, keyScheme !== null && keyScheme !== void 0 ? keyScheme : "content", tagPrefix, projectIdsAndTokens, opts.excludeDeps);
78
78
  if (file_utils_1.existsBuffered(output)) {
79
79
  const overwrite = yield user_utils_1.confirmWithUser(`File ${output} already exists. Do you want to overwrite?`, opts.forceOverwrite);
80
80
  if (!overwrite) {
package/dist/api.d.ts CHANGED
@@ -200,7 +200,7 @@ export declare class PlasmicApi {
200
200
  metadata?: Metadata;
201
201
  }): Promise<ProjectBundle>;
202
202
  projectMeta(projectId: string): Promise<ProjectMetaInfo>;
203
- genLocalizationStrings(projects: readonly string[], format: "po" | "json" | "lingui", keyScheme: "content" | "hash" | "path", tagPrefix: string | undefined, projectIdsAndTokens: ProjectIdAndToken[]): Promise<string>;
203
+ genLocalizationStrings(projects: readonly string[], format: "po" | "json" | "lingui", keyScheme: "content" | "hash" | "path", tagPrefix: string | undefined, projectIdsAndTokens: ProjectIdAndToken[], excludeDeps: boolean | undefined): Promise<string>;
204
204
  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>;
205
205
  projectStyleTokens(projectId: string, branchName: string, versionRange?: string): Promise<StyleTokensMap>;
206
206
  projectIcons(projectId: string, branchName: string, versionRange?: string, iconIds?: string[]): Promise<ProjectIconsResponse>;
package/dist/api.js CHANGED
@@ -99,11 +99,17 @@ class PlasmicApi {
99
99
  return result.data;
100
100
  });
101
101
  }
102
- genLocalizationStrings(projects, format, keyScheme, tagPrefix, projectIdsAndTokens) {
102
+ genLocalizationStrings(projects, format, keyScheme, tagPrefix, projectIdsAndTokens, excludeDeps) {
103
103
  return __awaiter(this, void 0, void 0, function* () {
104
- const result = yield this.get(`${this.codegenHost}/api/v1/localization/gen-texts?format=${format}&keyScheme=${keyScheme}&tagPrefix=${tagPrefix}&preview=true&${projects
105
- .map((p) => `projectId=${p}`)
106
- .join("&")}`, undefined, {
104
+ const params = new URLSearchParams([
105
+ ["format", format],
106
+ ["keyScheme", keyScheme],
107
+ ["preview", "true"],
108
+ ...projects.map((p) => ["projectId", p]),
109
+ tagPrefix ? ["tagPrefix", tagPrefix] : undefined,
110
+ excludeDeps ? ["excludeDeps", "true"] : undefined,
111
+ ].filter((x) => !!x));
112
+ const result = yield this.get(`${this.codegenHost}/api/v1/localization/gen-texts?${params.toString()}`, undefined, {
107
113
  "x-plasmic-api-project-tokens": projectIdsAndTokens
108
114
  .map(({ projectId, projectApiToken }) => `${projectId}:${projectApiToken}`)
109
115
  .join(","),
package/dist/index.js CHANGED
@@ -212,6 +212,11 @@ yargs_1.default
212
212
  .option("tag-prefix", {
213
213
  describe: "By default, rich text with markup tags look like '<0>hello</0>'. If your localization framework requires num-numeric tags, then specify a prefix; for example a prefix of 'n' turns it into '<n0>hello</n0>'.",
214
214
  type: "string",
215
+ })
216
+ .option("exclude-deps", {
217
+ type: "boolean",
218
+ describe: "By default, strings from imported dependencies are also included. Specify --exclude-deps to only include strings from projects you explicitly specify.",
219
+ default: false,
215
220
  })
216
221
  .option("output", {
217
222
  alias: "o",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicapp/cli",
3
- "version": "0.1.292",
3
+ "version": "0.1.293",
4
4
  "description": "plasmic cli for syncing local code with Plasmic designs",
5
5
  "engines": {
6
6
  "node": ">=12"
@@ -80,5 +80,5 @@
80
80
  "wrap-ansi": "^7.0.0",
81
81
  "yargs": "^15.4.1"
82
82
  },
83
- "gitHead": "b416c3aff370f8f8b0c884e3700bd8fe61ad3e2b"
83
+ "gitHead": "44f8c8ab413dee1f09112df30df9bdf323ac5214"
84
84
  }
@@ -19,6 +19,7 @@ export interface LocalizationStringsArgs extends CommonArgs {
19
19
  forceOverwrite: boolean;
20
20
  keyScheme: "content" | "hash" | "path" | undefined;
21
21
  tagPrefix: string | undefined;
22
+ excludeDeps: boolean | undefined;
22
23
  }
23
24
 
24
25
  export async function localizationStrings(
@@ -89,7 +90,8 @@ export async function localizationStrings(
89
90
  opts.format,
90
91
  keyScheme ?? "content",
91
92
  tagPrefix,
92
- projectIdsAndTokens
93
+ projectIdsAndTokens,
94
+ opts.excludeDeps
93
95
  );
94
96
  if (existsBuffered(output)) {
95
97
  const overwrite = await confirmWithUser(
package/src/api.ts CHANGED
@@ -304,14 +304,21 @@ export class PlasmicApi {
304
304
  format: "po" | "json" | "lingui",
305
305
  keyScheme: "content" | "hash" | "path",
306
306
  tagPrefix: string | undefined,
307
- projectIdsAndTokens: ProjectIdAndToken[]
307
+ projectIdsAndTokens: ProjectIdAndToken[],
308
+ excludeDeps: boolean | undefined
308
309
  ) {
310
+ const params = new URLSearchParams(
311
+ [
312
+ ["format", format],
313
+ ["keyScheme", keyScheme],
314
+ ["preview", "true"],
315
+ ...projects.map((p) => ["projectId", p]),
316
+ tagPrefix ? ["tagPrefix", tagPrefix] : undefined,
317
+ excludeDeps ? ["excludeDeps", "true"] : undefined,
318
+ ].filter((x): x is [string, string] => !!x)
319
+ );
309
320
  const result = await this.get(
310
- `${
311
- this.codegenHost
312
- }/api/v1/localization/gen-texts?format=${format}&keyScheme=${keyScheme}&tagPrefix=${tagPrefix}&preview=true&${projects
313
- .map((p) => `projectId=${p}`)
314
- .join("&")}`,
321
+ `${this.codegenHost}/api/v1/localization/gen-texts?${params.toString()}`,
315
322
  undefined,
316
323
  {
317
324
  "x-plasmic-api-project-tokens": projectIdsAndTokens
package/src/index.ts CHANGED
@@ -263,6 +263,12 @@ yargs
263
263
  "By default, rich text with markup tags look like '<0>hello</0>'. If your localization framework requires num-numeric tags, then specify a prefix; for example a prefix of 'n' turns it into '<n0>hello</n0>'.",
264
264
  type: "string",
265
265
  })
266
+ .option("exclude-deps", {
267
+ type: "boolean",
268
+ describe:
269
+ "By default, strings from imported dependencies are also included. Specify --exclude-deps to only include strings from projects you explicitly specify.",
270
+ default: false,
271
+ })
266
272
  .option("output", {
267
273
  alias: "o",
268
274
  describe: "Output file",