-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
9,150 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Editor configuration, see http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[.*] | ||
insert_final_newline = false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules/ | ||
.idea/ | ||
.DS_Store | ||
*.log | ||
build/ | ||
dist/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Installation | ||
```bash | ||
yarn add webpack-genius --dev | ||
``` | ||
|
||
# Usage | ||
Create file `webpack.config.ts` | ||
```typescript | ||
import webpackGenius from 'webpack-genius'; | ||
|
||
export default webpackGenius(); | ||
``` | ||
|
||
### With Port | ||
The default port is `3000`, feel free to modify port by yourself. | ||
```typescript | ||
import webpackGenius from 'webpack-genius'; | ||
|
||
export default webpackGenius(5100); | ||
``` | ||
|
||
### With Host | ||
The default host is `0.0.0.0`, you may keep this IP address usually. | ||
```typescript | ||
import webpackGenius from 'webpack-genius'; | ||
|
||
export default webpackGenius(3000, (genius) => { | ||
genius.devServer((config) => { | ||
config.host = 'YOUR HOST OR IP'; | ||
}); | ||
}); | ||
``` | ||
|
||
### With Entry | ||
The default entry is from `package.json` | ||
```json | ||
{ | ||
"main": "./src/entries/Index.jsx" | ||
} | ||
``` | ||
Or you can set entry file in config: | ||
```typescript | ||
import webpackGenius from 'webpack-genius'; | ||
|
||
export default webpackGenius(3000, (genius) => { | ||
genius.entry('./src/entries/Index.tsx'); | ||
}); | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
"name": "webpack-genius", | ||
"version": "4.0.0", | ||
"main": "index.js", | ||
"repository": "git@github.com:fwh1990/webpack-genius.git", | ||
"author": "范文华 <531362022@qq.com>", | ||
"keywords": [ | ||
"webpack", | ||
"webpack-cli" | ||
], | ||
"license": "MIT", | ||
"bin": "./command.js", | ||
"dependencies": { | ||
"@babel/core": "^7.7.2", | ||
"@babel/plugin-proposal-class-properties": "^7.7.0", | ||
"@babel/plugin-syntax-dynamic-import": "^7.2.0", | ||
"@babel/preset-env": "^7.7.1", | ||
"@babel/preset-react": "^7.7.0", | ||
"@babel/preset-typescript": "^7.7.2", | ||
"autoprefixer": "^9.7.1", | ||
"babel-loader": "^8.0.6", | ||
"babel-plugin-import": "^1.12.2", | ||
"clean-webpack-plugin": "^3.0.0", | ||
"core-js": "^3.4.1", | ||
"css-loader": "^3.2.0", | ||
"file-loader": "^4.2.0", | ||
"hard-source-webpack-plugin": "^0.13.1", | ||
"html-loader": "^0.5.5", | ||
"html-webpack-plugin": "^3.2.0", | ||
"less": "^3.10.3", | ||
"less-loader": "^5.0.0", | ||
"lodash.clonedeep": "^4.5.0", | ||
"mini-css-extract-plugin": "^0.8.0", | ||
"node-sass": "^4.13.0", | ||
"optimize-css-assets-webpack-plugin": "^5.0.3", | ||
"postcss-loader": "^3.0.0", | ||
"react-dev-utils": "^9.1.0", | ||
"sass-loader": "^8.0.0", | ||
"style-loader": "^1.0.0", | ||
"url-loader": "^2.2.0", | ||
"webpack": "^4.41.2", | ||
"webpack-cli": "^3.3.10", | ||
"webpack-dev-server": "^3.9.0" | ||
}, | ||
"devDependencies": { | ||
"@types/autoprefixer": "^9.6.1", | ||
"@types/hard-source-webpack-plugin": "^1.0.1", | ||
"@types/html-webpack-plugin": "^3.2.1", | ||
"@types/lodash.clonedeep": "^4.5.6", | ||
"@types/mini-css-extract-plugin": "^0.8.0", | ||
"@types/node": "^12.12.7", | ||
"@types/optimize-css-assets-webpack-plugin": "^5.0.1", | ||
"@types/terser-webpack-plugin": "^2.2.0", | ||
"@types/webpack": "^4.39.8", | ||
"@types/webpack-dev-server": "^3.4.0", | ||
"@types/webpack-env": "^1.14.1", | ||
"ts-node": "^8.5.0", | ||
"typescript": "^3.7.2" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
set -e | ||
|
||
rm -rf ./build | ||
|
||
./node_modules/.bin/tsc | ||
|
||
mv ./build/src/* ./build | ||
cp README.md package.json LICENSE ./build | ||
|
||
old_registry=$(npm config get registry) | ||
npm config set registry https://registry.npmjs.org | ||
set +e | ||
whoami=$(npm whoami 2>/dev/null) | ||
set -e | ||
|
||
if [ -z "$whoami" ] | ||
then | ||
echo "login plz..." | ||
npm login | ||
fi | ||
echo "I am: $(npm whoami)" | ||
|
||
sleep 1 | ||
echo "Begin publish..." | ||
npm publish ./build/ --access=public "$@" | ||
|
||
npm config set registry ${old_registry} |
Oops, something went wrong.