From f684093e943bb1f868a96a4769c6d8f40dee1438 Mon Sep 17 00:00:00 2001 From: Labhansh Agrawal Date: Sun, 29 Dec 2019 20:11:00 +0530 Subject: [PATCH] split package.json to separate config files --- .eslintrc.json | 98 ++++++++++++++++++ .huskyrc.json | 6 ++ ava.config.js | 7 ++ babel.config.json | 45 ++++++++ electron-builder.json | 73 +++++++++++++ package.json | 235 ------------------------------------------ 6 files changed, 229 insertions(+), 235 deletions(-) create mode 100644 .eslintrc.json create mode 100644 .huskyrc.json create mode 100644 ava.config.js create mode 100644 babel.config.json create mode 100644 electron-builder.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 00000000..3872c5e8 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,98 @@ +{ + "plugins": [ + "react", + "prettier", + "@typescript-eslint" + ], + "extends": [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:prettier/recommended" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 8, + "sourceType": "module", + "ecmaFeatures": { + "jsx": true, + "impliedStrict": true, + "experimentalObjectRestSpread": true + }, + "allowImportExportEverywhere": true + }, + "env": { + "es6": true, + "browser": true, + "node": true + }, + "settings": { + "react": { + "version": "detect" + } + }, + "rules": { + "func-names": [ + "error", + "as-needed" + ], + "no-shadow": "error", + "no-extra-semi": 0, + "react/prop-types": 0, + "react/react-in-jsx-scope": 0, + "react/no-unescaped-entities": 0, + "react/jsx-no-target-blank": 0, + "react/no-string-refs": 0, + "prettier/prettier": [ + "error", + { + "printWidth": 120, + "tabWidth": 2, + "singleQuote": true, + "trailingComma": "none", + "bracketSpacing": false, + "semi": true, + "useTabs": false, + "jsxBracketSameLine": false + } + ] + }, + "overrides": [ + { + "files": [ + "app/config/config-default.js", + ".hyper.js" + ], + "rules": { + "prettier/prettier": [ + "error", + { + "printWidth": 120, + "tabWidth": 2, + "singleQuote": true, + "trailingComma": "es5", + "bracketSpacing": false, + "semi": true, + "useTabs": false, + "parser": "babel", + "jsxBracketSameLine": false + } + ] + } + }, + { + "files": [ + "**.ts", + "**.tsx" + ], + "extends": [ + "plugin:@typescript-eslint/recommended", + "prettier/@typescript-eslint" + ], + "rules": { + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-non-null-assertion": "off" + } + } + ] +} diff --git a/.huskyrc.json b/.huskyrc.json new file mode 100644 index 00000000..96a97ffa --- /dev/null +++ b/.huskyrc.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json.schemastore.org/huskyrc", + "hooks": { + "pre-push": "yarn test" + } +} diff --git a/ava.config.js b/ava.config.js new file mode 100644 index 00000000..09617d79 --- /dev/null +++ b/ava.config.js @@ -0,0 +1,7 @@ +export default { + files: ['test/unit/*'], + helpers: ['**/testUtils/**/*'], + compileEnhancements: false, + extensions: ['ts'], + require: ['ts-node/register/transpile-only'] +}; diff --git a/babel.config.json b/babel.config.json new file mode 100644 index 00000000..d5e10743 --- /dev/null +++ b/babel.config.json @@ -0,0 +1,45 @@ +{ + "presets": [ + "@babel/react", + "@babel/typescript" + ], + "plugins": [ + [ + "styled-jsx/babel", + { + "vendorPrefixes": false + } + ], + "@babel/plugin-proposal-numeric-separator", + "@babel/proposal-class-properties", + "@babel/proposal-object-rest-spread", + "@babel/plugin-proposal-optional-chaining" + ], + "env": { + "production": { + "plugins": [ + "minify-constant-folding", + "minify-dead-code-elimination", + "minify-flip-comparisons", + "minify-guarded-expressions", + "minify-infinity", + [ + "minify-mangle-names", + { + "keepClassName": true, + "keepFnName": true + } + ], + "minify-replace", + "minify-simplify", + "minify-type-constructors", + "transform-member-expression-literals", + "transform-merge-sibling-variables", + "transform-minify-booleans", + "transform-property-literals", + "transform-simplify-comparison-operators", + "transform-undefined-to-void" + ] + } + } +} diff --git a/electron-builder.json b/electron-builder.json new file mode 100644 index 00000000..958cb668 --- /dev/null +++ b/electron-builder.json @@ -0,0 +1,73 @@ +{ + "$schema": "http://json.schemastore.org/electron-builder", + "appId": "co.zeit.hyper", + "directories": { + "app": "target" + }, + "extraResources": [ + "./bin/yarn-standalone.js", + "./bin/cli.js", + { + "from": "./build/${os}/", + "to": "./bin/", + "filter": [ + "hyper*" + ] + } + ], + "linux": { + "category": "TerminalEmulator", + "target": [ + { + "target": "deb", + "arch": [ + "x64" + ] + }, + { + "target": "AppImage", + "arch": [ + "x64" + ] + }, + { + "target": "rpm", + "arch": [ + "x64" + ] + }, + { + "target": "snap", + "arch": [ + "x64" + ] + } + ] + }, + "win": { + "target": [ + "squirrel" + ], + "rfc3161TimeStampServer": "http://timestamp.comodoca.com" + }, + "mac": { + "category": "public.app-category.developer-tools", + "extendInfo": "build/Info.plist", + "darkModeSupport": true + }, + "deb": { + "afterInstall": "./build/linux/after-install.tpl" + }, + "rpm": { + "afterInstall": "./build/linux/after-install.tpl" + }, + "snap": { + "confinement": "classic" + }, + "protocols": { + "name": "ssh URL", + "schemes": [ + "ssh" + ] + } +} diff --git a/package.json b/package.json index be1cbb0f..f5476dae 100644 --- a/package.json +++ b/package.json @@ -16,236 +16,6 @@ "dist": "yarn run build && cross-env BABEL_ENV=production babel target/renderer/bundle.js --out-file target/renderer/bundle.js --no-comments --minified && electron-builder", "clean": "node ./bin/rimraf-standalone.js node_modules && node ./bin/rimraf-standalone.js ./app/node_modules && node ./bin/rimraf-standalone.js ./app/renderer" }, - "ava": { - "files": [ - "test/unit/*" - ], - "helpers": [ - "**/testUtils/**/*" - ], - "compileEnhancements": false, - "extensions": [ - "ts" - ], - "require": [ - "ts-node/register/transpile-only" - ] - }, - "eslintConfig": { - "plugins": [ - "react", - "prettier", - "@typescript-eslint" - ], - "extends": [ - "eslint:recommended", - "plugin:react/recommended", - "plugin:prettier/recommended" - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 8, - "sourceType": "module", - "ecmaFeatures": { - "jsx": true, - "impliedStrict": true, - "experimentalObjectRestSpread": true - }, - "allowImportExportEverywhere": true - }, - "env": { - "es6": true, - "browser": true, - "node": true - }, - "settings": { - "react": { - "version": "detect" - } - }, - "rules": { - "func-names": [ - "error", - "as-needed" - ], - "no-shadow": "error", - "no-extra-semi": 0, - "react/prop-types": 0, - "react/react-in-jsx-scope": 0, - "react/no-unescaped-entities": 0, - "react/jsx-no-target-blank": 0, - "react/no-string-refs": 0, - "prettier/prettier": [ - "error", - { - "printWidth": 120, - "tabWidth": 2, - "singleQuote": true, - "trailingComma": "none", - "bracketSpacing": false, - "semi": true, - "useTabs": false, - "jsxBracketSameLine": false - } - ] - }, - "overrides": [ - { - "files": [ - "app/config/config-default.js", - ".hyper.js" - ], - "rules": { - "prettier/prettier": [ - "error", - { - "printWidth": 120, - "tabWidth": 2, - "singleQuote": true, - "trailingComma": "es5", - "bracketSpacing": false, - "semi": true, - "useTabs": false, - "parser": "babel", - "jsxBracketSameLine": false - } - ] - } - }, - { - "files": [ - "**.ts", - "**.tsx" - ], - "extends": [ - "plugin:@typescript-eslint/recommended", - "prettier/@typescript-eslint" - ], - "rules": { - "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-non-null-assertion": "off" - } - } - ] - }, - "babel": { - "presets": [ - "@babel/react", - "@babel/typescript" - ], - "plugins": [ - [ - "styled-jsx/babel", - { - "vendorPrefixes": false - } - ], - "@babel/plugin-proposal-numeric-separator", - "@babel/proposal-class-properties", - "@babel/proposal-object-rest-spread", - "@babel/plugin-proposal-optional-chaining" - ], - "env": { - "production": { - "plugins": [ - "minify-constant-folding", - "minify-dead-code-elimination", - "minify-flip-comparisons", - "minify-guarded-expressions", - "minify-infinity", - [ - "minify-mangle-names", - { - "keepClassName": true, - "keepFnName": true - } - ], - "minify-replace", - "minify-simplify", - "minify-type-constructors", - "transform-member-expression-literals", - "transform-merge-sibling-variables", - "transform-minify-booleans", - "transform-property-literals", - "transform-simplify-comparison-operators", - "transform-undefined-to-void" - ] - } - } - }, - "build": { - "appId": "co.zeit.hyper", - "directories": { - "app": "target" - }, - "extraResources": [ - "./bin/yarn-standalone.js", - "./bin/cli.js", - { - "from": "./build/${os}/", - "to": "./bin/", - "filter": [ - "hyper*" - ] - } - ], - "linux": { - "category": "TerminalEmulator", - "target": [ - { - "target": "deb", - "arch": [ - "x64" - ] - }, - { - "target": "AppImage", - "arch": [ - "x64" - ] - }, - { - "target": "rpm", - "arch": [ - "x64" - ] - }, - { - "target": "snap", - "arch": [ - "x64" - ] - } - ] - }, - "win": { - "target": [ - "squirrel" - ], - "rfc3161TimeStampServer": "http://timestamp.comodoca.com" - }, - "mac": { - "category": "public.app-category.developer-tools", - "extendInfo": "build/Info.plist", - "darkModeSupport": true - }, - "deb": { - "afterInstall": "./build/linux/after-install.tpl" - }, - "rpm": { - "afterInstall": "./build/linux/after-install.tpl" - }, - "snap": { - "confinement": "classic" - }, - "protocols": { - "name": "ssh URL", - "schemes": [ - "ssh" - ] - } - }, "license": "MIT", "author": { "name": "ZEIT, Inc.", @@ -345,10 +115,5 @@ "ts-node": "8.5.4", "typescript": "3.7.4", "webpack": "4.41.5" - }, - "husky": { - "hooks": { - "pre-push": "yarn test" - } } }