Skip to content

Commit

Permalink
Default to studies dir and seed.bin output file. (#1235)
Browse files Browse the repository at this point in the history
Use sane defaults to be able to call `seed_tools create` and `seed_tools
lint` without any parameters.
  • Loading branch information
goodov authored Oct 23, 2024
1 parent 96b5b53 commit edd9f7f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/scripts/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ function getLintAllCommands(options: Options): string[] {
return [
'prettier . --ignore-unknown' + (options.fix ? ' --write' : ' --check'),
'eslint . --config src/.eslintrc.js' + (options.fix ? ' --fix' : ''),
// TODO(goodov): Add a command to lint JSON studies when per-file structure
// appears.
// TODO(goodov): Enable when per-file structure appears.
// 'npm run seed_tools lint --' + (options.fix ? ' --fix' : ''),
];
}

Expand All @@ -53,7 +53,7 @@ function getLintDiffCommands(options: Options): Record<string, any> {
'*.{ts,js,tsx,jsx}':
'eslint --config src/.eslintrc.js' + (options.fix ? ' --fix' : ''),
'studies/*': () =>
'npm run seed_tools -- lint studies' + (options.fix ? ' --fix' : ''),
'npm run seed_tools lint --' + (options.fix ? ' --fix' : ''),
};
}

Expand Down
8 changes: 6 additions & 2 deletions src/seed_tools/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ import { readStudiesToSeed } from '../utils/studies_to_seed';
export default function createCommand() {
return new Command('create')
.description('Create seed.bin from study files')
.argument('<studies_dir>', 'path to the directory containing study files')
.argument('<output_seed_file>', 'output seed file')
.argument(
'[studies_dir]',
'path to the directory containing study files',
'studies',
)
.argument('[output_seed_file]', 'output seed file', 'seed.bin')
.option('--mock_serial_number <value>', 'mock serial number')
.option(
'--output_serial_number_file <path>',
Expand Down
6 changes: 5 additions & 1 deletion src/seed_tools/commands/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import { readStudiesToSeed } from '../utils/studies_to_seed';
export default function createCommand() {
return new Command('lint')
.description('Lint study files without creating seed.bin')
.argument('<studies_dir>', 'path to the directory containing study files')
.argument(
'[studies_dir]',
'path to the directory containing study files',
'studies',
)
.option('--fix', 'fix format errors in-place')
.action(lintStudies);
}
Expand Down

0 comments on commit edd9f7f

Please sign in to comment.