Skip to content

Commit

Permalink
Merge pull request #147 from VanishMax/develop
Browse files Browse the repository at this point in the history
Release 1.0
  • Loading branch information
aabounegm authored Mar 29, 2020
2 parents 00426d8 + 5ff559d commit fd4562b
Show file tree
Hide file tree
Showing 439 changed files with 18,670 additions and 7,369 deletions.
4 changes: 3 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"brace-style": 0,
"no-return-assign": 0,
"no-trailing-spaces": 0,
"no-constant-condition": "off",
"curly": [0, "multi"],
"indent": "off",
"comma-dangle": ["warn", "always-multiline"],
Expand All @@ -40,6 +41,7 @@
{ "vars": "all", "args": "none", "ignoreRestSiblings": true }
],
"jsx-a11y/anchor-has-content": "off",
"jsx-a11y/anchor-is-valid": "off"
"jsx-a11y/anchor-is-valid": "off",
"keyword-spacing": "error"
}
}
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@
yarn-error.log
/__sapper__/
.idea
yarn.lock
package-lock.json
webpack.config.js
.env
13 changes: 13 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"plugins": [
"stylelint-scss",
],
"extends": ["stylelint-config-standard"],
"rules": {
"number-leading-zero": "never",
"selector-list-comma-newline-after": null,
"no-descending-specificity": null,
"at-rule-no-unknown": null,
"scss/at-rule-no-unknown": true,
},
}
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM node:13-alpine

RUN mkdir -p /app
WORKDIR /app

# install our dependencies
COPY .eslintrc package.json yarn.lock rollup.config.js /app/
RUN yarn

# copy the project code
COPY src /app/src
COPY static /app/static

# expose the server port
EXPOSE 3000
# Expose a Sapper dev port. Only for development
EXPOSE 10000

# define the default command to run when starting the container
CMD ["yarn", "dev"]
21 changes: 21 additions & 0 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:13-alpine

RUN mkdir -p /app
WORKDIR /app

# install our dependencies
COPY .env .eslintrc package.json yarn.lock rollup.config.js /app/
RUN yarn

# copy the project code
COPY src /app/src
COPY static /app/static

# Build the project
RUN yarn build

# expose the server port
EXPOSE 3000

# define the default command to run when starting the container
CMD ["yarn", "start"]
166 changes: 166 additions & 0 deletions get_css_bundles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
import re
from subprocess import run


SASS_PATH = 'sass'
POSTCSS_PATH = 'postcss'


common = [
'global/normalize',
'global/common',
'global/ui-kit',
]

layout_default = [
'page-components/header',
'page-components/notification-center',
'page-components/empty-state',
'page-components/footer',
]

styles = {
'home': [
'home/header',
'home/main',
'home/tagline',
'home/how-to',
'home/contacts',
'home/options',
'home/store',
'page-components/empty-state',
'page-components/notification-center',
'page-components/footer',
],
'_error': [
'page-components/404',
'page-components/403',
],
'dashboard': [
'admin-dashboard/main',
],
'profile': [
'profile/quick-info',
'profile/main-card',
'profile/timeline',
'profile/leave-feedback-modal',
'profile/export-data-modal',
'profile/statistics',
'profile/bar-colors',
'profile/notifications',
'page-components/modal-dialog',
],
'store': [
'page-components/tagline',
'page-components/filters',
'store/filters-spec',
'store/main',
'page-components/pagination',
],
'products_new': [
'create-product/main',
'create-product/preview-card',
'page-components/modal-dialog',
],
'products_id': [
'view-product/main',
'page-components/modal-dialog',
],
'products_id_edit': [
'create-product/main',
'create-product/preview-card',
'page-components/modal-dialog',
],
'projects': [
'page-components/tagline',
'page-components/filters',
'projects/filters-spec',
'projects/main',
],
'projects_new': [
'create-project/steps',
'create-project/main',
'create-project/general',
'create-project/activity',
'create-project/actions',
'page-components/create-activity',
],
'projects_past': [
'page-components/tagline',
'page-components/filters',
'projects/filters-spec',
'projects/main',
],
'projects_id': [
'view-project/main',
'view-project/activity',
'view-project/activity-user',
'view-project/activity-moderated',
'view-project/activity-finalizing',
'review-project/main',
'page-components/create-activity',
'view-project/moderators',
'view-project/proper-grid',
'view-project/report-performance-modal',
'view-project/read-feedback-modal',
'profile/leave-feedback-modal',
'view-project/apply-modal',
'page-components/modal-dialog',
],
'projects_id_edit': [
'create-project/steps',
'create-project/main',
'create-project/general',
'create-project/activity',
'create-project/actions',
'edit-project/main',
'page-components/create-activity',
],
'projects_id_review': [
'view-project/main',
'view-project/activity',
'view-project/activity-moderated',
'view-project/activity-finalizing',
'review-project/main',
'view-project/moderators',
'page-components/modal-dialog',
],
}

def build_bundle(contents, output):
'''Build a minified CSS bundle at path `output` from the files listed in `contents`.'''
sass_bundled = ''
for file in contents:
directory, name = file.split('/')
with open(f'static/css/{directory}/src/{name}.scss') as sass_file:
sass_bundled += sass_file.read() + '\n'

sass_bundled = re.sub('@import "[^"]+";', '', sass_bundled)
sass_bundled = (
'@import "static/css/global/src/_mixins.scss";\n'
+ '@import "static/css/global/src/_variables.scss";\n'
+ sass_bundled
)

run([SASS_PATH, '--stdin', output, '-s', 'compressed', '--no-source-map'],
input=sass_bundled,
text=True,
check=True)

run([POSTCSS_PATH, output, '--use', 'autoprefixer', '--no-map', '-r'],
input=sass_bundled,
text=True)


def get_all_bundles():
bundle_fmt = 'static/css/bundles/{}.min.css'

build_bundle(common, bundle_fmt.format('common'))

build_bundle(layout_default, bundle_fmt.format('layout-default'))

for page in styles:
build_bundle(styles[page], bundle_fmt.format(page.replace('_', '-')))

if __name__ == '__main__':
get_all_bundles()
11 changes: 11 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "es2019",
"allowSyntheticDefaultImports": false,
"baseUrl": "./",
"paths": {
"@/*": ["src/*"],
}
},
"exclude": ["node_modules", "dist"]
}
44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
"name": "innopoints-frontend",
"description": "Innopolis University innopoints project",
"version": "0.4.0",
"engines": {
"node": "v12.14.0"
},
"scripts": {
"dev": "sapper dev",
"build": "sapper build --legacy",
Expand All @@ -31,41 +28,44 @@
]
},
"dependencies": {
"clipboard-polyfill": "^2.8.6",
"compression": "^1.7.1",
"node-fetch": "^2.6.0",
"polka": "next",
"polka": "^1.0.0-next.11",
"sapper-environment": "^1.0.1",
"simplebar": "^5.1.0",
"sirv": "^0.4.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/runtime": "^7.0.0",
"@babel/core": "^7.8.3",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.8.3",
"@babel/preset-env": "^7.8.3",
"@babel/runtime": "^7.8.3",
"@rollup/plugin-alias": "^3.0.0",
"@rollup/plugin-commonjs": "^11.0.1",
"@rollup/plugin-node-resolve": "^7.0.0",
"@rollup/plugin-replace": "^2.3.0",
"babel-eslint": "^10.0.3",
"eslint": "^6.4.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-formatter-pretty": "^2.1.1",
"eslint-formatter-pretty": "^3.0.1",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-svelte3": "^2.7.3",
"fecha": "^3.0.3",
"husky": "^3.0.5",
"lint-staged": "^9.2.5",
"fecha": "^4.2.0",
"husky": "^4.2.3",
"lint-staged": "^10.0.8",
"npm-run-all": "^4.1.5",
"rollup": "^1.12.0",
"rollup-plugin-alias": "^2.0.0",
"rollup": "^2.1.0",
"rollup-plugin-babel": "^4.0.2",
"rollup-plugin-commonjs": "^10.0.0",
"rollup-plugin-eslint": "^7.0.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-svelte": "^5.0.1",
"rollup-plugin-terser": "^4.0.4",
"rollup-plugin-terser": "^5.3.0",
"sapper": "^0.27.9",
"simplebar": "^5.0.7",
"sortablejs": "^1.10.2",
"svelte": "^3.14.0",
"stylelint": "^13.2.1",
"stylelint-config-standard": "^20.0.0",
"stylelint-scss": "^3.13.0",
"svelte": "^3.18.0",
"swiper": "^5.2.1"
},
"repository": {
Expand Down
17 changes: 8 additions & 9 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import resolve from 'rollup-plugin-node-resolve';
import replace from 'rollup-plugin-replace';
import commonjs from 'rollup-plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import commonjs from '@rollup/plugin-commonjs';
import svelte from 'rollup-plugin-svelte';
import babel from 'rollup-plugin-babel';
import alias from 'rollup-plugin-alias';
import alias from '@rollup/plugin-alias';
import { eslint } from 'rollup-plugin-eslint';
import { terser } from 'rollup-plugin-terser';
import config from 'sapper/config/rollup.js';
import pkg from './package.json';
import preprocess from './src/utils/preprocess';
import substituteSvgs from './src/utils/substitute-svgs.js';
import sapperEnv from 'sapper-environment';

const mode = process.env.NODE_ENV;
const dev = mode === 'development';
const legacy = !!process.env.SAPPER_LEGACY_BUILD;

const onwarn = (warning, onwarn) => onwarn(warning);
const onwarn = (warning, onwarn) => (warning.code === 'CIRCULAR_DEPENDENCY' && /[/\\]@sapper[/\\]/.test(warning.message)) || onwarn(warning);

const dedupe = importee =>
importee === 'svelte' || importee.startsWith('svelte/');
Expand All @@ -34,8 +34,7 @@ export default {
svelte({
extensions: ['.html', '.svelte', '.svg'],
preprocess: {
markup: data => preprocess(data, false, {}),
style: ({ content }) => ({code: content}),
markup: substituteSvgs,
},
dev,
hydratable: true,
Expand Down Expand Up @@ -97,7 +96,7 @@ export default {
svelte({
extensions: ['.html', '.svelte', '.svg'],
preprocess: {
markup: data => preprocess(data, false, {}),
markup: substituteSvgs,
},
generate: 'ssr',
dev,
Expand Down
Loading

0 comments on commit fd4562b

Please sign in to comment.