Skip to content

Instantly share code, notes, and snippets.

@SilentImp
Created June 7, 2018 18:44
Show Gist options
  • Save SilentImp/4d005064063701faa04c29b02114d0df to your computer and use it in GitHub Desktop.
Save SilentImp/4d005064063701faa04c29b02114d0df to your computer and use it in GitHub Desktop.
const fs = require('fs');
const path = require('path');
const projectPath = path.resolve(__dirname, './');
const pathToSrc = path.resolve(projectPath, 'src');
const stats = fs.statSync(pathToSrc);
const env = process.env.NODE_ENV || 'dev';
const envAppConfigURL = path.resolve(__dirname, `../app/${env}.js`);
const devAppConfigURL = path.resolve(__dirname, 'dev.js');
const localAppConfigURL = path.resolve(__dirname, 'local.js');
const sampleAppConfigURL = path.resolve(__dirname, 'local.sample.js');
const isEnvConfig = fs.existsSync(envAppConfigURL);
const isDevConfig = fs.existsSync(devAppConfigURL);
const isLocalConfig = fs.existsSync(localAppConfigURL);
const isSampleConfig = fs.existsSync(sampleAppConfigURL);
let ConfigURL;
if (isEnvConfig) {
ConfigURL = envAppConfigURL;
} else if (isLocalConfig) {
ConfigURL = localAppConfigURL;
} else if (isSampleConfig) {
ConfigURL = sampleAppConfigURL;
} else {
ConfigURL = devAppConfigURL;
}
module.exports = {
"presets": [
["@babel/preset-env", {
"targets": {
"uglify": true,
"node": "current",
"browsers": ["> 3%", "ie 11"]
},
"debug": false,
}],
"@babel/preset-react",
["@babel/preset-stage-0", {
"decoratorsLegacy": true,
}]
],
"plugins": [
["module-resolver", {
"root": ["./"],
"alias": {
Config$: ConfigURL,
Utils: path.resolve(projectPath, 'src/shared/utils/'),
Components: path.resolve(projectPath, 'src/shared/components/'),
Reducers: path.resolve(projectPath, 'src/shared/reducers/'),
Images: path.resolve(projectPath, 'src/shared/assets/images/'),
Icons: path.resolve(projectPath, 'src/shared/assets/icons/'),
Styles: path.resolve(projectPath, 'src/shared/assets/styles/'),
Shared: path.resolve(projectPath, 'src/shared/'),
}
}],
"react-css-modules",
"@babel/plugin-proposal-export-default-from",
["@babel/plugin-proposal-decorators", {
"legacy": true
}],
["@babel/plugin-proposal-class-properties", {
"loose" : true
}]
],
};
{
"env": {
"browser": true,
"node": true,
"jest": true,
"worker": true,
"serviceworker": true,
"es6": true
},
"extends": "airbnb",
"parser": "babel-eslint",
"globals": {
"FontFaceObserver": true,
"fontFaceSet": true,
},
"plugins": [
"react",
"jsx-a11y",
"import",
"jest"
],
"settings": {
"import/resolver": {
"webpack": {
"config": "webpack.config.js"
}
}
},
"rules": {
"jsx-a11y/anchor-is-valid": [ "error", { "components": [ "Link" ], "specialLink": [ "to" ] } ],
"no-underscore-dangle": ["error", { "allow": ["_id", "_insertCss", "_getCss","__REDUX_STATE__", "_meta"] }],
"no-restricted-syntax": ["error", "WithStatement", "BinaryExpression[operator='in']"]
}
}
/Users/silentimp/Work/SSSR/src/client/index.jsx
4:1 error 'react-router' should be listed in the project's dependencies. Run 'npm i -S react-router' to add it import/no-extraneous-dependencies
5:10 error 'Provider' is defined but never used no-unused-vars
6:10 error 'Route' is defined but never used no-unused-vars
7:10 error 'ConnectedRouter' is defined but never used no-unused-vars
10:28 error Unable to resolve path to module 'Shared/store' import/no-unresolved
10:28 error Missing file extension for "Shared/store" import/extensions
11:18 error Missing file extension for "Shared/i18n" import/extensions
11:18 error Unable to resolve path to module 'Shared/i18n' import/no-unresolved
12:18 error Unable to resolve path to module 'Shared/Root' import/no-unresolved
12:18 error Missing file extension for "Shared/Root" import/extensions
/Users/silentimp/Work/SSSR/src/server/index.jsx
1:20 error Unable to resolve path to module 'Config' import/no-unresolved
1:20 error Missing file extension for "Config" import/extensions
5:19 error Unable to resolve path to module '../../stats.json' import/no-unresolved
12:3 warning Unexpected console statement no-console
13:3 warning Unexpected console statement no-console
/Users/silentimp/Work/SSSR/src/server/routes/test.jsx
2:25 error Unable to resolve path to module 'Utils/TMMemcached' import/no-unresolved
2:25 error Missing file extension for "Utils/TMMemcached" import/extensions
8:22 error Unable to resolve path to module 'Shared/template/index.pug' import/no-unresolved
10:28 error Unable to resolve path to module 'Shared/store' import/no-unresolved
10:28 error Missing file extension for "Shared/store" import/extensions
11:18 error Unable to resolve path to module 'Shared/i18n' import/no-unresolved
11:18 error Missing file extension for "Shared/i18n" import/extensions
12:18 error Missing file extension for "Shared/Root" import/extensions
12:18 error Unable to resolve path to module 'Shared/Root' import/no-unresolved
13:19 error Unable to resolve path to module '../../../stats.json' import/no-unresolved
15:7 error 'penthouse' is assigned a value but never used no-unused-vars
15:19 error 'penthouse' should be listed in the project's dependencies, not devDependencies import/no-extraneous-dependencies
117:5 warning Unexpected console statement no-console
119:5 warning Unexpected console statement no-console
135:7 warning Unexpected console statement no-console
137:7 warning Unexpected console statement no-console
169:7 warning Unexpected console statement no-console
208:9 error 'styles' is assigned a value but never used no-unused-vars
/Users/silentimp/Work/SSSR/src/shared/components/App/App.jsx
2:8 error 'PropTypes' is defined but never used no-unused-vars
3:18 error Unable to resolve path to module 'Components/Test' import/no-unresolved
3:18 error Missing file extension for "Components/Test" import/extensions
7:8 error Component should be written as a pure function react/prefer-stateless-function
/Users/silentimp/Work/SSSR/src/shared/components/LocaleContext/index.js
1:18 error Unable to resolve path to module 'Shared/i18n' import/no-unresolved
1:18 error Missing file extension for "Shared/i18n" import/extensions
22:7 error 't' is missing in props validation react/prop-types
26:7 error JSX not allowed in files with extension '.js' react/jsx-filename-extension
/Users/silentimp/Work/SSSR/src/shared/components/Test/index.js
1:8 error Using exported name 'Test' as identifier for default export import/no-named-as-default
2:37 error Absolute imports should come before relative imports import/first
2:37 error Unable to resolve path to module 'Components/LocaleContext' import/no-unresolved
2:37 error Missing file extension for "Components/LocaleContext" import/extensions
5:3 error 'React' must be in scope when using JSX react/react-in-jsx-scope
5:3 error JSX not allowed in files with extension '.js' react/jsx-filename-extension
7:7 error 'React' must be in scope when using JSX react/react-in-jsx-scope
/Users/silentimp/Work/SSSR/src/shared/components/Test/Test.jsx
23:16 error 'change' is missing in props validation react/prop-types
26:3 error componentDidCatch should be placed after shouldComponentUpdate react/sort-comp
31:19 error 'locale' is missing in props validation react/prop-types
35:5 warning Unexpected console statement no-console
39:13 error 'changeLanguage' is missing in props validation react/prop-types
51:19 error JSX props should not use .bind() react/jsx-no-bind
52:19 error JSX props should not use .bind() react/jsx-no-bind
/Users/silentimp/Work/SSSR/src/shared/i18n.js
5:10 error 'reactI18nextModule' is defined but never used no-unused-vars
/Users/silentimp/Work/SSSR/src/shared/Root.jsx
4:17 error Unable to resolve path to module 'Components/App' import/no-unresolved
4:17 error Missing file extension for "Components/App" import/extensions
5:28 error Unable to resolve path to module 'Components/LocaleContext' import/no-unresolved
5:28 error Missing file extension for "Components/LocaleContext" import/extensions
7:8 error Unable to resolve path to module 'Styles/main.pcss' import/no-unresolved
8:8 error Unable to resolve path to module 'Styles/reset.css' import/no-unresolved
/Users/silentimp/Work/SSSR/src/shared/store/index.js
4:25 error Unable to resolve path to module 'Reducers' import/no-unresolved
4:25 error Missing file extension for "Reducers" import/extensions
/Users/silentimp/Work/SSSR/src/shared/utils/chat.js
1:20 error Unable to resolve path to module 'Config' import/no-unresolved
1:20 error Missing file extension for "Config" import/extensions
/Users/silentimp/Work/SSSR/src/shared/utils/screenshots.js
1:20 error Unable to resolve path to module 'Config' import/no-unresolved
1:20 error Missing file extension for "Config" import/extensions
/Users/silentimp/Work/SSSR/src/shared/utils/TMMemcached.js
14:7 warning Unexpected console statement no-console
24:11 warning Unexpected console statement no-console
64:11 warning Unexpected console statement no-console
66:11 warning Unexpected console statement no-console
74:13 warning Unexpected console statement no-console
77:11 warning Unexpected console statement no-console
81:9 warning Unexpected console statement no-console
✖ 75 problems (60 errors, 15 warnings)
{
"name": "ssr-scaffolder",
"version": "0.0.0",
"description": "TemplateMonster Scaffolder with Server Side Rendering",
"main": "index.js",
"sideEffects": false,
"scripts": {
"clean": "rimraf build public",
"start": "npm run build && node ./build/runner.js",
"build": "npm run clean && export NODE_ENV=production && run-s build:production:*",
"build:production:client": "node --max_old_space_size=4096 node_modules/.bin/webpack --config webpack.config.js --env=production",
"build:production:server": "node --max_old_space_size=4096 node_modules/.bin/webpack --config webpack.server.config.js --env=production",
"build:dev": "npm run clean && export NODE_ENV=dev && run-s build:dev:*",
"build:dev:client": "node --max_old_space_size=4096 node_modules/.bin/webpack-cli --json > stats.json --config webpack.config.js --env=dev",
"build:dev:server": "node --max_old_space_size=4096 node_modules/.bin/webpack-cli --config webpack.server.config.js --env=dev",
"build:localssr": "npm run clean && export NODE_ENV=local && run-s build:localssr:*",
"build:localssr:client": "node --max_old_space_size=4096 node_modules/.bin/webpack-cli --json > stats.json --profile --config webpack.config.js --env=local",
"build:localssr:server": "rm ./build/index.html & node --max_old_space_size=4096 node_modules/.bin/webpack --config webpack.server.config.js --env=local",
"build:local": "npm run clean && export NODE_ENV=local && export NODE_DEV_SERVER=true && run-s build:local:*",
"build:local:devserver": "export NODE_ENV=local && node --max_old_space_size=4096 node_modules/.bin/webpack-dev-server --hot --inline --watch --config webpack.config.js --env=local --colors",
"build:doc": "documentation build src/*.js* -o public -f html",
"test": "export NODE_ENV=test && jest --no-cache",
"test:watch": "export NODE_ENV=test && jest --no-cache --watch",
"test:coverage": "export NODE_ENV=test && jest --no-cache --coverage",
"lint": "run-p lint:*",
"lint:js": "eslint ./src/** --ext .jsx,.js --color -f stylish --fix",
"lint:css": "stylelint './src/**/*.pcss' --color -r -f verbose --fix",
"precommit": "lint-staged",
"commitmsg": "commit-msg ${GIT_PARAMS}"
},
"lint-staged": {
"*.{jsx,js}": [
"eslint --color -f stylish --fix"
],
"*.pcss": [
"stylelint --color -r -f verbose --fix"
]
},
"contributors": [
{
"name": "Anton Nemtsev",
"email": "thesilentimp@gmail.com",
"url": "http://frontender.info/"
}
],
"license": "ISC",
"dependencies": {
"@plasma-platform/plasma-quark": "^3.6.1",
"@plasma-platform/quark-library": "^1.3.3",
"@plasma-platform/tm-css": "^1.8.0",
"@plasma-platform/tm-message-hook": "^2.0.11",
"babel-plugin-react-css-modules": "^3.4.2",
"centrifuge": "^1.4.8",
"classnames": "^2.2.5",
"compression": "^1.7.1",
"cookie-parser": "^1.4.3",
"css-loader": "^0.28.11",
"documentation": "^8.0.0",
"dotenv": "^6.0.0",
"eslint-plugin-react": "^7.9.1",
"express": "^4.16.2",
"express-cache-headers": "^0.1.3",
"history": "^4.7.2",
"husky": "^0.14.3",
"i18next": "^11.3.2",
"i18next-browser-languagedetector": "^2.1.0",
"i18next-localstorage-cache": "^1.1.1",
"i18next-sprintf-postprocessor": "^0.2.2",
"i18next-xhr-backend": "^1.5.0",
"isbot": "^2.1.2",
"isomorphic-fetch": "^2.2.1",
"jest": "^23.1.0",
"jsdom": "^11.11.0",
"json-loader": "^0.5.7",
"lint-staged": "^7.1.3",
"lodash": "^4.17.10",
"markdown-it": "^8.4.1",
"md5": "^2.2.1",
"memcached": "^2.2.2",
"moment": "^2.22.2",
"nock": "^9.3.0",
"node-localstorage": "^1.3.1",
"normalizr": "^3.2.4",
"npm-run-all": "^4.1.2",
"plasma-reviews-api-client-js": "^1.0.44",
"postcss-conditionals": "^2.1.0",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.1.3",
"postcss-mixins": "^6.2.0",
"postcss-nested": "^3.0.0",
"postcss-sass": "^0.3.2",
"postcss-simple-vars": "^4.1.0",
"prop-types": "^15.6.0",
"qs": "^6.5.1",
"react": "^16.4.0",
"react-document-title": "^2.0.3",
"react-dom": "^16.4.0",
"react-helmet": "^5.2.0",
"react-hot-loader": "^4.3.0",
"react-i18next": "^7.7.0",
"react-interpolate-component": "^0.12.0",
"react-redux": "^5.0.6",
"react-router-dom": "^4.2.2",
"react-router-redux": "^5.0.0-alpha.9",
"react-test-renderer": "^16.4.0",
"react-trigger-change": "^1.0.2",
"redux": "^4.0.0",
"redux-devtools": "^3.4.1",
"redux-form": "^7.2.0",
"redux-mock-store": "^1.3.0",
"redux-router": "^2.1.2",
"redux-thunk": "^2.3.0",
"reselect": "^3.0.1",
"rimraf": "^2.6.2",
"sockjs-client": "^1.1.5",
"style-loader": "^0.21.0",
"stylelint": "^9.2.1",
"stylelint-scss": "^3.1.0",
"svg-sprite-loader": "^3.8.0",
"svgo": "^1.0.5",
"svgo-loader": "^2.1.0",
"url": "^0.11.0",
"valid-url": "^1.0.9"
},
"devDependencies": {
"@babel/cli": "^7.0.0-beta.49",
"@babel/core": "^7.0.0-beta.49",
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.49",
"@babel/plugin-proposal-decorators": "^7.0.0-beta.49",
"@babel/plugin-proposal-export-default-from": "^7.0.0-beta.49",
"@babel/polyfill": "^7.0.0-beta.49",
"@babel/preset-env": "^7.0.0-beta.49",
"@babel/preset-react": "^7.0.0-beta.49",
"@babel/preset-stage-0": "^7.0.0-beta.49",
"autoprefixer": "^8.6.0",
"babel-eslint": "^8.2.3",
"babel-jest": "^23.0.1",
"babel-loader": "^8.0.0-beta.3",
"babel-plugin-module-resolver": "^3.1.1",
"babel-plugin-transform-decorators-legacy": "^1.3.5",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-plugin-transform-es2015-modules-umd": "^6.24.1",
"babel-plugin-transform-react-remove-prop-types": "^0.4.13",
"browser-env": "^3.2.4",
"copy-webpack-plugin": "^4.5.1",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-loader": "^2.0.0",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-jest": "^21.17.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"extract-loader": "^2.0.1",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "^1.1.5",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.4.0",
"penthouse": "^1.5.0",
"pug": "^2.0.3",
"pug-loader": "^2.3.0",
"sinon": "^5.1.0",
"url-loader": "^1.0.1",
"webpack": "^4.11.1",
"webpack-bundle-analyzer": "^2.13.1",
"webpack-cli": "^3.0.2",
"webpack-dev-server": "^3.1.4",
"webpack-manifest-plugin": "^2.0.3",
"webpack-merge": "^4.1.2",
"webpack-node-externals": "^1.7.2"
},
"jest": {
"modulePaths": [
"src",
"src/shared",
"src/shared/components"
],
"moduleNameMapper": {
"^Config": "<rootDir>/config/app/dev.js",
"^Images": "<rootDir>/src/assets/images/",
"^Icons": "<rootDir>/src/assets/icons/",
"^Styles": "<rootDir>/src/assets/styles/",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/__mocks__/fileMock.js",
"\\.(css|pcss)$": "<rootDir>/src/__mocks__/styleMock.js"
},
"coverageReporters": [
"clover",
"json",
"text",
"html"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment