From b08fee339270ae8fc9456481cd147a22d7f88022 Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Wed, 2 May 2018 23:49:18 +0800 Subject: [PATCH] html: add .editorconfig --- html/.editorconfig | 11 ++++++ html/README.md | 2 +- html/gulpfile.js | 4 +- html/package.json | 88 +++++++++++++++++++++--------------------- html/webpack.config.js | 44 ++++++++++----------- html/webpack.dev.js | 46 +++++++++++----------- html/webpack.prod.js | 18 ++++----- 7 files changed, 112 insertions(+), 101 deletions(-) create mode 100644 html/.editorconfig diff --git a/html/.editorconfig b/html/.editorconfig new file mode 100644 index 0000000..c3f6353 --- /dev/null +++ b/html/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/html/README.md b/html/README.md index 3ed619d..8e48ca6 100644 --- a/html/README.md +++ b/html/README.md @@ -9,4 +9,4 @@ install [Yarn](https://yarnpkg.com), and run: `yarn install`. ## Publish -Run `yarn run build`, this will compile the inlined html to `../src/index.html`. \ No newline at end of file +Run `yarn run build`, this will compile the inlined html to `../src/index.html`. diff --git a/html/gulpfile.js b/html/gulpfile.js index 0b8e4d5..dcdbbe1 100644 --- a/html/gulpfile.js +++ b/html/gulpfile.js @@ -1,9 +1,9 @@ const gulp = require('gulp'), - clean = require('gulp-clean'), + clean = require('gulp-clean'), inlinesource = require('gulp-inline-source'); gulp.task('clean', function () { - return gulp.src('dist', {read: false}) + return gulp.src('dist', {read: false}) .pipe(clean()); }); diff --git a/html/package.json b/html/package.json index 6172eec..af86844 100644 --- a/html/package.json +++ b/html/package.json @@ -1,46 +1,46 @@ { - "name": "ttyd", - "version": "1.1.0", - "description": "Share your terminal over the web", - "main": "js/app.js", - "repository": { - "url": "git@github.com:tsl0922/ttyd.git", - "type": "git" - }, - "author": "Shuanglei Tao ", - "license": "MIT", - "scripts": { - "build": "webpack --config webpack.prod.js && gulp", - "clean": "gulp clean", - "start": "webpack-serve webpack.dev.js" - }, - "dependencies": { - "bulma": "^0.6.1", - "core-js": "^2.5.3", - "fast-text-encoding": "^1.0.0", - "xterm": "^3.2.0", - "zmodem.js": "^0.1.5" - }, - "devDependencies": { - "babel-core": "^6.26.3", - "babel-loader": "^7.1.4", - "babel-preset-env": "^1.6.1", - "copy-webpack-plugin": "^4.5.1", - "css-loader": "^0.28.8", - "gulp": "^3.9.1", - "gulp-clean": "^0.4.0", - "gulp-inline-source": "^3.1.0", - "html-webpack-inline-source-plugin": "^0.0.10", - "html-webpack-plugin": "^3.2.0", - "http-proxy-middleware": "^0.18.0", - "koa-connect": "^2.0.1", - "mini-css-extract-plugin": "^0.4.0", - "node-sass": "^4.7.2", - "sass-loader": "^6.0.6", - "style-loader": "^0.19.1", - "webpack": "^4.6.0", - "webpack-cli": "^2.1.2", - "webpack-merge": "^4.1.2", - "webpack-serve": "^0.3.2" - } + "name": "ttyd", + "version": "1.1.0", + "description": "Share your terminal over the web", + "main": "js/app.js", + "repository": { + "url": "git@github.com:tsl0922/ttyd.git", + "type": "git" + }, + "author": "Shuanglei Tao ", + "license": "MIT", + "scripts": { + "build": "webpack --config webpack.prod.js && gulp", + "clean": "gulp clean", + "start": "webpack-serve webpack.dev.js" + }, + "dependencies": { + "bulma": "^0.6.1", + "core-js": "^2.5.3", + "fast-text-encoding": "^1.0.0", + "xterm": "^3.2.0", + "zmodem.js": "^0.1.5" + }, + "devDependencies": { + "babel-core": "^6.26.3", + "babel-loader": "^7.1.4", + "babel-preset-env": "^1.6.1", + "copy-webpack-plugin": "^4.5.1", + "css-loader": "^0.28.8", + "gulp": "^3.9.1", + "gulp-clean": "^0.4.0", + "gulp-inline-source": "^3.1.0", + "html-webpack-inline-source-plugin": "^0.0.10", + "html-webpack-plugin": "^3.2.0", + "http-proxy-middleware": "^0.18.0", + "koa-connect": "^2.0.1", + "mini-css-extract-plugin": "^0.4.0", + "node-sass": "^4.7.2", + "sass-loader": "^6.0.6", + "style-loader": "^0.19.1", + "webpack": "^4.6.0", + "webpack-cli": "^2.1.2", + "webpack-merge": "^4.1.2", + "webpack-serve": "^0.3.2" + } } diff --git a/html/webpack.config.js b/html/webpack.config.js index dafadab..0c2e0df 100644 --- a/html/webpack.config.js +++ b/html/webpack.config.js @@ -9,34 +9,34 @@ module.exports = { filename: devMode ? '[name].js' : '[name].[hash].js' }, module: { - rules: [ - { - test: /\.js$/, - exclude: /node_modules\/(?!zmodem.js\/)/, - use: { - loader: 'babel-loader', - options: { - presets: ['env'] + rules: [ + { + test: /\.js$/, + exclude: /node_modules\/(?!zmodem.js\/)/, + use: { + loader: 'babel-loader', + options: { + presets: ['env'] + } + } + }, + { + test: /\.s?[ac]ss$/, + use: [ + devMode ? 'style-loader' : MiniCssExtractPlugin.loader, + 'css-loader', + 'sass-loader', + ] } - } - }, - { - test: /\.s?[ac]ss$/, - use: [ - devMode ? 'style-loader' : MiniCssExtractPlugin.loader, - 'css-loader', - 'sass-loader', - ] - } - ] + ] }, plugins: [ new CopyWebpackPlugin([ - {from: 'favicon.png', to: '.' } + {from: 'favicon.png', to: '.' } ], {}), new MiniCssExtractPlugin({ - filename: devMode ? '[name].css' : '[name].[hash].css', - chunkFilename: devMode ? '[id].css' : '[id].[hash].css', + filename: devMode ? '[name].css' : '[name].[hash].css', + chunkFilename: devMode ? '[id].css' : '[id].[hash].css', }) ] } \ No newline at end of file diff --git a/html/webpack.dev.js b/html/webpack.dev.js index 5a1a089..6174f2a 100644 --- a/html/webpack.dev.js +++ b/html/webpack.dev.js @@ -6,27 +6,27 @@ const config = require('./webpack.config.js'); const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = merge(config, { - devtool: 'source-map', - mode: 'development', - plugins: [ - new HtmlWebpackPlugin({ - template: 'index.html' - }) - ], - serve: { - content: __dirname + '/dist', - add: (app, middleware, options) => { - var ttydProxy = proxy( - [ - '/ws', - '/auth_token.js' - ], - { - target: 'http://127.0.0.1:7681', - ws: true - } - ); - app.use(convert(ttydProxy)); - } + devtool: 'source-map', + mode: 'development', + plugins: [ + new HtmlWebpackPlugin({ + template: 'index.html' + }) + ], + serve: { + content: __dirname + '/dist', + add: (app, middleware, options) => { + var ttydProxy = proxy( + [ + '/ws', + '/auth_token.js', + ], + { + target: 'http://127.0.0.1:7681', + ws: true, + } + ); + app.use(convert(ttydProxy)); + } } -}); \ No newline at end of file +}); diff --git a/html/webpack.prod.js b/html/webpack.prod.js index 40d61ed..d1d01cd 100644 --- a/html/webpack.prod.js +++ b/html/webpack.prod.js @@ -5,12 +5,12 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin'); module.exports = merge(config, { - mode: 'production', - plugins: [ - new HtmlWebpackPlugin({ - inlineSource: '.(js|css)$', - template: 'index.html' - }), - new HtmlWebpackInlineSourcePlugin() - ] -}); \ No newline at end of file + mode: 'production', + plugins: [ + new HtmlWebpackPlugin({ + inlineSource: '.(js|css)$', + template: 'index.html' + }), + new HtmlWebpackInlineSourcePlugin() + ] +}); -- 2.43.4