Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Commit

Permalink
Added ESLint and Grunt for creating static files
Browse files Browse the repository at this point in the history
  • Loading branch information
Glennmen committed Jun 25, 2017
1 parent a85d5b7 commit 8578440
Show file tree
Hide file tree
Showing 37 changed files with 4,886 additions and 4,149 deletions.
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**/vendor/**
**/dist/**
**/node_modules/**
**/server.js
**/venv/**
Gruntfile.js
55 changes: 55 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"extends": "standard",
"parserOptions": {
"ecmaFeatures": {
"jsx": false
},
"ecmaVersion": 6,
"sourceType": "module"
},
"rules": {
"indent": ["error", 4, {
"SwitchCase": 1
}],
"space-before-function-paren": ["error", {
"anonymous": "always",
"named": "never",
"asyncArrow": "ignore"
}],
"no-multiple-empty-lines": ["error", {
"max": 2
}]
},
"env": {
"browser": true,
"jquery": true
},
"globals": {
"toastr": true,
"google": true,
"mapData": true,
"Store": true,
"centerLat": true,
"centerLng": true,
"zoom": true,
"showConfig": true,
"pageLoaded": true,
"countMarkers": true,
"skel": true,
"setupPokemonMarker": true,

"isTouchDevice": true,
"isMobileDevice": true,
"pokemonSprites": true,
"noLabelsStyle": true,
"darkStyle": true,
"light2Style": true,
"pGoStyle": true,
"darkStyleNoLabels": true,
"light2StyleNoLabels": true,
"pGoStyleNoLabels": true,
"pGoStyleDay": true,
"pGoStyleNight": true,
"moment": false
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

#PMSF
/.sass-cache/
/node_modules/
1 change: 1 addition & 0 deletions .idea/MSF.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 0 additions & 43 deletions .idea/watcherTasks.xml

This file was deleted.

128 changes: 128 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
module.exports = function(grunt) {

// load plugins as needed instead of up front
require('jit-grunt')(grunt);

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

sass: {
dist: {
files: {
'static/dist/css/app.built.css': 'static/sass/main.scss',
'static/dist/css/mobile.built.css': 'static/sass/mobile.scss',
'static/dist/css/statistics.built.css': 'static/css/statistics.css',
'static/dist/css/status.built.css': 'static/sass/status.scss'
}
}
},
eslint: {
src: ['static/js/*.js', '!js/vendor/**/*.js']
},
babel: {
options: {
sourceMap: true,
presets: ['es2015']
},
dist: {
files: {
'static/dist/js/app.built.js': 'static/js/app.js',
'static/dist/js/map.built.js': 'static/js/map.js',
'static/dist/js/map.common.built.js': 'static/js/map.common.js',
'static/dist/js/mobile.built.js': 'static/js/mobile.js',
'static/dist/js/stats.built.js': 'static/js/stats.js',
'static/dist/js/statistics.built.js': 'static/js/statistics.js',
'static/dist/js/status.built.js': 'static/js/status.js'
}
}
},
uglify: {
options: {
banner: '/*\n <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> \n*/\n',
sourceMap: true,
compress: {
unused: false
}
},
build: {
files: {
'static/dist/js/app.min.js': 'static/dist/js/app.built.js',
'static/dist/js/map.min.js': 'static/dist/js/map.built.js',
'static/dist/js/map.common.min.js': 'static/dist/js/map.common.built.js',
'static/dist/js/mobile.min.js': 'static/dist/js/mobile.built.js',
'static/dist/js/stats.min.js': 'static/dist/js/stats.built.js',
'static/dist/js/statistics.min.js': 'static/dist/js/statistics.built.js',
'static/dist/js/status.min.js': 'static/dist/js/status.built.js'
}
}
},
minjson: {
build: {
files: {
'static/dist/data/pokemon.min.json': 'static/data/pokemon.json',
'static/dist/data/moves.min.json': 'static/data/moves.json',
'static/dist/data/mapstyle.min.json': 'static/data/mapstyle.json',
'static/dist/data/searchmarkerstyle.min.json': 'static/data/searchmarkerstyle.json',
'static/dist/locales/de.min.json': 'static/locales/de.json',
'static/dist/locales/fr.min.json': 'static/locales/fr.json',
'static/dist/locales/ja.min.json': 'static/locales/ja.json',
'static/dist/locales/ko.min.json': 'static/locales/ko.json',
'static/dist/locales/pt_br.min.json': 'static/locales/pt_br.json',
'static/dist/locales/ru.min.json': 'static/locales/ru.json',
'static/dist/locales/zh_cn.min.json': 'static/locales/zh_cn.json',
'static/dist/locales/zh_tw.min.json': 'static/locales/zh_tw.json',
'static/dist/locales/zh_hk.min.json': 'static/locales/zh_hk.json'
}
}
},
clean: {
build: {
src: 'static/dist'
}
},
watch: {
options: {
interval: 1000,
spawn: true
},
js: {
files: ['static/js/**/*.js'],
options: { livereload: true },
tasks: ['js-lint', 'js-build']
},
json: {
files: ['static/data/*.json', 'static/locales/*.json'],
options: { livereload: true },
tasks: ['json']
},
css: {
files: '**/*.scss',
options: { livereload: true },
tasks: ['css-build']
}
},
cssmin: {
options: {
banner: '/*\n <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> \n*/\n'
},
build: {
files: {
'static/dist/css/app.min.css': 'static/dist/css/app.built.css',
'static/dist/css/mobile.min.css': 'static/dist/css/mobile.built.css',
'static/dist/css/statistics.min.css': 'static/dist/css/statistics.built.css',
'static/dist/css/status.min.css': 'static/dist/css/status.built.css'
}
}
}
});

grunt.registerTask('js-build', ['newer:babel', 'newer:uglify']);
grunt.registerTask('css-build', ['newer:sass', 'newer:cssmin']);
grunt.registerTask('js-lint', ['newer:eslint']);
grunt.registerTask('json', ['newer:minjson']);

grunt.registerTask('build', ['clean', 'js-build', 'css-build', 'json']);
grunt.registerTask('lint', ['js-lint']);
grunt.registerTask('default', ['build', 'watch']);

};
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ class="onoffswitch-checkbox"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
<script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
<script src="static/js/app.js"></script>
<script src="static/dist/js/app.min.js"></script>
<script src="static/js/vendor/classie.js"></script>
<script>
var centerLat = <?= $startingLat; ?>;
Expand All @@ -432,7 +432,7 @@ class="onoffswitch-checkbox"/>
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
<script src="static/js/map.common.js"></script>
<script src="static/js/map.js"></script>
<script src="static/dist/js/map.min.js"></script>
<script src="static/dist/js/stats.min.js"></script>
<script defer
src="https://maps.googleapis.com/maps/api/js?key=<?= $gmapsKey ?>&amp;callback=initMap&amp;libraries=places,geometry"></script>
Expand Down
Loading

0 comments on commit 8578440

Please sign in to comment.