forked from diplodoc-platform/components
-
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
1 parent
cc2fd4c
commit 55143a9
Showing
39 changed files
with
22,925 additions
and
0 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,13 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[{*.json,*.yml}] | ||
indent_style = space | ||
indent_size = 2 |
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 @@ | ||
node_modules | ||
|
||
/build | ||
/storybook-static |
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,194 @@ | ||
{ | ||
"extends": ["eslint:recommended"], | ||
"parser": "babel-eslint", | ||
"parserOptions": { | ||
"ecmaVersion": 2019 | ||
}, | ||
"env": { | ||
"es6": true, | ||
"shared-node-browser": true | ||
}, | ||
"rules": { | ||
"no-empty": 0, | ||
"valid-jsdoc": [1, { | ||
"requireParamDescription": false, | ||
"requireReturnDescription": false | ||
}], | ||
"array-callback-return": 2, | ||
"block-scoped-var": 1, | ||
"complexity": 1, | ||
"consistent-return": 1, | ||
"curly": 2, | ||
"dot-location": [2, "property"], | ||
"eqeqeq": [1, "always"], | ||
"guard-for-in": 2, | ||
"no-caller": 2, | ||
"no-div-regex": 1, | ||
"no-eq-null": 2, | ||
"no-eval": 1, | ||
"no-extend-native": 2, | ||
"no-extra-bind": 1, | ||
"no-extra-label": 2, | ||
"no-floating-decimal": 2, | ||
"no-global-assign": 1, | ||
"no-implicit-coercion": 1, | ||
"no-implicit-globals": 1, | ||
"no-implied-eval": 1, | ||
"no-iterator": 2, | ||
"no-labels": 2, | ||
"no-loop-func": 2, | ||
"no-multi-spaces": 2, | ||
"no-new": 2, | ||
"no-new-func": 1, | ||
"no-new-wrappers": 2, | ||
"no-octal-escape": 2, | ||
"no-param-reassign": 1, | ||
"no-proto": 2, | ||
"no-return-assign": [2, "always"], | ||
"no-script-url": 2, | ||
"no-self-compare": 2, | ||
"no-sequences": 2, | ||
"no-throw-literal": 1, | ||
"no-unmodified-loop-condition": 2, | ||
"no-unused-expressions": 2, | ||
"no-useless-call": 2, | ||
"no-useless-concat": 2, | ||
"no-void": 2, | ||
"no-with": 2, | ||
"radix": 1, | ||
"wrap-iife": [2, "inside"], | ||
"strict": 1, | ||
"no-label-var": 2, | ||
"no-shadow": 1, | ||
"no-shadow-restricted-names": 2, | ||
"no-undef-init": 2, | ||
"no-use-before-define": [1, {"functions": false}], | ||
"callback-return": 1, | ||
"handle-callback-err": 1, | ||
"no-new-require": 2, | ||
"no-path-concat": 1, | ||
"array-bracket-spacing": [2, "never"], | ||
"block-spacing": [2, "always"], | ||
"brace-style": [2, "1tbs", {"allowSingleLine": true}], | ||
"camelcase": [2, {"properties": "never"}], | ||
"comma-dangle": [2, "always-multiline"], | ||
"comma-spacing": [2, {"before": false, "after": true}], | ||
"comma-style": [2, "last"], | ||
"computed-property-spacing": [2, "never"], | ||
"eol-last": 1, | ||
"func-call-spacing": [2, "never"], | ||
"indent": [2, 4, {"SwitchCase": 1}], | ||
"key-spacing": [2, {"beforeColon": false, "afterColon": true}], | ||
"keyword-spacing": [2, {"before": true, "after": true}], | ||
"linebreak-style": [2, "unix"], | ||
"max-depth": [1, {"maximum": 5}], | ||
"max-len": [1, {"code": 120, "ignoreUrls": true}], | ||
"new-cap": 2, | ||
"new-parens": 2, | ||
"no-array-constructor": 1, | ||
"no-bitwise": 2, | ||
"no-lonely-if": 1, | ||
"no-multiple-empty-lines": 2, | ||
"no-negated-condition": 1, | ||
"no-nested-ternary": 1, | ||
"no-new-object": 1, | ||
"no-restricted-syntax": [2, "WithStatement"], | ||
"no-trailing-spaces": 2, | ||
"no-unneeded-ternary": 2, | ||
"no-whitespace-before-property": 2, | ||
"object-curly-spacing": [2, "never"], | ||
"quotes": [2, "single"], | ||
"semi": [2, "always"], | ||
"semi-spacing": 2, | ||
"space-before-blocks": 2, | ||
"space-before-function-paren": [2, {"anonymous": "always", "named": "never"}], | ||
"space-in-parens": [2, "never"], | ||
"space-infix-ops": 2, | ||
"space-unary-ops": 2, | ||
"arrow-parens": 2, | ||
"arrow-spacing": [2, {"before": true, "after": true}], | ||
"generator-star-spacing": [2, {"before": false, "after": true}], | ||
"no-duplicate-imports": 2, | ||
"no-useless-constructor": 2, | ||
"no-var": 2, | ||
"prefer-arrow-callback": 1, | ||
"prefer-const": 2, | ||
"prefer-rest-params": 2, | ||
"prefer-spread": 2, | ||
"require-atomic-updates": 0, | ||
"require-yield": 1, | ||
"template-curly-spacing": [2, "never"], | ||
"yield-star-spacing": [2, {"before": false, "after": true}] | ||
}, | ||
"overrides": [{ | ||
"files": ["*.ts", "*.tsx"], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"strict": 0, | ||
"no-undef": 0, | ||
"no-dupe-class-members": 0, | ||
"valid-jsdoc": [1, { | ||
"requireReturnType": false, | ||
"requireParamType": false, | ||
"requireParamDescription": false, | ||
"requireReturnDescription": false | ||
}], | ||
"semi": 0, | ||
"@typescript-eslint/semi": 2, | ||
"no-unused-vars": 0, | ||
"@typescript-eslint/no-unused-vars": 2, | ||
"no-use-before-define": 0, | ||
"@typescript-eslint/no-use-before-define": [1, {"functions": false}], | ||
"no-useless-constructor": 0, | ||
"@typescript-eslint/no-useless-constructor": 2, | ||
"@typescript-eslint/class-name-casing": 2, | ||
"@typescript-eslint/member-delimiter-style": 2, | ||
"@typescript-eslint/member-ordering": [2, { | ||
"default": [ | ||
"public-static-field", | ||
"protected-static-field", | ||
"private-static-field", | ||
|
||
"public-static-method", | ||
"protected-static-method", | ||
"private-static-method", | ||
|
||
"public-instance-field", | ||
"protected-instance-field", | ||
"private-instance-field", | ||
|
||
"constructor", | ||
|
||
"public-instance-method", | ||
"protected-instance-method", | ||
"private-instance-method" | ||
] | ||
}], | ||
"@typescript-eslint/explicit-member-accessibility": [2, {"accessibility": "no-public"}], | ||
"@typescript-eslint/consistent-type-assertions": 2, | ||
"@typescript-eslint/no-array-constructor": 2, | ||
"@typescript-eslint/no-explicit-any": 1, | ||
"@typescript-eslint/no-inferrable-types": 2, | ||
"@typescript-eslint/no-namespace": 2, | ||
"@typescript-eslint/no-non-null-assertion": 1, | ||
"@typescript-eslint/no-parameter-properties": 2, | ||
"@typescript-eslint/triple-slash-reference": 2, | ||
"@typescript-eslint/prefer-namespace-keyword": 2, | ||
"@typescript-eslint/type-annotation-spacing": [2, { | ||
"before": true, | ||
"after": true, | ||
"overrides": { | ||
"colon": { | ||
"before": 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,12 @@ | ||
# Settings | ||
.idea | ||
.vscode | ||
.DS_Store | ||
.env | ||
|
||
# Libs | ||
node_modules | ||
|
||
# Generated content | ||
/build | ||
/storybook-static |
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,3 @@ | ||
import '@storybook/addon-knobs/register'; | ||
import '@storybook/addon-actions/register'; | ||
import 'storybook-readme/register'; |
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,25 @@ | ||
import React from 'react'; | ||
import {configure, addDecorator, addParameters} from '@storybook/react'; | ||
import {withKnobs} from '@storybook/addon-knobs'; | ||
import {addReadme} from 'storybook-readme'; | ||
|
||
addParameters({ | ||
options: { | ||
panelPosition: 'right', | ||
theme: { | ||
brandTitle: 'Docs Components', | ||
brandUrl: 'https://github.yandex-team.ru/data-ui/docs-components', | ||
}, | ||
} | ||
}); | ||
addDecorator(addReadme); | ||
addDecorator(withKnobs); | ||
|
||
addDecorator((Story, context) => ( | ||
<main> | ||
<Pointerfocus/> | ||
<Story {...context}/> | ||
</main> | ||
)); | ||
|
||
configure(require.context('../src/stories', true, /\.stories.tsx?$/), module); |
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,6 @@ | ||
exports.ConfigBuilder = require('./lib/ConfigBuilder'); | ||
exports.javascript = require('./lib/levels/javascript'); | ||
exports.styles = require('./lib/levels/styles'); | ||
exports.assets = require('./lib/levels/assets'); | ||
exports.analyze = require('./lib/levels/analyze'); | ||
exports.optimize = require('./lib/levels/optimize'); |
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,108 @@ | ||
const webpack = require('webpack'); | ||
const WebpackManifestPlugin = require('webpack-manifest-plugin'); | ||
|
||
const {getOption} = require('./utils'); | ||
const Entry = require('./Entry'); | ||
const Output = require('./Output'); | ||
const Module = require('./Module'); | ||
const Resolve = require('./Resolve'); | ||
const Plugins = require('./Plugins'); | ||
const Optimization = require('./Optimization'); | ||
const Externals = require('./Externals'); | ||
const DevServer = require('./DevServer'); | ||
const Stats = require('./Stats'); | ||
const Performance = require('./Performance'); | ||
const Node = require('./Node'); | ||
|
||
class ConfigBuilder { | ||
constructor(options = {}) { | ||
this.name = getOption(options.name); | ||
this.target = getOption(options.target); | ||
this.context = getOption(options.context); | ||
this.mode = getOption(options.mode, process.env.NODE_ENV || 'production'); | ||
this.sourceMap = getOption(options.sourceMap, true); | ||
this.cache = getOption(options.cache); | ||
this.isProduction = this.mode === 'production'; | ||
this.isDevelopment = this.mode === 'development'; | ||
|
||
this.entry = new Entry(this); | ||
this.output = new Output(this); | ||
this.module = new Module(this); | ||
this.resolve = new Resolve(this); | ||
this.plugins = new Plugins(this); | ||
this.optimization = new Optimization(this); | ||
this.externals = new Externals(this); | ||
this.devServer = new DevServer(this); | ||
this.stats = new Stats(this); | ||
this.performance = new Performance(this); | ||
this.node = new Node(this); | ||
|
||
// Defaults | ||
if (this.sourceMap) { | ||
this.setDevtool(this.isProduction ? 'source-map' : 'cheap-module-source-map'); | ||
} | ||
|
||
this.plugins.addPlugin(new WebpackManifestPlugin()); | ||
|
||
if (this.isDevelopment) { | ||
this.plugins.addPlugin(new webpack.HotModuleReplacementPlugin()); | ||
} | ||
|
||
this.stats.set({ | ||
children: false, | ||
excludeAssets: (assetName) => { | ||
const regex = /\.map$/; | ||
|
||
return regex.test(assetName); | ||
}, | ||
}); | ||
} | ||
|
||
setMode(mode) { | ||
this.mode = mode; | ||
|
||
return this; | ||
} | ||
|
||
setContext(context) { | ||
this.context = context; | ||
|
||
return this; | ||
} | ||
|
||
setDevtool(devtool) { | ||
this.devtool = devtool; | ||
|
||
return this; | ||
} | ||
|
||
apply(definition) { | ||
definition(this); | ||
|
||
return this; | ||
} | ||
|
||
build() { | ||
return { | ||
name: this.name, | ||
target: this.target, | ||
context: this.context, | ||
mode: this.mode, | ||
cache: this.cache, | ||
devtool: this.devtool, | ||
entry: this.entry.build(), | ||
output: this.output.build(), | ||
module: this.module.build(), | ||
resolve: this.resolve.build(), | ||
plugins: this.plugins.build(), | ||
optimization: this.optimization.build(), | ||
externals: this.externals.build(), | ||
devServer: this.devServer.build(), | ||
stats: this.stats.build(), | ||
performance: this.performance.build(), | ||
node: this.node.build(), | ||
}; | ||
} | ||
} | ||
|
||
module.exports = ConfigBuilder; |
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,17 @@ | ||
class DevServer { | ||
constructor(builder) { | ||
this._builder = builder; | ||
} | ||
|
||
set(devServer) { | ||
this._devServer = devServer; | ||
|
||
return this._builder; | ||
} | ||
|
||
build() { | ||
return this._devServer; | ||
} | ||
} | ||
|
||
module.exports = DevServer; |
Oops, something went wrong.