Skip to content

Commit f8478c7

Browse files
committed
feat: refactor code into typescript
BREAKING CHANGE: introduces types, uses typescript & exports are named now, otherwise the functionality remains the same and shouldnt require much time to upgrade
1 parent 5560033 commit f8478c7

33 files changed

+3593
-3972
lines changed

.babelrc

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

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "makeomatic",
2+
"extends": "makeomatic/typescript",
33
"rules": {
44
"object-curly-newline": 0
55
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ node_modules
3232
# compiled source code
3333
lib
3434
.env
35+
*.tsbuildinfo

.mdeprc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"node": "12.14.1",
2+
"node": "14",
33
"auto_compose": true,
44
"with_local_compose": true
55
}

.mocharc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"require": "@babel/register",
32
"timeout": 10000,
4-
"bail": true
3+
"bail": true,
4+
"require": "ts-node/register"
55
}

.nycrc

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

bin/decrypt.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33
/* eslint-disable no-console */
44

55
// decodes input token
6-
const assert = require('assert');
7-
const crypto = require('../lib/utils/crypto');
6+
const assert = require('assert')
7+
const { createCipher } = require('../lib/utils/crypto')
88

99
//
1010
// Logic
1111
//
12-
const [,, token, algorithm, sharedSecret] = process.argv;
12+
const [,, token, algorithm, sharedSecret] = process.argv
1313

14-
assert.ok(token, 'pass token as first arg');
15-
assert.ok(algorithm, 'pass algo as second arg');
16-
assert.ok(sharedSecret, 'pass shared secret as third arg');
14+
assert.ok(token, 'pass token as first arg')
15+
assert.ok(algorithm, 'pass algo as second arg')
16+
assert.ok(sharedSecret, 'pass shared secret as third arg')
1717

18-
const { decrypt } = crypto.createCipher({ algorithm, sharedSecret });
18+
const { decrypt } = createCipher({ algorithm, sharedSecret })
1919

2020
// decrypted
21-
const decrypted = decrypt(token);
21+
const decrypted = decrypt(token)
2222

23-
console.info('\ndecrypted: \n', decrypted, '\n');
23+
console.info('\ndecrypted: \n', decrypted, '\n')
2424

25-
const parsed = JSON.parse(decrypted);
25+
const parsed = JSON.parse(decrypted)
2626

27-
console.info('\nparsed JSON: \n', parsed, '\n');
27+
console.info('\nparsed JSON: \n', parsed, '\n')
2828

29-
process.exit(0);
29+
process.exit(0)

package.json

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"main": "./lib/index.js",
66
"scripts": {
77
"test": "yarn lint && yarn test-unit && yarn test-integration",
8-
"test-unit": "mocha test/unit.js",
9-
"test-integration": "mdep test run -t ./test/integration.js",
8+
"test-unit": "mocha --extensions ts test/unit.ts",
9+
"test-integration": "mdep test run -t ./test/integration.ts",
1010
"lint": "eslint ./src",
11-
"compile": "babel ./src -d ./lib --copy-files",
11+
"compile": "rimraf ./lib *.tsbuildinfo; tsc --build tsconfig.build.json",
1212
"prepublishOnly": "yarn compile",
1313
"semantic-release": "semantic-release"
1414
},
@@ -36,36 +36,42 @@
3636
"node": ">= 12.14.0"
3737
},
3838
"devDependencies": {
39-
"@babel/cli": "^7.8.4",
40-
"@babel/core": "^7.9.6",
41-
"@babel/plugin-proposal-class-properties": "^7.8.3",
42-
"@babel/plugin-proposal-object-rest-spread": "^7.9.6",
43-
"@babel/plugin-transform-strict-mode": "^7.8.3",
44-
"@babel/register": "^7.9.0",
45-
"@makeomatic/deploy": "^10.1.4",
46-
"babel-plugin-istanbul": "^6.0.0",
47-
"codecov": "^3.6.5",
39+
"@makeomatic/deploy": "^10.3.1",
40+
"@types/base64-url": "^2.2.0",
41+
"@types/bluebird": "^3.5.33",
42+
"@types/chance": "^1.1.0",
43+
"@types/get-value": "^3.0.1",
44+
"@types/glob": "^7.1.3",
45+
"@types/ioredis": "^4.17.7",
46+
"@types/is": "^0.0.21",
47+
"@types/mocha": "^8.0.3",
48+
"@types/node": "^14.14.6",
49+
"@types/uuid": "^8.3.0",
50+
"@typescript-eslint/eslint-plugin": "^4.6.1",
51+
"@typescript-eslint/parser": "^4.6.1",
52+
"codecov": "^3.8.1",
4853
"cross-env": "^7.0.2",
49-
"eslint": "^6.8.0",
50-
"eslint-config-makeomatic": "^5.0.0",
51-
"eslint-plugin-import": "^2.20.2",
52-
"eslint-plugin-mocha": "^6.3.0",
54+
"eslint": "^7.12.1",
55+
"eslint-config-makeomatic": "^5.0.3",
56+
"eslint-plugin-import": "^2.22.1",
57+
"eslint-plugin-mocha": "^8.0.0",
5358
"eslint-plugin-promise": "^4.2.1",
54-
"ioredis": "^4.16.3",
55-
"mocha": "^7.1.2",
56-
"nyc": "^15.0.1",
57-
"rimraf": "^3.0.2"
59+
"ioredis": "^4.19.2",
60+
"mocha": "^8.2.1",
61+
"nyc": "^15.1.0",
62+
"rimraf": "^3.0.2",
63+
"ts-node": "^9.0.0",
64+
"typescript": "^4.0.5"
5865
},
5966
"dependencies": {
60-
"@hapi/joi": "^17.1.1",
6167
"base64-url": "^2.3.3",
62-
"chance": "^1.1.4",
68+
"chance": "^1.1.7",
6369
"get-value": "^3.0.1",
6470
"glob": "^7.1.6",
6571
"is": "^3.3.0",
66-
"lodash.compact": "^3.0.1",
67-
"lodash.omit": "^4.5.0",
68-
"uuid": "^8.0.0"
72+
"joi": "^17.3.0",
73+
"read-pkg": "^5.2.0",
74+
"uuid": "^8.3.1"
6975
},
7076
"files": [
7177
"src/",

src/actions/create.js

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

0 commit comments

Comments
 (0)