@lightdash/cli 0.1352.0 → 0.1352.2

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.
@@ -98,10 +98,11 @@ const findAndUpdateModelYaml = async ({ model, table, docs, includeMeta, project
98
98
  const expectedYamlPath = path.join(projectDir, projectSubpath, expectedYamlSubPath);
99
99
  filenames.push(expectedYamlPath);
100
100
  }
101
- const defaultYmlPath = path.join(path.dirname(path.join(packageName === projectName
101
+ const outputDir = path.dirname(path.join(packageName === projectName
102
102
  ? '.'
103
- : path.join('dbt_packages', packageName), model.originalFilePath)), `${model.name}.yml`);
104
- filenames.push(defaultYmlPath);
103
+ : path.join('dbt_packages', packageName), model.originalFilePath));
104
+ const outputFilePath = path.join(projectDir, outputDir, `${model.name}.yml`);
105
+ filenames.push(outputFilePath);
105
106
  const match = await (0, schema_1.searchForModel)({
106
107
  modelName: model.name,
107
108
  filenames,
@@ -186,7 +187,7 @@ const findAndUpdateModelYaml = async ({ model, table, docs, includeMeta, project
186
187
  };
187
188
  return {
188
189
  updatedYml,
189
- outputFilePath: defaultYmlPath,
190
+ outputFilePath,
190
191
  };
191
192
  };
192
193
  exports.findAndUpdateModelYaml = findAndUpdateModelYaml;
@@ -94,6 +94,14 @@ const generateHandler = async (options) => {
94
94
  const ymlString = yaml.dump(updatedYml, {
95
95
  quotingType: '"',
96
96
  });
97
+ const outputDirPath = path.dirname(outputFilePath);
98
+ // Create a directory if it doesn't exist
99
+ try {
100
+ await fs_1.promises.access(outputDirPath);
101
+ }
102
+ catch (error) {
103
+ await fs_1.promises.mkdir(outputDirPath, { recursive: true });
104
+ }
97
105
  await fs_1.promises.writeFile(outputFilePath, existingHeadComments
98
106
  ? `${existingHeadComments}\n${ymlString}`
99
107
  : ymlString);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "0.1352.0",
3
+ "version": "0.1352.2",
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.1352.0",
15
- "@lightdash/warehouses": "^0.1352.0",
14
+ "@lightdash/common": "^0.1352.2",
15
+ "@lightdash/warehouses": "^0.1352.2",
16
16
  "@types/columnify": "^1.5.1",
17
17
  "ajv": "^8.11.0",
18
18
  "ajv-formats": "^2.1.1",