2016-11-14 16:16:51 +03:00
|
|
|
/* eslint-env node */
|
2017-01-04 18:40:56 +03:00
|
|
|
/* eslint-disable object-shorthand */
|
2017-03-30 15:27:01 +03:00
|
|
|
'use strict';
|
2016-05-24 15:07:31 +03:00
|
|
|
|
2018-01-05 18:38:23 +03:00
|
|
|
module.exports = function (grunt) {
|
2016-05-24 15:07:31 +03:00
|
|
|
// Find all of the task which start with `grunt-` and load them, rather than explicitly declaring them all
|
|
|
|
require('matchdep').filterDev(['grunt-*', '!grunt-cli']).forEach(grunt.loadNpmTasks);
|
|
|
|
|
|
|
|
grunt.initConfig({
|
2016-07-14 14:43:49 +03:00
|
|
|
clean: {
|
|
|
|
built: {
|
2018-03-19 20:56:09 +03:00
|
|
|
src: ['dist/**']
|
2016-07-14 14:43:49 +03:00
|
|
|
},
|
|
|
|
dependencies: {
|
2018-03-19 20:56:09 +03:00
|
|
|
src: ['node_modules/**']
|
2016-07-14 14:43:49 +03:00
|
|
|
},
|
|
|
|
tmp: {
|
|
|
|
src: ['tmp/**']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-08-06 12:26:24 +03:00
|
|
|
watch: {
|
|
|
|
csscomb: {
|
|
|
|
files: ['app/styles/**/*.css'],
|
|
|
|
tasks: ['shell:csscombfix']
|
2016-08-03 10:54:24 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-05-24 15:07:31 +03:00
|
|
|
shell: {
|
2016-06-18 20:30:35 +03:00
|
|
|
'npm-install': {
|
2017-04-04 13:36:17 +03:00
|
|
|
command: 'yarn install'
|
2016-06-18 20:30:35 +03:00
|
|
|
},
|
|
|
|
|
2016-08-03 10:54:24 +03:00
|
|
|
ember: {
|
|
|
|
command: function (mode) {
|
2017-03-30 15:27:01 +03:00
|
|
|
let liveReloadBaseUrl = grunt.option('live-reload-base-url') || '/ghost/';
|
|
|
|
|
2016-08-03 10:54:24 +03:00
|
|
|
switch (mode) {
|
2016-11-14 16:16:51 +03:00
|
|
|
case 'prod':
|
|
|
|
return 'npm run build -- --environment=production --silent';
|
|
|
|
case 'dev':
|
|
|
|
return 'npm run build';
|
2017-03-16 17:39:57 +03:00
|
|
|
case 'watch':
|
2017-03-30 15:27:01 +03:00
|
|
|
return `npm run start -- --live-reload-base-url=${liveReloadBaseUrl} --live-reload-port=4201`;
|
2016-08-03 10:54:24 +03:00
|
|
|
}
|
|
|
|
}
|
2016-06-18 20:30:35 +03:00
|
|
|
},
|
|
|
|
|
2016-05-24 15:07:31 +03:00
|
|
|
csscombfix: {
|
2016-08-03 10:54:24 +03:00
|
|
|
command: 'csscomb -c app/styles/csscomb.json -v app/styles'
|
2016-05-24 15:07:31 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
csscomblint: {
|
2016-08-03 10:54:24 +03:00
|
|
|
command: 'csscomb -c app/styles/csscomb.json -lv app/styles'
|
|
|
|
},
|
|
|
|
|
|
|
|
test: {
|
|
|
|
command: 'npm test'
|
|
|
|
},
|
|
|
|
|
|
|
|
options: {
|
|
|
|
preferLocal: true
|
2016-05-24 15:07:31 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-05-17 11:08:45 +03:00
|
|
|
grunt.registerTask('init', 'Install the admin dependencies',
|
2018-03-19 20:56:09 +03:00
|
|
|
['shell:npm-install']
|
2016-06-18 20:30:35 +03:00
|
|
|
);
|
2016-05-24 15:07:31 +03:00
|
|
|
};
|