Skip to content

Commit 98eecd3

Browse files
committed
Publish package to npm Registry
1 parent a6fd543 commit 98eecd3

File tree

6 files changed

+118
-1
lines changed

6 files changed

+118
-1
lines changed

.github/workflows/publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Publish to package registry
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
build:
10+
name: npm Registry
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@master
16+
17+
- name: Cache dependencies
18+
id: cache
19+
uses: actions/cache@v1
20+
with:
21+
path: ./.npm
22+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
23+
restore-keys: |
24+
${{ runner.os }}-npm-
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@master
28+
with:
29+
node-version: '15.x'
30+
31+
- name: Install npm dependencies
32+
run: npm ci --prefer-offline --cache=./.npm
33+
34+
- name: Build library
35+
run: npx tsc
36+
37+
- name: Set version in package.json
38+
run: npm --no-git-tag-version version ${{ github.event.release.tag_name }}
39+
40+
- name: Set npm credentials
41+
run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
42+
43+
- name: Publish to npm Registry
44+
run: npm publish --access public
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Quality assurance
2+
3+
on: push
4+
5+
jobs:
6+
eslint:
7+
name: ESLint
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@master
13+
14+
- name: Cache dependencies
15+
id: cache
16+
uses: actions/cache@v1
17+
with:
18+
path: ./.npm
19+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
20+
restore-keys: |
21+
${{ runner.os }}-npm-
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@master
25+
with:
26+
node-version: '15.x'
27+
28+
- name: Install npm dependencies
29+
run: npm ci --prefer-offline --cache=./.npm
30+
31+
- name: Lint with ESLint
32+
run: npx eslint .
33+
34+
typescript_compiler:
35+
name: TypeScript compiler
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@master
41+
42+
- name: Cache dependencies
43+
id: cache
44+
uses: actions/cache@v1
45+
with:
46+
path: ./.npm
47+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
48+
restore-keys: |
49+
${{ runner.os }}-npm-
50+
51+
- name: Setup Node.js
52+
uses: actions/setup-node@master
53+
with:
54+
node-version: '15.x'
55+
56+
- name: Install npm dependencies
57+
run: npm ci --prefer-offline --cache=./.npm
58+
59+
- name: Build library
60+
run: npx tsc

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/node_modules/
2+
/dist/
23
.DS_Store

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
"name": "@fosfad/json-schema-typescript-definitions",
33
"description": "Types and interfaces for writing valid JSON schema in TypeScript.",
44
"repository": "github:fosfad/json-schema-typescript-definitions",
5+
"main": "dist/index.js",
6+
"types": "dist/index.d.ts",
7+
"files": [
8+
"dist"
9+
],
510
"author": {
611
"email": "[email protected]",
712
"name": "Petr Flaks"

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export {
2+
JsonSchema, AnySchema, ObjectSchema, ArraySchema, IntegerSchema, NumberSchema, StringSchema, BooleanSchema, NullSchema,
3+
} from './jsonSchema';

tsconfig.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
"noUnusedParameters": true,
1111
"module": "CommonJS",
1212
"moduleResolution": "Node",
13-
"lib": ["ES2020"]
13+
"sourceMap": true,
14+
"declaration": true,
15+
"declarationMap": true,
16+
"lib": ["ES2020"],
17+
"outDir": "dist"
1418
}
1519
}

0 commit comments

Comments
 (0)