added eslint
parent
313518413a
commit
6dc438dd46
|
@ -0,0 +1,47 @@
|
||||||
|
{
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"rules": {
|
||||||
|
"array-bracket-spacing": ["error", "never"],
|
||||||
|
"brace-style": "error",
|
||||||
|
"comma-dangle": ["error", "always-multiline"],
|
||||||
|
"comma-style": ["error", "last"],
|
||||||
|
"computed-property-spacing": ["error", "never"],
|
||||||
|
"curly": ["error", "all"],
|
||||||
|
"eqeqeq": ["error", "always"],
|
||||||
|
"func-call-spacing": ["error", "never"],
|
||||||
|
"func-style": ["error", "declaration"],
|
||||||
|
"indent": ["error", "tab"],
|
||||||
|
"key-spacing": ["error", {
|
||||||
|
"afterColon": true,
|
||||||
|
"mode": "minimum",
|
||||||
|
}],
|
||||||
|
"keyword-spacing": ["error", {
|
||||||
|
"before": true,
|
||||||
|
"after": true
|
||||||
|
}],
|
||||||
|
"linebreak-style": ["error", "unix"],
|
||||||
|
"object-curly-newline": ["error", {
|
||||||
|
"minProperties": 1
|
||||||
|
}],
|
||||||
|
"no-mixed-spaces-and-tabs": "error",
|
||||||
|
"no-multi-spaces": "error",
|
||||||
|
"padded-blocks": ["error", "never"],
|
||||||
|
"padding-line-between-statements": ["error",
|
||||||
|
{ "blankLine": "always", "prev": "*", "next": "return" }
|
||||||
|
],
|
||||||
|
"quote-props": ["error", "as-needed"],
|
||||||
|
"quotes": ["error", "single"],
|
||||||
|
"semi-spacing": ["error", {
|
||||||
|
"before": false,
|
||||||
|
"after": true
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"angular": true,
|
||||||
|
"gtag": true,
|
||||||
|
"hljs": true,
|
||||||
|
"JSZip": true,
|
||||||
|
"Masonry": true,
|
||||||
|
"saveAs": true
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,6 +22,7 @@
|
||||||
"angular-tooltips": "^1.2.2",
|
"angular-tooltips": "^1.2.2",
|
||||||
"autoprefixer": "^8.6.4",
|
"autoprefixer": "^8.6.4",
|
||||||
"bootstrap": "^4.1.1",
|
"bootstrap": "^4.1.1",
|
||||||
|
"eslint": "^5.9.0",
|
||||||
"highlight.js": "^9.12.0",
|
"highlight.js": "^9.12.0",
|
||||||
"node-sass": "^4.9.0",
|
"node-sass": "^4.9.0",
|
||||||
"postcss-cli": "^5.0.1"
|
"postcss-cli": "^5.0.1"
|
||||||
|
@ -42,8 +43,11 @@
|
||||||
|
|
||||||
"autoprefixer": "postcss public/assets/css/app.min.css --use autoprefixer --no-map --replace --verbose",
|
"autoprefixer": "postcss public/assets/css/app.min.css --use autoprefixer --no-map --replace --verbose",
|
||||||
|
|
||||||
"test": "start-server-and-test start http://localhost:8080 cypress:run",
|
"lint": "eslint public/assets/js/app.js",
|
||||||
"test:debug": "start-server-and-test start http://localhost:8080 cypress:open",
|
"lint:fix": "npm run lint -- --fix",
|
||||||
|
|
||||||
|
"test": "npm run lint && start-server-and-test start http://localhost:8080 cypress:run",
|
||||||
|
"test:debug": "npm run lint && start-server-and-test start http://localhost:8080 cypress:open",
|
||||||
|
|
||||||
"cypress:run": "cypress run",
|
"cypress:run": "cypress run",
|
||||||
"cypress:open": "cypress open"
|
"cypress:open": "cypress open"
|
||||||
|
|
|
@ -1,6 +1,91 @@
|
||||||
(function() {
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var repeat = function(string, count) {
|
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('NginxConfigIoApp', ['ngclipboard', '720kb.tooltips'])
|
||||||
|
.config(nginxCongigIoConfig)
|
||||||
|
.config(tooltipsConfig)
|
||||||
|
.directive('ngIncludeTabs', ngIncludeTabs)
|
||||||
|
.controller('NginxConfigIoController', NginxConfigIoController);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var DEFAULTS = {
|
||||||
|
ipv4: '*',
|
||||||
|
ipv6: '::',
|
||||||
|
|
||||||
|
domain: '',
|
||||||
|
path: '',
|
||||||
|
document_root: '/public',
|
||||||
|
|
||||||
|
https: true,
|
||||||
|
http2: true,
|
||||||
|
|
||||||
|
redirect: true,
|
||||||
|
force_https: true,
|
||||||
|
|
||||||
|
cert_type: 'letsencrypt',
|
||||||
|
ssl_profile: 'intermediate',
|
||||||
|
hsts: true,
|
||||||
|
hsts_subdomains: true,
|
||||||
|
hsts_preload: true,
|
||||||
|
email: '',
|
||||||
|
ssl_certificate: '',
|
||||||
|
ssl_certificate_key: '',
|
||||||
|
|
||||||
|
resolver_cloudflare: true,
|
||||||
|
resolver_google: true,
|
||||||
|
resolver_opendns: true,
|
||||||
|
|
||||||
|
non_www: true,
|
||||||
|
cdn: false,
|
||||||
|
|
||||||
|
index: 'index.php',
|
||||||
|
fallback_html: false,
|
||||||
|
fallback_php: true,
|
||||||
|
fallback_php_path: '/api/',
|
||||||
|
|
||||||
|
php: true,
|
||||||
|
php_server: '/var/run/php/php7.2-fpm.sock',
|
||||||
|
php_server_backup: '',
|
||||||
|
wordpress: false,
|
||||||
|
drupal: false,
|
||||||
|
|
||||||
|
file_structure: 'modularized',
|
||||||
|
|
||||||
|
referrer_policy: 'no-referrer-when-downgrade',
|
||||||
|
content_security_policy: 'default-src * data: \'unsafe-eval\' \'unsafe-inline\'',
|
||||||
|
|
||||||
|
worker_processes: 'auto',
|
||||||
|
user: 'www-data',
|
||||||
|
pid: '/run/nginx.pid',
|
||||||
|
|
||||||
|
access_log: '/var/log/nginx/access.log',
|
||||||
|
error_log: '/var/log/nginx/error.log warn',
|
||||||
|
access_log_domain: false,
|
||||||
|
error_log_domain: false,
|
||||||
|
|
||||||
|
client_max_body_size: 16,
|
||||||
|
gzip: true,
|
||||||
|
server_tokens: false,
|
||||||
|
log_not_found: false,
|
||||||
|
limit_req: false,
|
||||||
|
|
||||||
|
expires_assets: '7d',
|
||||||
|
expires_media: '7d',
|
||||||
|
expires_svg: '7d',
|
||||||
|
expires_fonts: '7d',
|
||||||
|
|
||||||
|
proxy: false,
|
||||||
|
proxy_path: '/',
|
||||||
|
proxy_pass: 'http://127.0.0.1:3000',
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function repeat(string, count) {
|
||||||
var repeatedString = '';
|
var repeatedString = '';
|
||||||
|
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
|
@ -8,18 +93,49 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return repeatedString;
|
return repeatedString;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
angular
|
function tooltipsConfig(tooltipsConfProvider) {
|
||||||
.module('NginxConfigIoApp', ['ngclipboard', '720kb.tooltips'])
|
tooltipsConfProvider.configure({
|
||||||
.config(function NginxCongigIoConfig($locationProvider) {
|
side: 'right',
|
||||||
|
size: 'small',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function nginxCongigIoConfig($locationProvider) {
|
||||||
$locationProvider
|
$locationProvider
|
||||||
.html5Mode(true)
|
.html5Mode(true)
|
||||||
.hashPrefix('!');
|
.hashPrefix('!');
|
||||||
})
|
}
|
||||||
.controller('NginxConfigIoController', function NginxConfigIoController($scope, $window, $location, $timeout) {
|
|
||||||
|
|
||||||
|
|
||||||
|
function ngIncludeTabs() {
|
||||||
|
return {
|
||||||
|
require: 'ngInclude',
|
||||||
|
restrict: 'A',
|
||||||
|
link: {
|
||||||
|
pre: function preLink(scope, iElement, iAttrs, controller) {
|
||||||
|
var tabs = parseInt(iAttrs.ngIncludeTabs || 0);
|
||||||
|
|
||||||
|
var startRegex = new RegExp(repeat('\t', tabs - 1));
|
||||||
|
|
||||||
|
controller.template = controller.template
|
||||||
|
.replace(/^(.*)$/mg, repeat('\t', tabs) + '$1')
|
||||||
|
.replace(startRegex, '')
|
||||||
|
.replace(/\s*$/, '');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function NginxConfigIoController($scope, $window, $location, $timeout) {
|
||||||
///////////////////////
|
///////////////////////
|
||||||
// PRIVATE VARIABLES //
|
// PRIVATE VARIABLES //
|
||||||
///////////////////////
|
///////////////////////
|
||||||
|
@ -30,76 +146,7 @@
|
||||||
/////////////////////
|
/////////////////////
|
||||||
// SCOPE VARIABLES //
|
// SCOPE VARIABLES //
|
||||||
/////////////////////
|
/////////////////////
|
||||||
$scope.defaultData = {
|
$scope.defaultData = DEFAULTS;
|
||||||
ipv4: '*',
|
|
||||||
ipv6: '::',
|
|
||||||
|
|
||||||
domain: '',
|
|
||||||
path: '',
|
|
||||||
document_root: '/public',
|
|
||||||
|
|
||||||
https: true,
|
|
||||||
http2: true,
|
|
||||||
|
|
||||||
redirect: true,
|
|
||||||
force_https: true,
|
|
||||||
|
|
||||||
cert_type: 'letsencrypt',
|
|
||||||
ssl_profile: 'intermediate',
|
|
||||||
hsts: true,
|
|
||||||
hsts_subdomains: true,
|
|
||||||
hsts_preload: true,
|
|
||||||
email: '',
|
|
||||||
ssl_certificate: '',
|
|
||||||
ssl_certificate_key:'',
|
|
||||||
|
|
||||||
resolver_cloudflare:true,
|
|
||||||
resolver_google: true,
|
|
||||||
resolver_opendns: true,
|
|
||||||
|
|
||||||
non_www: true,
|
|
||||||
cdn: false,
|
|
||||||
|
|
||||||
index: 'index.php',
|
|
||||||
fallback_html: false,
|
|
||||||
fallback_php: true,
|
|
||||||
fallback_php_path: '/api/',
|
|
||||||
|
|
||||||
php: true,
|
|
||||||
php_server: '/var/run/php/php7.2-fpm.sock',
|
|
||||||
php_server_backup: '',
|
|
||||||
wordpress: false,
|
|
||||||
drupal: false,
|
|
||||||
|
|
||||||
file_structure: 'modularized',
|
|
||||||
|
|
||||||
referrer_policy: 'no-referrer-when-downgrade',
|
|
||||||
content_security_policy: 'default-src * data: \'unsafe-eval\' \'unsafe-inline\'',
|
|
||||||
|
|
||||||
worker_processes: 'auto',
|
|
||||||
user: 'www-data',
|
|
||||||
pid: '/run/nginx.pid',
|
|
||||||
|
|
||||||
access_log: '/var/log/nginx/access.log',
|
|
||||||
error_log: '/var/log/nginx/error.log warn',
|
|
||||||
access_log_domain: false,
|
|
||||||
error_log_domain: false,
|
|
||||||
|
|
||||||
client_max_body_size: 16,
|
|
||||||
gzip: true,
|
|
||||||
server_tokens: false,
|
|
||||||
log_not_found: false,
|
|
||||||
limit_req: false,
|
|
||||||
|
|
||||||
expires_assets: '7d',
|
|
||||||
expires_media: '7d',
|
|
||||||
expires_svg: '7d',
|
|
||||||
expires_fonts: '7d',
|
|
||||||
|
|
||||||
proxy: false,
|
|
||||||
proxy_path: '/',
|
|
||||||
proxy_pass: 'http://127.0.0.1:3000',
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.location = $location;
|
$scope.location = $location;
|
||||||
$scope.data = angular.copy($scope.defaultData);
|
$scope.data = angular.copy($scope.defaultData);
|
||||||
|
@ -120,7 +167,7 @@
|
||||||
docs: 'pdf|' +
|
docs: 'pdf|' +
|
||||||
'docx?|dotx?|docm|dotm|' +
|
'docx?|dotx?|docm|dotm|' +
|
||||||
'xlsx?|xltx?|xlsm|xltm|' +
|
'xlsx?|xltx?|xlsm|xltm|' +
|
||||||
'pptx?|potx?|pptm|potm|ppsx?'
|
'pptx?|potx?|pptm|potm|ppsx?',
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.gzipTypes = 'text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml';
|
$scope.gzipTypes = 'text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml';
|
||||||
|
@ -271,13 +318,14 @@
|
||||||
zip.file(name, content);
|
zip.file(name, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
zip.generateAsync({ type: 'blob' })
|
zip.generateAsync({
|
||||||
.then(function(content) {
|
type: 'blob',
|
||||||
saveAs(content, 'nginxconfig.io-' + $scope.domain() + '.zip');
|
}).then(function(content) {
|
||||||
});
|
saveAs(content, 'nginxconfig.io-' + $scope.domain() + '.zip');
|
||||||
|
});
|
||||||
|
|
||||||
gtag('event', $scope.domain(), {
|
gtag('event', $scope.domain(), {
|
||||||
event_category: 'download_zip'
|
event_category: 'download_zip',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -311,7 +359,7 @@
|
||||||
percentPosition: true,
|
percentPosition: true,
|
||||||
initLayout: false,
|
initLayout: false,
|
||||||
stagger: 0,
|
stagger: 0,
|
||||||
transitionDuration: '0.6s'
|
transitionDuration: '0.6s',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -327,29 +375,29 @@
|
||||||
$scope.data.index = $scope.defaultData.index;
|
$scope.data.index = $scope.defaultData.index;
|
||||||
$scope.data.fallback_html = $scope.defaultData.fallback_html;
|
$scope.data.fallback_html = $scope.defaultData.fallback_html;
|
||||||
|
|
||||||
switch(preset) {
|
switch (preset) {
|
||||||
case 'frontend':
|
case 'frontend':
|
||||||
$scope.data.php = false;
|
$scope.data.php = false;
|
||||||
$scope.data.index = 'index.html';
|
$scope.data.index = 'index.html';
|
||||||
$scope.data.fallback_html = true;
|
$scope.data.fallback_html = true;
|
||||||
break;
|
break;
|
||||||
case 'backend':
|
case 'backend':
|
||||||
$scope.data.index = 'index.php';
|
$scope.data.index = 'index.php';
|
||||||
break;
|
break;
|
||||||
case 'spa':
|
case 'spa':
|
||||||
$scope.data.index = 'index.html';
|
$scope.data.index = 'index.html';
|
||||||
$scope.data.fallback_html = true;
|
$scope.data.fallback_html = true;
|
||||||
break;
|
break;
|
||||||
case 'wordpress':
|
case 'wordpress':
|
||||||
$scope.data.wordpress = true;
|
$scope.data.wordpress = true;
|
||||||
break;
|
break;
|
||||||
case 'drupal':
|
case 'drupal':
|
||||||
$scope.data.drupal = true;
|
$scope.data.drupal = true;
|
||||||
break;
|
break;
|
||||||
case 'nodejs':
|
case 'nodejs':
|
||||||
$scope.data.php = false;
|
$scope.data.php = false;
|
||||||
$scope.data.proxy = true;
|
$scope.data.proxy = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtag('event', preset, {
|
gtag('event', preset, {
|
||||||
|
@ -568,30 +616,5 @@
|
||||||
//////////
|
//////////
|
||||||
$scope.setDataFromHash();
|
$scope.setDataFromHash();
|
||||||
$scope.initMasonry();
|
$scope.initMasonry();
|
||||||
})
|
}
|
||||||
.config(['tooltipsConfProvider', function (tooltipsConfProvider) {
|
|
||||||
tooltipsConfProvider.configure({
|
|
||||||
side: 'right',
|
|
||||||
size: 'small',
|
|
||||||
});
|
|
||||||
}])
|
|
||||||
.directive('ngIncludeTabs', function () {
|
|
||||||
return {
|
|
||||||
require: 'ngInclude',
|
|
||||||
restrict: 'A',
|
|
||||||
link: {
|
|
||||||
pre: function preLink(scope, iElement, iAttrs, controller) {
|
|
||||||
var tabs = parseInt(iAttrs.ngIncludeTabs || 0);
|
|
||||||
|
|
||||||
var startRegex = new RegExp(repeat('\t', tabs - 1));
|
|
||||||
|
|
||||||
controller.template = controller.template
|
|
||||||
.replace(/^(.*)$/mg, repeat('\t', tabs) + '$1')
|
|
||||||
.replace(startRegex, '')
|
|
||||||
.replace(/\s*$/, '');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in New Issue