Skip to content

Commit 1898747

Browse files
authored
Merge pull request #118 from permitio/create-hybrid-build
Create hybrid build
2 parents e799c31 + 29eee15 commit 1898747

45 files changed

Lines changed: 1239 additions & 572 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
PDP_API_KEY: test
11+
12+
jobs:
13+
test-and-lint:
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [18, 20]
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
cache: 'yarn'
29+
30+
- name: Install dependencies
31+
run: yarn install --frozen-lockfile
32+
33+
- name: Run linting
34+
run: yarn lint
35+
36+
- name: Build project
37+
run: yarn build
38+
39+
- name: Run all tests
40+
run: yarn test

package.json

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
{
22
"name": "permitio",
3-
"version": "2.7.1-rc.0",
3+
"version": "2.7.5",
44
"description": "Node.js client library for the Permit.io full-stack permissions platform",
55
"type": "commonjs",
6-
"main": "build/main/index.js",
7-
"typings": "build/main/index.d.ts",
8-
"module": "build/module/index.mjs",
6+
"main": "build/index.js",
7+
"typings": "build/index.d.ts",
8+
"module": "build/index.mjs",
99
"exports": {
1010
".": {
11-
"types": "./build/module/index.d.ts",
12-
"import": "./build/module/index.mjs",
13-
"require": "./build/main/index.js"
14-
},
15-
"./build/main/*": "./build/main/*",
16-
"./build/module/*": "./build/module/*"
11+
"types": "./build/index.d.ts",
12+
"import": "./build/index.mjs",
13+
"require": "./build/index.js"
14+
}
1715
},
1816
"repository": {
1917
"type": "git",
@@ -22,17 +20,21 @@
2220
"license": "MIT",
2321
"keywords": [],
2422
"scripts": {
25-
"build": "run-p build:*",
26-
"build:main": "tsc -p tsconfig.json",
27-
"build:module": "tsc -p tsconfig.module.json && yarn rename:esm",
23+
"build": "run-s build:js build:types",
24+
"build:js": "tsup",
25+
"build:types": "tsc --emitDeclarationOnly --outDir build",
26+
"lint": "run-s lint:*",
27+
"lint:eslint": "eslint src --ext .ts",
28+
"lint:prettier": "prettier --config .prettierrc \"src/**/*.{ts,css,less,scss,js}\" --check",
2829
"fix": "run-s fix:*",
2930
"fix:prettier": "prettier --config .prettierrc \"src/**/*.{ts,css,less,scss,js}\" --write",
3031
"fix:lint": "eslint src --ext .ts --fix",
3132
"test": "run-s test:*",
32-
"test:integration": "run-s build && ava --verbose src/**/endpoints/**",
33-
"test:e2e:rbac": "run-s build && ava --verbose src/**/e2e/rbac.e2e.spec.ts",
34-
"test:e2e:rebac": "run-s build && ava --verbose src/**/e2e/rebac.e2e.spec.ts",
35-
"test:e2e:local_facts": "run-s build && ava --verbose src/**/e2e/local_facts.e2e.spec.ts",
33+
"test:integration": "run-s build && ava --verbose build/tests/endpoints/**/*.spec.js",
34+
"test:module-imports": "run-s build && ava --verbose build/tests/module-imports/**/*.spec.js",
35+
"test:e2e:rbac": "run-s build && ava --verbose build/tests/e2e/rbac.e2e.spec.js",
36+
"test:e2e:rebac": "run-s build && ava --verbose build/tests/e2e/rebac.e2e.spec.js",
37+
"test:e2e:local_facts": "run-s build && ava --verbose build/tests/e2e/local_facts.e2e.spec.js",
3638
"check-cli": "run-s test diff-integration-tests check-integration-tests",
3739
"check-integration-tests": "run-s check-integration-test:*",
3840
"diff-integration-tests": "mkdir -p diff && rm -rf diff/test && cp -r test diff/test && rm -rf diff/test/test-*/.git && cd diff && git init --quiet && git add -A && git commit --quiet --no-verify --allow-empty -m 'WIP' && echo '\\n\\nCommitted most recent integration test output in the \"diff\" directory. Review the changes with \"cd diff && git diff HEAD\" or your preferred git diff viewer.'",
@@ -46,7 +48,6 @@
4648
"docs": "typedoc",
4749
"docs:watch": "typedoc --watch",
4850
"version": "2.5.2",
49-
"rename:esm": "/bin/bash ./scripts/rename-mjs.sh",
5051
"reset-hard": "git clean -dfx && git reset --hard && yarn",
5152
"prepare": "npm run build && husky install",
5253
"prepare-release": "run-s reset-hard test cov:check doc:html version doc:publish",
@@ -94,12 +95,12 @@
9495
"prettier": "^2.5.1",
9596
"standard-version": "^9.0.0",
9697
"ts-node": "^9.0.0",
98+
"tsup": "^8.5.0",
9799
"typedoc": "^0.24.7",
98100
"typescript": "^4.6.4"
99101
},
100102
"files": [
101-
"build/main",
102-
"build/module",
103+
"build",
103104
"!**/*.spec.*",
104105
"!**/*.json",
105106
"CHANGELOG.md",
@@ -110,13 +111,7 @@
110111
"failFast": true,
111112
"failWithoutAssertions": false,
112113
"timeout": "60s",
113-
"typescript": {
114-
"rewritePaths": {
115-
"src/": "build/main/"
116-
}
117-
},
118114
"files": [
119-
"!build/module/**",
120115
"!src/tests/fixtures.ts"
121116
]
122117
},

scripts/rename-mjs.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/api/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios, { AxiosError, AxiosResponse } from 'axios';
22
import { Logger } from 'pino';
33

4-
import { IPermitConfig, FactsSyncTimeoutPolicy } from '../config';
4+
import { FactsSyncTimeoutPolicy, IPermitConfig } from '../config';
55
import { APIKeysApi, Configuration } from '../openapi';
66
import { BASE_PATH } from '../openapi/base';
77

src/enforcement/enforcer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import axios, { AxiosInstance } from 'axios';
22
import { Logger } from 'pino';
33
import URL from 'url-parse';
4+
45
import { IPermitConfig } from '../config';
56
import { CheckConfig, Context, ContextStore } from '../utils/context';
67
import { AxiosLoggingInterceptor } from '../utils/http-logger';

src/openapi/types/activity-details-list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ export const ActivityDetailsListKindEnum = {
4747
} as const;
4848

4949
export type ActivityDetailsListKindEnum =
50-
typeof ActivityDetailsListKindEnum[keyof typeof ActivityDetailsListKindEnum];
50+
(typeof ActivityDetailsListKindEnum)[keyof typeof ActivityDetailsListKindEnum];

src/openapi/types/activity-details-object.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ export const ActivityDetailsObjectKindEnum = {
4949
} as const;
5050

5151
export type ActivityDetailsObjectKindEnum =
52-
typeof ActivityDetailsObjectKindEnum[keyof typeof ActivityDetailsObjectKindEnum];
52+
(typeof ActivityDetailsObjectKindEnum)[keyof typeof ActivityDetailsObjectKindEnum];

src/openapi/types/allowed-result.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ export const AllowedResultQueryTypeEnum = {
4545
} as const;
4646

4747
export type AllowedResultQueryTypeEnum =
48-
typeof AllowedResultQueryTypeEnum[keyof typeof AllowedResultQueryTypeEnum];
48+
(typeof AllowedResultQueryTypeEnum)[keyof typeof AllowedResultQueryTypeEnum];

src/openapi/types/apikey-owner-type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ export const APIKeyOwnerType = {
2424
Elements: 'elements',
2525
} as const;
2626

27-
export type APIKeyOwnerType = typeof APIKeyOwnerType[keyof typeof APIKeyOwnerType];
27+
export type APIKeyOwnerType = (typeof APIKeyOwnerType)[keyof typeof APIKeyOwnerType];

src/openapi/types/apikey-viewer-context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ export const APIKeyViewerContextTypeEnum = {
4141
} as const;
4242

4343
export type APIKeyViewerContextTypeEnum =
44-
typeof APIKeyViewerContextTypeEnum[keyof typeof APIKeyViewerContextTypeEnum];
44+
(typeof APIKeyViewerContextTypeEnum)[keyof typeof APIKeyViewerContextTypeEnum];

0 commit comments

Comments
 (0)