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",
|
||||
"autoprefixer": "^8.6.4",
|
||||
"bootstrap": "^4.1.1",
|
||||
"eslint": "^5.9.0",
|
||||
"highlight.js": "^9.12.0",
|
||||
"node-sass": "^4.9.0",
|
||||
"postcss-cli": "^5.0.1"
|
||||
|
@ -42,8 +43,11 @@
|
|||
|
||||
"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",
|
||||
"test:debug": "start-server-and-test start http://localhost:8080 cypress:open",
|
||||
"lint": "eslint public/assets/js/app.js",
|
||||
"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:open": "cypress open"
|
||||
|
|
|
@ -1,6 +1,91 @@
|
|||
(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 = '';
|
||||
|
||||
for (var i = 0; i < count; i++) {
|
||||
|
@ -8,18 +93,49 @@
|
|||
}
|
||||
|
||||
return repeatedString;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
angular
|
||||
.module('NginxConfigIoApp', ['ngclipboard', '720kb.tooltips'])
|
||||
.config(function NginxCongigIoConfig($locationProvider) {
|
||||
function tooltipsConfig(tooltipsConfProvider) {
|
||||
tooltipsConfProvider.configure({
|
||||
side: 'right',
|
||||
size: 'small',
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
function nginxCongigIoConfig($locationProvider) {
|
||||
$locationProvider
|
||||
.html5Mode(true)
|
||||
.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 //
|
||||
///////////////////////
|
||||
|
@ -30,76 +146,7 @@
|
|||
/////////////////////
|
||||
// SCOPE VARIABLES //
|
||||
/////////////////////
|
||||
$scope.defaultData = {
|
||||
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.defaultData = DEFAULTS;
|
||||
|
||||
$scope.location = $location;
|
||||
$scope.data = angular.copy($scope.defaultData);
|
||||
|
@ -120,7 +167,7 @@
|
|||
docs: 'pdf|' +
|
||||
'docx?|dotx?|docm|dotm|' +
|
||||
'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';
|
||||
|
@ -271,13 +318,14 @@
|
|||
zip.file(name, content);
|
||||
}
|
||||
|
||||
zip.generateAsync({ type: 'blob' })
|
||||
.then(function(content) {
|
||||
saveAs(content, 'nginxconfig.io-' + $scope.domain() + '.zip');
|
||||
});
|
||||
zip.generateAsync({
|
||||
type: 'blob',
|
||||
}).then(function(content) {
|
||||
saveAs(content, 'nginxconfig.io-' + $scope.domain() + '.zip');
|
||||
});
|
||||
|
||||
gtag('event', $scope.domain(), {
|
||||
event_category: 'download_zip'
|
||||
event_category: 'download_zip',
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -311,7 +359,7 @@
|
|||
percentPosition: true,
|
||||
initLayout: false,
|
||||
stagger: 0,
|
||||
transitionDuration: '0.6s'
|
||||
transitionDuration: '0.6s',
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -327,29 +375,29 @@
|
|||
$scope.data.index = $scope.defaultData.index;
|
||||
$scope.data.fallback_html = $scope.defaultData.fallback_html;
|
||||
|
||||
switch(preset) {
|
||||
case 'frontend':
|
||||
$scope.data.php = false;
|
||||
$scope.data.index = 'index.html';
|
||||
$scope.data.fallback_html = true;
|
||||
break;
|
||||
case 'backend':
|
||||
$scope.data.index = 'index.php';
|
||||
break;
|
||||
case 'spa':
|
||||
$scope.data.index = 'index.html';
|
||||
$scope.data.fallback_html = true;
|
||||
break;
|
||||
case 'wordpress':
|
||||
$scope.data.wordpress = true;
|
||||
break;
|
||||
case 'drupal':
|
||||
$scope.data.drupal = true;
|
||||
break;
|
||||
case 'nodejs':
|
||||
$scope.data.php = false;
|
||||
$scope.data.proxy = true;
|
||||
break;
|
||||
switch (preset) {
|
||||
case 'frontend':
|
||||
$scope.data.php = false;
|
||||
$scope.data.index = 'index.html';
|
||||
$scope.data.fallback_html = true;
|
||||
break;
|
||||
case 'backend':
|
||||
$scope.data.index = 'index.php';
|
||||
break;
|
||||
case 'spa':
|
||||
$scope.data.index = 'index.html';
|
||||
$scope.data.fallback_html = true;
|
||||
break;
|
||||
case 'wordpress':
|
||||
$scope.data.wordpress = true;
|
||||
break;
|
||||
case 'drupal':
|
||||
$scope.data.drupal = true;
|
||||
break;
|
||||
case 'nodejs':
|
||||
$scope.data.php = false;
|
||||
$scope.data.proxy = true;
|
||||
break;
|
||||
}
|
||||
|
||||
gtag('event', preset, {
|
||||
|
@ -568,30 +616,5 @@
|
|||
//////////
|
||||
$scope.setDataFromHash();
|
||||
$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