Project is created.
This commit is contained in:
commit
7ef564a6c1
46
config/webpack/webpack.config.base.js
Normal file
46
config/webpack/webpack.config.base.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
const Path = require('path');
|
||||
const TsConfigPathsPlugin = require('awesome-typescript-loader').TsConfigPathsPlugin;
|
||||
const packages = require('../../package.json');
|
||||
|
||||
module.exports = {
|
||||
target: 'web',
|
||||
entry: {
|
||||
app: [
|
||||
Path.resolve(__dirname, '../../src/ts/index.tsx')
|
||||
],
|
||||
vendor: Object.keys(packages.dependencies)
|
||||
},
|
||||
|
||||
output: {
|
||||
path: Path.resolve(__dirname, '../../dist'),
|
||||
filename: '[name].js',
|
||||
publicPath: '/'
|
||||
},
|
||||
|
||||
devtool: '',
|
||||
|
||||
resolve: {
|
||||
extensions: ['.ts', '.tsx', '.js', '.json'],
|
||||
plugins: [
|
||||
new TsConfigPathsPlugin({
|
||||
tsconfig: "tsconfig.json",
|
||||
compiler: "typescript"
|
||||
})
|
||||
]
|
||||
},
|
||||
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
enforce: 'pre',
|
||||
exclude: [
|
||||
Path.resolve(__dirname, '../../node_modules/')
|
||||
],
|
||||
loader: 'tslint-loader',
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
]
|
||||
};
|
72
config/webpack/webpack.config.dev.js
Normal file
72
config/webpack/webpack.config.dev.js
Normal file
|
@ -0,0 +1,72 @@
|
|||
const Path = require('path');
|
||||
const Webpack = require('webpack');
|
||||
const WebpackMerge = require('webpack-merge');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const configBase = require('./webpack.config.base.js');
|
||||
|
||||
module.exports = WebpackMerge(configBase, {
|
||||
entry: {
|
||||
app: [
|
||||
]
|
||||
},
|
||||
|
||||
devtool: 'inline-source-map',
|
||||
|
||||
devServer: {
|
||||
hot: true,
|
||||
inline: true,
|
||||
historyApiFallback: true,
|
||||
publicPath: '/', // match the output `publicPath`
|
||||
host: '127.0.0.1',
|
||||
port: 9091,
|
||||
stats: {
|
||||
colors: true
|
||||
},
|
||||
},
|
||||
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
enforce: 'pre',
|
||||
test: /\.js$/,
|
||||
loader: 'source-map-loader',
|
||||
exclude: [
|
||||
Path.resolve(__dirname, '../../node_modules/')
|
||||
]
|
||||
},
|
||||
{
|
||||
enforce: 'pre',
|
||||
test: /\.tsx?$/,
|
||||
use: "source-map-loader",
|
||||
exclude: [
|
||||
Path.resolve(__dirname, '../../node_modules/')
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
loaders: [
|
||||
'awesome-typescript-loader'
|
||||
],
|
||||
exclude: [
|
||||
Path.resolve(__dirname, '../../node_modules/')
|
||||
],
|
||||
include: [
|
||||
Path.resolve(__dirname, '../../src/')
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new Webpack.HotModuleReplacementPlugin(),
|
||||
new Webpack.NamedModulesPlugin(),
|
||||
new Webpack.NoEmitOnErrorsPlugin(),
|
||||
new HtmlWebpackPlugin({
|
||||
template: Path.resolve(__dirname, '../../public/index.html')
|
||||
}),
|
||||
new Webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'vendor',
|
||||
minChunks: Infinity,
|
||||
filename: 'vendor.js'
|
||||
}),
|
||||
]
|
||||
});
|
71
config/webpack/webpack.config.prod.js
Normal file
71
config/webpack/webpack.config.prod.js
Normal file
|
@ -0,0 +1,71 @@
|
|||
const Path = require('path');
|
||||
const Webpack = require('webpack');
|
||||
const WebpackMerge = require('webpack-merge');
|
||||
const configBase = require('./webpack.config.base.js');
|
||||
|
||||
|
||||
module.exports = WebpackMerge(configBase, {
|
||||
devtool: 'source-map',
|
||||
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
enforce: 'pre',
|
||||
test: /\.js$/,
|
||||
loader: 'source-map-loader',
|
||||
exclude: [
|
||||
Path.resolve(__dirname, '../../node_modules/')
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
loader: 'awesome-typescript-loader',
|
||||
exclude: [
|
||||
Path.resolve(__dirname, '../../node_modules/')
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new Webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
'NODE_ENV': JSON.stringify('production')
|
||||
},
|
||||
'DEBUG': false,
|
||||
'__DEVTOOLS__': false
|
||||
}),
|
||||
// Plugings for optimizing size and performance.
|
||||
// Here you have all the available by now:
|
||||
// Webpack 1. https://github.com/webpack/webpack/blob/v1.13.3/lib/optimize
|
||||
// Webpack 2. https://github.com/webpack/webpack/tree/master/lib/optimize
|
||||
new Webpack.optimize.UglifyJsPlugin({
|
||||
compress: {
|
||||
warnings: false,
|
||||
screw_ie8: true,
|
||||
conditionals: true,
|
||||
unused: true,
|
||||
comparisons: true,
|
||||
sequences: true,
|
||||
dead_code: true,
|
||||
evaluate: true,
|
||||
if_return: true,
|
||||
join_vars: true,
|
||||
drop_console: true,
|
||||
drop_debugger: true,
|
||||
global_defs: {
|
||||
__REACT_HOT_LOADER__: undefined // eslint-disable-line no-undefined
|
||||
}
|
||||
},
|
||||
minimize: true,
|
||||
debug: false,
|
||||
sourceMap: true,
|
||||
output: {
|
||||
comments: false
|
||||
},
|
||||
|
||||
}),
|
||||
// Included by default in webpack 2
|
||||
// new webpack.optimize.OccurrenceOrderPlugin(),
|
||||
new Webpack.optimize.AggressiveMergingPlugin()
|
||||
]
|
||||
});
|
32
config/webpack/webpack.config.stats.js
Normal file
32
config/webpack/webpack.config.stats.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// WebPack 2 STATS Config
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// REMEMBER UPLOAD YOUR stats.json to http://webpack.github.io/analyse/
|
||||
// IMPORTANT. If you use console.log in this file, the stats.json will not work...
|
||||
// TODO. Include fileDateTime in stats.json as well.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const Visualizer = require('webpack-visualizer-plugin');
|
||||
const WebpackMerge = require('webpack-merge');
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// File name for Visualizer
|
||||
////////////////////////////////////////////////
|
||||
const currentDateTime = new Date();
|
||||
const currentDate = currentDateTime.toLocaleDateString('en-GB').replace(/\//g, "-");
|
||||
const currentTime = currentDateTime.toLocaleTimeString('en-GB', { hour12: false }).replace(/:/g, "-");
|
||||
const fileDateTime = currentDate + "-" + currentTime;
|
||||
const statisticsFileName = './stats/statistics-' + fileDateTime + '.html';
|
||||
const configBase = require('./webpack.config.prod.js');
|
||||
|
||||
|
||||
module.exports = WebpackMerge(configBase, {
|
||||
plugins: [
|
||||
new Visualizer({
|
||||
filename: statisticsFileName
|
||||
})
|
||||
]
|
||||
});
|
91
package.json
Normal file
91
package.json
Normal file
|
@ -0,0 +1,91 @@
|
|||
{
|
||||
"name": "hello",
|
||||
"version": "1.0.0",
|
||||
"description": "Node Hello Project",
|
||||
"main": "index.js",
|
||||
"repository": "https://git.loafle.net/prototype/hello.git",
|
||||
"author": "LOAFLE (rnd@loafle.com)",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"clean": "./node_modules/.bin/rimraf ./dist",
|
||||
"prepublish": "yarn run build",
|
||||
"postpublish": "./node_modules/.bin/greenkeeper-postpublish",
|
||||
"start": "set NODE_ENV=development && ./node_modules/.bin/webpack-dev-server --open --progress --config ./config/webpack/webpack.config.dev.js",
|
||||
"test": "yarn run jest",
|
||||
"test:watch": "yarn run jest -- --watch",
|
||||
"jest": "PWD=$(pwd) NODE_ENV=test ./node_modules/.bin/jest -w 1 --coverage",
|
||||
"prebuild": "./node_modules/.bin/check-dependencies && yarn run clean",
|
||||
"build": "set NODE_ENV=production && ./node_modules/.bin/webpack --progress -profile --colors --config ./config/webpack/webpack.config.prod.js",
|
||||
"lint": "./node_modules/.bin/tslint -c tslint.json 'src/ts/**/*.{ts,tsx}' && ./node_modules/.bin/sass-lint 'src/**/*.scss'",
|
||||
"stats": "set NODE_ENV=production && webpack --progress --config ./config/webpack/webpack.config.stats.js --profile --json > ./config/webpack/stats/stats.json"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^19.2.4",
|
||||
"@types/material-ui": "^0.17.11",
|
||||
"@types/prop-types": "^15.5.1",
|
||||
"@types/react": "^15.0.24",
|
||||
"@types/react-addons-test-utils": "^0.14.18",
|
||||
"@types/react-dom": "^15.5.0",
|
||||
"@types/react-redux": "4.4.40",
|
||||
"@types/react-router": "^4.0.9",
|
||||
"@types/react-router-dom": "^4.0.4",
|
||||
"@types/react-tap-event-plugin": "^0.0.30",
|
||||
"@types/redux": "^3.6.0",
|
||||
"awesome-typescript-loader": "^3.1.3",
|
||||
"check-dependencies": "^1.0.1",
|
||||
"copy-webpack-plugin": "^4.0.1",
|
||||
"css-loader": "^0.28.2",
|
||||
"extract-text-webpack-plugin": "^2.1.0",
|
||||
"file-loader": "^0.11.1",
|
||||
"greenkeeper-postpublish": "^1.0.1",
|
||||
"html-webpack-plugin": "^2.28.0",
|
||||
"image-webpack-loader": "^3.3.1",
|
||||
"jest": "^20.0.4",
|
||||
"node-sass": "^4.5.3",
|
||||
"postcss-import": "^10.0.0",
|
||||
"postcss-loader": "^2.0.5",
|
||||
"raw-loader": "^0.5.1",
|
||||
"react-addons-test-utils": "^15.5.1",
|
||||
"rimraf": "^2.6.1",
|
||||
"sass-lint": "^1.10.2",
|
||||
"sass-loader": "^6.0.5",
|
||||
"source-map-loader": "^0.2.1",
|
||||
"style-loader": "^0.18.1",
|
||||
"tslint": "^5.4.3",
|
||||
"tslint-loader": "^3.5.3",
|
||||
"tslint-react": "^3.0.0",
|
||||
"typescript": "^2.3.3",
|
||||
"webpack": "^2.6.0",
|
||||
"webpack-dev-server": "^2.4.5",
|
||||
"webpack-merge": "^4.1.0",
|
||||
"webpack-visualizer-plugin": "^0.1.11"
|
||||
},
|
||||
"dependencies": {
|
||||
"immutable": "^3.8.1",
|
||||
"material-ui": "^0.18.3",
|
||||
"prop-types":"^15.5.10",
|
||||
"react": "^15.5.4",
|
||||
"react-dom": "15.5.4",
|
||||
"react-immutable-proptypes": "^2.1.0",
|
||||
"react-redux": "^5.0.5",
|
||||
"react-router": "^4.1.1",
|
||||
"react-router-dom": "^4.1.1",
|
||||
"react-tap-event-plugin": "^2.0.1",
|
||||
"redux": "^3.6.0",
|
||||
"redux-actions": "^2.0.3",
|
||||
"redux-saga": "^0.15.3",
|
||||
"reselect": "^3.0.1"
|
||||
},
|
||||
|
||||
"jest": {
|
||||
"moduleFileExtensions": [
|
||||
"ts",
|
||||
"tsx",
|
||||
"js"
|
||||
],
|
||||
"transform": {
|
||||
"\\.(ts|tsx)$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
|
||||
},
|
||||
"testRegex": "\\./src/ts/(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$"
|
||||
}
|
||||
}
|
10
public/index.html
Normal file
10
public/index.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Hello React!</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="react-placeholder"></div>
|
||||
</body>
|
||||
</html>
|
7
src/ts/index.tsx
Normal file
7
src/ts/index.tsx
Normal file
|
@ -0,0 +1,7 @@
|
|||
class Starter {
|
||||
public static main(): void {
|
||||
console.log('Hello world.');
|
||||
}
|
||||
}
|
||||
|
||||
Starter.main();
|
12
src/ts/member/api/model/Member.ts
Normal file
12
src/ts/member/api/model/Member.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import {MemberStatus} from './MemberStatus';
|
||||
|
||||
|
||||
export interface Member {
|
||||
id: number;
|
||||
email: string;
|
||||
name: string;
|
||||
phone: string;
|
||||
companyName: string;
|
||||
createDate: Date;
|
||||
status: MemberStatus;
|
||||
}
|
6
src/ts/member/api/model/MemberStatus.ts
Normal file
6
src/ts/member/api/model/MemberStatus.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
export enum MemberStatus {
|
||||
NOAUTH = 1,
|
||||
NORMAL = 2,
|
||||
DORMANCY = 3,
|
||||
WITHDRAWAL = 4
|
||||
}
|
25
src/ts/member/redux/actions.ts
Normal file
25
src/ts/member/redux/actions.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { Member } from 'member/api/model/Member';
|
||||
|
||||
export type REGIST = '@overflow/member/regist/REGIST';
|
||||
export const REGIST: REGIST = '@overflow/member/regist/REGIST';
|
||||
|
||||
export type RegistAction = {
|
||||
type: REGIST,
|
||||
by: Member
|
||||
};
|
||||
|
||||
function counterReducer(state = INITIAL_STATE, action:CounterAction = OtherAction) {
|
||||
switch (action.type) {
|
||||
case INCREMENT_COUNTER:
|
||||
return state.update({value: state.value + action.by});
|
||||
|
||||
case DECREMENT_COUNTER:
|
||||
return state.update({value: state.value - action.by});
|
||||
|
||||
case LOGOUT_USER:
|
||||
return INITIAL_STATE;
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
35
tsconfig.json
Normal file
35
tsconfig.json
Normal file
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"baseUrl": "src/ts",
|
||||
"declaration": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"jsx": "react",
|
||||
"lib": [
|
||||
"dom",
|
||||
"es5",
|
||||
"es6"
|
||||
],
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"newLine": "LF",
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": false,
|
||||
"outDir": "dist/ts/",
|
||||
"preserveConstEnums": true,
|
||||
"pretty": true,
|
||||
"removeComments": true,
|
||||
"sourceMap": true,
|
||||
"target": "es5"
|
||||
},
|
||||
"include": [
|
||||
"src/ts/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"build",
|
||||
"config",
|
||||
"node_modules",
|
||||
"public"
|
||||
]
|
||||
}
|
98
tslint.json
Normal file
98
tslint.json
Normal file
|
@ -0,0 +1,98 @@
|
|||
{
|
||||
"rules": {
|
||||
"align": [true,
|
||||
"parameters",
|
||||
"arguments",
|
||||
"statements"],
|
||||
"ban": false,
|
||||
"class-name": true,
|
||||
"comment-format": [true,
|
||||
"check-space"
|
||||
],
|
||||
"curly": true,
|
||||
"eofline": true,
|
||||
"forin": true,
|
||||
"indent": [true, 2, "spaces"],
|
||||
"interface-name": [true],
|
||||
"jsdoc-format": true,
|
||||
"label-position": true,
|
||||
"max-line-length": [true, 140],
|
||||
"member-access": true,
|
||||
"member-ordering": [
|
||||
true,
|
||||
{
|
||||
"order": [
|
||||
"static-field",
|
||||
"instance-field",
|
||||
"constructor",
|
||||
"public-instance-method",
|
||||
"protected-instance-method",
|
||||
"private-instance-method"
|
||||
]
|
||||
}
|
||||
],
|
||||
"no-any": false,
|
||||
"no-arg": true,
|
||||
"no-bitwise": true,
|
||||
"no-conditional-assignment": true,
|
||||
"no-console": [true,
|
||||
"debug",
|
||||
"info",
|
||||
"time",
|
||||
"timeEnd",
|
||||
"trace"
|
||||
],
|
||||
"no-construct": true,
|
||||
"no-debugger": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-duplicate-variable": true,
|
||||
"no-empty": true,
|
||||
"no-eval": true,
|
||||
"no-inferrable-types": [false],
|
||||
"no-internal-module": true,
|
||||
"no-require-imports": false,
|
||||
"no-string-literal": true,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-trailing-whitespace": true,
|
||||
"no-unused-expression": true,
|
||||
"no-unused-variable": true,
|
||||
"no-use-before-declare": true,
|
||||
"no-var-keyword": true,
|
||||
"no-var-requires": true,
|
||||
"object-literal-sort-keys": false,
|
||||
"one-line": [true,
|
||||
"check-open-brace",
|
||||
"check-catch",
|
||||
"check-else",
|
||||
"check-whitespace"
|
||||
],
|
||||
"quotemark": [true, "single", "avoid-escape"],
|
||||
"radix": true,
|
||||
"semicolon": [true, "always"],
|
||||
"switch-default": true,
|
||||
"trailing-comma": [true, {
|
||||
"multiline": "always",
|
||||
"singleline": "never"
|
||||
}],
|
||||
"triple-equals": [true, "allow-null-check"],
|
||||
"typedef": [true,
|
||||
"call-signature",
|
||||
"parameter",
|
||||
"property-declaration",
|
||||
"member-variable-declaration"
|
||||
],
|
||||
"typedef-whitespace": [true, {
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
}],
|
||||
"variable-name": false,
|
||||
"whitespace": [true,
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-separator"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user