Skip to content

Commit

Permalink
Merge pull request #29 from UnumID/bugfix-replace-enum-constant
Browse files Browse the repository at this point in the history
  • Loading branch information
leo1994 authored Aug 11, 2023
2 parents 39626e7 + 288ccec commit 0f92996
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 24 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Compile package
run: npm run compile

# ref: https://github.community/t/auto-update-package-json-on-publishing/16894
- name: Update source code
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
node_modules/
.history
.idea

# Ignore build files
build/
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ g) Entity types belong in the projects that interface with their data layers. Fo
## Documentation
The `index.d.ts` file should serve as a self documenting file. Alternatively, [Typedoc](https://typedoc.org/) could be used however it would require a build step which it mostly unnecessary for this project. That said, if for any reason we would like to go with a full ts build step then Typedocs would be a great way to create external documentation that can be served via this repo's Github Pages.

The **constants** or other types which needs be compiled must be added in a separate file `constants.ts` where the same should be imported as `@unumid/core-types/constants`

## Release
Releases and publishing to NPM is automated via Github Actions CI job. In order to trigger a release one should push a git tag with a preceding `v` with semver notation, ie `v1.1.1`, to the `main` branch. This will trigger the CI job to bump the package version, make a release commit, and make a Github Release. The contents of the Github Release are autogenerated based on pull requests with commits associated with the release, so please use PRs to makes changes to `main`. The message of the git tag will be the commit message for the release so please make it meaningful. For example, `git tag v1.1.1 -m "Updated project with a new CI job" && git push origin v1.1.1 && git tag -d v1.1.1`.

Expand Down
8 changes: 8 additions & 0 deletions enums.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Type of possible options for mandatory field a credential request.
*/
export const MandatoryEnum = {
YES: 'yes',
NO: 'no',
IF_AVAILABLE: 'if_available'
} as const
11 changes: 2 additions & 9 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { MandatoryEnum } from './enums';

/****************************************
* DATA RESOLVER TYPES *
* TYPES FROM THE DATA RESOLVER SERVICE *
Expand Down Expand Up @@ -93,15 +95,6 @@ export interface AuthenticationResult {
user: UserDto;
}

/**
* Type of possible options for mandatory field a credential request.
*/
export enum MandatoryEnum {
YES = 'yes',
NO = 'no',
IF_AVAILABLE = 'if_available'
}

/**
* Represents a credential request in a presentation request
*/
Expand Down
1 change: 1 addition & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * as enums from './enums'
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{
"name": "@unumid/core-types",
"version": "0.23.1",
"version": "0.23.2",
"description": "UnumID shared core service types",
"main": "index.js",
"main": "build/index.js",
"types": "build/index.d.ts",
"engines": {
"node": ">= 18.12.1",
"npm": ">=8.19.2"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"compile": "tsc --build"
},
"repository": {
"type": "git",
Expand All @@ -22,5 +24,6 @@
"homepage": "https://github.com/UnumID/core-types#readme",
"devDependencies": {
"typescript": "^4.9.5"
}
},
"files": ["build/"]
}
17 changes: 8 additions & 9 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */

/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
Expand All @@ -15,15 +15,15 @@
"sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./build", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"rootDir": ".", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */

/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
Expand All @@ -33,13 +33,13 @@
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */

/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */

/* Module Resolution Options */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
Expand All @@ -51,17 +51,17 @@
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */

/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */

/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */

/* Advanced Options */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
Expand All @@ -72,4 +72,3 @@
"test"
]
}

0 comments on commit 0f92996

Please sign in to comment.