Skip to content

Commit e226f7c

Browse files
guergaboGabriel Guerradfarr
authored
feat(release): npm publish package (#1)
Publish package to npm --------- Co-authored-by: Gabriel Guerra <[email protected]> Co-authored-by: David Farr <[email protected]>
1 parent c933465 commit e226f7c

10 files changed

+561
-727
lines changed

.eslintrc.yml

+5
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,8 @@ rules:
2626

2727
parserOptions:
2828
project: "./tsconfig.json"
29+
30+
ignorePatterns:
31+
- jest.config.js
32+
- "dist/"
33+
- "examples/"
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: CICD
22

33
on:
44
push:
@@ -10,6 +10,7 @@ on:
1010

1111
permissions:
1212
contents: read
13+
id-token: write
1314

1415
jobs:
1516
ci:
@@ -18,17 +19,24 @@ jobs:
1819
steps:
1920
- name: Checkout repository
2021
uses: actions/checkout@v3
21-
2222
- name: Set up Node
2323
uses: actions/setup-node@v4
2424
with:
2525
node-version: "20"
26-
26+
registry-url: "https://registry.npmjs.org"
2727
- name: Install dependencies
2828
run: npm install
29-
3029
- name: Run linter
3130
run: npm run lint
32-
3331
- name: Run tests
3432
run: npm test
33+
- name: Build
34+
run: npm run build
35+
- name: Publish
36+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
37+
env:
38+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
39+
run: |
40+
npm install -g npm
41+
npm version prerelease --no-git-tag-version --preid $GITHUB_SHA
42+
npm publish --access public

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.DS_Store
22
node_modules/
33
out/
4+
dist/
45
.next/
56
mydb.sqlite

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
build
2+
dist
23
coverage
34
examples
45
README.md

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<div align="center">
1515

16-
[![ci](https://github.com/resonatehq/resonate-sdk-ts/actions/workflows/ci.yaml/badge.svg)](https://github.com/resonatehq/resonate-sdk-ts/actions/workflows/ci.yaml)
16+
[![cicd](https://github.com/resonatehq/resonate-sdk-ts/actions/workflows/cicd.yaml/badge.svg)](https://github.com/resonatehq/resonate-sdk-ts/actions/workflows/cicd.yaml)
1717
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
1818

1919
</div>

lib/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Resonate, Context } from "./resonate";
2+
3+
export { Resonate, Context };

package-lock.json

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

package.json

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
{
2-
"name": "resonate-sdk-ts",
2+
"name": "@resonatehq/sdk",
3+
"version": "0.0.0",
4+
"description": "Resonate TypeScript SDK",
5+
"main": "dist/index.js",
6+
"types": "dist/index.d.ts",
7+
"license": "Apache-2.0",
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/resonatehq/resonate-sdk-ts.git"
11+
},
12+
"publishConfig": {
13+
"provenance": true
14+
},
315
"scripts": {
416
"test": "jest",
17+
"build": "tsc --build tsconfig.build.json",
518
"lint": "prettier . --check && eslint .",
619
"prettier": "prettier . --write",
720
"debug": "node --inspect-brk ./node_modules/.bin/jest -i"
821
},
22+
"files": [
23+
"dist"
24+
],
925
"devDependencies": {
1026
"@jest/globals": "^29.7.0",
1127
"@typescript-eslint/eslint-plugin": "^6.10.0",

tsconfig.build.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"exclude": ["test/**/*"]
4+
}

tsconfig.json

+10-5
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@
4444
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
4545

4646
/* Emit */
47-
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
48-
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
47+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
48+
"declarationMap": true, /* Create sourcemaps for d.ts files. */
4949
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
5050
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
5151
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
52-
// "outDir": "./", /* Specify an output folder for all emitted files. */
52+
"outDir": "./dist", /* Specify an output folder for all emitted files. */
5353
// "removeComments": true, /* Disable emitting comments. */
5454
// "noEmit": true, /* Disable emitting files from a compilation. */
5555
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
@@ -99,5 +99,10 @@
9999
/* Completeness */
100100
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
101101
"skipLibCheck": true /* Skip type checking all .d.ts files. */
102-
}
103-
}
102+
},
103+
"include": [
104+
"lib/**/*",
105+
"test/**/*"
106+
]
107+
}
108+

0 commit comments

Comments
 (0)