Created
January 5, 2017 14:17
-
-
Save kgroat/5ccd657cf30fafa5c2ff1ab12b3157ae to your computer and use it in GitHub Desktop.
An example of how to use npm as a build tool along with TypeScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "playground", | |
"version": "1.0.0", | |
"main": "server/app.js", | |
"private": true, | |
"scripts": { | |
"clean": "npm run clean:client && npm run clean:server", | |
"clean:client": "rm -rf public/*.* && rm -rf public/**/*.* && rm -rf src/ts/*.js && rm -rf src/ts/**/*.js", | |
"clean:server": "rm -rf server/*.{js,d.ts} && rm -rf server/**/*.{js,d.ts}", | |
"compile": "npm run compile:client && npm run compile:sass && npm run compile:server && npm run compile:static", | |
"compile:client": "tsc --project tsconfig.client.json && browserify src/ts/index.js -o public/bundle.js", | |
"compile:sass": "node-sass src/scss/index.scss -o public", | |
"compile:server": "tsc --project tsconfig.server.json", | |
"compile:static": "for file in src/static/*; do cp \"$file\" \"public/${file/src\\/static\\/}\";done", | |
"dev": "npm run compile && concurrently \"node server/app.js\" \"sleep 1 && npm run open\"", | |
"open": "opn http://localhost:${PORT:-3000}/", | |
"prestart": "npm run compile", | |
"start": "node server/app.js" | |
}, | |
"dependencies": { | |
"@types/express": "^4.0.34", | |
"@types/node": "^6.0.56", | |
"browserify": "^13.3.0", | |
"express": "^4.14.0", | |
"node-sass": "^4.1.1", | |
"typescript": "^2.1.4" | |
}, | |
"devDependencies": { | |
"concurrently": "^3.1.0", | |
"opn-cli": "^3.1.0" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"compilerOptions": { | |
"allowSyntheticDefaultImports": true, | |
"declaration": false, | |
"emitDecoratorMetadata": true, | |
"experimentalDecorators": true, | |
"lib": [ | |
"es2015", | |
"dom" | |
], | |
"module": "commonjs", | |
"moduleResolution": "node", | |
"target": "es5" | |
}, | |
"include": [ | |
"src/**/*" | |
], | |
"exclude": [ | |
"node_modules" | |
], | |
"compileOnSave": false, | |
"atom": { | |
"rewriteTsconfig": false | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"compilerOptions": { | |
"allowSyntheticDefaultImports": true, | |
"declaration": true, | |
"emitDecoratorMetadata": true, | |
"experimentalDecorators": true, | |
"lib": [ | |
"es2015", | |
"dom" | |
], | |
"module": "commonjs", | |
"moduleResolution": "node", | |
"target": "es5" | |
}, | |
"include": [ | |
"server/**/*" | |
], | |
"exclude": [ | |
"node_modules" | |
], | |
"compileOnSave": false, | |
"atom": { | |
"rewriteTsconfig": false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment