Skip to content

Commit e71073c

Browse files
committedJul 30, 2024
feat: initial commit
0 parents  commit e71073c

14 files changed

+196
-0
lines changed
 

‎.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

‎.github/workflows/publish.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- alpha
8+
- beta
9+
- next
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: 20
20+
21+
- run: npm install
22+
23+
- run: npm run lint
24+
25+
- run: npx semantic-release
26+
env:
27+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

‎.github/workflows/test.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- main
7+
- alpha
8+
- beta
9+
- next
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: 20
20+
21+
- run: npm install
22+
23+
- run: npm run lint

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

‎.npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package-lock=false
2+
save-exact=true

‎CONTRIBUTING.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Contributing
2+
3+
Thank you for showing an interest in contributing to Eik 🧡
4+
5+
This module is a [shared config for TypeScript](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#tsconfig-bases). We accept changes that should apply to all repositories in the [eik-lib origanisation](https://github.com/eik-lib).
6+
7+
Exports from this module are handled via the `"files"` property. Configurations should be at the root level so user's `"extends"` field is `@eik/typescript-config/module.json` and so on.
8+
9+
Commits should follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) format.
10+
11+
A change in configuration is considered a `patch` in [semantic versioning](https://semver.org/). A new export would be a `minor`. Depending on a newer major version of TypeScript would be a `major`.
12+
13+
This repo uses [semantic release](https://github.com/semantic-release/semantic-release) to automate releases whenever changes are merged to the default branch.

‎README.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# @eik/typescript-config
2+
3+
Shared config for TypeScript, used in Eik projects to generate type definitions from JSDoc and test them.
4+
5+
## Install
6+
7+
```
8+
npm install --save-dev typescript @eik/typescript-config
9+
```
10+
11+
## Usage
12+
13+
Create two files in your root directory.
14+
15+
`tsconfig.json` (assuming source in `lib/`):
16+
17+
```json
18+
{
19+
"extends": "@eik/typescript-config/module.json",
20+
"include": ["./lib/**/*.js"],
21+
"compilerOptions": {
22+
"outDir": "types"
23+
}
24+
}
25+
```
26+
27+
`tsconfig.test.json` (assuming tests in `tests/`):
28+
29+
```json
30+
{
31+
"extends": "@eik/typescript-config/module.json",
32+
"include": ["./tests/**/*.js"]
33+
}
34+
```
35+
36+
You should have a similar setup in your `package.json`:
37+
38+
```json
39+
{
40+
"scripts": {
41+
"types": "run-s types:module types:test",
42+
"types:module": "tsc",
43+
"types:test": "tsc --project tsconfig.test.json"
44+
},
45+
"dependencies": {
46+
"npm-run-all": "4.1.5"
47+
}
48+
}
49+
```

‎eslint.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import config from "@eik/eslint-config";
2+
3+
export default config;

‎module.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"compilerOptions": {
3+
"lib": ["es2020", "DOM"],
4+
"module": "nodenext",
5+
"moduleResolution": "nodenext",
6+
"target": "es2020",
7+
"resolveJsonModule": true,
8+
"checkJs": true,
9+
"allowJs": true,
10+
"declaration": true,
11+
"emitDeclarationOnly": true,
12+
"skipLibCheck": true,
13+
"allowSyntheticDefaultImports": true
14+
}
15+
}

‎package.json

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "@eik/typescript-config",
3+
"version": "1.0.0",
4+
"description": "Shared typescript config for Eik modules",
5+
"files": [
6+
"module.json",
7+
"test.json"
8+
],
9+
"repository": {
10+
"type": "git",
11+
"url": "git+ssh://git@github.com/eik-lib/typescript-config.git"
12+
},
13+
"publishConfig": {
14+
"access": "public"
15+
},
16+
"bugs": {
17+
"url": "https://github.com/eik-lib/typescript-config/issues"
18+
},
19+
"homepage": "https://github.com/eik-lib/typescript-config#readme",
20+
"scripts": {
21+
"lint": "eslint .",
22+
"lint:fix": "npm run lint -- --fix",
23+
"test": "echo \"Error: no test specified\" && exit 1"
24+
},
25+
"keywords": [],
26+
"author": "",
27+
"license": "MIT",
28+
"peerDependencies": {
29+
"typescript": ">= 5"
30+
},
31+
"devDependencies": {
32+
"@eik/eslint-config": "1.0.0",
33+
"@eik/prettier-config": "1.0.1",
34+
"@eik/semantic-release-config": "1.0.0",
35+
"eslint": "9.8.0",
36+
"prettier": "3.3.3",
37+
"semantic-release": "24.0.0"
38+
}
39+
}

‎prettier.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import config from "@eik/prettier-config";
2+
3+
export default config;

‎release.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
extends: "@eik/semantic-release-config",
3+
};

‎renovate.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"config:recommended"
5+
]
6+
}

‎test.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./module.json",
3+
"compilerOptions": {
4+
"module": "nodenext",
5+
"moduleResolution": "nodenext",
6+
"emitDeclarationOnly": false,
7+
"noEmit": true
8+
}
9+
}

0 commit comments

Comments
 (0)