Skip to content

Commit

Permalink
Feat(lts-schedule): Introduce fork of the Node.js LTS schedule script
Browse files Browse the repository at this point in the history
  * custom release schedule graph generator
  • Loading branch information
literat committed Dec 11, 2024
1 parent 2c981d2 commit b44fb02
Show file tree
Hide file tree
Showing 9 changed files with 2,382 additions and 160 deletions.
1 change: 1 addition & 0 deletions .commitlintrc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default {
'design-tokens',
'form-validations',
'icons',
'lts-schedule',
'web',
'web-react',
'web-twig',
Expand Down
2 changes: 1 addition & 1 deletion .remarkrc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
[
'remark-lint-heading-capitalization',
{
lowerCaseWords: ['eu/spirit', '@lmc', 'spirit/node', 'spirit/jsdom', 'v1', 'v2', 'v3'],
lowerCaseWords: ['eu/spirit', '@lmc', 'spirit/node', 'spirit/jsdom', 'lts-schedule', 'v1', 'v2', 'v3'],
},
],
],
Expand Down
6 changes: 6 additions & 0 deletions docs/contribution/release-schedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,20 @@ repositories.
This document was heavily inspired by the work of the
[NodeJS Release Working Group][node-js-release-working-group] and [Carbon Design System Release Schedule][carbon-release-schedule].

The schedule graph was generated using
[our fork][spirit-lts-schedule] of
[`nodejs/lts-schedule`][node-lts-schedule]

[carbon-release-schedule]: https://github.com/carbon-design-system/carbon/blob/main/docs/release-schedule.md
[node-js-release-working-group]: https://github.com/nodejs/release
[node-lts-schedule]: https://github.com/nodejs/lts-schedule
[release-jira-board]: https://jira.almacareer.tech/projects/DS?selectedItem=com.atlassian.jira.jira-projects-plugin%3Arelease-page&status=released-unreleased
[release-names-decision]: https://github.com/lmc-eu/spirit-design-system/blob/main/docs/decisions/007-release-names.md
[release-schedule-static]: https://raw.githubusercontent.com/lmc-eu/spirit-design-system/refs/heads/main/static/release-schedule.svg
[spirit-docs]: https://spirit.design
[spirit-figma]: https://www.figma.com/design/w9Ca4hvkuYLshsrHu1bYwT/Spirit-UI-KIT?node-id=22776-26259&node-type=canvas&t=JIF1i6Yfp9rGUA35-0
[spirit-github-monorepo]: https://github.com/lmc-eu/spirit-design-system
[spirit-jira-board]: https://jira.almacareer.tech/secure/RapidBoard.jspa?rapidView=366&projectKey=DS
[spirit-lts-schedule]: https://github.com/lmc-eu/spirit-design-system/tree/main/packages/lts-schedule
[spirit-support-slack-channel]: https://almamedia.slack.com/archives/C068XPSDWQN
[quarterly-goals]: https://www.notion.so/almacareer/Spirit-Design-System-Quarterly-Goals-878e92d5b74543039e513c0160fb9117
37 changes: 37 additions & 0 deletions packages/lts-schedule/README.md
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
107 changes: 107 additions & 0 deletions packages/lts-schedule/bin/lts.js
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);
Loading

0 comments on commit b44fb02

Please sign in to comment.