@lightdash/cli 0.1440.5 → 0.1441.0

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.
@@ -5,6 +5,7 @@ type GenerateHandlerOptions = CompileHandlerOptions & {
5
5
  models: string[] | undefined;
6
6
  assumeYes: boolean;
7
7
  excludeMeta: boolean;
8
+ skipExisting?: boolean;
8
9
  };
9
10
  export declare const generateHandler: (options: GenerateHandlerOptions) => Promise<void>;
10
11
  export {};
@@ -90,6 +90,17 @@ const generateHandler = async (options) => {
90
90
  assumeYes: options.assumeYes,
91
91
  });
92
92
  try {
93
+ if (options.skipExisting) {
94
+ try {
95
+ await fs_1.promises.access(outputFilePath);
96
+ spinner.warn(` already exists ${styles.bold(compiledModel.name)}${styles.info(` ➡️ ${path.relative(process.cwd(), outputFilePath)} `)}`);
97
+ // eslint-disable-next-line no-continue
98
+ continue; // Skip this file if it already exists
99
+ }
100
+ catch {
101
+ // File does not exist, we continue
102
+ }
103
+ }
93
104
  const existingHeadComments = await (0, schema_1.getFileHeadComments)(outputFilePath);
94
105
  const ymlString = yaml.dump(updatedYml, {
95
106
  quotingType: '"',
package/dist/index.js CHANGED
@@ -287,6 +287,7 @@ ${styles.bold('Examples:')}
287
287
  .option('--target <name>', 'target to use in profiles.yml file', undefined)
288
288
  .option('--vars <vars>')
289
289
  .option('-y, --assume-yes', 'assume yes to prompts', false)
290
+ .option('--skip-existing', 'skip files that already exist', false)
290
291
  .option('--exclude-meta', 'exclude Lightdash metadata from the generated .yml', false)
291
292
  .option('--verbose', undefined, false)
292
293
  .action(generate_1.generateHandler);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "0.1440.5",
3
+ "version": "0.1441.0",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "lightdash": "dist/index.js"
@@ -11,8 +11,8 @@
11
11
  ],
12
12
  "dependencies": {
13
13
  "@actions/core": "^1.11.1",
14
- "@lightdash/common": "^0.1440.5",
15
- "@lightdash/warehouses": "^0.1440.5",
14
+ "@lightdash/common": "^0.1441.0",
15
+ "@lightdash/warehouses": "^0.1441.0",
16
16
  "@types/columnify": "^1.5.1",
17
17
  "ajv": "^8.11.0",
18
18
  "ajv-formats": "^2.1.1",