Skip to content

Commit

Permalink
Revert "fix(server-core): Handle schemaPath default value correctly e…
Browse files Browse the repository at this point in the history
…verywhere (#8131)"

This reverts commit 23bd621.
  • Loading branch information
paveltiunov committed Apr 12, 2024
1 parent 7710c6f commit 22a6f8b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
10 changes: 6 additions & 4 deletions packages/cubejs-server-core/src/core/DevServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,12 @@ export class DevServer {
});
const files = scaffoldingTemplate.generateFilesByTableNames(req.body.tables, { dataSource });

await fs.emptyDir(path.join(options.schemaPath, 'cubes'));
await fs.emptyDir(path.join(options.schemaPath, 'views'));
const schemaPath = options.schemaPath || 'schema';

await fs.emptyDir(path.join(schemaPath, 'cubes'));
await fs.emptyDir(path.join(schemaPath, 'views'));

await fs.writeFile(path.join(options.schemaPath, 'views', 'example_view.yml'), `# In Cube, views are used to expose slices of your data graph and act as data marts.
await fs.writeFile(path.join(schemaPath, 'views', 'example_view.yml'), `# In Cube, views are used to expose slices of your data graph and act as data marts.
# You can control which measures and dimensions are exposed to BIs or data apps,
# as well as the direction of joins between the exposed cubes.
# You can learn more about views in documentation here - https://cube.dev/docs/schema/reference/view
Expand Down Expand Up @@ -193,7 +195,7 @@ export class DevServer {
# prefix: true
# includes:
# - city`);
await Promise.all(files.map(file => fs.writeFile(path.join(options.schemaPath, 'cubes', file.fileName), file.content)));
await Promise.all(files.map(file => fs.writeFile(path.join(schemaPath, 'cubes', file.fileName), file.content)));

res.json({ files });
}));
Expand Down
2 changes: 1 addition & 1 deletion packages/cubejs-server-core/src/core/OptsHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ export class OptsHandler {
(this.isDevMode()
? 'dev_pre_aggregations'
: 'prod_pre_aggregations'),
schemaPath: getEnv('schemaPath'),
schemaPath: process.env.CUBEJS_SCHEMA_PATH || 'schema',
scheduledRefreshTimer: getEnv('refreshWorkerMode'),
sqlCache: true,
livePreview: getEnv('livePreview'),
Expand Down
1 change: 0 additions & 1 deletion packages/cubejs-server-core/src/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ export type ServerCoreInitializedOptions = Required<
'telemetry' |
'dashboardAppPath' |
'dashboardAppPort' |
'schemaPath' |
'driverFactory' |
'dialectFactory' |
'externalDriverFactory' |
Expand Down

0 comments on commit 22a6f8b

Please sign in to comment.