heicat 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/publish.yml +58 -0
- package/README.md +6 -6
- package/examples/express-app/package.json +1 -1
- package/examples/express-app/server.js +1 -1
- package/package.json +7 -7
- package/packages/cli/package.json +2 -2
- package/packages/cli/src/commands/status.ts +1 -1
- package/packages/cli/src/commands/test.ts +1 -1
- package/packages/cli/src/commands/validate.ts +1 -1
- package/packages/cli/src/commands/watch.ts +1 -1
- package/packages/core/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
name: Publish to NPM
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, master ]
|
|
6
|
+
release:
|
|
7
|
+
types: [ published ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup Node.js
|
|
18
|
+
uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version: '18'
|
|
21
|
+
registry-url: 'https://registry.npmjs.org/'
|
|
22
|
+
|
|
23
|
+
- name: Install root dependencies
|
|
24
|
+
run: npm install
|
|
25
|
+
|
|
26
|
+
- name: Build core package
|
|
27
|
+
run: npm run build:core
|
|
28
|
+
|
|
29
|
+
- name: Publish core package
|
|
30
|
+
run: |
|
|
31
|
+
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
|
|
32
|
+
cd packages/core
|
|
33
|
+
npm publish --access public
|
|
34
|
+
env:
|
|
35
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
36
|
+
|
|
37
|
+
- name: Build CLI package with published core
|
|
38
|
+
run: |
|
|
39
|
+
cd packages/cli
|
|
40
|
+
# Temporarily change dependency to published version
|
|
41
|
+
sed -i 's|"file:../core"|"^0.1.0"|g' package.json
|
|
42
|
+
sed -i 's|"heicat-core": "file:../core"|"heicat-core": "^0.1.0"|g' package.json
|
|
43
|
+
npm install # This will install dependencies including published @heicat/core
|
|
44
|
+
npm run build
|
|
45
|
+
|
|
46
|
+
- name: Publish CLI package
|
|
47
|
+
run: |
|
|
48
|
+
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
|
|
49
|
+
cd packages/cli
|
|
50
|
+
npm publish --access public
|
|
51
|
+
env:
|
|
52
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
53
|
+
|
|
54
|
+
- name: Run tests
|
|
55
|
+
run: npm test
|
|
56
|
+
|
|
57
|
+
- name: Validate contracts
|
|
58
|
+
run: npx heicat validate
|
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Runtime-enforced API contract system for Node.js. Catches bugs that TypeScript cannot.
|
|
4
4
|
|
|
5
|
-
[](https://badge.fury.io/js/heicat-core)
|
|
6
|
+
[](https://badge.fury.io/js/heicat-cli)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
8
|
|
|
9
9
|
## Quick Start
|
|
@@ -12,11 +12,11 @@ Runtime-enforced API contract system for Node.js. Catches bugs that TypeScript c
|
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
# Install both packages
|
|
15
|
-
npm install
|
|
15
|
+
npm install heicat-core heicat-cli
|
|
16
16
|
|
|
17
17
|
# Or install individually
|
|
18
|
-
npm install
|
|
19
|
-
npm install -D
|
|
18
|
+
npm install heicat-core
|
|
19
|
+
npm install -D heicat-cli
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
### Setup
|
|
@@ -30,7 +30,7 @@ npx heicat init
|
|
|
30
30
|
Add middleware to your Express app:
|
|
31
31
|
|
|
32
32
|
```typescript
|
|
33
|
-
import { contractMiddleware } from "
|
|
33
|
+
import { contractMiddleware } from "heicat-core";
|
|
34
34
|
|
|
35
35
|
app.use(
|
|
36
36
|
contractMiddleware({
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "heicat",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Runtime-enforced API contract system for Node.js",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "npm run build
|
|
8
|
-
"build:core": "npm run build --workspace
|
|
9
|
-
"build:cli": "npm run build --workspace
|
|
7
|
+
"build": "npm run build:core && npm run build:cli",
|
|
8
|
+
"build:core": "npm run build --workspace=heicat-core",
|
|
9
|
+
"build:cli": "npm run build --workspace=heicat-cli",
|
|
10
10
|
"clean": "npm run clean --workspaces",
|
|
11
11
|
"test": "npm run test --workspaces",
|
|
12
12
|
"lint": "npm run lint --workspaces",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|
|
33
|
-
"url": "https://github.com/
|
|
33
|
+
"url": "https://github.com/Heicat-Backend-Contract/heicat/.git"
|
|
34
34
|
},
|
|
35
35
|
"bugs": {
|
|
36
|
-
"url": "https://github.com/
|
|
36
|
+
"url": "https://github.com/Heicat-Backend-Contract/heicat/issues"
|
|
37
37
|
},
|
|
38
|
-
"homepage": "https://github.com/
|
|
38
|
+
"homepage": "https://github.com/Heicat-Backend-Contract/heicat/#readme",
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^20.0.0",
|
|
41
41
|
"typescript": "^5.0.0"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
2
|
+
"name": "heicat-cli",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"description": "CLI tools for Heicat",
|
|
5
5
|
"bin": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"author": "Backend Contract Studio",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"
|
|
25
|
+
"heicat-core": "file:../core",
|
|
26
26
|
"chalk": "^5.0.0",
|
|
27
27
|
"commander": "^11.0.0",
|
|
28
28
|
"inquirer": "^9.0.0"
|
|
@@ -2,7 +2,7 @@ import { readdirSync, readFileSync } from 'fs';
|
|
|
2
2
|
import { resolve, extname } from 'path';
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import chalk from 'chalk';
|
|
5
|
-
import { Contract } from '
|
|
5
|
+
import { Contract } from 'heicat-core';
|
|
6
6
|
|
|
7
7
|
export function statusCommand(options: { contractsPath: string }) {
|
|
8
8
|
const contractsPath = resolve(process.cwd(), options.contractsPath);
|
|
@@ -2,7 +2,7 @@ import { Command } from 'commander';
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { readFileSync, readdirSync } from 'fs';
|
|
4
4
|
import { resolve, extname } from 'path';
|
|
5
|
-
import { Contract } from '
|
|
5
|
+
import { Contract } from 'heicat-core';
|
|
6
6
|
|
|
7
7
|
interface TestResult {
|
|
8
8
|
contract: string;
|
|
@@ -2,7 +2,7 @@ import { readdirSync, readFileSync } from 'fs';
|
|
|
2
2
|
import { resolve, extname } from 'path';
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import chalk from 'chalk';
|
|
5
|
-
import { Contract } from '
|
|
5
|
+
import { Contract } from 'heicat-core';
|
|
6
6
|
|
|
7
7
|
export function validateCommand(options: { contractsPath: string }) {
|
|
8
8
|
const contractsPath = resolve(process.cwd(), options.contractsPath);
|
|
@@ -3,7 +3,7 @@ import chalk from 'chalk';
|
|
|
3
3
|
import { createServer } from 'http';
|
|
4
4
|
import { readFileSync, watch as fsWatch, readdirSync } from 'fs';
|
|
5
5
|
import { resolve, extname } from 'path';
|
|
6
|
-
import { ContractEngine, loadContracts } from '
|
|
6
|
+
import { ContractEngine, loadContracts } from 'heicat-core';
|
|
7
7
|
|
|
8
8
|
export function watchCommand(options: { contractsPath: string; port: string }) {
|
|
9
9
|
const contractsPath = resolve(process.cwd(), options.contractsPath);
|