From 3596a13f02b638abea05ef5f03040fb308c07aa4 Mon Sep 17 00:00:00 2001 From: Adam Rich Date: Fri, 15 Jun 2018 17:06:04 -0700 Subject: [PATCH] basics --- .babelrc | 8 +++++ .editorconfig | 33 +++++++++++++++++++ .eslintrc.js | 63 ++++++++++++++++++++++++++++++++++++ .gitignore | 14 ++++++++ README.md | 2 +- package.json | 47 +++++++++++++++++++++++++++ webpack.config.js | 81 +++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 .babelrc create mode 100644 .editorconfig create mode 100644 .eslintrc.js create mode 100644 .gitignore create mode 100644 package.json create mode 100644 webpack.config.js diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..9a530d1 --- /dev/null +++ b/.babelrc @@ -0,0 +1,8 @@ +{ + "env": { + "test": { + "presets": ["env", "react"], + "plugins": ["transform-object-rest-spread", "transform-decorators-legacy"] + } + } +} \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3c8720f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,33 @@ +# http://editorconfig.org + +# A special property that should be specified at the top of the file outside of +# any sections. Set to true to stop .editor config file search on current file +root = true + +[*] +# Indentation style +# Possible values - tab, space +indent_style = tab + +# Indentation size in single-spaced characters +# Possible values - an integer, tab +indent_size = 4 + +# Line ending file format +# Possible values - lf, crlf, cr +end_of_line = lf + +# File character encoding +# Possible values - latin1, utf-8, utf-16be, utf-16le +charset = utf-8 + +# Denotes whether to trim whitespace at the end of lines +# Possible values - true, false +trim_trailing_whitespace = true + +# Denotes whether file should end with a newline +# Possible values - true, false +insert_final_newline = true + +[package.json] +indent_size = 2 \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..8260efb --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,63 @@ +module.exports = { + parser: 'babel-eslint', + parserOptions: { + ecmaVersion: 8, + sourceType: 'module', + ecmaFeatures: { + impliedStrict: true, + jsx: true, + experimentalObjectRestSpread: true + } + }, + plugins: [ + 'react' + ], + globals: { + APP_ID: false, + API_HOST: false, + API_KEY: false, + fetch: false + }, + extends: [ + 'eslint:recommended', + 'plugin:react/recommended' + ], + env: { + browser: true, + node: true, + es6: true + }, + rules: { + 'brace-style': 2, + camelcase: 2, + 'class-methods-use-this': 2, + 'comma-dangle': 2, + 'comma-spacing': 2, + 'dot-notation': 2, + eqeqeq: 2, + indent: [2, 'tab', {SwitchCase: 1}], + 'key-spacing': 2, + 'lines-between-class-members': 2, + 'max-len': [2, 200, 2], + 'newline-per-chained-call': [2, {ignoreChainWithDepth: 3}], + 'no-console': [2, {allow: ['error']}], + 'no-multiple-empty-lines': 2, + 'no-shadow': 2, + 'no-unneeded-ternary': [2, {defaultAssignment: false}], + 'no-unused-expressions': 2, + 'no-var': 2, + 'object-shorthand': 2, + 'padded-blocks': [2, 'never'], + 'prefer-const': 2, + 'prefer-arrow-callback': 2, + 'quote-props': [2, 'as-needed'], + quotes: [2, 'single'], + 'require-await': 2, + semi: [2, 'always'], + 'space-before-function-paren': [2, {anonymous: 'always', named: 'never'}], + 'space-infix-ops': 2, + strict: 2, + yoda: 2, + 'react/no-unescaped-entities': 0 + } +}; \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cc85212 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +dist/ +node_modules/ + +# OS generated files # +###################### +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db +.log +*.log \ No newline at end of file diff --git a/README.md b/README.md index aed1cc2..335a28b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # ui -ui +UI kit for pubrec products, built on React diff --git a/package.json b/package.json new file mode 100644 index 0000000..31734fd --- /dev/null +++ b/package.json @@ -0,0 +1,47 @@ +{ + "name": "ui", + "version": "1.0.0", + "description": "UI kit based on ReactJS for TCG projects", + "main": "src/index.js", + "scripts": { + "test": "eslint ./src" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/the-control-group/ui.git" + }, + "author": "The Control Group", + "license": "UNLICENSED", + "private": "true", + "bugs": { + "url": "https://github.com/the-control-group/ui/issues" + }, + "homepage": "https://github.com/the-control-group/ui#readme", + "devDependencies": { + "autoprefixer": "^8.1.0", + "babel-core": "^6.26.0", + "babel-eslint": "^8.2.2", + "babel-loader": "^7.1.4", + "babel-plugin-transform-object-rest-spread": "^6.26.0", + "babel-preset-env": "^1.6.1", + "babel-preset-react": "^6.24.1", + "classnames": "^2.2.5", + "css-loader": "^0.28.11", + "cssnano": "^3.10.0", + "eslint": "^4.19.0", + "eslint-plugin-react": "^7.7.0", + "file-loader": "^1.1.11", + "less": "^3.0.1", + "less-loader": "^4.1.0", + "normalize.css": "^8.0.0", + "prop-types": "^15.6.1", + "react": "^16.2.0", + "react-devtools": "^3.1.0", + "react-dom": "^16.2.0", + "style-loader": "^0.20.3", + "url-loader": "^1.0.1", + "webpack": "^4.1.1", + "webpack-cli": "^2.0.12", + "webpack-dev-server": "^3.1.1" + } +} diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..0074d98 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,81 @@ +const path = require("path"); +const HtmlWebpackPlugin = require("html-webpack-plugin"); + +module.exports = { + entry: path.join(__dirname, "src/docs"), + output: { + path: path.join(__dirname, "docs"), + filename: "bundle.js" + }, + module: { + rules: [ + { + test: /\.(js|jsx)$/, + use: "babel-loader", + exclude: /node_modules/ + }, + { + test: /\.css$/, + use: ["style-loader", "css-loader"] + } + ] + }, + plugins: [ + new HtmlWebpackPlugin({ + template: path.join(__dirname, "src/docs/index.html") + }) + ], + resolve: { + extensions: [".js", ".jsx"] + }, + devServer: { + contentBase: path.join(__dirname, "docs"), + port: 8000, + stats: "minimal" + } +}; + +// const path = require('path'), +// CleanWebpackPlugin = require('clean-webpack-plugin'), +// HtmlWebpackPlugin = require('html-webpack-plugin'), +// ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin'), +// ExtractTextPlugin = require('extract-text-webpack-plugin'); + +// const extractLess = new ExtractTextPlugin({ +// filename: 'main.[contenthash].css', +// disable: process.env.NODE_ENV !== 'production' +// }); + +// const config = { +// resolve: { +// modules: [path.resolve(__dirname, 'src'), 'node_modules'] +// }, +// module: { +// rules: [ +// { +// test: /(\.less$)|(\.css$)/, +// use: extractLess.extract({ +// use: ['css-loader', 'less-loader'], +// fallback: 'style-loader' +// }) +// }, +// { +// test: /(\.jpg$)|(\.png$)/, +// use: 'url-loader' +// } +// ] +// }, +// plugins: [ +// new CleanWebpackPlugin(['dist']), +// new HtmlWebpackPlugin({ +// inject: 'head', +// template: 'src/index.html' +// }), +// new ScriptExtHtmlWebpackPlugin({ +// defaultAttribute: 'defer' +// }), +// extractLess +// ] +// }; + +// module.exports = config;