Skip to content

Commit e64c5d1

Browse files
bjohansebaskjugi
andauthored
docs: add license and readme (#13)
The necessary documentation is added to be moved to the Express organization closes #12 --------- Co-authored-by: Filip Kudła <[email protected]>
1 parent 6e43412 commit e64c5d1

File tree

5 files changed

+152
-1
lines changed

5 files changed

+152
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { execSync } from 'node:child_process'
2+
import { readFile, writeFile } from 'node:fs/promises'
3+
import { join } from 'node:path'
4+
5+
let output = execSync('node ../../index.js --help', {
6+
encoding: 'utf-8',
7+
})
8+
9+
output = output.replace(
10+
/(?<=Usage: @expressjs\/codemod \[codemod\] \[source\] \[options\]\n\n)[\s\S]*?(?=Options:)/,
11+
'',
12+
)
13+
14+
const readmePath = join('..', '..', 'README.md')
15+
const readme = await readFile(readmePath, 'utf-8')
16+
17+
const updatedReadme = readme.replace(
18+
/(?<=<!-- GENERATED START -->\n\n```\n)[\s\S]*?(?=```\n\n<!-- GENERATED END -->)/,
19+
output,
20+
)
21+
22+
await writeFile(readmePath, updatedReadme, 'utf-8')
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Generate dynamic README
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- index.ts
9+
10+
jobs:
11+
generate-readme:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
persist-credentials: false
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '22'
24+
25+
- name: Install dependencies
26+
run: npm install
27+
28+
- name: Build package
29+
run: npm run build
30+
31+
- name: Run script
32+
working-directory: .github/actions
33+
run: node ./generate-help-docs.mjs
34+
35+
- name: Create Pull Request
36+
uses: gr2m/create-or-update-pull-request-action@v1
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
with:
40+
title: 'Update options in README'
41+
commit-message: 'chore: update README'
42+
branch: readme-${{ github.sha }}
43+
body: >
44+
'Update the available options of the package in the CLI'

LICENSE

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
(The MIT License)
2+
3+
Copyright (c) 2024 Sebastian Beltran <[email protected]>
4+
Copyright (c) 2024 Filip Kudla <[email protected]>
5+
6+
Permission is hereby granted, free of charge, to any person obtaining
7+
a copy of this software and associated documentation files (the
8+
'Software'), to deal in the Software without restriction, including
9+
without limitation the rights to use, copy, modify, merge, publish,
10+
distribute, sublicense, and/or sell copies of the Software, and to
11+
permit persons to whom the Software is furnished to do so, subject to
12+
the following conditions:
13+
14+
The above copyright notice and this permission notice shall be
15+
included in all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# @expressjs/codemod
2+
3+
[![NPM Version][npm-version-image]][npm-url]
4+
[![NPM Install Size][npm-install-size-image]][npm-install-size-url]
5+
[![NPM Downloads][npm-downloads-image]][npm-downloads-url]
6+
[![OpenSSF Scorecard Badge][ossf-scorecard-badge]][ossf-scorecard-visualizer]
7+
8+
Express.js provides Codemod transforms to help you upgrade your express server when a feature is deprecated or removed.
9+
10+
Codemods are transformations that run on your codebase programmatically. This allows for a large amount of changes to be applied without having to manually go through every file.
11+
12+
## Installation
13+
14+
You don't need to install this package, run the following command:
15+
16+
```sh
17+
npx @expressjs/codemod # or pnpx, bunx, etc.
18+
```
19+
20+
or install globally:
21+
22+
```sh
23+
npm i -g @expressjs/codemod # or pnpm, bun, etc.
24+
```
25+
26+
## Usage
27+
28+
Use `@expressjs/codemod -h` to explore available command-line options.
29+
30+
<!-- GENERATED START -->
31+
32+
```
33+
Usage: @expressjs/codemod [codemod] [source] [options]
34+
35+
Options:
36+
-v, --version Output the current version of @expressjs/codemod.
37+
-d, --dry Dry run (no changes are made to files)
38+
-h, --help Display this help message.
39+
```
40+
41+
<!-- GENERATED END -->
42+
43+
## Contributing
44+
45+
The Express.js project welcomes all constructive contributions. Contributions take many forms,
46+
from code for bug fixes and enhancements, to additions and fixes to documentation, additional
47+
tests, triaging incoming pull requests and issues, and more!
48+
49+
See the [Contributing Guide](https://github.com/expressjs/express/blob/master/Contributing.md) for more technical details on contributing.
50+
51+
## License
52+
53+
[MIT](LICENSE)
54+
55+
[npm-downloads-image]: https://badgen.net/npm/dm/@expressjs/codemod
56+
[npm-downloads-url]: https://npmcharts.com/compare/@expressjs/codemod?minimal=true
57+
[npm-install-size-image]: https://badgen.net/packagephobia/install/@expressjs/codemod
58+
[npm-install-size-url]: https://packagephobia.com/result?p=@expressjs/codemod
59+
[npm-url]: https://npmjs.org/package/@expressjs/codemod
60+
[npm-version-image]: https://badgen.net/npm/v/@expressjs/codemod
61+
[ossf-scorecard-badge]: https://api.scorecard.dev/projects/github.com/expressjs/codemod/badge
62+
[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/codemod

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "0.0.1",
55
"description": "Codemods for updating express servers.",
66
"main": "index.js",
7-
"author": "Sebastian Beltran <[email protected]>",
7+
"contributors": ["Sebastian Beltran <[email protected]>", "Filip Kudla <[email protected]>"],
88
"license": "MIT",
99
"bin": "./index.js",
1010
"files": ["transforms/*.js", "commands/*.js", "utils/*.js", "config.js", "index.js"],

0 commit comments

Comments
 (0)