@plasmicapp/cli 0.1.301 → 0.1.303

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicapp/cli",
3
- "version": "0.1.301",
3
+ "version": "0.1.303",
4
4
  "description": "plasmic cli for syncing local code with Plasmic designs",
5
5
  "engines": {
6
6
  "node": ">=12"
@@ -78,5 +78,5 @@
78
78
  "wrap-ansi": "^7.0.0",
79
79
  "yargs": "^15.4.1"
80
80
  },
81
- "gitHead": "eb28b8015d98fcffb97ed126463f35476a2ecf13"
81
+ "gitHead": "21247728f875ffbc940e6b4636e99f7a67aca454"
82
82
  }
@@ -75,6 +75,7 @@ export interface SyncArgs extends CommonArgs {
75
75
  allFiles?: boolean;
76
76
  loaderConfig?: string;
77
77
  skipFormatting?: boolean;
78
+ skipBuffering?: boolean;
78
79
  }
79
80
 
80
81
  async function ensureRequiredPackages(
@@ -319,8 +320,7 @@ export async function sync(
319
320
  const externalNpmPackages = new Set<string>();
320
321
  const externalCssImports = new Set<string>();
321
322
 
322
- // Perform the actual sync
323
- await withBufferedFs(async () => {
323
+ const doSync = async () => {
324
324
  // Sync in sequence (no parallelism)
325
325
  // going in reverse to get leaves of the dependency tree first
326
326
  for (const projectMeta of projectsToSync) {
@@ -408,7 +408,14 @@ export async function sync(
408
408
  });
409
409
  // Write the new ComponentConfigs to disk
410
410
  await updateConfig(context, context.config, baseDir);
411
- });
411
+ };
412
+
413
+ // Perform the actual sync
414
+ if (opts.skipBuffering) {
415
+ await doSync();
416
+ } else {
417
+ await withBufferedFs(doSync);
418
+ }
412
419
 
413
420
  await checkExternalPkgs(
414
421
  context,
package/src/index.ts CHANGED
@@ -366,6 +366,12 @@ function configureSyncArgs(
366
366
  describe: "Disables formatting on generated code",
367
367
  default: false,
368
368
  })
369
+ .option("skip-buffering", {
370
+ type: "boolean",
371
+ describe:
372
+ "Write files directly to disk, instead of buffering and only writing if sync completes successfully",
373
+ default: false,
374
+ })
369
375
  .option("all-files", {
370
376
  type: "boolean",
371
377
  describe:
package/src/lib.ts CHANGED
@@ -8,3 +8,7 @@ export { WatchArgs, watchProjects } from "./actions/watch";
8
8
  export { logger } from "./deps";
9
9
  export { HandledError, handleError } from "./utils/error";
10
10
  export { Metadata, setMetadataEnv } from "./utils/get-context";
11
+ export {
12
+ localizationStrings,
13
+ LocalizationStringsArgs,
14
+ } from "./actions/localization-strings";
@@ -504,6 +504,7 @@ export async function fixAllImportStatements(
504
504
  logger.info("Fixing import statements...");
505
505
  const config = context.config;
506
506
  const fixImportContext = mkFixImportContext(config);
507
+ let lastError: any = undefined;
507
508
  for (const project of config.projects) {
508
509
  for (const compConfig of project.components) {
509
510
  const compSummary = summary?.get(compConfig.id);
@@ -514,17 +515,36 @@ export async function fixAllImportStatements(
514
515
  ? compSummary.skeletonModuleModified
515
516
  : true;
516
517
  if (!summary || compSummary) {
517
- await fixComponentImportStatements(
518
- context,
519
- compConfig,
520
- fixImportContext,
521
- fixSkeletonModule,
522
- baseDir
523
- );
518
+ try {
519
+ await fixComponentImportStatements(
520
+ context,
521
+ compConfig,
522
+ fixImportContext,
523
+ fixSkeletonModule,
524
+ baseDir
525
+ );
526
+ } catch (err) {
527
+ logger.error(
528
+ `Error encountered while fixing imports for ${compConfig.name}: ${err}`
529
+ );
530
+ lastError = err;
531
+ }
524
532
  }
525
533
  }
526
534
  }
527
- fixGlobalContextImportStatements(context, fixImportContext, baseDir);
535
+
536
+ try {
537
+ fixGlobalContextImportStatements(context, fixImportContext, baseDir);
538
+ } catch (err) {
539
+ logger.error(
540
+ `Error encountered while fixing imports for global contexts: ${err}`
541
+ );
542
+ lastError = err;
543
+ }
544
+
545
+ if (lastError) {
546
+ throw lastError;
547
+ }
528
548
  }
529
549
 
530
550
  async function fixComponentImportStatements(