-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat(lts-schedule): Introduce fork of the Node.js LTS schedule script
* custom release schedule graph generator
- Loading branch information
Showing
9 changed files
with
2,382 additions
and
160 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,37 @@ | ||
# lts-schedule | ||
|
||
A command line utility that generates the Spirit LTS schedule as a graph. | ||
Accepts JSON LTS data and a date range as inputs. | ||
Writes the LTS graph as HTML, SVG, and PNG files. | ||
|
||
## 👨💻 Usage | ||
|
||
```bash | ||
node bin/lts.js -s 2021-07-01 -e 2027-06-01 -h output.html -g output.svg -p output.png | ||
``` | ||
|
||
### Options | ||
|
||
- `-d`, `--data` - The path of the input JSON file. The JSON file should be of the same format as the [one in Node's LTS repo][node-lts-repo]. If this option is not provided, `lts` uses its own bundled JSON file. | ||
- `-s`, `--start` - The start date of the graph. Internally, this option is passed to `new Date()`. Optional. Defaults to the current date. | ||
- `-e`, `--end` - The end date of the graph. Internally, this option is passed to `new Date()`. Optional. Defaults to one year from the current date. | ||
- `-h`, `--html` - The location to write the HTML output file. Optional. | ||
- `-g`, `--svg` - The location to write the SVG output file. Optional. | ||
- `-p`, `--png` - The location to write the PNG output file. Uses `svg2png` under the hood. Optional. | ||
- `-a`, `--animate` - Animate the bars of the graph on load. | ||
- `-m`, `--excludeMaster` - Exclude the `Master (unstable)` bar that is ever-present at the top of the graph. Optional. Defaults to false | ||
- `-n`, `--projectName` - Provide a project name for the graph which will be displayed on the left axis beside each version. Optional. Defaults to `Node.js` | ||
|
||
## 🙌 Contributing | ||
|
||
We're always looking for contributors to help us fix bugs, build new features, | ||
or help us improve the project documentation. If you're interested, definitely | ||
check out our [Contributing Guide][contributing]! 👀 | ||
|
||
## 📝 License | ||
|
||
Licensed under the [MIT][license]. | ||
|
||
[contributing]: https://github.com/lmc-eu/spirit-design-system/blob/main/CONTRIBUTING.md | ||
[node-lts-repo]: https://github.com/nodejs/LTS/blob/master/schedule.json | ||
[license]: https://github.com/lmc-eu/spirit-design-system/blob/main/LICENSE.md |
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,107 @@ | ||
#!/usr/bin/env node | ||
const Path = require('path'); | ||
// eslint-disable-next-line import/no-unresolved | ||
const Bossy = require('bossy'); | ||
const Lib = require('../lib'); | ||
|
||
const now = new Date(); | ||
const oneYearFromNow = new Date(); | ||
|
||
oneYearFromNow.setFullYear(now.getFullYear() + 1); | ||
|
||
const cliArgs = { | ||
d: { | ||
description: 'Input LTS JSON file', | ||
alias: 'data', | ||
type: 'string', | ||
require: false, | ||
multiple: false, | ||
default: Path.resolve(__dirname, '..', 'lts.json') | ||
}, | ||
s: { | ||
description: 'Query start date', | ||
alias: 'start', | ||
type: 'string', | ||
require: false, | ||
multiple: false, | ||
default: now | ||
}, | ||
e: { | ||
description: 'Query end date', | ||
alias: 'end', | ||
type: 'string', | ||
require: false, | ||
multiple: false, | ||
default: oneYearFromNow | ||
}, | ||
h: { | ||
description: 'HTML output file', | ||
alias: 'html', | ||
type: 'string', | ||
require: false, | ||
multiple: false, | ||
default: null | ||
}, | ||
g: { | ||
description: 'SVG output file', | ||
alias: 'svg', | ||
type: 'string', | ||
require: false, | ||
multiple: false, | ||
default: null | ||
}, | ||
p: { | ||
description: 'PNG output file', | ||
alias: 'png', | ||
type: 'string', | ||
require: false, | ||
multiple: false, | ||
default: null | ||
}, | ||
a: { | ||
description: 'Animate bars on load', | ||
alias: 'animate', | ||
type: 'boolean', | ||
require: false, | ||
multiple: false, | ||
default: false | ||
}, | ||
m: { | ||
description: 'Exclude Master (unstable) in graph', | ||
alias: 'excludeMaster', | ||
type: 'boolean', | ||
require: false, | ||
multiple: false, | ||
default: false | ||
}, | ||
n: { | ||
description: 'Project Name', | ||
alias: 'projectName', | ||
type: 'string', | ||
require: false, | ||
multiple: false, | ||
default: 'Spirit' | ||
} | ||
}; | ||
|
||
const args = Bossy.parse(cliArgs, { argv: process.argv }); | ||
|
||
if (args instanceof Error) { | ||
Bossy.usage(cliArgs, args.message); | ||
process.exit(1); | ||
} | ||
|
||
const options = { | ||
// eslint-disable-next-line import/no-dynamic-require, global-require | ||
data: require(args.data), | ||
queryStart: new Date(args.start), | ||
queryEnd: new Date(args.end), | ||
html: args.html ? Path.resolve(args.html) : null, | ||
svg: args.svg ? Path.resolve(args.svg) : null, | ||
png: args.png ? Path.resolve(args.png) : null, | ||
animate: args.animate, | ||
excludeMaster: args.excludeMaster, | ||
projectName: args.projectName | ||
}; | ||
|
||
Lib.create(options); |
Oops, something went wrong.