Skip to content

Instantly share code, notes, and snippets.

@Stwissel
Last active June 4, 2023 09:38
Show Gist options
  • Save Stwissel/889f1ee888d0d7dbe2c8933b3395ff81 to your computer and use it in GitHub Desktop.
Save Stwissel/889f1ee888d0d7dbe2c8933b3395ff81 to your computer and use it in GitHub Desktop.
TypeScript project setup
'use strict';
module.exports = {
spec: ['test/**/*.spec.ts'],
};
{
"printWidth": 150,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "none",
"semi": true,
"arrowParens": "always"
}
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch TS-Demo",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/dist/index.js",
"preLaunchTask": "tsc: build - tsconfig.json",
"cwd": "${workspaceFolder/dist}",
"console": "integratedTerminal",
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
]
},
{
"name": "Run with Watch",
"command": "npm run dev",
"request": "launch",
"type": "node-terminal"
}
]
}
{
"name": "ts-demo",
"version": "1.0.0",
"description": "Minimal ExpressJS with TypeScript",
"main": "dist/index.js",
"scripts": {
"build": "npx tsc",
"postbuild": "npm run test",
"dev": "ts-node-dev --respawn --pretty --transpile-only src/index.ts",
"prestart": "npm run build",
"start": "node .",
"test" : "./node_modules/.bin/mocha -r ts-node/register test/**/*.spec.ts"
},
"keywords": [
"typescript",
"express"
],
"author": "notessensei",
"license": "Apache-2.0",
"dependencies": {
"express": "^4.18.2"
},
"devDependencies": {
"@types/chai": "^4.3.5",
"@types/chai-as-promised": "^7.1.5",
"@types/express": "^4.17.17",
"@types/mocha": "^10.0.1",
"@types/node": "^20.2.5",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
"mocha": "^10.2.0",
"ts-node": "^10.9.1",
"ts-node-dev": "^2.0.0",
"typescript": "^5.1.3"
}
}
{
"cmake.configureOnOpen": false,
"editor.renderWhitespace": "all",
"editor.fontFamily": "'Jetbrains Mono', Menlo, Monaco, 'Courier New', monospace",
"editor.fontLigatures": true,
"editor.formatOnSave": true,
"editor.suggestSelection": "first",
"editor.tabCompletion": "on",
"editor.wordWrap": "on",
"mochaExplorer.files": "test/**/*.ts",
"mochaExplorer.require": "ts-node/register",
"mochaExplorer.logpanel": true,
"mocha-snippets.function-type": "arrow"
}
{
"compilerOptions": {
"target": "ES2020",
"module": "NodeNext",
"moduleResolution": "nodenext",
"resolveJsonModule": true,
"sourceMap": true,
"outDir": "./dist",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"strictNullChecks": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"skipLibCheck": true
},
"include": ["src/**/*.ts", "src/**/*.json",".env"],
"exclude": ["node_modules","**/*spec.ts"],
"ts-node": {
"files": true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment