Last active
May 17, 2018 09:20
-
-
Save KatagiriSo/88a4324cf3c332ee7f7fccc14c29a7d6 to your computer and use it in GitHub Desktop.
typescript start script
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
{ | |
"compilerOptions": { | |
"sourceMap": true, | |
"target": "es5", | |
"module": "es2015" | |
} | |
} |
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
module.exports = { | |
// or production | |
mode: 'development', | |
entry: { | |
main:'./src/main.ts', | |
menu:'./src/menu.ts'}, | |
module: { | |
rules: [ | |
{ | |
test: /\.ts$/, | |
use: 'ts-loader' | |
}, | |
{ | |
test: /\.html$/, | |
loader: 'html-loader' | |
} | |
] | |
}, | |
// for import | |
resolve: { | |
extensions: [ | |
'.ts' | |
] | |
} | |
}; |
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
var data = require( "./package.json" ); | |
console.log( data ); | |
data["scripts"] = { | |
"build": "webpack", | |
"watch": "webpack -w" | |
}; | |
var fs = require('fs'); | |
fs.writeFile('package.json', JSON.stringify(data, null, ' ')); | |
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
#!/bin/bash | |
if [ $# -ne 1 ]; then | |
echo "directry name.." | |
exit 1 | |
fi | |
dir=$1 | |
echo "create" $dir | |
mkdir $dir | |
echo "cd" $dir | |
cd $dir | |
pwd | |
echo "npm init -y" | |
npm init -y | |
echo "npm install webpack webpack-cli typescript ts-loader html-loader" | |
npm install webpack webpack-cli typescript ts-loader html-loader | |
echo "cp file.js" | |
cp ../file.js file.js | |
echo "node file.js" | |
node file.js | |
rm file.js | |
echo "cp tsconfig.json" | |
cp ../_tmp_tsconfig.json tsconfig.json | |
echo "cp webpack.config.js" | |
cp ../_tmp_webpack.config.js webpack.config.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment