Skip to content

Commit

Permalink
grunt to webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadtaimoor-deriv committed Feb 1, 2024
1 parent 20129c2 commit d678fb8
Show file tree
Hide file tree
Showing 47 changed files with 19,749 additions and 14,343 deletions.
3 changes: 1 addition & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ build/*.js
src/javascript/**/__tests__/*.js
src/javascript/_autogenerated/**/*.js
src/javascript/_common/lib/**/*.js
src/javascript/landing_pages/ico*.js
Gruntfile.js
src/javascript/landing_pages/ico*.js
86 changes: 86 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
module.exports = {
plugins: [
'stylelint-selector-bem-pattern',
],
rules: {
'at-rule-name-case' : 'lower',
'at-rule-name-space-after' : 'always',
'at-rule-semicolon-newline-after' : 'always',
'block-closing-brace-newline-after' : 'always',
'block-closing-brace-newline-before' : 'always',
'block-no-empty' : true,
'block-opening-brace-newline-after' : 'always',
'block-opening-brace-space-before' : 'always',
'color-hex-case' : 'lower',
'color-named' : 'never',
'color-no-hex' : true,
'color-no-invalid-hex' : true,
'declaration-bang-space-after' : 'never',
'declaration-bang-space-before' : 'always',
'declaration-block-no-duplicate-properties' : [true, { ignore: ['consecutive-duplicates'] }],
'declaration-block-no-shorthand-property-overrides': true,
'declaration-block-semicolon-newline-after' : 'always',
'declaration-block-semicolon-newline-before' : 'never-multi-line',
'declaration-block-semicolon-space-after' : 'always-single-line',
'declaration-block-semicolon-space-before' : 'never',
'declaration-block-trailing-semicolon' : 'always',
'declaration-colon-space-after' : 'always',
'declaration-colon-space-before' : 'never',
'font-family-name-quotes' : 'always-unless-keyword',
'function-calc-no-unspaced-operator' : true,
'function-comma-space-after' : 'always',
'function-comma-space-before' : 'never',
'function-name-case' : 'lower',
'function-parentheses-space-inside' : 'never',
'function-url-quotes' : 'always',
'indentation' : 4,
'max-empty-lines' : 1,
'media-feature-colon-space-after' : 'always',
'media-feature-colon-space-before' : 'never',
'media-feature-range-operator-space-after' : 'always',
'media-feature-range-operator-space-before' : 'always',
'media-query-list-comma-newline-after' : 'never-multi-line',
'media-query-list-comma-newline-before' : 'never-multi-line',
'media-query-list-comma-space-after' : 'always',
'media-query-list-comma-space-before' : 'never',
'no-duplicate-selectors' : true,
'no-eol-whitespace' : true,
'no-extra-semicolons' : true,
'no-invalid-double-slash-comments' : true,
'number-leading-zero' : 'always',
'number-max-precision' : 3,
'number-no-trailing-zeros' : true,
'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',
'selector-attribute-operator-space-after' : 'never',
'selector-attribute-operator-space-before' : 'never',
'selector-class-pattern' : null,
'selector-combinator-space-after' : 'always',
'selector-combinator-space-before' : 'always',
'selector-list-comma-newline-after' : 'never-multi-line',
'selector-list-comma-newline-before' : 'never-multi-line',
'selector-list-comma-space-after' : 'always',
'selector-list-comma-space-before' : 'never',
'selector-max-empty-lines' : 0,
'selector-pseudo-class-case' : 'lower',
'selector-pseudo-class-no-unknown' : true,
'selector-pseudo-class-parentheses-space-inside' : 'never',
'selector-pseudo-element-case' : 'lower',
'selector-pseudo-element-colon-notation' : 'single',
'selector-pseudo-element-no-unknown' : true,
'selector-type-case' : 'lower',
'selector-type-no-unknown' : [true, { ignoreTypes: ['from', 'to', '0%', '50%', '100%', '_'] }],
'shorthand-property-no-redundant-values' : true,
'string-no-newline' : true,
'string-quotes' : 'single',
'time-min-milliseconds' : 100,
'unit-case' : 'lower',
'unit-whitelist' : ['px', 'em', 'rem', '%', 'vw', 'vh', 'deg', 'ms', 's', 'fr'],
'value-keyword-case' : 'lower',
'value-list-comma-newline-after' : 'never-multi-line',
'value-list-comma-newline-before' : 'never-multi-line',
'value-list-comma-space-after' : 'always',
'value-list-comma-space-before' : 'never',
}
};
23 changes: 11 additions & 12 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ module.exports = {
'at-rule-semicolon-newline-after' : 'always',
'block-closing-brace-newline-after' : 'always',
'block-closing-brace-newline-before' : 'always',
'block-no-empty' : true,
'block-no-empty' : null,
'block-opening-brace-newline-after' : 'always',
'block-opening-brace-space-before' : 'always',
'color-hex-case' : 'lower',
'color-named' : 'never',
'color-no-hex' : true,
'color-no-hex' : null,
'color-no-invalid-hex' : true,
'declaration-bang-space-after' : 'never',
'declaration-bang-space-before' : 'always',
Expand All @@ -26,15 +25,15 @@ module.exports = {
'declaration-block-trailing-semicolon' : 'always',
'declaration-colon-space-after' : 'always',
'declaration-colon-space-before' : 'never',
'font-family-name-quotes' : 'always-unless-keyword',
'font-family-name-quotes' : null,
'function-calc-no-unspaced-operator' : true,
'function-comma-space-after' : 'always',
'function-comma-space-before' : 'never',
'function-name-case' : 'lower',
'function-parentheses-space-inside' : 'never',
'function-url-quotes' : 'always',
'function-url-quotes' : null,
'indentation' : 4,
'max-empty-lines' : 1,
'max-empty-lines' : 5,
'media-feature-colon-space-after' : 'always',
'media-feature-colon-space-before' : 'never',
'media-feature-range-operator-space-after' : 'always',
Expand All @@ -43,15 +42,15 @@ module.exports = {
'media-query-list-comma-newline-before' : 'never-multi-line',
'media-query-list-comma-space-after' : 'always',
'media-query-list-comma-space-before' : 'never',
'no-duplicate-selectors' : true,
'no-eol-whitespace' : true,
'no-extra-semicolons' : true,
'no-invalid-double-slash-comments' : true,
'no-duplicate-selectors' : null,
'no-eol-whitespace' : null,
'no-extra-semicolons' : null,
'no-invalid-double-slash-comments' : null,
'number-leading-zero' : 'always',
'number-max-precision' : 3,
'number-no-trailing-zeros' : true,
'property-case' : 'lower',
'rule-empty-line-before' : ['always', { ignore: ['after-comment'], except: ['inside-block-and-after-rule', 'first-nested'] }],
// 'rule-empty-line-before' : ['always', { ignore: ['after-comment'], except: ['inside-block-and-after-rule', 'first-nested'] }],
'selector-attribute-brackets-space-inside' : 'never',
'selector-attribute-operator-space-after' : 'never',
'selector-attribute-operator-space-before' : 'never',
Expand All @@ -72,7 +71,7 @@ module.exports = {
'selector-type-case' : 'lower',
'selector-type-no-unknown' : [true, { ignoreTypes: ['from', 'to', '0%', '50%', '100%', '_'] }],
'shorthand-property-no-redundant-values' : true,
'string-no-newline' : true,
'string-no-newline' : null,
'string-quotes' : 'single',
'time-min-milliseconds' : 100,
'unit-case' : 'lower',
Expand Down
22 changes: 0 additions & 22 deletions Gruntfile.js

This file was deleted.

10 changes: 5 additions & 5 deletions build/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = function (grunt) {
livereload: {
options: {
hostname : '0.0.0.0',
port : 443,
port : 8090,
protocol : 'https',
base : 'dist',
open : {
Expand Down Expand Up @@ -46,10 +46,10 @@ module.exports = function (grunt) {

middlewares.push((req, res) => {
const path_404 = `${options.base[0]}/404.html`;
if (grunt.file.exists(path_404)) {
require('fs').createReadStream(path_404).pipe(res);
return;
}
// if (grunt.file.exists(path_404)) {
// require('fs').createReadStream(path_404).pipe(res);
// return;
// }
res.statusCode(404); // 404.html not found
res.end();
});
Expand Down
5 changes: 4 additions & 1 deletion build/mochaTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ module.exports = {
'mock-local-storage',
],
},
src: [
spec: [
'src/javascript/**/__tests__/*.js',
'scripts/__tests__/*.js',
],
},
};


// NODE_ENV=test ./node_modules/mocha/bin/mocha '*/**/__tests__/**/*.js' --reporter spec --exclude 'node_modules/**/*
24 changes: 12 additions & 12 deletions build/postcss.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module.exports = function (grunt) {
return {
options: {
processors: [
require('autoprefixer')({ browsers: ['last 2 version', 'last 5 iOS versions', 'last 3 Safari versions'] })
],
},
dist: {
src: `${global.dist}/css/{app,common,static}.css`,
},
};
};
// module.exports = function (grunt) {
// return {
// options: {
// processors: [
// require('autoprefixer')({ browsers: ['last 2 version', 'last 5 iOS versions', 'last 3 Safari versions'] })
// ],
// },
// dist: {
// src: `${global.dist}/css/{app,common,static}.css`,
// },
// };
// };
32 changes: 16 additions & 16 deletions build/sass.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
const sass = require('node-sass');
// const sass = require('sass');

module.exports = {
app: {
options: {
style: 'expanded',
implementation: sass,
},
files: [{
cwd : 'src/sass',
dest : `${global.dist}/css`,
expand: true,
ext : '.css',
src : ['*.scss'],
}]
}
};
// module.exports = {
// app: {
// options: {
// style: 'expanded',
// implementation: sass,
// },
// files: [{
// cwd : 'src/sass',
// dest : `${global.dist}/css`,
// expand: true,
// ext : '.css',
// src : ['*.scss'],
// }]
// }
// };
24 changes: 12 additions & 12 deletions build/stylelint.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const stylelintFormatter = require('stylelint-formatter-pretty');
// const stylelintFormatter = require('stylelint-formatter-pretty');

module.exports = {
options: {
formatter: stylelintFormatter
},
all: {
src: [
'src/sass/**/*.scss',
'!src/sass/**/external/**/*.scss',
],
},
};
// module.exports = {
// options: {
// formatter: stylelintFormatter
// },
// all: {
// src: [
// 'src/sass/**/*.scss',
// '!src/sass/**/external/**/*.scss',
// ],
// },
// };
42 changes: 21 additions & 21 deletions build/watch.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
module.exports = function (grunt){
return {
css: {
files: ['src/sass/**/*.scss'],
tasks: ['stylelint', 'css']
},
landing_pages: {
files: ['src/javascript/landing_pages/*.js'],
tasks: ['babel:landing_pages']
},
options: {
spawn : false,
interrupt : true,
debounceDelay: 250,
livereload: {
key : grunt.file.read('node_modules/grunt-contrib-connect/tasks/certs/server.key'),
cert: grunt.file.read('node_modules/grunt-contrib-connect/tasks/certs/server.crt')
},
}
};
};
// module.exports = function (grunt){
// return {
// css: {
// files: ['src/sass/**/*.scss'],
// tasks: ['stylelint', 'css']
// },
// landing_pages: {
// files: ['src/javascript/landing_pages/*.js'],
// tasks: ['babel:landing_pages']
// },
// options: {
// spawn : false,
// interrupt : true,
// debounceDelay: 250,
// livereload: {
// key : grunt.file.read('node_modules/grunt-contrib-connect/tasks/certs/server.key'),
// cert: grunt.file.read('node_modules/grunt-contrib-connect/tasks/certs/server.crt')
// },
// }
// };
// };
24 changes: 0 additions & 24 deletions build/webpack.js

This file was deleted.

Empty file added mocha.config.js
Empty file.
Loading

0 comments on commit d678fb8

Please sign in to comment.