Skip to content

Commit 72ee01f

Browse files
fix: make @CASL peerDependencies optional
1 parent 681637c commit 72ee01f

File tree

6 files changed

+23
-9
lines changed

6 files changed

+23
-9
lines changed

esbuild.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,4 @@ const clientBuildOptions = {
4545
await build({ ...nodeBuildOptions, entryPoints: ["./src/sh.ts"], outfile: "./dist/sh.js" });
4646
await build({ ...nodeBuildOptions, entryPoints: ["./src/generator.ts"], outfile: "./dist/generator.js" });
4747
await build({ ...clientBuildOptions, entryPoints: ["./src/index.ts"], outfile: "./dist/index.js" });
48+
await build({ ...clientBuildOptions, entryPoints: ["./src/acl.ts"], outfile: "./dist/acl.js" });

package.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@povio/openapi-codegen-cli",
3-
"version": "2.0.0",
3+
"version": "2.0.1-rc.0",
44
"main": "./dist/index.js",
55
"types": "./dist/index.d.ts",
66
"exports": {
@@ -13,6 +13,11 @@
1313
"types": "./dist/generator.d.ts",
1414
"import": "./dist/generator.js",
1515
"require": "./dist/generator.js"
16+
},
17+
"./acl": {
18+
"types": "./dist/acl.d.ts",
19+
"import": "./dist/acl.js",
20+
"require": "./dist/acl.js"
1621
}
1722
},
1823
"bin": {
@@ -64,6 +69,14 @@
6469
"react": "^19.1.0",
6570
"zod": "^4.1.12"
6671
},
72+
"peerDependenciesMeta": {
73+
"@casl/ability": {
74+
"optional": true
75+
},
76+
"@casl/react": {
77+
"optional": true
78+
}
79+
},
6780
"devDependencies": {
6881
"@apidevtools/swagger-parser": "^10.1.0",
6982
"@casl/ability": "^6.7.3",

src/acl.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// ACL exports - requires @casl/ability and @casl/react peer dependencies
2+
export { AbilityContext } from "./lib/acl/ability.context";
3+
export { createAclGuard } from "./lib/acl/AclGuard";
4+
export { Can } from "./lib/acl/Can";
5+
export type { AppAbilities, AppAbility } from "./lib/acl/appAbility.types";

src/generators/const/deps.const.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { GenerateFile, Import } from "src/generators/types/generate";
2-
import { PACKAGE_IMPORT_PATH } from "./package.const";
2+
import { ACL_PACKAGE_IMPORT_PATH, PACKAGE_IMPORT_PATH } from "./package.const";
33

44
export const APP_REST_CLIENT_NAME = "AppRestClient";
55
export const APP_REST_CLIENT_FILE: GenerateFile = { fileName: "app-rest-client", extension: "ts" };
@@ -23,7 +23,7 @@ export const ERROR_HANDLING_IMPORT: Import = {
2323
export const ABILITY_CONTEXT = "AbilityContext";
2424
export const ABILITY_CONTEXT_IMPORT: Import = {
2525
bindings: [ABILITY_CONTEXT],
26-
from: PACKAGE_IMPORT_PATH,
26+
from: ACL_PACKAGE_IMPORT_PATH,
2727
};
2828
export const BUILDERS_UTILS = {
2929
dynamicInputs: "dynamicInputs",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export const PACKAGE_IMPORT_PATH = "@povio/openapi-codegen-cli";
2+
export const ACL_PACKAGE_IMPORT_PATH = "@povio/openapi-codegen-cli/acl";

src/index.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,3 @@ export { OpenApiQueryConfig } from "./lib/config/queryConfig.context";
2424
export { AuthContext } from "./lib/auth/auth.context";
2525
export { AuthGuard } from "./lib/auth/AuthGuard";
2626
export type { AuthGuardProps } from "./lib/auth/AuthGuard";
27-
28-
// ACL
29-
export { AbilityContext } from "./lib/acl/ability.context";
30-
export { createAclGuard } from "./lib/acl/AclGuard";
31-
export { Can } from "./lib/acl/Can";
32-
export type { AppAbilities, AppAbility } from "./lib/acl/appAbility.types";

0 commit comments

Comments
 (0)