Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(lts-schedule): Introduce fork of the Node.js LTS schedule script #1792

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .commitlintrc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export default {
'prettier-config',
'stylelint-config',
'typescript-config',
// Use when affecting the scripts
'scripts',
literat marked this conversation as resolved.
Show resolved Hide resolved
// Use when affecting CI process
'ci',
// Use for anything that does not directly affect packages, ie. updating repo-wide
Expand Down
10 changes: 10 additions & 0 deletions docs/contribution/release-schedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ major versions of the Spirit Design System.

👉 See [Releases in Jira Board][release-jira-board] and [Quarterly Goals][quarterly-goals] in the Notion.

## Next Major Release Plans

👉 See [Releases in Jira Board][release-jira-board].

## Release Phases

### Prerelease
Expand Down Expand Up @@ -88,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/scripts/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
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
"node": ">=18"
},
"workspaces": [
"apps/demo",
"apps/storybook",
"configs/*",
"packages/*",
"examples/*",
"exporters/*",
"apps/demo",
"apps/storybook"
"packages/*",
"scripts/*"
],
"scripts": {
"start": "yarn packages:start --ignore '@almacareer/spirit-example*'",
Expand Down
37 changes: 37 additions & 0 deletions scripts/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 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,
literat marked this conversation as resolved.
Show resolved Hide resolved
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 scripts/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
Loading