generated from templates/typescript-library
Initial commit
This commit is contained in:
commit
acf02696ce
30
.gitea/workflows/publish.yaml
Normal file
30
.gitea/workflows/publish.yaml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
name: Build and publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch: { }
|
||||||
|
# push:
|
||||||
|
# branches:
|
||||||
|
# - master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
steps:
|
||||||
|
- name: Check out the repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Use Node.js 20
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
|
||||||
|
- name: Login to package registry
|
||||||
|
run: |
|
||||||
|
npm config set @<scope name>:registry https://gitea.jbrumond.me/api/packages/<scope name>/npm/
|
||||||
|
npm config set -- '//gitea.jbrumond.me/api/packages/<scope name>/npm/:_authToken' "$NPM_PUBLISH_TOKEN"
|
||||||
|
|
||||||
|
- name: Publish package
|
||||||
|
run: npm publish
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
build
|
29
package-lock.json
generated
Normal file
29
package-lock.json
generated
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "@templates/typescript-library",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "@templates/typescript-library",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"license": "ISC",
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^5.1.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/typescript": {
|
||||||
|
"version": "5.1.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
|
||||||
|
"integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.17"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
23
package.json
Normal file
23
package.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"name": "@templates/typescript-library",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Template project for creating new TypeScript library packages",
|
||||||
|
"main": "build/index.js",
|
||||||
|
"types": "build/index.d.ts",
|
||||||
|
"scripts": {
|
||||||
|
"tsc": "tsc --build",
|
||||||
|
"clean": "rm -rf ./build"
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"registry": "https://gitea.jbrumond.me/api/packages/templates/npm/"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://gitea.jbrumond.me/templates/typescript-library.git"
|
||||||
|
},
|
||||||
|
"author": "James Brumond <https://jbrumond.me>",
|
||||||
|
"license": "ISC",
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^5.1.3"
|
||||||
|
}
|
||||||
|
}
|
30
readme.md
Normal file
30
readme.md
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
Template project for creating new TypeScript library packages
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Get Started
|
||||||
|
|
||||||
|
### Pull down the code
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git init
|
||||||
|
git pull https://gitea.jbrumond.me/templates/typescript-library.git master
|
||||||
|
```
|
||||||
|
|
||||||
|
### Update configuration
|
||||||
|
|
||||||
|
- In `package.json`, update any fields like `name`, `description`, `repository`, etc.
|
||||||
|
- In `.gitea/workflows/publish.yaml`, update `<scope name>` placeholders
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run tsc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
4
src/index.ts
Normal file
4
src/index.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
export function hello() : string {
|
||||||
|
return 'hello';
|
||||||
|
}
|
14
tsconfig.json
Normal file
14
tsconfig.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"include": [
|
||||||
|
"src/**/*.ts"
|
||||||
|
],
|
||||||
|
"compilerOptions": {
|
||||||
|
"rootDir": "./src",
|
||||||
|
"outDir": "./build",
|
||||||
|
"target": "ES2022",
|
||||||
|
"moduleResolution": "NodeNext",
|
||||||
|
"module": "CommonJS",
|
||||||
|
"declaration": true,
|
||||||
|
"sourceMap": true
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user