@lightdash/cli 0.2155.7 → 0.2155.9

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.
@@ -1,6 +1,7 @@
1
1
  type GetDbtContextArgs = {
2
2
  projectDir: string;
3
3
  initialProjectDir?: string;
4
+ targetPath?: string;
4
5
  };
5
6
  export type DbtContext = {
6
7
  projectName: string;
@@ -8,6 +9,6 @@ export type DbtContext = {
8
9
  targetDir: string;
9
10
  modelsDir: string;
10
11
  };
11
- export declare const getDbtContext: ({ projectDir, initialProjectDir, }: GetDbtContextArgs) => Promise<DbtContext>;
12
+ export declare const getDbtContext: ({ projectDir, initialProjectDir, targetPath, }: GetDbtContextArgs) => Promise<DbtContext>;
12
13
  export {};
13
14
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/dbt/context.ts"],"names":[],"mappings":"AAOA,KAAK,iBAAiB,GAAG;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AACF,MAAM,MAAM,UAAU,GAAG;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAkBF,eAAO,MAAM,aAAa,uCAGvB,iBAAiB,KAAG,OAAO,CAAC,UAAU,CA+CxC,CAAC"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/dbt/context.ts"],"names":[],"mappings":"AAOA,KAAK,iBAAiB,GAAG;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AACF,MAAM,MAAM,UAAU,GAAG;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAkBF,eAAO,MAAM,aAAa,mDAIvB,iBAAiB,KAAG,OAAO,CAAC,UAAU,CAqExC,CAAC"}
@@ -18,7 +18,7 @@ function tryRenderVariable(variableName, raw) {
18
18
  return raw;
19
19
  }
20
20
  }
21
- const getDbtContext = async ({ projectDir, initialProjectDir, }) => {
21
+ const getDbtContext = async ({ projectDir, initialProjectDir, targetPath, }) => {
22
22
  globalState_1.default.debug(`> Loading dbt_project.yml file from: ${projectDir}`);
23
23
  const projectFilename = path.join(projectDir, 'dbt_project.yml');
24
24
  let file;
@@ -31,6 +31,7 @@ const getDbtContext = async ({ projectDir, initialProjectDir, }) => {
31
31
  return await (0, exports.getDbtContext)({
32
32
  projectDir: parentDir,
33
33
  initialProjectDir: initialProjectDir || projectDir,
34
+ targetPath,
34
35
  });
35
36
  }
36
37
  const msg = (0, common_1.getErrorMessage)(e);
@@ -38,17 +39,32 @@ const getDbtContext = async ({ projectDir, initialProjectDir, }) => {
38
39
  }
39
40
  const config = yaml.load(file);
40
41
  // Try to render Jinja templating (e.g., env_var) for each individual config key needed
41
- let targetSubDir = config['target-path'] || './target';
42
+ let targetSubDir;
43
+ // Precedence: CLI option > env var > dbt_project.yml > default
44
+ if (targetPath) {
45
+ targetSubDir = targetPath;
46
+ globalState_1.default.debug(`> Using target-path from CLI option: ${targetSubDir}`);
47
+ }
48
+ else if (process.env.DBT_TARGET_PATH) {
49
+ targetSubDir = process.env.DBT_TARGET_PATH;
50
+ globalState_1.default.debug(`> Using target-path from DBT_TARGET_PATH env var: ${targetSubDir}`);
51
+ }
52
+ else {
53
+ targetSubDir = config['target-path'] || './target';
54
+ targetSubDir = tryRenderVariable('target-path', targetSubDir);
55
+ globalState_1.default.debug(`> Using target-path from dbt_project.yml: ${targetSubDir}`);
56
+ }
42
57
  let modelsSubDir = config['models-path'] || './models';
43
58
  let projectName = config.name;
44
59
  let profileName = config.profile;
45
60
  // ! Important: We only render the variables that are needed for the context, other variables are not rendered to avoid unexpected behavior.
46
- targetSubDir = tryRenderVariable('target-path', targetSubDir);
47
61
  modelsSubDir = tryRenderVariable('models-path', modelsSubDir);
48
62
  projectName = tryRenderVariable('name', projectName);
49
63
  profileName = tryRenderVariable('profile', profileName);
50
64
  globalState_1.default.debug(`> dbt target directory: ${targetSubDir}`);
51
- const targetDir = path.join(projectDir, targetSubDir);
65
+ const targetDir = path.isAbsolute(targetSubDir)
66
+ ? targetSubDir
67
+ : path.join(projectDir, targetSubDir);
52
68
  const modelsDir = path.join(projectDir, modelsSubDir);
53
69
  return {
54
70
  projectName,
@@ -66,4 +66,87 @@ models-path: "models"
66
66
  expect(context.modelsDir).toBe(path.join(tempDir, 'models'));
67
67
  });
68
68
  });
69
+ describe('target-path precedence', () => {
70
+ test('should use DBT_TARGET_PATH env var when set', async () => {
71
+ process.env.DBT_TARGET_PATH = 'env-target';
72
+ const dbtProjectContent = `name: test_project
73
+ profile: test_profile
74
+ target-path: "yml-target"
75
+ models-path: "models"
76
+ `;
77
+ await fs_1.promises.writeFile(path.join(tempDir, 'dbt_project.yml'), dbtProjectContent);
78
+ const context = await (0, context_1.getDbtContext)({ projectDir: tempDir });
79
+ expect(context.targetDir).toBe(path.join(tempDir, 'env-target'));
80
+ });
81
+ test('should use CLI option over DBT_TARGET_PATH env var', async () => {
82
+ process.env.DBT_TARGET_PATH = 'env-target';
83
+ const dbtProjectContent = `name: test_project
84
+ profile: test_profile
85
+ target-path: "yml-target"
86
+ models-path: "models"
87
+ `;
88
+ await fs_1.promises.writeFile(path.join(tempDir, 'dbt_project.yml'), dbtProjectContent);
89
+ const context = await (0, context_1.getDbtContext)({
90
+ projectDir: tempDir,
91
+ targetPath: 'cli-target',
92
+ });
93
+ expect(context.targetDir).toBe(path.join(tempDir, 'cli-target'));
94
+ });
95
+ test('should use CLI option over dbt_project.yml', async () => {
96
+ const dbtProjectContent = `name: test_project
97
+ profile: test_profile
98
+ target-path: "yml-target"
99
+ models-path: "models"
100
+ `;
101
+ await fs_1.promises.writeFile(path.join(tempDir, 'dbt_project.yml'), dbtProjectContent);
102
+ const context = await (0, context_1.getDbtContext)({
103
+ projectDir: tempDir,
104
+ targetPath: 'cli-target',
105
+ });
106
+ expect(context.targetDir).toBe(path.join(tempDir, 'cli-target'));
107
+ });
108
+ test('should use dbt_project.yml when no env var or CLI option', async () => {
109
+ const dbtProjectContent = `name: test_project
110
+ profile: test_profile
111
+ target-path: "yml-target"
112
+ models-path: "models"
113
+ `;
114
+ await fs_1.promises.writeFile(path.join(tempDir, 'dbt_project.yml'), dbtProjectContent);
115
+ const context = await (0, context_1.getDbtContext)({ projectDir: tempDir });
116
+ expect(context.targetDir).toBe(path.join(tempDir, 'yml-target'));
117
+ });
118
+ test('should use default target when nothing is set', async () => {
119
+ const dbtProjectContent = `name: test_project
120
+ profile: test_profile
121
+ models-path: "models"
122
+ `;
123
+ await fs_1.promises.writeFile(path.join(tempDir, 'dbt_project.yml'), dbtProjectContent);
124
+ const context = await (0, context_1.getDbtContext)({ projectDir: tempDir });
125
+ expect(context.targetDir).toBe(path.join(tempDir, './target'));
126
+ });
127
+ test('should use absolute path from DBT_TARGET_PATH without joining', async () => {
128
+ const absoluteTargetPath = '/usr/app/examples/full-jaffle-shop/dbt/test_target';
129
+ process.env.DBT_TARGET_PATH = absoluteTargetPath;
130
+ const dbtProjectContent = `name: test_project
131
+ profile: test_profile
132
+ models-path: "models"
133
+ `;
134
+ await fs_1.promises.writeFile(path.join(tempDir, 'dbt_project.yml'), dbtProjectContent);
135
+ const context = await (0, context_1.getDbtContext)({ projectDir: tempDir });
136
+ expect(context.targetDir).toBe(absoluteTargetPath);
137
+ });
138
+ test('should use absolute path from CLI option without joining', async () => {
139
+ const absoluteTargetPath = '/usr/app/examples/full-jaffle-shop/dbt/test_target';
140
+ const dbtProjectContent = `name: test_project
141
+ profile: test_profile
142
+ models-path: "models"
143
+ `;
144
+ await fs_1.promises.writeFile(path.join(tempDir, 'dbt_project.yml'), dbtProjectContent);
145
+ const context = await (0, context_1.getDbtContext)({
146
+ projectDir: tempDir,
147
+ targetPath: absoluteTargetPath,
148
+ });
149
+ expect(context.targetDir).toBe(absoluteTargetPath);
150
+ });
151
+ });
69
152
  });
@@ -1 +1 @@
1
- {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/handlers/compile.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,iBAAiB,EAA8B,MAAM,eAAe,CAAC;AAI9E,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,OAAO,YAAmB,qBAAqB,gGAwJ3D,CAAC;AACF,eAAO,MAAM,cAAc,oBACN,qBAAqB,kBAuBzC,CAAC"}
1
+ {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/handlers/compile.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,iBAAiB,EAA8B,MAAM,eAAe,CAAC;AAI9E,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,OAAO,YAAmB,qBAAqB,gGA2J3D,CAAC;AACF,eAAO,MAAM,cAAc,oBACN,qBAAqB,kBAuBzC,CAAC"}
@@ -32,7 +32,10 @@ const compile = async (options) => {
32
32
  });
33
33
  const absoluteProjectPath = path_1.default.resolve(options.projectDir);
34
34
  globalState_1.default.debug(`> Compiling with project dir ${absoluteProjectPath}`);
35
- const context = await (0, context_1.getDbtContext)({ projectDir: absoluteProjectPath });
35
+ const context = await (0, context_1.getDbtContext)({
36
+ projectDir: absoluteProjectPath,
37
+ targetPath: options.targetPath,
38
+ });
36
39
  const compiledModelIds = await (0, compile_1.maybeCompileModelsAndJoins)({ targetDir: context.targetDir }, options);
37
40
  const manifest = await (0, manifest_1.loadManifest)({ targetDir: context.targetDir });
38
41
  const manifestVersion = (0, common_1.getDbtManifestVersion)(manifest);
@@ -13,6 +13,7 @@ type CreateProjectOptions = {
13
13
  copyContent?: boolean;
14
14
  warehouseCredentials?: boolean;
15
15
  organizationCredentials?: string;
16
+ targetPath?: string;
16
17
  };
17
18
  export declare const createProject: (options: CreateProjectOptions) => Promise<ApiCreateProjectResults | undefined>;
18
19
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"createProject.d.ts","sourceRoot":"","sources":["../../src/handlers/createProject.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,+BAA+B,EAE/B,WAAW,EAEX,KAAK,uBAAuB,EAG/B,MAAM,mBAAmB,CAAC;AA2D3B,eAAO,MAAM,kCAAkC,SACrC,MAAM,KACb,OAAO,CAAC,MAAM,CAyChB,CAAC;AAEF,KAAK,oBAAoB,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,+BAA+B,CAAC;IACrD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,aAAa,YACb,oBAAoB,KAC9B,OAAO,CAAC,uBAAuB,GAAG,SAAS,CA2H7C,CAAC"}
1
+ {"version":3,"file":"createProject.d.ts","sourceRoot":"","sources":["../../src/handlers/createProject.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,+BAA+B,EAE/B,WAAW,EAEX,KAAK,uBAAuB,EAG/B,MAAM,mBAAmB,CAAC;AA2D3B,eAAO,MAAM,kCAAkC,SACrC,MAAM,KACb,OAAO,CAAC,MAAM,CAyChB,CAAC;AAEF,KAAK,oBAAoB,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,+BAA+B,CAAC;IACrD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,aAAa,YACb,oBAAoB,KAC9B,OAAO,CAAC,uBAAuB,GAAG,SAAS,CA8H7C,CAAC"}
@@ -94,7 +94,10 @@ const createProject = async (options) => {
94
94
  }
95
95
  const dbtVersion = await (0, getDbtVersion_1.getDbtVersion)();
96
96
  const absoluteProjectPath = path_1.default.resolve(options.projectDir);
97
- const context = await (0, context_1.getDbtContext)({ projectDir: absoluteProjectPath });
97
+ const context = await (0, context_1.getDbtContext)({
98
+ projectDir: absoluteProjectPath,
99
+ targetPath: options.targetPath,
100
+ });
98
101
  let targetName;
99
102
  let credentials;
100
103
  // If using organization credentials, don't load warehouse credentials from profiles
@@ -17,6 +17,7 @@ export type DbtCompileOptions = {
17
17
  skipWarehouseCatalog: boolean | undefined;
18
18
  useDbtList: boolean | undefined;
19
19
  defer: boolean | undefined;
20
+ targetPath: string | undefined;
20
21
  };
21
22
  export declare const dbtCompile: (options: DbtCompileOptions) => Promise<void>;
22
23
  export declare function maybeCompileModelsAndJoins(loadManifestOpts: LoadManifestArgs, initialOptions: DbtCompileOptions): Promise<string[] | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/handlers/dbt/compile.ts"],"names":[],"mappings":"AAUA,OAAO,EAAgB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAIpE,MAAM,MAAM,iBAAiB,GAAG;IAC5B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,cAAc,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,cAAc,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,oBAAoB,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1C,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,KAAK,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9B,CAAC;AAsCF,eAAO,MAAM,UAAU,YAAmB,iBAAiB,kBAW1D,CAAC;AAgFF,wBAAsB,0BAA0B,CAC5C,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,iBAAiB,GAClC,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAsF/B"}
1
+ {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/handlers/dbt/compile.ts"],"names":[],"mappings":"AAUA,OAAO,EAAgB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAIpE,MAAM,MAAM,iBAAiB,GAAG;IAC5B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,cAAc,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,cAAc,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,oBAAoB,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1C,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,KAAK,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC,CAAC;AAuCF,eAAO,MAAM,UAAU,YAAmB,iBAAiB,kBAW1D,CAAC;AAgFF,wBAAsB,0BAA0B,CAC5C,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,iBAAiB,GAClC,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAsF/B"}
@@ -24,6 +24,7 @@ const dbtCompileArgs = [
24
24
  'state',
25
25
  'fullRefresh',
26
26
  'defer',
27
+ 'targetPath',
27
28
  ];
28
29
  const camelToSnakeCase = (str) => str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
29
30
  const optionsToArgs = (options) => Object.entries(options).reduce((acc, [key, value]) => {
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/handlers/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,OAAO,EACP,YAAY,EAOf,MAAM,mBAAmB,CAAC;AAiB3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGlD,KAAK,oBAAoB,GAAG,iBAAiB,GAAG;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,KAAK,UAAU,GAAG,oBAAoB,GAAG;IACrC,WAAW,EAAE,MAAM,CAAC;CACvB,CAAC;AAkCF,eAAO,MAAM,MAAM,aACL,CAAC,OAAO,GAAG,YAAY,CAAC,EAAE,WAC3B,UAAU,KACpB,OAAO,CAAC,IAAI,CA2Cd,CAAC;AAwFF,eAAO,MAAM,aAAa,oBAA2B,oBAAoB,kBA+ExE,CAAC"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/handlers/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,OAAO,EACP,YAAY,EAOf,MAAM,mBAAmB,CAAC;AAiB3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGlD,KAAK,oBAAoB,GAAG,iBAAiB,GAAG;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,KAAK,UAAU,GAAG,oBAAoB,GAAG;IACrC,WAAW,EAAE,MAAM,CAAC;CACvB,CAAC;AAkCF,eAAO,MAAM,MAAM,aACL,CAAC,OAAO,GAAG,YAAY,CAAC,EAAE,WAC3B,UAAU,KACpB,OAAO,CAAC,IAAI,CA2Cd,CAAC;AAyFF,eAAO,MAAM,aAAa,oBAA2B,oBAAoB,kBA+ExE,CAAC"}
@@ -72,6 +72,7 @@ const createNewProject = async (executionId, options) => {
72
72
  const absoluteProjectPath = path_1.default.resolve(options.projectDir);
73
73
  const context = await (0, context_1.getDbtContext)({
74
74
  projectDir: absoluteProjectPath,
75
+ targetPath: options.targetPath,
75
76
  });
76
77
  const dbtName = (0, common_1.friendlyName)(context.projectName);
77
78
  // default project name
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/handlers/generate.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAKlD,KAAK,sBAAsB,GAAG,qBAAqB,GAAG;IAClD,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC9B,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,eAAe,YAAmB,sBAAsB,kBAoKpE,CAAC"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/handlers/generate.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAKlD,KAAK,sBAAsB,GAAG,qBAAqB,GAAG;IAClD,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC9B,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,eAAe,YAAmB,sBAAsB,kBAqKpE,CAAC"}
@@ -46,6 +46,7 @@ const generateHandler = async (options) => {
46
46
  const absoluteProjectPath = path.resolve(options.projectDir);
47
47
  const context = await (0, context_1.getDbtContext)({
48
48
  projectDir: absoluteProjectPath,
49
+ targetPath: options.targetPath,
49
50
  });
50
51
  const profileName = options.profile || context.profileName;
51
52
  const dbtVersion = await (0, getDbtVersion_1.getDbtVersion)();
@@ -1 +1 @@
1
- {"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/handlers/preview.ts"],"names":[],"mappings":"AACA,OAAO,EACH,+BAA+B,EAGlC,MAAM,mBAAmB,CAAC;AAe3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGlD,KAAK,qBAAqB,GAAG,iBAAiB,GAAG;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,kBAAkB,EAAE,+BAA+B,CAAC;IACpD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAyEF,eAAO,MAAM,cAAc,YACd,qBAAqB,KAC/B,OAAO,CAAC,IAAI,CAiPd,CAAC;AAEF,eAAO,MAAM,mBAAmB,YACnB,qBAAqB,KAC/B,OAAO,CAAC,IAAI,CAwHd,CAAC;AAEF,eAAO,MAAM,kBAAkB,YAClB,yBAAyB,KACnC,OAAO,CAAC,IAAI,CA0Cd,CAAC"}
1
+ {"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/handlers/preview.ts"],"names":[],"mappings":"AACA,OAAO,EACH,+BAA+B,EAGlC,MAAM,mBAAmB,CAAC;AAe3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGlD,KAAK,qBAAqB,GAAG,iBAAiB,GAAG;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,kBAAkB,EAAE,+BAA+B,CAAC;IACpD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAyEF,eAAO,MAAM,cAAc,YACd,qBAAqB,KAC/B,OAAO,CAAC,IAAI,CAkPd,CAAC;AAEF,eAAO,MAAM,mBAAmB,YACnB,qBAAqB,KAC/B,OAAO,CAAC,IAAI,CAwHd,CAAC;AAEF,eAAO,MAAM,kBAAkB,YAClB,yBAAyB,KACnC,OAAO,CAAC,IAAI,CA0Cd,CAAC"}
@@ -200,6 +200,7 @@ const previewHandler = async (options) => {
200
200
  const absoluteProjectPath = path_1.default.resolve(options.projectDir);
201
201
  const context = await (0, context_1.getDbtContext)({
202
202
  projectDir: absoluteProjectPath,
203
+ targetPath: options.targetPath,
203
204
  });
204
205
  const manifestFilePath = path_1.default.join(context.targetDir, 'manifest.json');
205
206
  const pressToShutdown = globalState_1.default.startSpinner(` Press [ENTER] to shutdown preview...`);
package/dist/index.js CHANGED
@@ -139,6 +139,7 @@ commander_1.program
139
139
  .option('--profiles-dir <path>', 'The directory of the dbt profiles', env_1.DEFAULT_DBT_PROFILES_DIR)
140
140
  .option('--profile <name>', 'The name of the profile to use (defaults to profile name in dbt_project.yml)', undefined)
141
141
  .option('--target <name>', 'target to use in profiles.yml file', undefined)
142
+ .option('--target-path <path>', 'The target directory for dbt (overrides DBT_TARGET_PATH and dbt_project.yml)', undefined)
142
143
  .option('--vars <vars>')
143
144
  .option('--threads <number>')
144
145
  .option('--no-version-check')
@@ -163,6 +164,7 @@ commander_1.program
163
164
  .option('--profiles-dir <path>', 'The directory of the dbt profiles', env_1.DEFAULT_DBT_PROFILES_DIR)
164
165
  .option('--profile <name>', 'The name of the profile to use (defaults to profile name in dbt_project.yml)', undefined)
165
166
  .option('--target <name>', 'target to use in profiles.yml file', undefined)
167
+ .option('--target-path <path>', 'The target directory for dbt (overrides DBT_TARGET_PATH and dbt_project.yml)', undefined)
166
168
  .option('--vars <vars>')
167
169
  .option('--defer', 'dbt property. Resolve unselected nodes by deferring to the manifest within the --state directory.', undefined)
168
170
  .option('--no-defer', 'dbt property. Do not resolve unselected nodes by deferring to the manifest within the --state directory.', undefined)
@@ -192,6 +194,7 @@ commander_1.program
192
194
  .option('--profiles-dir <path>', 'The directory of the dbt profiles', env_1.DEFAULT_DBT_PROFILES_DIR)
193
195
  .option('--profile <name>', 'The name of the profile to use (defaults to profile name in dbt_project.yml)', undefined)
194
196
  .option('--target <name>', 'target to use in profiles.yml file', undefined)
197
+ .option('--target-path <path>', 'The target directory for dbt (overrides DBT_TARGET_PATH and dbt_project.yml)', undefined)
195
198
  .option('--vars <vars>')
196
199
  .option('--defer', 'dbt property. Resolve unselected nodes by deferring to the manifest within the --state directory.', undefined)
197
200
  .option('--no-defer', 'dbt property. Do not resolve unselected nodes by deferring to the manifest within the --state directory.', undefined)
@@ -247,6 +250,7 @@ commander_1.program
247
250
  .option('--profiles-dir <path>', 'The directory of the dbt profiles', env_1.DEFAULT_DBT_PROFILES_DIR)
248
251
  .option('--profile <name>', 'The name of the profile to use (defaults to profile name in dbt_project.yml)', undefined)
249
252
  .option('--target <name>', 'target to use in profiles.yml file', undefined)
253
+ .option('--target-path <path>', 'The target directory for dbt (overrides DBT_TARGET_PATH and dbt_project.yml)', undefined)
250
254
  .option('--vars <vars>')
251
255
  .option('--threads <number>')
252
256
  .option('--no-version-check')
@@ -320,6 +324,7 @@ ${styles.bold('Examples:')}
320
324
  .option('--profiles-dir <path>', 'The directory of the dbt profiles', env_1.DEFAULT_DBT_PROFILES_DIR)
321
325
  .option('--profile <name>', 'The name of the profile to use (defaults to profile name in dbt_project.yml)', undefined)
322
326
  .option('--target <name>', 'target to use in profiles.yml file', undefined)
327
+ .option('--target-path <path>', 'The target directory for dbt (overrides DBT_TARGET_PATH and dbt_project.yml)', undefined)
323
328
  .option('--vars <vars>')
324
329
  .option('-y, --assume-yes', 'assume yes to prompts', false)
325
330
  .option('--skip-existing', 'skip files that already exist', false)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "0.2155.7",
3
+ "version": "0.2155.9",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "lightdash": "dist/index.js"
@@ -33,8 +33,8 @@
33
33
  "parse-node-version": "^2.0.0",
34
34
  "unique-names-generator": "^4.7.1",
35
35
  "uuid": "^11.0.3",
36
- "@lightdash/common": "0.2155.7",
37
- "@lightdash/warehouses": "0.2155.7"
36
+ "@lightdash/common": "0.2155.9",
37
+ "@lightdash/warehouses": "0.2155.9"
38
38
  },
39
39
  "description": "Lightdash CLI tool",
40
40
  "devDependencies": {