diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..d1ce213 --- /dev/null +++ b/.babelrc @@ -0,0 +1,4 @@ +{ + "plugins": ["transform-object-rest-spread"], + "presets": ["@babel/preset-typescript"] +} \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json index deaddf1..10a69cc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,14 +3,19 @@ "extends": "airbnb", "plugins": ["react", "jsx-a11y", "import"], "rules": { - "jsx-a11y/no-static-element-interactions": 0, - "jsx-a11y/click-events-have-key-events": 0, - "jsx-a11y/anchor-is-valid": 2, - "jsx-a11y/href-no-hash": "off", - "react/jsx-filename-extension": "off", - "react/button-has-type": 0, "allowArrowFunctions": true, - "no-underscore-dangle": 0, + "array-bracket-spacing": "off", + "arrow-parens": ["error", "as-needed", { "requireForBlockBody": false }], + "arrow-parens": [ + "error", + "as-needed", + { + "requireForBlockBody": false + } + ], + "arrow-spacing": "off", + "block-spacing": "off", + "brace-style": "off", "comma-dangle": ["error", { "arrays": "always-multiline", "objects": "always-multiline", @@ -18,7 +23,76 @@ "exports": "always-multiline", "functions": "ignore" }], - "arrow-parens": ["error", "as-needed", { "requireForBlockBody": false }] + "comma-spacing": "off", + "comma-style": "off", + "computed-property-spacing": "off", + "dot-location": "off", + "eol-last": "error", + "func-call-spacing": "off", + "function-paren-newline": "off", + "generator-star-spacing": "off", + "implicit-arrow-linebreak": "off", + "indent": "off", + "jsx-a11y/anchor-is-valid": 2, + "jsx-a11y/click-events-have-key-events": 0, + "jsx-a11y/href-no-hash": "off", + "jsx-a11y/no-static-element-interactions": 0, + "jsx-quotes": "off", + "key-spacing": "off", + "keyword-spacing": "off", + "max-len": ["error", { + "code": 100, + "ignoreUrls": true, + "ignoreStrings": true + }], + "new-parens": "off", + "newline-per-chained-call": "off", + "no-confusing-arrow": ["error", {"allowParens": true}], + "no-extra-semi": "off", + "no-floating-decimal": "off", + "no-mixed-spaces-and-tabs": "off", + "no-multi-spaces": "off", + "no-multiple-empty-lines": "off", + "no-spaced-func": "off", + "no-trailing-spaces": "off", + "no-underscore-dangle": 0, + "no-whitespace-before-property": "off", + "nonblock-statement-body-position": "off", + "object-curly-newline": "off", + "object-curly-spacing": "off", + "object-property-newline": "off", + "one-var-declaration-per-line": "off", + "operator-linebreak": "off", + "padded-blocks": "off", + "quote-props": "off", + "react/button-has-type": 0, + "react/jsx-closing-bracket-location": "off", + "react/jsx-closing-tag-location": "off", + "react/jsx-curly-spacing": "off", + "react/jsx-filename-extension": "off", + "react/jsx-first-prop-new-line": "off", + "react/jsx-indent": "off", + "react/jsx-indent-props": "off", + "react/jsx-max-props-per-line": "off", + "react/jsx-one-expression-per-line": "off", + "react/jsx-props-no-multi-spaces": "off", + "react/jsx-tag-spacing": "off", + "react/jsx-wrap-multilines": "off", + "rest-spread-spacing": "off", + "semi": "off", + "semi-spacing": "off", + "semi-style": "off", + "space-before-blocks": "off", + "space-before-function-paren": "off", + "space-in-parens": "off", + "space-infix-ops": "off", + "space-unary-ops": "off", + "switch-colon-spacing": "off", + "template-curly-spacing": "off", + "template-tag-spacing": "off", + "unicode-bom": "off", + "wrap-iife": "off", + "yield-star-spacing": "off" }, "parserOptions": { "ecmaVersion": 8 diff --git a/.gitignore b/.gitignore index c7bd190..11192c9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ yarn-error.log -yarn.lock -/node_modules \ No newline at end of file +/node_modules +server/config/dev.ts diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..ec6d3cd --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +package.json diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..4cc6aa6 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "trailingComma": "es5", + "singleQuote": true, + "printWidth": 100 +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..db79261 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM node:9.6.1 + +RUN mkdir client/usr/src/app +WORKDIR /client/usr/src/app + +ENV PATH /usr/src/app/node_modules/.bin:$PATH + +COPY package.json /client/usr/src/app/package.json +RUN npm install --silent +RUN npm install react-scripts@1.1.1 -g --silent + +CMD ["npm", "start"] \ No newline at end of file diff --git a/README.md b/README.md index 6da0d52..85f676d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,25 @@ -## CodeBuddy - +### Installation + ```sh +$ git clone git@github.com:lydiahallie/CodeBuddy.git +$ cd CodeBuddy +$ yarn +``` +Run client: +```sh +$ cd client +$ yarn +$ cd .. +$ yarn client +``` +Run server: +```sh +$ cd server +$ yarn +$ cd .. +$ ts-node -O '{"module":"commonjs"}' server +``` + ### Branches +Whenever you open a PR, please use the `dev` branch as the base branch. + + ### First draft version +![demo](preview1.gif) diff --git a/client/config/paths.js b/client/config/paths.js index 8afa7cd..0caa696 100644 --- a/client/config/paths.js +++ b/client/config/paths.js @@ -40,7 +40,7 @@ module.exports = { appBuild: resolveApp('build'), appPublic: resolveApp('public'), appHtml: resolveApp('public/index.html'), - appIndexJs: resolveApp('src/index.js'), + appIndexJs: resolveApp('src/index.tsx'), appPackageJson: resolveApp('package.json'), appSrc: resolveApp('src'), yarnLockFile: resolveApp('yarn.lock'), diff --git a/client/config/webpack.config.dev.js b/client/config/webpack.config.dev.js index 2488393..63232c3 100644 --- a/client/config/webpack.config.dev.js +++ b/client/config/webpack.config.dev.js @@ -62,7 +62,8 @@ module.exports = { // This is the URL that app is served from. We use "/" in development. publicPath, // Point sourcemap entries to original disk location (format as URL on Windows) - devtoolModuleFilenameTemplate: info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/'), + devtoolModuleFilenameTemplate: info => + path.resolve(info.absoluteResourcePath).replace(/\\/g, '/'), }, resolve: { // This allows you to set a fallback for where Webpack should look for modules. @@ -71,7 +72,7 @@ module.exports = { // https://github.com/facebookincubator/create-react-app/issues/253 modules: ['node_modules', paths.appNodeModules].concat( // It is guaranteed to exist because we tweak it in `env.js` - process.env.NODE_PATH.split(path.delimiter).filter(Boolean), + process.env.NODE_PATH.split(path.delimiter).filter(Boolean) ), // These are the reasonable defaults supported by the Node ecosystem. // We also include JSX as a common component filename extension to support @@ -79,9 +80,8 @@ module.exports = { // https://github.com/facebookincubator/create-react-app/issues/290 // `web` extension prefixes have been added for better support // for React Native Web. - extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx'], + extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx', '.ts', '.tsx'], alias: { - // Support React Native Web // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/ 'react-native': 'react-native-web', @@ -118,6 +118,8 @@ module.exports = { ], include: paths.appSrc, }, + { test: /\.tsx?$/, loader: "awesome-typescript-loader" }, + { enforce: "pre", test: /\.js$/, loader: "source-map-loader" }, { // "oneOf" will traverse all following loaders until one will // match the requirements. When no loader matches it will fall @@ -140,7 +142,6 @@ module.exports = { include: paths.appSrc, loader: require.resolve('babel-loader'), options: { - // This is a feature of `babel-loader` for webpack (not Babel itself). // It enables caching results in ./node_modules/.cache/babel-loader/ // directory for faster rebuilds. @@ -215,16 +216,16 @@ module.exports = { ], }, plugins: [ - // Makes some environment variables available in index.html. - // The public URL is available as %PUBLIC_URL% in index.html, e.g.: - // - // In development, this will be an empty string. - new InterpolateHtmlPlugin(env.raw), // Generates an `index.html` file with the