From f342517d22a0edd8907b8b5249ef23176da5f237 Mon Sep 17 00:00:00 2001 From: alexkar598 <25136265+alexkar598@users.noreply.github.com> Date: Tue, 22 Mar 2022 21:13:38 -0400 Subject: [PATCH] Adds action workflows --- .github/workflows/publish.yml | 19 +++++++++++++++++++ .github/workflows/test.yml | 27 +++++++++++++++++++++++++++ package-lock.json | 22 +++++++++++++++++++++- package.json | 8 ++++++-- 4 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..beacf5d --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,19 @@ +name: Publish Package to npmjs +on: + release: + types: [published] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + # Setup .npmrc file to publish to npm + - uses: actions/setup-node@v2 + with: + # We don't really use anything requiring anything newer than this + node-version: '16.x' + registry-url: 'https://registry.npmjs.org' + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..c7f53c4 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: Run typescript compiler +on: + push: + branches-ignore: + # publish.yml will need to run the compiler anyways + - master + pull_request: + +jobs: + build: + strategy: + fail-fast: true + matrix: + # All active LTS versions(12,14,16) + current(17) + node: [ 17, 16, 14, 12 ] + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + # Setup .npmrc file to publish to npm + - uses: actions/setup-node@v2 + with: + # We don't really use anything requiring anything newer than this + node-version: ${{ matrix.node }} + registry-url: 'https://registry.npmjs.org' + - run: npm ci + - run: npm run prepare \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index a2bcf11..5bd5888 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,8 @@ "version": "3.0.0", "license": "MIT", "devDependencies": { - "@types/node": "^17.0.22" + "@types/node": "^17.0.22", + "typescript": "^4.6.2" } }, "node_modules/@types/node": { @@ -17,6 +18,19 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.22.tgz", "integrity": "sha512-8FwbVoG4fy+ykY86XCAclKZDORttqE5/s7dyWZKLXTdv3vRy5HozBEinG5IqhvPXXzIZEcTVbuHlQEI6iuwcmw==", "dev": true + }, + "node_modules/typescript": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", + "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } } }, "dependencies": { @@ -25,6 +39,12 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.22.tgz", "integrity": "sha512-8FwbVoG4fy+ykY86XCAclKZDORttqE5/s7dyWZKLXTdv3vRy5HozBEinG5IqhvPXXzIZEcTVbuHlQEI6iuwcmw==", "dev": true + }, + "typescript": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", + "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", + "dev": true } } } diff --git a/package.json b/package.json index da8d79c..6e4a1a9 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,9 @@ "name": "http2byond", "description": "Communication layer between node.js and BYOND game servers.", "version": "3.0.0", + "scripts": { + "prepare": "npx tsc" + }, "contributors": [ { "name": "Tigercat2000", @@ -25,10 +28,11 @@ }, "files": [ "dist", - "types" + "typings" ], "types": "typings/index.d.ts", "devDependencies": { - "@types/node": "^17.0.22" + "@types/node": "^17.0.22", + "typescript": "^4.6.2" } }