add typescript capability

This commit is contained in:
Daniel
2019-10-23 14:06:16 -04:00
parent 10a3381a5e
commit 14c15139cb
4 changed files with 121 additions and 2 deletions

63
package-lock.json generated
View File

@@ -496,6 +496,15 @@
"@babel/helper-plugin-utils": "^7.0.0"
}
},
"@babel/plugin-syntax-typescript": {
"version": "7.3.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.3.3.tgz",
"integrity": "sha512-dGwbSMA1YhVS8+31CnPR7LB4pcbrzcV99wQzby4uAfrkZPYZlQ7ImwdpzLqi6Z6IL02b8IAL379CaMwo0x5Lag==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0"
}
},
"@babel/plugin-transform-arrow-functions": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz",
@@ -855,6 +864,17 @@
"@babel/helper-plugin-utils": "^7.0.0"
}
},
"@babel/plugin-transform-typescript": {
"version": "7.6.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.6.3.tgz",
"integrity": "sha512-aiWINBrPMSC3xTXRNM/dfmyYuPNKY/aexYqBgh0HBI5Y+WO5oRAqW/oROYeYHrF4Zw12r9rK4fMk/ZlAmqx/FQ==",
"dev": true,
"requires": {
"@babel/helper-create-class-features-plugin": "^7.6.0",
"@babel/helper-plugin-utils": "^7.0.0",
"@babel/plugin-syntax-typescript": "^7.2.0"
}
},
"@babel/plugin-transform-unicode-regex": {
"version": "7.6.2",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.6.2.tgz",
@@ -965,6 +985,16 @@
"@babel/plugin-transform-react-jsx-source": "^7.0.0"
}
},
"@babel/preset-typescript": {
"version": "7.6.0",
"resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.6.0.tgz",
"integrity": "sha512-4xKw3tTcCm0qApyT6PqM9qniseCE79xGHiUnNdKGdxNsGUc2X7WwZybqIpnTmoukg3nhPceI5KPNzNqLNeIJww==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0",
"@babel/plugin-transform-typescript": "^7.6.0"
}
},
"@babel/register": {
"version": "7.6.2",
"resolved": "https://registry.npmjs.org/@babel/register/-/register-7.6.2.tgz",
@@ -1090,12 +1120,34 @@
"resolved": "https://registry.npmjs.org/@types/object-assign/-/object-assign-4.0.30.tgz",
"integrity": "sha1-iUk3HVqZ9Dge4PHfCpt6GH4H5lI="
},
"@types/prop-types": {
"version": "15.7.3",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz",
"integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw=="
},
"@types/q": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.2.tgz",
"integrity": "sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw==",
"dev": true
},
"@types/react": {
"version": "16.9.9",
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.9.tgz",
"integrity": "sha512-L+AudFJkDukk+ukInYvpoAPyJK5q1GanFOINOJnM0w6tUgITuWvJ4jyoBPFL7z4/L8hGLd+K/6xR5uUjXu0vVg==",
"requires": {
"@types/prop-types": "*",
"csstype": "^2.2.0"
}
},
"@types/react-dom": {
"version": "16.9.2",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.2.tgz",
"integrity": "sha512-hgPbBoI1aTSTvZwo8HYw35UaTldW6n2ETLvHAcfcg1FaOuBV3olmyCe5eMpx2WybWMBPv0MdU2t5GOcQhP+3zA==",
"requires": {
"@types/react": "*"
}
},
"@webassemblyjs/ast": {
"version": "1.8.5",
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.8.5.tgz",
@@ -2825,6 +2877,11 @@
}
}
},
"csstype": {
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.7.tgz",
"integrity": "sha512-9Mcn9sFbGBAdmimWb2gLVDtFJzeKtDGIr76TUqmjZrw9LFXBMSU70lcs+C0/7fyCd6iBDqmksUcCOUIkisPHsQ=="
},
"currently-unhandled": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz",
@@ -9836,6 +9893,12 @@
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
"dev": true
},
"typescript": {
"version": "3.6.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.4.tgz",
"integrity": "sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg==",
"dev": true
},
"uglify-js": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz",

View File

@@ -4,7 +4,8 @@
"description": "Chaotic Backup",
"scripts": {
"start": "webpack-dev-server -d --inline",
"build": "webpack -p"
"build": "npm run check-types && webpack -p",
"check-types": "tsc"
},
"repository": {
"type": "git",
@@ -14,6 +15,8 @@
"license": "MIT",
"dependencies": {
"@loadable/component": "^5.10.3",
"@types/react": "^16.9.9",
"@types/react-dom": "^16.9.2",
"lokijs": "^1.5.7",
"mobx": "^5.13.1",
"mobx-react": "^5.4.4",
@@ -37,12 +40,14 @@
"@babel/node": "^7.6.2",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-decorators": "^7.6.0",
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.6.2",
"@babel/polyfill": "^7.6.0",
"@babel/preset-env": "^7.6.2",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.6.0",
"@babel/register": "^7.6.2",
"@babel/runtime": "^7.6.2",
"babel-eslint": "^10.0.3",
@@ -57,6 +62,7 @@
"optimize-css-assets-webpack-plugin": "^5.0.3",
"sass-loader": "^8.0.0",
"style-loader": "^1.0.0",
"typescript": "^3.6.4",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^4.41.0",
"webpack-cli": "^3.3.9",

48
tsconfig.json Normal file
View File

@@ -0,0 +1,48 @@
{
"compilerOptions": {
// Target latest version of ECMAScript.
"target": "esnext",
// Search under node_modules for non-relative imports.
"moduleResolution": "node",
// Process & infer types from .js files.
"allowJs": true,
// Support jsx in .tsx files (https://www.typescriptlang.org/docs/handbook/jsx.html)
"jsx": "preserve",
// Don't emit; allow Babel to transform files.
"noEmit": true,
// Enable strictest settings like strictNullChecks & noImplicitAny.
// "strict": true,
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"alwaysStrict": false,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": false,
// Disallow features that require cross-file information for emit.
"isolatedModules": true,
// Import non-ES modules as default imports.
"esModuleInterop": true,
// Allow default imports from modules with no default export (e.g
// import React from "React")
"allowSyntheticDefaultImports": true,
// Include modules imported with .json extension.
"resolveJsonModule": true,
// Library files to be used in the project.
// Tells the compiler that "DOM-APIs" and new ECMAScript features are valid.
"lib": ["dom", "es2018"],
// Allows @decorators
"experimentalDecorators": true,
// List of folders to include type definitions from.
"typeRoots": [
"./node_modules/@types"
]
},
"include": [
"src"
],
"exclude": [
"./build/*",
"./node_modules/*"
]
}

View File

@@ -72,11 +72,12 @@ const config = {
module: {
rules: [
{
test: /\.(js|jsx)$/,
test: /\.(js|ts)x?$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: [
'@babel/typescript',
'@babel/preset-env',
'@babel/preset-react',
'@babel/preset-flow',
@@ -86,6 +87,7 @@ const config = {
['@babel/plugin-proposal-decorators', {legacy: true }],
['@babel/plugin-proposal-class-properties', { loose: true }],
'@babel/plugin-syntax-dynamic-import',
'@babel/proposal-object-rest-spread',
],
},
},