Skip to content

Commit 873e099

Browse files
committed
Fix sourcemap and add licensed
1 parent 90f899d commit 873e099

8 files changed

+142
-3
lines changed

.github/workflows/licensed.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# This workflow checks the statuses of cached dependencies used in this action
2+
# with the help of the Licensed tool. If any licenses are invalid or missing,
3+
# this workflow will fail. See: https://github.com/licensee/licensed
4+
5+
name: Licensed
6+
7+
on:
8+
# Uncomment the below lines to run this workflow on pull requests and pushes
9+
# to the default branch. This is useful for checking licenses before merging
10+
# changes into the default branch.
11+
# pull_request:
12+
# branches:
13+
# - main
14+
# push:
15+
# branches:
16+
# - main
17+
workflow_dispatch:
18+
19+
permissions:
20+
contents: write
21+
22+
jobs:
23+
licensed:
24+
name: Check Licenses
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- name: Checkout
29+
id: checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Setup Node.js
33+
id: setup-node
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version-file: .node-version
37+
cache: npm
38+
39+
- name: Install Dependencies
40+
id: npm-ci
41+
run: npm ci
42+
43+
- name: Setup Ruby
44+
id: setup-ruby
45+
uses: ruby/setup-ruby@v1
46+
with:
47+
ruby-version: ruby
48+
49+
- uses: github/setup-licensed@v1
50+
with:
51+
version: 4.x
52+
github_token: ${{ secrets.GITHUB_TOKEN }}
53+
54+
# If this is a workflow_dispatch event, update the cached licenses.
55+
- if: ${{ github.event_name == 'workflow_dispatch' }}
56+
name: Update Licenses
57+
id: update-licenses
58+
run: licensed cache
59+
60+
# Then, commit the updated licenses to the repository.
61+
- if: ${{ github.event_name == 'workflow_dispatch' }}
62+
name: Commit Licenses
63+
id: commit-licenses
64+
run: |
65+
git config --local user.email "[email protected]"
66+
git config --local user.name "licensed-ci"
67+
git add .
68+
git commit -m "Auto-update license files"
69+
git push
70+
71+
# Last, check the status of the cached licenses.
72+
- name: Check Licenses
73+
id: check-licenses
74+
run: licensed status

.licensed.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# See: https://github.com/licensee/licensed/blob/main/docs/configuration.md
2+
3+
sources:
4+
npm: true
5+
6+
allowed:
7+
- apache-2.0
8+
- bsd-2-clause
9+
- bsd-3-clause
10+
- isc
11+
- mit
12+
- cc0-1.0
13+
- other
14+
15+
ignored:
16+
npm:
17+
# Used by Rollup.js when building in GitHub Actions
18+
- '@rollup/rollup-linux-x64-gnu'

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.DS_Store
2+
.licenses/
23
dist/
34
node_modules/
45
coverage/

.yaml-lint.yml

+2
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ rules:
1010
max: 80
1111
allow-non-breakable-words: true
1212
allow-non-breakable-inline-mappings: true
13+
ignore:
14+
- .licenses/

README.md

+45
Original file line numberDiff line numberDiff line change
@@ -279,3 +279,48 @@ steps:
279279
id: output
280280
run: echo "${{ steps.test-action.outputs.time }}"
281281
```
282+
283+
## Dependency License Management
284+
285+
This template includes a GitHub Actions workflow,
286+
[`licensed.yml`](./.github/workflows/licensed.yml), that uses
287+
[Licensed](https://github.com/licensee/licensed) to check for dependencies with
288+
missing or non-compliant licenses. This workflow is initially disabled. To
289+
enable the workflow, follow the below steps.
290+
291+
1. Open [`licensed.yml`](./.github/workflows/licensed.yml)
292+
1. Uncomment the following lines:
293+
294+
```yaml
295+
# pull_request:
296+
# branches:
297+
# - main
298+
# push:
299+
# branches:
300+
# - main
301+
```
302+
303+
1. Save and commit the changes
304+
305+
Once complete, this workflow will run any time a pull request is created or
306+
changes pushed directly to `main`. If the workflow detects any dependencies with
307+
missing or non-compliant licenses, it will fail the workflow and provide details
308+
on the issue(s) found.
309+
310+
### Updating Licenses
311+
312+
Whenever you install or update dependencies, you can use the Licensed CLI to
313+
update the licenses database. To install Licensed, see the project's
314+
[Readme](https://github.com/licensee/licensed?tab=readme-ov-file#installation).
315+
316+
To update the cached licenses, run the following command:
317+
318+
```bash
319+
licensed cache
320+
```
321+
322+
To check the status of cached licenses, run the following command:
323+
324+
```bash
325+
licensed status
326+
```

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rollup.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const config = {
1212
format: 'es',
1313
sourcemap: true
1414
},
15-
plugins: [typescript(), nodeResolve(), commonjs()]
15+
plugins: [typescript(), nodeResolve({ preferBuiltins: true }), commonjs()]
1616
}
1717

1818
export default config

tsconfig.base.json

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"noUnusedParameters": false,
1616
"pretty": true,
1717
"resolveJsonModule": true,
18-
"sourceMap": true,
1918
"strict": true,
2019
"strictNullChecks": true,
2120
"target": "ES2022"

0 commit comments

Comments
 (0)