Style: change 2 spaces to 4

This commit is contained in:
jas0ncn 2018-09-02 02:57:09 +08:00
parent 37739d7f44
commit c81a02b2fc
15 changed files with 212 additions and 195 deletions

View File

@ -1,17 +1,17 @@
{
"presets": [
["@babel/preset-env", {"modules": false}],
"@babel/preset-react"
],
"plugins": [
"react-hot-loader/babel"
],
"env": {
"production": {
"presets": ["minify"]
},
"test": {
"presets": ["@babel/preset-env", "@babel/preset-react"]
"presets": [
["@babel/preset-env", {"modules": false}],
"@babel/preset-react"
],
"plugins": [
"react-hot-loader/babel"
],
"env": {
"production": {
"presets": ["minify"]
},
"test": {
"presets": ["@babel/preset-env", "@babel/preset-react"]
}
}
}
}

12
.editorconfig Normal file
View File

@ -0,0 +1,12 @@
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

View File

@ -1,3 +1,3 @@
{
"extends": "stylelint-config-standard"
"extends": "stylelint-config-standard"
}

View File

@ -1,22 +1,22 @@
language: node_js
sudo: false
node_js:
- "stable"
- "stable"
cache:
directories:
- "$HOME/.npm"
directories:
- "$HOME/.npm"
install:
- "npm ci"
- "npm ci"
script:
- "npm run lint"
- "npm run lint"
before_deploy:
- "npm run build"
- "npm run build"
deploy:
provider: pages
skip-cleanup: true
local-dir: dist
github-token: $GITHUB_TOKEN
on:
repo: Dreamacro/clash-dashboard
branch: master
tags: true
provider: pages
skip-cleanup: true
local-dir: dist
github-token: $GITHUB_TOKEN
on:
repo: Dreamacro/clash-dashboard
branch: master
tags: true

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2018 Dreamacro
Copyright (c) 2018 ClashTeam
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.

View File

@ -1,3 +1,3 @@
# clash-dashboard
web port of clash
web port of clash

View File

@ -5,52 +5,52 @@ const StyleLintPlugin = require('stylelint-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
context: resolve(__dirname, '../../src'),
module: {
rules: [
{
test: /\.js$/,
use: ['babel-loader', 'source-map-loader'],
exclude: /node_modules/,
},
{
test: /\.tsx?$/,
use: ['babel-loader', 'awesome-typescript-loader'],
},
{
test: /\.css$/,
use: ['style-loader', { loader: 'css-loader', options: { importLoaders: 1 } }],
},
{
test: /\.scss$/,
loaders: [
'style-loader',
{ loader: 'css-loader', options: { importLoaders: 1 } },
'sass-loader',
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
context: resolve(__dirname, '../../src'),
module: {
rules: [
{
test: /\.js$/,
use: ['babel-loader', 'source-map-loader'],
exclude: /node_modules/,
},
{
test: /\.tsx?$/,
use: ['babel-loader', 'awesome-typescript-loader'],
},
{
test: /\.css$/,
use: ['style-loader', { loader: 'css-loader', options: { importLoaders: 1 } }],
},
{
test: /\.scss$/,
loaders: [
'style-loader',
{ loader: 'css-loader', options: { importLoaders: 1 } },
'sass-loader',
],
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'file-loader?hash=sha512&digest=hex&name=img/[hash].[ext]',
'image-webpack-loader?bypassOnDebug&optipng.optimizationLevel=7&gifsicle.interlaced=false',
],
},
],
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'file-loader?hash=sha512&digest=hex&name=img/[hash].[ext]',
'image-webpack-loader?bypassOnDebug&optipng.optimizationLevel=7&gifsicle.interlaced=false',
],
},
},
plugins: [
new CheckerPlugin(),
new StyleLintPlugin(),
new HtmlWebpackPlugin({ template: 'index.html.ejs', }),
],
},
plugins: [
new CheckerPlugin(),
new StyleLintPlugin(),
new HtmlWebpackPlugin({ template: 'index.html.ejs', }),
],
externals: {
'react': 'React',
'react-dom': 'ReactDOM',
},
performance: {
hints: false,
},
externals: {
'react': 'React',
'react-dom': 'ReactDOM',
},
performance: {
hints: false,
},
}

View File

@ -4,19 +4,19 @@ const webpack = require('webpack')
const commonConfig = require('./common')
module.exports = merge(commonConfig, {
mode: 'development',
entry: [
'react-hot-loader/patch', // activate HMR for React
'webpack-dev-server/client?http://localhost:8080',// bundle the client for webpack-dev-server and connect to the provided endpoint
'webpack/hot/only-dev-server', // bundle the client for hot reloading, only- means to only hot reload for successful updates
'./index.tsx' // the entry point of our app
],
devServer: {
hot: true, // enable HMR on the server
},
devtool: 'cheap-module-eval-source-map',
plugins: [
new webpack.HotModuleReplacementPlugin(), // enable HMR globally
new webpack.NamedModulesPlugin(), // prints more readable module names in the browser console on HMR updates
],
mode: 'development',
entry: [
'react-hot-loader/patch', // activate HMR for React
'webpack-dev-server/client?http://localhost:8080',// bundle the client for webpack-dev-server and connect to the provided endpoint
'webpack/hot/only-dev-server', // bundle the client for hot reloading, only- means to only hot reload for successful updates
'./index.tsx' // the entry point of our app
],
devServer: {
hot: true, // enable HMR on the server
},
devtool: 'cheap-module-eval-source-map',
plugins: [
new webpack.HotModuleReplacementPlugin(), // enable HMR globally
new webpack.NamedModulesPlugin(), // prints more readable module names in the browser console on HMR updates
],
})

View File

@ -5,13 +5,13 @@ const { resolve } = require('path')
const commonConfig = require('./common')
module.exports = merge(commonConfig, {
mode: 'production',
entry: './index.tsx',
output: {
filename: 'js/bundle.[hash].min.js',
path: resolve(__dirname, '../../dist'),
publicPath: '/',
},
devtool: 'source-map',
plugins: [],
mode: 'production',
entry: './index.tsx',
output: {
filename: 'js/bundle.[hash].min.js',
path: resolve(__dirname, '../../dist'),
publicPath: '/',
},
devtool: 'source-map',
plugins: [],
})

View File

@ -6,6 +6,6 @@ const sourceDir = 'dist'
app.use(express.static(sourceDir))
app.listen(portNumber, () => {
console.log(`Express web server started: http://localhost:${portNumber}`)
console.log(`Serving content from /${sourceDir}/`)
console.log(`Express web server started: http://localhost:${portNumber}`)
console.log(`Serving content from /${sourceDir}/`)
})

View File

@ -1,65 +1,65 @@
{
"name": "clash-dashboard",
"version": "0.1.0",
"description": "Web port of clash.",
"keywords": [
"clash",
"dashboard"
],
"author": "Dreamacro",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/Dreamacro/clash-dashboard.git"
},
"bugs": {
"url": "https://github.com/Dreamacro/clash-dashboard/issues"
},
"homepage": "https://github.com/Dreamacro/clash-dashboard",
"scripts": {
"build": "npm run clean-dist && webpack -p --config=configs/webpack/prod.js",
"clean-dist": "rm -f -r -d dist",
"lint": "npm run lint:ts && npm run lint:sass",
"lint:ts": "tslint './src/**/*.ts*' --format stylish --force",
"lint:sass": "stylelint ./src/**/*.scss",
"start": "npm run start-dev",
"start-dev": "webpack-dev-server --config=configs/webpack/dev.js",
"start-prod": "npm run build && node express.js"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@types/node": "^10.7.1",
"@types/react": "^16.4.11",
"@types/react-dom": "^16.0.7",
"awesome-typescript-loader": "^5.2.0",
"babel-loader": "^8.0.0",
"css-loader": "^1.0.0",
"express": "^4.16.3",
"file-loader": "^2.0.0",
"html-webpack-plugin": "^3.2.0",
"image-webpack-loader": "^4.3.1",
"node-sass": "^4.9.3",
"react": "^16.4.2",
"react-addons-test-utils": "^15.6.2",
"react-dom": "^16.4.2",
"react-hot-loader": "^4.3.4",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.0",
"stylelint": "^9.5.0",
"stylelint-config-standard": "^18.2.0",
"stylelint-webpack-plugin": "^0.10.5",
"tslint": "^5.11.0",
"tslint-config-standard": "^7.1.0",
"typescript": "^3.0.1",
"uglifyjs-webpack-plugin": "^1.3.0",
"webpack": "^4.17.1",
"webpack-cli": "^3.1.0",
"webpack-dev-middleware": "^3.1.3",
"webpack-dev-server": "^3.1.5",
"webpack-merge": "^4.1.4"
},
"dependencies": {}
"name": "clash-dashboard",
"version": "0.1.0",
"description": "Web port of clash.",
"keywords": [
"clash",
"dashboard"
],
"author": "Dreamacro",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/Dreamacro/clash-dashboard.git"
},
"bugs": {
"url": "https://github.com/Dreamacro/clash-dashboard/issues"
},
"homepage": "https://github.com/Dreamacro/clash-dashboard",
"scripts": {
"build": "npm run clean-dist && webpack -p --config=configs/webpack/prod.js",
"clean-dist": "rm -f -r -d dist",
"lint": "npm run lint:ts && npm run lint:sass",
"lint:ts": "tslint './src/**/*.ts*' --format stylish --force",
"lint:sass": "stylelint ./src/**/*.scss",
"start": "npm run start-dev",
"start-dev": "webpack-dev-server --config=configs/webpack/dev.js",
"start-prod": "npm run build && node express.js"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@types/node": "^10.7.1",
"@types/react": "^16.4.11",
"@types/react-dom": "^16.0.7",
"awesome-typescript-loader": "^5.2.0",
"babel-loader": "^8.0.0",
"css-loader": "^1.0.0",
"express": "^4.16.3",
"file-loader": "^2.0.0",
"html-webpack-plugin": "^3.2.0",
"image-webpack-loader": "^4.3.1",
"node-sass": "^4.9.3",
"react": "^16.4.2",
"react-addons-test-utils": "^15.6.2",
"react-dom": "^16.4.2",
"react-hot-loader": "^4.3.4",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.0",
"stylelint": "^9.5.0",
"stylelint-config-standard": "^18.2.0",
"stylelint-webpack-plugin": "^0.10.5",
"tslint": "^5.11.0",
"tslint-config-standard": "^7.1.0",
"typescript": "^3.0.1",
"uglifyjs-webpack-plugin": "^1.3.0",
"webpack": "^4.17.1",
"webpack-cli": "^3.1.0",
"webpack-dev-middleware": "^3.1.3",
"webpack-dev-server": "^3.1.5",
"webpack-merge": "^4.1.4"
},
"dependencies": {}
}

View File

@ -2,11 +2,11 @@ $bg-color: yellow;
$border-color: red;
.app {
font-family: helvetica, arial, sans-serif;
padding: 2em;
border: 5px solid $border-color;
font-family: helvetica, arial, sans-serif;
padding: 2em;
border: 5px solid $border-color;
p {
background-color: $bg-color;
}
p {
background-color: $bg-color;
}
}

View File

@ -5,12 +5,12 @@ export interface AppProps {
}
export default class App extends React.Component<AppProps, {}> {
render () {
return (
<div className='app'>
<h1>Hello World!</h1>
<p>Foo to the barz</p>
</div>
)
}
render () {
return (
<div className='app'>
<h1>Hello World!</h1>
<p>Foo to the barz</p>
</div>
)
}
}

View File

@ -6,23 +6,23 @@ import App from './components/App'
const rootEl = document.getElementById('root')
render(
<AppContainer>
<App />
</AppContainer>,
rootEl
<AppContainer>
<App />
</AppContainer>,
rootEl
)
// Hot Module Replacement API
declare let module: { hot: any }
if (module.hot) {
module.hot.accept('./components/App', () => {
const NewApp = require('./components/App').default
render(
<AppContainer>
<NewApp />
</AppContainer>,
rootEl
)
})
module.hot.accept('./components/App', () => {
const NewApp = require('./components/App').default
render(
<AppContainer>
<NewApp />
</AppContainer>,
rootEl
)
})
}

View File

@ -1,3 +1,8 @@
{
"extends": "tslint-config-standard"
"extends": "tslint-config-standard",
"rules": [
{
"indent": [true, "spaces", 4]
}
]
}