Skip to content

Commit

Permalink
initial code
Browse files Browse the repository at this point in the history
  • Loading branch information
NickShtefan committed May 13, 2019
1 parent 5e81631 commit 1b4dec3
Show file tree
Hide file tree
Showing 1,524 changed files with 78,480 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM node:11 as builder

ENV IN_DOCKER=1
WORKDIR /app

RUN npm install --global yarn

COPY .npmrc .yarnrc package.json yarn.lock .env .babelrc.js next.config.js ./

COPY src/ ./src

RUN yarn
RUN yarn build

FROM node:11

EXPOSE 3000
ENV NODE_ENV=production
ENV IN_DOCKER=1
WORKDIR /app

RUN npm install --global yarn

COPY --from=builder /app/package.json ./
COPY --from=builder /app/node_modules/ ./node_modules/
COPY --from=builder /app/src/ ./src/
COPY server ./server

CMD ["yarn", "start"]
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.6'
services:
web:
container_name: golos
restart: always
build:
context: .
dockerfile: Dockerfile
ports:
- $DOCKER_CONNECTOR_WEB_HOST:$DOCKER_CONNECTOR_WEB_PORT:3000
env_file:
- .env
8 changes: 8 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"*": ["src/app/*"]
}
}
}
49 changes: 49 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* eslint-disable no-param-reassign */
const path = require('path');
const webpack = require('webpack');
const DotEnv = require('dotenv-webpack');
const withSass = require('@zeit/next-sass');
const nextSourceMaps = require('@zeit/next-source-maps')();
const { compose } = require('ramda');
//const withBundleAnalyzer = require('@zeit/next-bundle-analyzer');

module.exports = compose(
nextSourceMaps,
withSass
)({
webpack: (config, { isServer, buildId }) => {
config.plugins.push(
// Read the .env file
new DotEnv({
path: path.join(__dirname, '.env'),
systemvars: !process.env.IN_DOCKER,
})
);

config.plugins.push(
new webpack.DefinePlugin({
'process.env.SENTRY_RELEASE': JSON.stringify(buildId),
})
);

if (!isServer) {
config.resolve.alias['@sentry/node'] = '@sentry/browser';
}

config.resolve.alias['styled-components'] = path.resolve('./node_modules/styled-components');

return config;
},
// analyzeServer: ['server', 'both'].includes(process.env.BUNDLE_ANALYZE),
// analyzeBrowser: ['browser', 'both'].includes(process.env.BUNDLE_ANALYZE),
// bundleAnalyzerConfig: {
// server: {
// analyzerMode: 'static',
// reportFilename: '../../.analyze/server.html',
// },
// browser: {
// analyzerMode: 'static',
// reportFilename: '../../.analyze/client.html',
// },
// },
});
8 changes: 8 additions & 0 deletions nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"env": {
"NODE_ENV": "development"
},
"restartable": "rs",
"verbose": true,
"ignore": [".git", "node_modules/**/node_modules", "src"]
}
130 changes: 130 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"name": "golos.io",
"version": "1.1.0",
"description": "Голос - социальная сеть, построенная на публичном блокчейне.",
"author": "Good guys from Golos",
"license": "MIT",
"private": true,
"main": "server/server.js",
"scripts": {
"dev": "nodemon server/server.js",
"build": "next build src",
"start": "NODE_ENV=production node server/server.js",
"test": "jest",
"release": "standard-version"
},
"dependencies": {
"@emotion/is-prop-valid": "^0.7.3",
"@flopflip/memory-adapter": "^1.2.2",
"@flopflip/react-redux": "^8.0.3",
"@sentry/browser": "^4.6.6",
"@sentry/node": "^4.6.6",
"bignumber.js": "^8.1.1",
"classnames": "^2.2.6",
"codemirror-md": "^0.1.1",
"cookie-parser": "^1.4.4",
"cyber-country-flag": "^0.0.3",
"counterpart": "^0.18.6",
"cyber-golos": "^1.1.19",
"cyber-keygen": "^1.3.3",
"dotenv-webpack": "^1.7.0",
"express": "^4.16.4",
"final-form": "^4.12.0",
"final-form-calculate": "^1.3.1",
"http-status": "^1.3.1",
"immutability-helper": "^3.0.0",
"is-hotkey": "^0.1.4",
"isomorphic-unfetch": "^3.0.0",
"jayson": "^2.1.2",
"js-cookie": "^2.2.0",
"jspdf": "^1.5.3",
"lodash": "^4.17.11",
"next": "^8.0.4",
"next-i18next": "^0.36.5",
"next-links": "^0.1.2",
"next-redux-wrapper": "^3.0.0-alpha.2",
"normalize.css": "^8.0.1",
"normalizr": "^3.3.0",
"nprogress": "^0.2.0",
"prop-types": "^15.7.2",
"qr-image": "^3.2.0",
"ramda": "^0.26.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-dropzone": "^10.1.0",
"react-fast-compare": "^2.0.4",
"react-final-form": "^4.1.0",
"react-interpolate-component": "^0.12.0",
"react-intl": "^2.8.0",
"react-lazyload": "^2.5.0",
"react-redux": "^6.0.1",
"react-rte-image": "^0.11.1",
"react-scroll-up": "^1.3.3",
"redux": "^4.0.1",
"redux-devtools-extension": "^2.13.8",
"redux-modals-manager": "^0.2.1",
"redux-thunk": "^2.3.0",
"remarkable": "^1.7.1",
"reselect": "^4.0.0",
"rpc-websockets": "^4.3.5",
"sanitize-html": "^1.20.0",
"speakingurl": "^14.0.1",
"styled-breakpoints": "^6.5.5",
"styled-by": "^0.3.0",
"styled-components": "^4.2.0",
"styled-is": "1.1.5",
"toasts-manager": "^0.1.8",
"turndown": "^5.0.3",
"uuid": "^3.3.2",
"webpack": "^4.29.6",
"xmldom": "^0.1.27"
},
"devDependencies": {
"@babel/core": "^7.4.0",
"@babel/plugin-proposal-decorators": "^7.4.0",
"@babel/plugin-proposal-export-default-from": "^7.2.0",
"@babel/plugin-proposal-optional-chaining": "^7.2.0",
"@commitlint/cli": "^7.5.2",
"@commitlint/config-conventional": "^7.5.0",
"@zeit/next-sass": "^1.0.1",
"@zeit/next-source-maps": "^0.0.4-canary.1",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.5.0",
"babel-plugin-module-resolver": "^3.2.0",
"babel-plugin-styled-components": "^1.10.0",
"commitizen": "^3.1.0",
"cz-conventional-changelog": "2.1.0",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.11.2",
"eslint": "^5.15.3",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^4.1.0",
"eslint-import-resolver-babel-module": "^5.0.1",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-react": "^7.12.4",
"husky": "^1.3.1",
"jest": "^24.5.0",
"lint-staged": "^8.1.5",
"node-sass": "^4.11.0",
"nodemon": "^1.18.10",
"prettier": "^1.16.4",
"react-addons-test-utils": "^15.6.2",
"react-test-renderer": "^16.8.6",
"redux-logger": "^3.0.6",
"sass-loader": "^7.1.0",
"sentry-testkit": "^2.1.0",
"standard-version": "^5.0.2",
"stylelint": "^9.10.1",
"stylelint-config-recommended": "^2.1.0",
"stylelint-config-styled-components": "^0.1.1",
"stylelint-processor-styled-components": "^1.6.0",
"svg-sprite-loader": "^4.1.3"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
66 changes: 66 additions & 0 deletions scripts/check_locales.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
const en = require('../src/locales/en.json');
const ru = require('../src/locales/ru-RU.json');
const ua = require('../src/locales/ua.json');

const data = {
en: extractKeys(en),
ru: extractKeys(ru),
ua: extractKeys(ua),
};

printDiff('en', 'ru');
printDiff('en', 'ua');

function extractKeys(obj) {
const keys = new Set();

_extractKeys(keys, obj, '');

return keys;
}

function _extractKeys(keys, obj, path) {
for (let key of Object.keys(obj)) {
const node = obj[key];

const newPath = (path ? path + '.' : '') + key;

if (typeof node === 'string') {
keys.add(newPath);
} else {
_extractKeys(keys, node, newPath);
}
}
}

function printDiff(lang1, lang2) {
const a = data[lang1];
const b = data[lang2];

const onlyInA = [];
const onlyInB = [];

for (let key of a) {
if (!b.has(key)) {
onlyInA.push(key);
}
}

for (let key of b) {
if (!a.has(key)) {
onlyInB.push(key);
}
}

console.log(`== Comparison [${lang1}] and [${lang2}]:`);

if (onlyInA.length) {
console.log(` Has not in [${lang2}]:\n ` + onlyInA.join('\n '));
console.log();
}

if (onlyInB.length) {
console.log(` Only in [${lang2}]:\n ` + onlyInB.join('\n '));
console.log();
}
}
12 changes: 12 additions & 0 deletions scripts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "golos.io-scripts",
"version": "0.0.0",
"private": true,
"description": "",
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"inquirer": "^6.0.0"
}
}
Loading

0 comments on commit 1b4dec3

Please sign in to comment.