-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose dataset generation in CLI (#983)
- Loading branch information
Showing
11 changed files
with
87 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#! /usr/bin/env node | ||
import './env.js'; | ||
|
||
import { program } from 'commander'; | ||
import cron from 'croner'; | ||
|
||
import { release } from '../scripts/dataset/index.js'; | ||
import logger from '../src/logger/index.js'; | ||
|
||
program | ||
.name('ota dataset') | ||
.description('Export the versions dataset into a ZIP file and optionally publish it to GitHub releases') | ||
.option('-f, --file <filename>', 'file name of the generated dataset') | ||
.option('-p, --publish', 'publish dataset to GitHub releases on versions repository. Mandatory authentication to GitHub is provided through the `GITHUB_TOKEN` environment variable') | ||
.option('-r, --remove-local-copy', 'remove local copy of dataset after publishing. Works only in combination with --publish option') | ||
.option('--schedule', 'schedule automatic dataset generation'); | ||
|
||
const { schedule, publish, removeLocalCopy, file: fileName } = program.parse().opts(); | ||
|
||
const options = { | ||
fileName, | ||
shouldPublish: publish, | ||
shouldRemoveLocalCopy: removeLocalCopy, | ||
}; | ||
|
||
if (!schedule) { | ||
await release(options); | ||
} else { | ||
logger.info('The scheduler is running…'); | ||
logger.info('Dataset will be published every Monday at 08:30 in the timezone of this machine'); | ||
|
||
cron('30 8 * * MON', () => release(options)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters