Skip to content

Commit

Permalink
Update TypeScript to latest stable version
Browse files Browse the repository at this point in the history
TypeScript has been updated to the latest stable version. Our standard
module TypeScript configuration has been brought over from the module
template as well, including a separate configuration file for
production builds (as opposed to the root file used for things like
tests).

A `build:clean` has been added as well, for consistency with the module
template.
  • Loading branch information
Gudahtt committed Oct 26, 2022
1 parent 98dd4b4 commit a7ee58b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 20 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"dist/"
],
"scripts": {
"build": "tsc",
"build": "tsc --project tsconfig.build.json",
"build:clean": "rimraf dist && yarn build",
"buildTest": "yarn build && browserify test/index.js -o test/bundle.js",
"lint": "yarn lint:eslint && yarn lint:misc --check",
"lint:eslint": "eslint . --cache --ext js,ts",
Expand All @@ -54,8 +55,9 @@
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.3.0",
"rimraf": "^3.0.2",
"testem": "^3.4.2",
"typescript": "^4.3.4"
"typescript": "^4.8.4"
},
"engines": {
"node": ">=14.0.0"
Expand Down
11 changes: 5 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
type EncryptionResult = {
interface EncryptionResult {
data: string;
iv: string;
salt?: string;
};
}

/**
* Encrypts a data object that can be any serializable value using
Expand Down Expand Up @@ -169,10 +169,9 @@ export function serializeBufferFromStorage(str: string): Uint8Array {
*/
export function serializeBufferForStorage(buffer: Uint8Array): string {
let result = '0x';
const len = buffer.length || buffer.byteLength;
for (let i = 0; i < len; i++) {
result += unprefixedHex(buffer[i]);
}
buffer.forEach((value) => {
result += unprefixedHex(value);
});
return result;
}

Expand Down
12 changes: 12 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"inlineSources": true,
"noEmit": false,
"outDir": "dist",
"rootDir": "src",
"sourceMap": true
},
"include": ["./src/**/*.ts"]
}
16 changes: 8 additions & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"compilerOptions": {
"declaration": true,
"esModuleInterop": true,
"inlineSources": true,
"exactOptionalPropertyTypes": true,
"forceConsistentCasingInFileNames": true,
"lib": ["DOM", "ES2020"],
"module": "CommonJS",
"moduleResolution": "Node",
"outDir": "dist",
"rootDir": "src",
"sourceMap": true,
"moduleResolution": "node",
"noEmit": true,
"noErrorTruncation": true,
"noUncheckedIndexedAccess": true,
"strict": true,
"target": "ES2017"
"target": "es2017"
},
"include": ["src/**/*.ts"]
"exclude": ["./dist/**/*"]
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4099,10 +4099,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@^4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.4.tgz#3f85b986945bcf31071decdd96cf8bfa65f9dcbc"
integrity sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew==
typescript@^4.8.4:
version "4.8.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6"
integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==

umd@^3.0.0:
version "3.0.3"
Expand Down

0 comments on commit a7ee58b

Please sign in to comment.