Skip to content

Commit

Permalink
Upgrade project
Browse files Browse the repository at this point in the history
  • Loading branch information
Aqours committed Nov 15, 2018
1 parent b07cba9 commit 5fc93c4
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 62 deletions.
16 changes: 13 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
# top-most EditorConfig file
root = true

# Option for setting a maximum length for each line
# Supported By A Limited Number of Editors
# https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#supported-by-a-limited-number-of-editors
[*]
max_line_length = 120

# Unix-style newlines with a newline ending every file
# Use git.core.crlf instead
# [*]
# end_of_line = lf
[*]
end_of_line = lf

# Matches multiple files with brace expansion notation
# Set default charset
Expand All @@ -22,3 +27,8 @@ indent_size = 4
[*.{json,yml}]
indent_style = space
indent_size = 2

# Configration files
[.*]
indent_style = space
indent_size = 2
7 changes: 6 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
dist/**/*
demo/**/*
dist/**/*
coverage/**/*
node_modules/**/*

# ignore root configration files
*.json
*.yml
7 changes: 7 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Use `.editorconfig` instead.
# tabWidth: 4
# printWidth: 120

# Explicit specifiy `singleQuote` value
singleQuote: false
trailingComma: all
28 changes: 13 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
"browser": "dist/release/fullscreen.js",
"types": "src/index.ts",
"scripts": {
"build": "npm run tslint && webpack --mode=production --devtool=source-map",
"build": "webpack --mode=production --devtool=source-map",
"start": "webpack -w --mode=development --devtool=cheap-module-eval-source-map",
"tslint": "tslint -p ./ \"./**/*.ts\" \"./**/*.tsx\"",
"pretty": "prettier --write \"./{docs,src,test,types}/**/*.{js,jsx,ts,tsx,css,less,json,md}\"",
"version": "npm run build && git add -A dist"
},
"repository": {
Expand All @@ -34,23 +33,22 @@
"pre-push": "npm run tslint"
}
},
"prettier": {
"printWidth": 120
},
"devDependencies": {
"@types/node": "10.9.4",
"event-hooks-webpack-plugin": "2.1.0",
"event-hooks-webpack-plugin": "2.1.1",
"git-rev-sync": "1.12.0",
"husky": "1.0.0-rc.13",
"prettier": "1.14.2",
"pretty-quick": "1.6.0",
"husky": "1.1.4",
"prettier": "1.15.2",
"pretty-quick": "1.8.0",
"rimraf": "2.6.2",
"ts-loader": "5.0.0",
"ts-loader": "5.3.0",
"tslint": "5.11.0",
"typescript": "3.0.3",
"uglifyjs-webpack-plugin": "1.3.0",
"webpack": "4.16.3",
"webpack-bundle-analyzer": "2.13.1",
"webpack-cli": "3.1.0"
"tslint-config-prettier": "1.16.0",
"tslint-plugin-prettier": "2.0.1",
"typescript": "3.1.6",
"uglifyjs-webpack-plugin": "2.0.1",
"webpack": "4.25.1",
"webpack-bundle-analyzer": "3.0.3",
"webpack-cli": "3.1.2"
}
}
19 changes: 16 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,21 @@
"outDir": "./dist/out-tsc",
"moduleResolution": "node",
"target": "es5",
"typeRoots": ["node_modules/@types"],
"lib": ["dom", "scripthost", "esnext"]
"typeRoots": [
"node_modules/@types"
],
"lib": [
"dom",
"scripthost",
"esnext"
]
},
"exclude": ["node_modules"]
"include": [
"src/**/*.ts",
"test/**/*.ts",
"types/**/*.ts"
],
"exclude": [
"node_modules"
]
}
86 changes: 71 additions & 15 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,57 @@
{
"linterOptions": {
"exclude": ["node_modules/**", "demo/**"]
"exclude": [
"node_modules/**",
"coverage/**",
"demo/**",
"dist/**"
]
},
"extends": [
"tslint-config-prettier"
],
"rulesDirectory": [
"tslint-plugin-prettier"
],
"rules": {
"member-ordering": [
"prettier": {
"severity": "warning"
},
"member-ordering": {
"options": [
{
"order": [
"static-field",
"instance-field",
"constructor",
"static-method",
"instance-method"
]
}
],
"severity": "warning"
},
"no-inferrable-types": [
true,
{
"order": ["static-field", "instance-field", "constructor", "static-method", "instance-method"]
}
"ignore-params",
"ignore-properties"
],
"no-inferrable-types": [true, "ignore-params", "ignore-properties"],
"no-internal-module": true,
"no-namespace": [true, "allow-declarations"],
"no-namespace": [
true,
"allow-declarations"
],
"no-non-null-assertion": true,
"typedef": true,
"unified-signatures": true,
"ban-comma-operator": true,
"label-position": true,
"no-arg": true,
"no-console": {
"severity": "warning"
},
"no-construct": true,
"no-debugger": true,
"no-duplicate-super": true,
"no-duplicate-switch-case": true,
"no-eval": true,
Expand All @@ -30,26 +63,49 @@
"no-this-assignment": [
true,
{
"allowed-names": ["^that$"],
"allowed-names": [
"^that$"
],
"allow-destructuring": true
}
],
"no-unsafe-finally": true,
"no-var-keyword": true,
"radix": true,
"triple-equals": [true, "allow-null-check"],
"triple-equals": [
true,
"allow-null-check"
],
"use-isnan": true,
"deprecation": true,
"max-file-line-count": [true, 2000],
"no-duplicate-imports": true,
"deprecation": {
"severity": "warning"
},
"max-file-line-count": {
"options": [
2400
],
"severity": "warning"
},
"no-duplicate-imports": {
"severity": "warning"
},
"no-require-imports": true,
"callable-types": true,
"class-name": true,
"interface-over-type-literal": true,
"new-parens": true,
"no-boolean-literal-compare": true,
"no-consecutive-blank-lines": [true, 2],
"number-literal-format": true,
"variable-name": [true, "check-format"]
"no-consecutive-blank-lines": [
true,
2
],
"number-literal-format": {
"severity": "warning"
},
"variable-name": [
true,
"ban-keywords",
"check-format"
]
}
}
48 changes: 23 additions & 25 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = function(env = {}, argv = {}) {
return {
mode: env.mode,
entry: {
fullscreen: "./src/index.ts"
fullscreen: "./src/index.ts",
},
devtool: env.devtool,
module: {
Expand All @@ -47,44 +47,42 @@ module.exports = function(env = {}, argv = {}) {
loader: "ts-loader",
options: {
compilerOptions: {
module: "esnext"
}
}
}
}
]
module: "esnext",
},
},
},
},
],
},
output: {
path: env.outputPath,
filename: "[name].js",
libraryTarget: "umd"
libraryTarget: "umd",
},
resolve: {
extensions: [".tsx", ".ts", ".jsx", ".js"]
extensions: [".tsx", ".ts", ".jsx", ".js"],
},
plugins: [
new webpack.ProgressPlugin((percentage, message) => {
console.log(`${(percentage * 100).toFixed()}% ${message}`);
}),
new webpack.ProgressPlugin(),
new webpack.DefinePlugin({
__X_METADATA__: JSON.stringify({
name: manifest.name,
version: manifest.version,
envMode: env.mode,
gitHash: git.short(),
lastCompiled: env.lastCompiled
})
lastCompiled: env.lastCompiled,
}),
}),
new EventHooksPlugin({
environment: function() {
rimraf.sync(webpackPath);
rimraf.sync(releasePath);
}
},
}),
new BundleAnalyzerPlugin({
analyzerMode: env.mode === "production" ? "static" : "disabled",
openAnalyzer: false
})
openAnalyzer: false,
}),
],
optimization: {
minimizer: [
Expand All @@ -94,22 +92,22 @@ module.exports = function(env = {}, argv = {}) {
uglifyOptions: {
compress: {
drop_console: false,
drop_debugger: true
drop_debugger: true,
},
output: {
/**
* @desc escape Unicode characters in strings and regexps
* (affects directives with non-ascii characters becoming invalid)
*/
ascii_only: false
}
}
})
]
ascii_only: false,
},
},
}),
],
},
node: false,
performance: {
hints: false
}
hints: false,
},
};
};

0 comments on commit 5fc93c4

Please sign in to comment.