Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Auer <[email protected]>
  • Loading branch information
auer-martin committed Jul 12, 2024
1 parent 158fb23 commit 84aba5e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
*.tsimp
*.log
packages/siop-oid4vp/lib/schemas/validation/schemaValidation.js
packages/siop-oid4vp/lib/generator/*
!packages/siop-oid4vp/lib/generator/schemaGenerator.ts
2 changes: 1 addition & 1 deletion packages/siop-oid4vp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Release Notes


The DID Auth SIOP typescript library is still in an beta state at this point. Please note that the interfaces might
still change a bit as the software still is in active development.

## 0.6.5

- Added:
- Initial support for OID4VP draft 20
- Removed did-jwt and did-resolver dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function writeSchema(config: any): Schema {
let schemaString = JSON.stringify(schema, null, 2)
schemaString = correctSchema(schemaString)

fs.writeFile(config.outputPath, `export const ${config.schemaId}Obj = ${schemaString};`, (err) => {
fs.writeFile(path.join(__dirname, config.outputPath), `export const ${config.schemaId}Obj = ${schemaString};`, (err) => {
if (err) {
throw err
}
Expand All @@ -61,7 +61,7 @@ function writeSchema(config: any): Schema {
function generateValidationCode(schemas: Schema[]) {
const ajv = new Ajv({ schemas, code: { source: true, lines: true, esm: false }, allowUnionTypes: true, strict: false })
const moduleCode = standaloneCode(ajv)
fs.writeFileSync(path.join(__dirname, '../lib/schemas/validation/schemaValidation.js'), moduleCode)
fs.writeFileSync(path.join(__dirname, '../schemas/validation/schemaValidation.js'), moduleCode)
}

function correctSchema(schemaString: string) {
Expand Down Expand Up @@ -111,81 +111,81 @@ function correctSchema(schemaString: string) {
}
/*
const requestOptsConf = {
path: '../lib/authorization-request/types.ts',
path: '../authorization-request/types.ts',
tsconfig: 'tsconfig.json',
type: 'CreateAuthorizationRequestOpts', // Or <type-name> if you want to generate schema for that one type only
schemaId: 'CreateAuthorizationRequestOptsSchema',
outputPath: 'lib/schemas/AuthorizationRequestOpts.schema.ts',
outputPath: '../../schemas/AuthorizationRequestOpts.schema.ts',
// outputConstName: 'AuthorizationRequestOptsSchema',
skipTypeCheck: true
};*/

const responseOptsConf = {
path: '../lib/authorization-response/types.ts',
path: '../authorization-response/types.ts',
tsconfig: 'tsconfig.json',
type: 'AuthorizationResponseOpts', // Or <type-name> if you want to generate schema for that one type only
schemaId: 'AuthorizationResponseOptsSchema',
outputPath: 'lib/schemas/AuthorizationResponseOpts.schema.ts',
outputPath: '../schemas/AuthorizationResponseOpts.schema.ts',
// outputConstName: 'AuthorizationResponseOptsSchema',
skipTypeCheck: true,
}

const rPRegistrationMetadataPayload = {
path: '../lib/types/SIOP.types.ts',
path: '../types/SIOP.types.ts',
tsconfig: 'tsconfig.json',
type: 'RPRegistrationMetadataPayload',
schemaId: 'RPRegistrationMetadataPayloadSchema',
outputPath: 'lib/schemas/RPRegistrationMetadataPayload.schema.ts',
outputPath: '../schemas/RPRegistrationMetadataPayload.schema.ts',
// outputConstName: 'RPRegistrationMetadataPayloadSchema',
skipTypeCheck: true,
}

const discoveryMetadataPayload = {
path: '../lib/types/SIOP.types.ts',
path: '../types/SIOP.types.ts',
tsconfig: 'tsconfig.json',
type: 'DiscoveryMetadataPayload',
schemaId: 'DiscoveryMetadataPayloadSchema',
outputPath: 'lib/schemas/DiscoveryMetadataPayload.schema.ts',
outputPath: '../schemas/DiscoveryMetadataPayload.schema.ts',
// outputConstName: 'DiscoveryMetadataPayloadSchema',
skipTypeCheck: true,
}

const authorizationRequestPayloadVID1 = {
path: '../lib/types/SIOP.types.ts',
path: '../types/SIOP.types.ts',
tsconfig: 'tsconfig.json',
type: 'AuthorizationRequestPayloadVID1', // Or <type-name> if you want to generate schema for that one type only
schemaId: 'AuthorizationRequestPayloadVID1Schema',
outputPath: 'lib/schemas/AuthorizationRequestPayloadVID1.schema.ts',
outputPath: '../schemas/AuthorizationRequestPayloadVID1.schema.ts',
// outputConstName: 'AuthorizationRequestPayloadSchemaVID1',
skipTypeCheck: true,
}

const authorizationRequestPayloadVD11 = {
path: '../lib/types/SIOP.types.ts',
path: '../types/SIOP.types.ts',
tsconfig: 'tsconfig.json',
type: 'AuthorizationRequestPayloadVD11', // Or <type-name> if you want to generate schema for that one type only
schemaId: 'AuthorizationRequestPayloadVD11Schema',
outputPath: 'lib/schemas/AuthorizationRequestPayloadVD11.schema.ts',
outputPath: '../schemas/AuthorizationRequestPayloadVD11.schema.ts',
// outputConstName: 'AuthorizationRequestPayloadSchemaVD11',
skipTypeCheck: true,
}

const authorizationRequestPayloadVD12OID4VPD18 = {
path: '../lib/types/SIOP.types.ts',
path: '../types/SIOP.types.ts',
tsconfig: 'tsconfig.json',
type: 'AuthorizationRequestPayloadVD12OID4VPD18', // Or <type-name> if you want to generate schema for that one type only
schemaId: 'AuthorizationRequestPayloadVD12OID4VPD18Schema',
outputPath: 'lib/schemas/AuthorizationRequestPayloadVD12OID4VPD18.schema.ts',
outputPath: '../schemas/AuthorizationRequestPayloadVD12OID4VPD18.schema.ts',
// outputConstName: 'AuthorizationRequestPayloadSchemaVD11',
skipTypeCheck: true,
}

const authorizationRequestPayloadVD12OID4VPD20 = {
path: '../lib/types/SIOP.types.ts',
path: '../types/SIOP.types.ts',
tsconfig: 'tsconfig.json',
type: 'AuthorizationRequestPayloadVD12OID4VPD20', // Or <type-name> if you want to generate schema for that one type only
schemaId: 'AuthorizationRequestPayloadVD12OID4VPD20Schema',
outputPath: 'lib/schemas/AuthorizationRequestPayloadVD12OID4VPD20.schema.ts',
outputPath: '../schemas/AuthorizationRequestPayloadVD12OID4VPD20.schema.ts',
// outputConstName: 'AuthorizationRequestPayloadSchemaVD11',
skipTypeCheck: true,
}
Expand Down
2 changes: 1 addition & 1 deletion packages/siop-oid4vp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"scripts": {
"build": "pnpm run-s build:*",
"build:main": "tsc -p tsconfig.build.json",
"build:schemaGenerator": "node --loader=tsimp/loader generator/schemaGenerator.ts",
"build:schemaGenerator": "node --loader=tsimp/loader ./lib/generator/schemaGenerator.ts",
"clean": "rimraf dist coverage",
"uninstall": "rimraf dist coverage node_modules"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/siop-oid4vp/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"exclude": ["test/**/*.ts", "generator/**/*.ts"],
"ts-node": {
"esm": false
}
},
"exclude": ["**/__tests__/**/*", "**/dist/**/*", "**/coverage/**"]
}

0 comments on commit 84aba5e

Please sign in to comment.