-
Notifications
You must be signed in to change notification settings - Fork 0
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
48 changed files
with
11,834 additions
and
3 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,36 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"modules": false, | ||
"targets": { | ||
"chrome": "58", | ||
"ie": "9" | ||
} | ||
} | ||
] | ||
], | ||
"plugins": [ | ||
[ | ||
"@babel/plugin-transform-runtime", | ||
{ | ||
"helpers": false | ||
} | ||
], | ||
"@babel/plugin-transform-modules-commonjs", | ||
"@babel/plugin-proposal-class-properties", | ||
"@babel/plugin-syntax-dynamic-import", | ||
[ | ||
"@babel/plugin-proposal-decorators", | ||
{ | ||
"legacy": true | ||
} | ||
] | ||
], | ||
"env": { | ||
"test": { | ||
"sourceMap": true | ||
} | ||
} | ||
} |
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,16 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = false | ||
|
||
[*.html] | ||
indent_size = 2 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = 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,68 @@ | ||
var rules = { | ||
"no-unused-vars": [ | ||
"warn", | ||
{ | ||
"varsIgnorePattern": "^__", | ||
"argsIgnorePattern": "^__" | ||
} | ||
], | ||
"no-console": [ | ||
"off" | ||
], | ||
"prefer-const": [ | ||
"warn" | ||
], | ||
} | ||
|
||
var plugins = [ | ||
"html", | ||
"vue" | ||
] | ||
|
||
module.exports = { | ||
"parser": "babel-eslint", | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"legacyDecorators": true, | ||
"experimentalObjectRestSpread": true | ||
} | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
], | ||
"rules": rules, | ||
"plugins": plugins, | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"browser": true, | ||
}, | ||
"globals": { | ||
"window": false, | ||
"process": false, | ||
"document": false, | ||
"require": false, | ||
"console": false, | ||
"module": false, | ||
"Blob": false, | ||
"HTMLCollection": false, | ||
"Element": false, | ||
"NodeList": false, | ||
"Worker": false, | ||
"history": false, | ||
"Image": false, | ||
"ImageData": false, | ||
"Audio": false, | ||
"URL": false, | ||
"setInterval": false, | ||
"clearInterval": false, | ||
"location": false, | ||
"localStorage": false, | ||
"setTimeout": false, | ||
"__dirname": false, | ||
"Buffer": false, | ||
"__webpack_public_path__": true | ||
} | ||
} |
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,8 @@ | ||
*.jpg filter=lfs diff=lfs merge=lfs -text | ||
*.png filter=lfs diff=lfs merge=lfs -text | ||
*.svg filter=lfs diff=lfs merge=lfs -text | ||
*.mp4 filter=lfs diff=lfs merge=lfs -text | ||
*.eot filter=lfs diff=lfs merge=lfs -text | ||
*.ttf filter=lfs diff=lfs merge=lfs -text | ||
*.woff filter=lfs diff=lfs merge=lfs -text | ||
*.wasm filter=lfs diff=lfs merge=lfs -text |
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,8 @@ | ||
{ | ||
"printWidth": 120, | ||
"tabWidth": 2, | ||
"singleQuote": true, | ||
"semi": false, | ||
"trailingComma": "all", | ||
"noBracketSpacing": 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,101 @@ | ||
import { Store } from 'vuex' | ||
|
||
declare namespace Doc { | ||
type DictOf<T> = { [key: string]: T } | ||
|
||
/** | ||
* vuex store | ||
* * typescript namespace | ||
*/ | ||
namespace Tstore { | ||
/** | ||
* vuex 创建 工具函数 | ||
* * typescript namespace | ||
*/ | ||
namespace TcreateUtils { | ||
type ActionDescriptor = [any, any] | ||
|
||
/** | ||
* 用于声明 Actions Descriptors | ||
*/ | ||
type ActionsOfDescriptors<Context, Descriptor extends DictOf<ActionDescriptor>> = { | ||
[K in keyof Descriptor]: (ctx: Context, payload: Descriptor[K][0]) => Descriptor[K][1] | ||
} | ||
|
||
/** | ||
* 用于声明 Mutations | ||
*/ | ||
type ModuleMutations<State, PayloadTree> = { | ||
[K in keyof PayloadTree]: (state: State, payload: PayloadTree[K]) => any | ||
} | ||
} | ||
|
||
/** | ||
* vuex state | ||
*/ | ||
interface state { | ||
/** | ||
* 是否 使用 移动设备 访问 | ||
* * 来自服务器端 | ||
*/ | ||
isMobile: boolean | ||
|
||
/** | ||
* 初始化 跳转访问 URL | ||
* * 来自服务器端 | ||
*/ | ||
initialReplaceStateUrl: string | ||
} | ||
|
||
/** | ||
* vuex Mutation-Payload-tree | ||
*/ | ||
interface MutationPayloads { | ||
/** | ||
* 全局 | ||
*/ | ||
global: { | ||
SET_IS_MOBILE: boolean | ||
} | ||
|
||
/** | ||
* 编辑器 | ||
*/ | ||
editor: { | ||
SET_HELLO_EDITOR: string | ||
test: undefined | ||
test2?: string | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* vue router | ||
*/ | ||
namespace Trouter { | ||
/** | ||
* 客户端 获取服务端 异步数据 | ||
*/ | ||
interface asyncData { | ||
store: Store<Tstore.state> | ||
} | ||
|
||
/** | ||
* 页面级别 中间件 | ||
* * 根据 server-middlewares path | ||
*/ | ||
namespace asyncData { | ||
/** | ||
* path | ||
* * / | ||
*/ | ||
interface index extends asyncData { | ||
serverStore: { | ||
hello: string | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
export = Doc |
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,11 @@ | ||
import Vue, { VNode } from 'vue' | ||
|
||
declare global { | ||
namespace JSX { | ||
// tslint:disable no-empty-interface | ||
interface ElementClass extends Vue {} | ||
interface IntrinsicElements { | ||
[elem: string]: any | ||
} | ||
} | ||
} |
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,4 @@ | ||
declare module '*.vue' { | ||
import Vue from 'vue' | ||
export default Vue | ||
} |
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 @@ | ||
# @bestminr/build-doc |
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,5 @@ | ||
{ | ||
"entry": "./build.config.ts", | ||
"injectContext": "./inject-context.json", | ||
"output": "./dist/build" | ||
} |
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,49 @@ | ||
import { ConfigOptions } from '@bestminr/build' | ||
|
||
import { getConfig } from './config' | ||
import getBase from './build/webpack.base.conf.babel' | ||
import getDll from './build/webpack.dll.conf.babel' | ||
import getClient from './build/webpack.client.conf.babel' | ||
import getServer from './build/webpack.server.conf.babel' | ||
import path from 'path' | ||
|
||
export default function(inject: ConfigOptions.getOptionsInject): ConfigOptions.options { | ||
const config = getConfig(inject) | ||
|
||
const base: any = getBase(config, inject) | ||
const dll: any = getDll(config, inject) | ||
const client: any = getClient(config, inject) | ||
const server: any = getServer(config, inject) | ||
|
||
return { | ||
env: ['SERVER_ENV', 'ENV', 'NODE_ENV'], | ||
babelrc: { | ||
presets: [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
modules: false, | ||
targets: { | ||
browsers: ['IE >= 11', 'last 2 versions'], | ||
}, | ||
}, | ||
], | ||
], | ||
}, | ||
render: config.render, | ||
statics: config.statics, | ||
proxyTable: config.proxyTable, | ||
extensions: { | ||
entry: { | ||
extensions: inject.resolve('./server/index.js'), | ||
}, | ||
path: path.resolve(base.output.path), | ||
}, | ||
webpack: { | ||
dll, | ||
base, | ||
client, | ||
server, | ||
}, | ||
} | ||
} |
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,32 @@ | ||
import path from 'path' | ||
import config from '../config' | ||
import HappyPack from 'happypack' | ||
import webpack from 'webpack' | ||
|
||
export function assetsPath(_path) { | ||
return path.posix.join(config.assetsSubDirectory, _path) | ||
} | ||
|
||
export function makeHappyPack(id, loaders) { | ||
return new HappyPack({ | ||
id: id, | ||
threads: 4, | ||
loaders: loaders | ||
}) | ||
} | ||
|
||
export const resolve = (p) => path.resolve(__dirname, '..', p) | ||
|
||
export function makeDllPlugins(nameArr) { | ||
const plugins = [] | ||
nameArr.forEach((name) => { | ||
plugins.push( | ||
new webpack.DllReferencePlugin({ | ||
// context: resolve('.'), | ||
// manifest: config.isProd ? require(`../dist/build/dll/${name}.manifest.json`) : require(`../dist/dll/${name}.manifest.json`) | ||
manifest: require(resolve(`${config.assetRoot}/dll/${name}.manifest.json`)), | ||
}) | ||
) | ||
}) | ||
return plugins | ||
} |
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,24 @@ | ||
export default function(config, { resolve }) { | ||
return { | ||
output: { | ||
path: config.assetRoot, | ||
publicPath: config.outputPath, | ||
}, | ||
resolve: { | ||
alias: { | ||
public: resolve('public'), | ||
src: resolve('src'), | ||
store$: resolve('src/store/index.ts') | ||
}, | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /worker\.js$/, | ||
loader: 'worker-loader', | ||
options: { inline: true }, | ||
}, | ||
], | ||
}, | ||
} | ||
} |
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,10 @@ | ||
export default function(config, { resolve }) { | ||
return { | ||
entry: { | ||
app: ['./src/entry-client.ts'], | ||
}, | ||
output: { | ||
globalObject: 'this', | ||
} | ||
} | ||
} |
Oops, something went wrong.