Skip to content

Instantly share code, notes, and snippets.

@onionmk2
Last active December 25, 2016 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onionmk2/6876fd3df97bf36d6ed9a71fa34e6428 to your computer and use it in GitHub Desktop.
Save onionmk2/6876fd3df97bf36d6ed9a71fa34e6428 to your computer and use it in GitHub Desktop.
typescript dev
#!/usr/bin/env bash
mkdir src
mkdir dist
npm init -y
npm install --save-dev typescript
npm install --save-dev webpack
npm install --save-dev ts-loader
# http://stackoverflow.com/questions/27573365/how-to-use-typescript-with-native-es6-promises
npm install --save core-js
npm install --save-dev @types/core-js
echo '"import 'core-js' must" ;'
touch tsconfig.json
cat << EOF > tsconfig.json
{
"compilerOptions": {
"experimentalDecorators": true,
"module": "commonjs",
"noEmitOnError": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"forceConsistentCasingInFileNames": true,
"strictNullChecks": true,
"target": "es5"
},
"lib": [
"DOM",
"ES2017"
],
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}
EOF
touch webpack.config.js
cat << EOF > webpack.config.js
const path = require('path');
module.exports = {
entry: './src/hi.ts',
output: {
path: path.resolve(__dirname, './dist'),
filename: '[name].js',
},
resolve: {
extensions: ['', 'ts']
},
devtool: 'inline-source-map',
module: {
loaders: [{
test: /\.ts(x?)$/,
exclude: /node_modules/,
loader: 'ts-loader'
}]
}
}
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment