Skip to content

Commit

Permalink
remove app_2
Browse files Browse the repository at this point in the history
  • Loading branch information
negarn committed May 14, 2019
1 parent f03b476 commit 3363473
Show file tree
Hide file tree
Showing 771 changed files with 45 additions and 38,178 deletions.
7 changes: 0 additions & 7 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@
],
"alias": {
"_common" : "./src/javascript/_common",
"App" : "./src/javascript/app_2/App",
"Assets" : "./src/javascript/app_2/Assets",
"Constants": "./src/javascript/app_2/Constants",
"Modules" : "./src/javascript/app_2/Modules",
"Services" : "./src/javascript/app_2/Services",
"Stores" : "./src/javascript/app_2/Stores",
"Utils" : "./src/javascript/app_2/Utils",
"Images" : "./src/images/"
}
}
Expand Down
9 changes: 0 additions & 9 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,6 @@ module.exports = {
'number-leading-zero' : 'always',
'number-max-precision' : 3,
'number-no-trailing-zeros' : true,
// 'plugin/selector-bem-pattern' : { preset: 'bem', implicitComponents: 'src/sass/app_2/**/*.scss' },
// 'plugin/selector-bem-pattern' : { preset: 'bem', implicitComponents: 'src/sass/app_2/modules/trading.scss' },
// 'plugin/selector-bem-pattern' : { preset: 'bem', implicitComponents: 'src/sass/app_2/_common/base/*.scss' },
// 'plugin/selector-bem-pattern' : { preset: 'bem', implicitComponents: 'src/sass/app_2/_common/components/*.scss' },
'plugin/selector-bem-pattern' : { preset: 'bem', implicitComponents: 'src/sass/app_2/_common/drawer/drawer.scss' },
// 'plugin/selector-bem-pattern' : { preset: 'bem', implicitComponents: 'src/sass/app_2/_common/form/*.scss' },
// 'plugin/selector-bem-pattern' : { preset: 'bem', implicitComponents: 'src/sass/app_2/_common/layout/*.scss' },
// 'plugin/selector-bem-pattern' : { preset: 'bem', implicitComponents: 'src/sass/app_2/_common/*.scss' },
// 'plugin/selector-bem-pattern' : { preset: 'bem', implicitComponents: 'src/sass/app_2/modules/*.scss' },
'property-case' : 'lower',
'rule-empty-line-before' : ['always', { ignore: ['after-comment'], except: ['inside-block-and-after-rule', 'first-nested'] }],
'selector-attribute-brackets-space-inside' : 'never',
Expand Down
15 changes: 1 addition & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,10 @@ In order to remove the created folders from your gh-pages, you can use either:
- `grunt shell:compile_dev --path=about-us` to re-compile only template(s) which serve about-us path in URL.
- To fix eslint errors run `npm run eslint`

### Sections
The codebase is divided into different sections. Passing `--section=[all|app|app_2]` to almost all grunt commands causes to run it on the specified section (excluding tests since it should run on the whole source code).

Current sections are:
- `app` represents current version of the website including `app`, `static`, `landing_pages` folders in the source code.
- `app_2` is the next version which its source code is mainly inside the `app_2` folders.
- `all` denotes to all available sections and is the default value if `--section` is not specified.

Although section is mandatory for release, but it is optional for the rest of commands as there is a default value (`all`).

## Release

```
grunt release --{release type}=1 --section=app|app_2 [--cleanup] [--reset]
grunt release --{release type}=1 [--cleanup] [--reset]
```
(The value is needed when more than one option is used)

Expand All @@ -101,9 +91,6 @@ grunt release --{release type}=1 --section=app|app_2 [--cleanup] [--reset]
- In order to prevent accidentally releasing to the wrong target, it is mandatory to provide one of these parameters.
- Your remote origin will be checked to be the correct target of the given parameter.
- Your current branch will be checked to be the correct branch of the given parameter.
- `--section` (mandatory)
- In order to prevent mistakes during the release, it is mandatory to specify the section.
- Valid section depends on the release target. Please refer to `release_config` [here](https://github.com/binary-com/binary-static/blob/new-app/build/config/constants.js).
- `--cleanup` [optional]
- Create CNAME file with proper value according to remote origin
- Deploy to gh-pages with the option `add: false`
Expand Down
1 change: 0 additions & 1 deletion build/aliases.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
css:
- 'sass'
- 'postcss'
- 'embedFonts'
- 'cssmin'

js:
Expand Down
1 change: 0 additions & 1 deletion build/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ module.exports = function (grunt) {
},
],
},
app_2: {},
get all() {
return this.app;
},
Expand Down
54 changes: 14 additions & 40 deletions build/config/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,57 +7,33 @@ const release_targets = {
repo : '[email protected]:binary-com/binary-static.git',
CNAME: 'staging.binary.com',
},
binarynex: {
repo : '[email protected]:binary-com/binarynex-deployed.git',
CNAME: 'www.binarynex.com',
},
};

/**
* branch : the required branch that should be checked out when releasing
* target_folder : the folder name in gh-pages to release to
* valid_sections: the list of sections that can use for this release
* origin : the required origin that local clone should point to (also the target repo to release to, when `target_repo` not available)
* target_repo : the target repo to release to
* CNAME : creates a CNAME file based on this entry to push alongside the release when needed
*/
const release_config = {
production: {
branch : 'master',
target_folder : '',
valid_sections: ['app', 'app_2', 'all'],
origin : release_targets.production.repo,
CNAME : release_targets.production.CNAME,
branch : 'master',
target_folder: '',
origin : release_targets.production.repo,
CNAME : release_targets.production.CNAME,
},
staging: {
branch : 'master',
target_folder : '',
valid_sections: ['app', 'app_2', 'all'],
origin : release_targets.staging.repo,
CNAME : release_targets.staging.CNAME,
branch : 'master',
target_folder: '',
origin : release_targets.staging.repo,
CNAME : release_targets.staging.CNAME,
},
translations: {
branch : 'translations',
target_folder : 'translations',
valid_sections: ['app'],
origin : release_targets.staging.repo,
CNAME : release_targets.staging.CNAME,
},
nex_production: {
branch : 'master',
target_folder : '',
valid_sections: ['app_2'],
origin : release_targets.staging.repo,
target_repo : release_targets.binarynex.repo,
CNAME : release_targets.binarynex.CNAME,
},
nex_beta: {
branch : 'master',
target_folder : 'beta',
valid_sections: ['app_2'],
origin : release_targets.staging.repo,
target_repo : release_targets.binarynex.repo,
CNAME : release_targets.binarynex.CNAME,
branch : 'translations',
target_folder: 'translations',
origin : release_targets.staging.repo,
CNAME : release_targets.staging.CNAME,
},
};

Expand All @@ -67,10 +43,8 @@ const node_modules_paths = {
};

const config = {
branch_prefix : 'br_',
valid_sections : ['all', 'app', 'app_2'],
default_section: 'all',
app_2_folder : 'app',
branch_prefix: 'br_',
section : 'app',
};

module.exports = {
Expand Down
26 changes: 0 additions & 26 deletions build/config/helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const Constants = require('./constants');

const isRelease = (grunt) => grunt.cli.tasks[0] === 'release';

const getReleaseTarget = (grunt) => {
Expand All @@ -12,28 +10,6 @@ const getReleaseTarget = (grunt) => {
return release_target;
};

const validateSection = (grunt, section) => {
let { valid_sections } = Constants.config;

if (isRelease(grunt)) {
valid_sections = [...global.release_config[global.release_target].valid_sections];

if (!grunt.option('section')) { // To prevent mistakes, section is mandatory when releasing
grunt.fail.fatal(`It is mandatory to specify the section when releasing. (--section=...)\nValid sections are: ${valid_sections.join(', ')}`);
}
}

if (!valid_sections.includes(section)) {
grunt.fail.fatal(`Unknown or wrong section: '${section}'.\nValid sections are: ${valid_sections.join(', ')}.`);
}
};

const getSection = (grunt) => {
const section = grunt.option('section') || Constants.config.default_section;
validateSection(grunt, section);
return section;
};

const getGhpagesCloneFolder = () => ( // clone each repo to a unique folder to prevent local cache issues when releasing
`.grunt/grunt-gh-pages/gh-pages/${/^.*:(.*)\.git$/g.exec(global.release_info.target_repo)[1].replace(/\//g, '__')}`
);
Expand All @@ -48,15 +24,13 @@ const generateCompileCommand = (params) => (
params || '',
global.branch ? `-b ${global.branch_prefix}${global.branch}` : '',
global.path ? `-p ${global.path}` : '',
`-s ${global.section}`,
],
].join(' ')
);

module.exports = {
isRelease,
getReleaseTarget,
getSection,
getGhpagesCloneFolder,
getDistPath,
generateCompileCommand,
Expand Down
9 changes: 3 additions & 6 deletions build/config/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const initGlobals = (grunt) => {
}

// ----- section -----
global.section = Helpers.getSection(grunt);
global.section = Constants.config.section;

// ----- branch info -----
if (global.release_target) {
Expand All @@ -29,18 +29,15 @@ const initGlobals = (grunt) => {

if (global.release_target === 'staging' && global.section === 'all') {
grunt.option('cleanup', true); // always cleanup when releasing to staging
} else if (global.release_info.valid_sections.length > 1 && global.section !== 'all' && grunt.option('cleanup')) {
grunt.fail.fatal(`can't release only one section to ${global.release_target} with --cleanup`);
}
} else {
global.branch_prefix = Constants.config.branch_prefix;
global.branch = grunt.option('branch');
}

// ----- paths -----
global.dist = Helpers.getDistPath();
global.dist_app_2 = `${global.dist}/${Constants.config.app_2_folder}`;
global.path = grunt.option('path');
global.dist = Helpers.getDistPath();
global.path = grunt.option('path');

// ----- compile templates -----
global.compileCommand = params => Helpers.generateCompileCommand(params);
Expand Down
27 changes: 4 additions & 23 deletions build/copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,20 @@ module.exports = function (grunt) {
{ expand: true, cwd: 'src/root_files/app', src: ['index.html'], dest: global.dist },

// app, static
{ expand: true, cwd: 'src/download/', src: ['**'], dest: `${global.dist}/download/` },
{ expand: true, cwd: 'src/images/', src: ['**', '!app_2/**', '!common/logos'], dest: `${global.dist}/images/` },
{ expand: true, cwd: 'src/javascript/_autogenerated/', src: ['*.js'], dest: `${global.dist}/js/texts/` },
{ expand: true, cwd: 'src/javascript/', src: ['manifest.json'], dest: global.dist },
{ expand: true, cwd: 'src/download/', src: ['**'], dest: `${global.dist}/download/` },
{ expand: true, cwd: 'src/images/', src: ['**', '!common/logos'], dest: `${global.dist}/images/` },
{ expand: true, cwd: 'src/javascript/_autogenerated/', src: ['*.js'], dest: `${global.dist}/js/texts/` },
{ expand: true, cwd: 'src/javascript/', src: ['manifest.json'], dest: global.dist },

// binary-style
{ expand: true, cwd: `${global.node_modules_paths.binary_style}/src/images/favicons`, src: ['**'], dest: `${global.dist}/images/favicons/` },
{ expand: true, cwd: `${global.node_modules_paths.binary_style}/src/images/logo`, src: ['**'], dest: `${global.dist}/images/logo/` },
],
},
app_2: {
files: [
...common,
{ expand: true, cwd: 'src/root_files/app_2', src: ['sitemap*.xml'], dest: 'dist' }, // top level
{ expand: true, cwd: 'src/root_files/app_2', src: ['index.html'], dest: global.dist_app_2 },

// app_2
{ expand: true, cwd: 'src/images/app_2', src: ['**'], dest: `${global.dist_app_2}/images/` },
{ expand: true, cwd: 'src/javascript/_autogenerated/app_2/', src: ['*.js'], dest: `${global.dist_app_2}/js/texts/` },

// binary-style
{ expand: true, cwd: `${global.node_modules_paths.binary_style}/src/images/favicons`, src: ['**'], dest: `${global.dist_app_2}/images/favicons/` },

// ChartIQ dependencies
{ expand: true, cwd: `${global.node_modules_paths.smartcharts}/dist/`, src: ['*.smartcharts.*'], dest: `${global.dist_app_2}/js/smartcharts/` },
{ expand: true, cwd: `${global.node_modules_paths.smartcharts}/dist/`, src: ['smartcharts.css*'], dest: `${global.dist_app_2}/css/` },
],
},
get all() {
return {
files: [
...this.app.files,
...this.app_2.files,
],
};
},
Expand Down
4 changes: 0 additions & 4 deletions build/cssmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ module.exports = function (grunt) {
{ src: `${global.dist}/css/app.css`, dest: `${global.dist}/css/app.min.css` },
{ src: `${global.dist}/css/static.css`, dest: `${global.dist}/css/static.min.css` },
],
app_2: [
{ src: `${global.dist_app_2}/css/app_2.css`, dest: `${global.dist_app_2}/css/app_2.min.css` },
],
get all() {
return [
...this.app,
...this.app_2,
];
},
};
Expand Down
20 changes: 0 additions & 20 deletions build/embedFonts.js

This file was deleted.

4 changes: 1 addition & 3 deletions build/postcss.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
module.exports = function (grunt) {
const src = {
app : `${global.dist}/css/{app,common,static}.css`,
app_2: `${global.dist_app_2}/css/app_2.css`,
app: `${global.dist}/css/{app,common,static}.css`,
get all() {
return [
this.app,
this.app_2,
];
},
};
Expand Down
4 changes: 1 addition & 3 deletions build/sass.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ module.exports = function (grunt) {
});

const config = {
app : generateConfig(['*.scss', '!app_2.scss'], `${global.dist}/css`),
app_2: generateConfig(['app_2.scss'], `${global.dist_app_2}/css`),
app: generateConfig(['*.scss'], `${global.dist}/css`),
get all() {
return {
options,
files: [
...this.app.files,
...this.app_2.files,
],
};
},
Expand Down
5 changes: 1 addition & 4 deletions build/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const webpack = require('webpack');
const webpackMerge = require('webpack-merge');
const appConfig = require('./webpack/config_app');
const app2Config = require('./webpack/config_app_2');
const commonConfig = require('./webpack/config_common');
const PATHS = require('./webpack/paths');
const getPlugins = require('./webpack/plugins');
Expand All @@ -12,12 +11,10 @@ module.exports = function (grunt) {
const common_config = commonConfig(grunt);

const config = {
app : [webpackMerge.smart(common_config, appConfig(grunt))],
app_2: [webpackMerge.smart(common_config, app2Config(grunt))],
app: [webpackMerge.smart(common_config, appConfig(grunt))],
get all() {
return [
...this.app,
...this.app_2,
];
},
};
Expand Down
Loading

0 comments on commit 3363473

Please sign in to comment.