Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ const runTestsOptionName = "run-tests";
const schemaOptionName = "schema";
const tableOptionName = "table";

const fmtIgnoreJsOptionName = "ignore-js-files"

const getCredentialsPath = (projectDir: string, credentialsPath: string) =>
actuallyResolve(credentialsPath || path.join(projectDir, CREDENTIALS_FILENAME));

Expand Down Expand Up @@ -683,9 +685,18 @@ export function runCli() {
format: `format [${projectDirMustExistOption.name}]`,
description: "Format the dataform project's files.",
positionalOptions: [projectDirMustExistOption],
options: [],
options: [
{
name: fmtIgnoreJsOptionName,
option: {
describe: "If set, the formatter will not consider javascript files (.js)",
type: "boolean"
}
}
],
processFn: async argv => {
const filenames = glob.sync("{definitions,includes}/**/*.{js,sqlx}", {
const extensions = argv[fmtIgnoreJsOptionName] ? "*.sqlx" : '*.{js,sqlx}'
const filenames = glob.sync(`{definitions,includes}/**/${extensions}`, {
cwd: argv[projectDirMustExistOption.name]
});
const results = await Promise.all(
Expand Down