Support all-typescript tooling with ts-node

The ts-node allows to execute build scripts written in TypeScript
so the entire project could be written in TypeScript.
This commit introduces support for ts-node, updates packages
and migrate copy routine to TypeScript

Thanks!
This commit is contained in:
Peter Blazejewicz 2017-12-16 22:41:40 +01:00
Родитель 7325bc49a2
Коммит bfd74b2dc6
5 изменённых файлов: 186 добавлений и 7 удалений

Просмотреть файл

@ -72,7 +72,7 @@ The full folder structure of this app is explained below:
| **views** | Views define how your app renders on the client. In this case we're using pug |
| .env.example | API keys, tokens, passwords, database URI. Clone this, but don't check it in to public repos. |
| .travis.yml | Used to configure Travis CI build |
| .copyStaticAssets.js | Build script that copies images, fonts, and JS libs to the dist folder |
| .copyStaticAssets.ts | Build script that copies images, fonts, and JS libs to the dist folder |
| package.json | File that contains npm dependencies as well as [build scripts](#what-if-a-library-isnt-on-definitelytyped) |
| tsconfig.json | Config settings for compiling server code written in TypeScript |
| tsconfig.tests.json | Config settings for compiling tests written in TypeScript |

Просмотреть файл

@ -1,5 +0,0 @@
var shell = require('shelljs');
shell.cp('-R', 'src/public/js/lib', 'dist/public/js/');
shell.cp('-R', 'src/public/fonts', 'dist/public/');
shell.cp('-R', 'src/public/images', 'dist/public/');

5
copyStaticAssets.ts Normal file
Просмотреть файл

@ -0,0 +1,5 @@
const shell = require("shelljs");
shell.cp("-R", "src/public/js/lib", "dist/public/js/");
shell.cp("-R", "src/public/fonts", "dist/public/");
shell.cp("-R", "src/public/images", "dist/public/");

177
package-lock.json сгенерированный
Просмотреть файл

@ -80,6 +80,12 @@
"@types/express": "4.0.39"
}
},
"@types/events": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@types/events/-/events-1.1.0.tgz",
"integrity": "sha512-y3bR98mzYOo0pAZuiLari+cQyiKk3UXRuT45h1RjhfeCzqkjaVsfZJNaxdgtk7/3tzOm1ozLTqEqMP3VbI48jw==",
"dev": true
},
"@types/express": {
"version": "4.0.39",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.0.39.tgz",
@ -124,6 +130,17 @@
"@types/node": "7.0.46"
}
},
"@types/glob": {
"version": "5.0.34",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-5.0.34.tgz",
"integrity": "sha512-sUvpieq+HsWTLdkeOI8Mi8u22Ag3AoGuM3sv+XMP1bKtbaIAHpEA2f52K2mz6vK5PVhTa3bFyRZLZMqTxOo2Cw==",
"dev": true,
"requires": {
"@types/events": "1.1.0",
"@types/minimatch": "3.0.2",
"@types/node": "7.0.46"
}
},
"@types/jest": {
"version": "21.1.5",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-21.1.5.tgz",
@ -147,6 +164,12 @@
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.0.tgz",
"integrity": "sha512-A2TAGbTFdBw9azHbpVd+/FkdW2T6msN1uct1O9bH3vTerEHKZhTXJUQXy+hNq1B0RagfU8U+KBdqiZpxjhOUQA=="
},
"@types/minimatch": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.2.tgz",
"integrity": "sha512-tctoxbfuMCxeI2CAsnwoZQfaBA+T7gPzDzDuiiFnyCSSyGYEB92cmRTh6E3tdR1hWsprbJ9IdbvX3PzLmJU/GA==",
"dev": true
},
"@types/mongodb": {
"version": "2.2.15",
"resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-2.2.15.tgz",
@ -305,6 +328,28 @@
"@types/mime": "2.0.0"
}
},
"@types/shelljs": {
"version": "0.7.7",
"resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.7.7.tgz",
"integrity": "sha512-37gn9J75TVAhhmzBqoX0vzQodsjzri1SxElMX+Wk092IobNZSGW/8X4ygLOQOrKjCQr5nxGN9Ik0UA3fSdL1Pw==",
"dev": true,
"requires": {
"@types/glob": "5.0.34",
"@types/node": "7.0.46"
}
},
"@types/strip-bom": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@types/strip-bom/-/strip-bom-3.0.0.tgz",
"integrity": "sha1-FKjsOVbC6B7bdSB5CuzyHCkK69I=",
"dev": true
},
"@types/strip-json-comments": {
"version": "0.0.30",
"resolved": "https://registry.npmjs.org/@types/strip-json-comments/-/strip-json-comments-0.0.30.tgz",
"integrity": "sha512-7NQmHra/JILCd1QqpSzl8+mJRc8ZHz3uDm8YV1Ks9IhK0epEiTw8aIErbvH9PI+6XbqhyIQy3462nEsn7UVzjQ==",
"dev": true
},
"@types/superagent": {
"version": "3.5.6",
"resolved": "https://registry.npmjs.org/@types/superagent/-/superagent-3.5.6.tgz",
@ -3255,6 +3300,15 @@
"os-tmpdir": "1.0.2"
}
},
"homedir-polyfill": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz",
"integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=",
"dev": true,
"requires": {
"parse-passwd": "1.0.0"
}
},
"hooks-fixed": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/hooks-fixed/-/hooks-fixed-2.0.0.tgz",
@ -5126,6 +5180,12 @@
"pify": "3.0.0"
}
},
"make-error": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.0.tgz",
"integrity": "sha1-Uq06M5zPEM5itAQLcI/nByRLi5Y=",
"dev": true
},
"makeerror": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz",
@ -5843,6 +5903,12 @@
"error-ex": "1.3.1"
}
},
"parse-passwd": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz",
"integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=",
"dev": true
},
"parse5": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz",
@ -7361,6 +7427,102 @@
}
}
},
"ts-node": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-4.0.2.tgz",
"integrity": "sha512-mg7l6ON8asjnfzkTi1LFWKaOGHl5Jf1+5ij0MQ502YfC6+4FBgh/idJgw9aN9kei1Rf4/pmFpNuFE1YbcQdOTA==",
"dev": true,
"requires": {
"arrify": "1.0.1",
"chalk": "2.3.0",
"diff": "3.4.0",
"make-error": "1.3.0",
"minimist": "1.2.0",
"mkdirp": "0.5.1",
"source-map-support": "0.5.0",
"tsconfig": "7.0.0",
"v8flags": "3.0.1",
"yn": "2.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
"integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
"dev": true,
"requires": {
"color-convert": "1.9.0"
}
},
"chalk": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz",
"integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==",
"dev": true,
"requires": {
"ansi-styles": "3.2.0",
"escape-string-regexp": "1.0.5",
"supports-color": "4.5.0"
}
},
"has-flag": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
"integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
"dev": true
},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"dev": true
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
},
"source-map-support": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.0.tgz",
"integrity": "sha512-vUoN3I7fHQe0R/SJLKRdKYuEdRGogsviXFkHHo17AWaTGv17VLnxw+CFXvqy+y4ORZ3doWLQcxRYfwKrsd/H7Q==",
"dev": true,
"requires": {
"source-map": "0.6.1"
}
},
"supports-color": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
"integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=",
"dev": true,
"requires": {
"has-flag": "2.0.0"
}
}
}
},
"tsconfig": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-7.0.0.tgz",
"integrity": "sha512-vZXmzPrL+EmC4T/4rVlT2jNVMWCi/O4DIiSj3UHg1OE5kCKbk4mfrXc6dZksLgRM/TZlKnousKH9bbTazUWRRw==",
"dev": true,
"requires": {
"@types/strip-bom": "3.0.0",
"@types/strip-json-comments": "0.0.30",
"strip-bom": "3.0.0",
"strip-json-comments": "2.0.1"
},
"dependencies": {
"strip-bom": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
"dev": true
}
}
},
"tslib": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz",
@ -7650,6 +7812,15 @@
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz",
"integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g=="
},
"v8flags": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.0.1.tgz",
"integrity": "sha1-3Oj8N5wX2fLJ6e142JzgAFKxt2s=",
"dev": true,
"requires": {
"homedir-polyfill": "1.0.1"
}
},
"validate-npm-package-license": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz",
@ -7994,6 +8165,12 @@
"dev": true
}
}
},
"yn": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz",
"integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=",
"dev": true
}
}
}

Просмотреть файл

@ -19,7 +19,7 @@
"build-sass": "node-sass src/public/css/main.scss dist/public/css/main.css",
"watch-sass": "node-sass -w src/public/css/main.scss dist/public/css/main.css",
"tslint": "tslint -c tslint.json -p tsconfig.json",
"copy-static-assets": "node copyStaticAssets.js",
"copy-static-assets": "ts-node copyStaticAssets.ts",
"debug": "npm run build && npm run watch-debug",
"serve-debug": "nodemon --inspect dist/server.js",
"watch-debug": "concurrently -k -p \"[{name}]\" -n \"Sass,TypeScript,Node\" -c \"yellow.bold,cyan.bold,green.bold\" \"npm run watch-sass\" \"npm run watch-ts\" \"npm run serve-debug\""
@ -87,6 +87,7 @@
"@types/passport": "^0.3.3",
"@types/passport-facebook": "^2.1.3",
"@types/request": "^2.0.7",
"@types/shelljs": "^0.7.7",
"@types/supertest": "^2.0.0",
"concurrently": "^3.4.0",
"jest": "^21.2.1",
@ -95,6 +96,7 @@
"shelljs": "^0.7.7",
"supertest": "^2.0.1",
"ts-jest": "^21.1.4",
"ts-node": "^4.0.2",
"tslint": "^5.8.0",
"typescript": "^2.4.0"
}