Last active
December 25, 2016 11:54
-
-
Save onionmk2/6876fd3df97bf36d6ed9a71fa34e6428 to your computer and use it in GitHub Desktop.
typescript dev
This file contains 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
#!/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