mirror of
https://github.com/infeng/react-viewer.git
synced 2025-12-08 17:36:40 +00:00
complete dev environment
This commit is contained in:
parent
b76a86d799
commit
691655d99f
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules/
|
||||
41
package.json
Normal file
41
package.json
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "react-viewer",
|
||||
"version": "0.0.1",
|
||||
"description": "react image viewer",
|
||||
"main": "dist/index",
|
||||
"entry": {
|
||||
"index": "./src/index.ts"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "dora --port 8001 --plugins \"webpack,webpack-hmr,browser-history?index=/src/entry/index.html\""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/infeng/react-viewer.git"
|
||||
},
|
||||
"keywords": [
|
||||
"react",
|
||||
"image",
|
||||
"viewer"
|
||||
],
|
||||
"author": "infeng",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/infeng/react-viewer/issues"
|
||||
},
|
||||
"homepage": "https://github.com/infeng/react-viewer#readme",
|
||||
"devDependencies": {
|
||||
"atool-build": "^0.8.1",
|
||||
"classnames": "^2.2.5",
|
||||
"dora": "^0.4.3",
|
||||
"dora-plugin-browser-history": "^0.2.0",
|
||||
"dora-plugin-webpack": "^0.8.1",
|
||||
"dora-plugin-webpack-hmr": "^0.2.1",
|
||||
"html-loader": "^0.4.4",
|
||||
"html-webpack-plugin": "^2.22.0",
|
||||
"tslint": "^3.15.1",
|
||||
"typescript": "^2.0.3",
|
||||
"webpack": "^1.13.2"
|
||||
}
|
||||
}
|
||||
11
src/entry/index.html
Normal file
11
src/entry/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>react-viewer</title>
|
||||
<meta charset="utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
0
src/index.ts
Normal file
0
src/index.ts
Normal file
14
tsconfig.json
Normal file
14
tsconfig.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"moduleResolution": "node",
|
||||
"jsx": "preserve",
|
||||
"sourceMap": true,
|
||||
"removeComments": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"experimentalDecorators": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
140
tslint.json
Normal file
140
tslint.json
Normal file
@ -0,0 +1,140 @@
|
||||
{
|
||||
"rules": {
|
||||
"align": [
|
||||
true,
|
||||
"parameters",
|
||||
"statements"
|
||||
],
|
||||
"class-name": true,
|
||||
"comment-format": [
|
||||
true,
|
||||
"check-space"
|
||||
],
|
||||
"curly": true,
|
||||
"eofline": true,
|
||||
"forin": true,
|
||||
"indent": [
|
||||
true,
|
||||
"spaces"
|
||||
],
|
||||
"jsdoc-format": false,
|
||||
"label-position": true,
|
||||
"label-undefined": true,
|
||||
"max-line-length": [
|
||||
true,
|
||||
120
|
||||
],
|
||||
"member-ordering": [
|
||||
true,
|
||||
{
|
||||
"order": "statics-first"
|
||||
}
|
||||
],
|
||||
"new-parens": true,
|
||||
"no-any": false,
|
||||
"no-arg": true,
|
||||
"no-bitwise": true,
|
||||
"no-conditional-assignment": true,
|
||||
"no-consecutive-blank-lines": true,
|
||||
"no-console": [
|
||||
true,
|
||||
"debug",
|
||||
"time",
|
||||
"timeEnd",
|
||||
"trace"
|
||||
],
|
||||
"no-construct": true,
|
||||
"no-constructor-vars": false,
|
||||
"no-debugger": true,
|
||||
"no-duplicate-key": true,
|
||||
"no-duplicate-variable": true,
|
||||
"no-empty": false,
|
||||
"no-eval": true,
|
||||
"no-internal-module": true,
|
||||
"no-namespace": true,
|
||||
"no-reference": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-string-literal": false,
|
||||
"no-switch-case-fall-through": false,
|
||||
"no-trailing-whitespace": true,
|
||||
"no-unreachable": true,
|
||||
"no-unused-expression": true,
|
||||
"no-unused-new": true,
|
||||
"no-unused-variable": [
|
||||
true,
|
||||
"react"
|
||||
],
|
||||
"no-use-before-declare": false,
|
||||
"no-var-keyword": true,
|
||||
"no-var-requires": false,
|
||||
"object-literal-sort-keys": false,
|
||||
"one-line": [
|
||||
true,
|
||||
"check-catch",
|
||||
"check-else",
|
||||
"check-finally",
|
||||
"check-open-brace",
|
||||
"check-whitespace"
|
||||
],
|
||||
"one-variable-per-declaration": [
|
||||
true,
|
||||
"ignore-for-loop"
|
||||
],
|
||||
"quotemark": [
|
||||
true,
|
||||
"single",
|
||||
"jsx-double"
|
||||
],
|
||||
"radix": true,
|
||||
"semicolon": [
|
||||
true,
|
||||
"always"
|
||||
],
|
||||
"switch-default": true,
|
||||
"trailing-comma": [
|
||||
true,
|
||||
{
|
||||
"singleline": "never",
|
||||
"multiline": "always"
|
||||
}
|
||||
],
|
||||
"triple-equals": [
|
||||
true,
|
||||
"allow-null-check"
|
||||
],
|
||||
"typedef": false,
|
||||
"typedef-whitespace": [
|
||||
true,
|
||||
{
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
},
|
||||
{
|
||||
"call-signature": "onespace",
|
||||
"index-signature": "onespace",
|
||||
"parameter": "onespace",
|
||||
"property-declaration": "onespace",
|
||||
"variable-declaration": "onespace"
|
||||
}
|
||||
],
|
||||
"use-isnan": true,
|
||||
"variable-name": [
|
||||
true,
|
||||
"ban-keywords",
|
||||
"check-format",
|
||||
"allow-pascal-case"
|
||||
],
|
||||
"whitespace": [
|
||||
true,
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-separator",
|
||||
"check-type",
|
||||
"check-typecast"
|
||||
]
|
||||
}
|
||||
}
|
||||
37
webpack.config.js
Normal file
37
webpack.config.js
Normal file
@ -0,0 +1,37 @@
|
||||
const webpack = require('atool-build/lib/webpack');
|
||||
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
|
||||
var conf = {
|
||||
filename: 'index.html',
|
||||
template: './src/entry/index.html',
|
||||
inject: true,
|
||||
minify: {
|
||||
removeComments: true,
|
||||
collapseWhitespace: false
|
||||
},
|
||||
hash: true,
|
||||
}
|
||||
|
||||
module.exports = function(webpackConfig) {
|
||||
webpackConfig.output.publicPath = '/';
|
||||
|
||||
webpackConfig.module.loaders.forEach(function(loader, index) {
|
||||
if(loader.test.toString().indexOf('html') > 0) {
|
||||
loader.loader = 'html';
|
||||
}
|
||||
});
|
||||
|
||||
webpackConfig.plugins.push(
|
||||
new HtmlWebpackPlugin(conf)
|
||||
);
|
||||
|
||||
webpackConfig.plugins.some(function(plugin, i){
|
||||
if(plugin instanceof webpack.optimize.CommonsChunkPlugin) {
|
||||
webpackConfig.plugins.splice(i, 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
return webpackConfig;
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user