commit 01ddcb91208376392f69fa3e54e15e7fecf9c390 Author: James Brumond Date: Sun Aug 20 18:58:29 2023 -0700 first commit diff --git a/.gitea/workflows/pubilsh.yaml b/.gitea/workflows/pubilsh.yaml new file mode 100644 index 0000000..d155937 --- /dev/null +++ b/.gitea/workflows/pubilsh.yaml @@ -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 @:registry https://gitea.jbrumond.me/api/packages//npm/ + npm config set -- '//gitea.jbrumond.me/api/packages//npm/:_authToken' "$NPM_PUBLISH_TOKEN" + + - name: Publish package + run: npm publish diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/build/index.js b/build/index.js new file mode 100644 index 0000000..3e7a57c --- /dev/null +++ b/build/index.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.hello = void 0; +function hello() { + return 'hello'; +} +exports.hello = hello; diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..b8d09b5 --- /dev/null +++ b/package-lock.json @@ -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" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..ded3a6d --- /dev/null +++ b/package.json @@ -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 ", + "license": "ISC", + "devDependencies": { + "typescript": "^5.1.3" + } +} diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..7389046 --- /dev/null +++ b/readme.md @@ -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 `` placeholders + + + +## Building + +```bash +npm run tsc +``` + + + + diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..4fa933d --- /dev/null +++ b/src/index.ts @@ -0,0 +1,4 @@ + +export function hello() : string { + return 'hello'; +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..16fbc0a --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,12 @@ +{ + "include": [ + "src/**/*.ts" + ], + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build", + "target": "ES2022", + "moduleResolution": "NodeNext", + "module": "CommonJS" + } +} \ No newline at end of file