mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-01 02:41:39 -05:00
Removed Grunt from Admin
- as part of our effort to reduce our usage of Grunt in favor of more maintainable (and maintained) alternatives, this commit removes Grunt from Admin - the main difference here is switching from subgrunt to shell, which should be a nice stepping stone to removing Grunt altogether one day
This commit is contained in:
parent
5f8b448ab6
commit
dd41929251
5 changed files with 31 additions and 86 deletions
|
@ -1,40 +0,0 @@
|
|||
/* eslint-env node */
|
||||
/* eslint-disable object-shorthand */
|
||||
'use strict';
|
||||
|
||||
module.exports = function (grunt) {
|
||||
// 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({
|
||||
clean: {
|
||||
built: {
|
||||
src: ['dist/**']
|
||||
},
|
||||
tmp: {
|
||||
src: ['tmp/**']
|
||||
}
|
||||
},
|
||||
|
||||
shell: {
|
||||
ember: {
|
||||
command: function (mode) {
|
||||
let liveReloadBaseUrl = grunt.option('live-reload-base-url') || '/ghost/';
|
||||
|
||||
switch (mode) {
|
||||
case 'prod':
|
||||
return 'npm run build -- --environment=production --silent';
|
||||
case 'dev':
|
||||
return 'npm run build';
|
||||
case 'watch':
|
||||
return `npm run start -- --live-reload-base-url=${liveReloadBaseUrl} --live-reload-port=4201`;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
options: {
|
||||
preferLocal: true
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
|
@ -18,6 +18,7 @@
|
|||
"scripts": {
|
||||
"start": "ember serve",
|
||||
"build": "ember build",
|
||||
"build:prod": "yarn build --environment=production --silent",
|
||||
"test": "ember exam --split 2 --parallel",
|
||||
"lint:js": "eslint .",
|
||||
"lint:hbs": "ember-template-lint .",
|
||||
|
@ -128,8 +129,6 @@
|
|||
"fs-extra": "10.1.0",
|
||||
"glob": "8.0.3",
|
||||
"google-caja-bower": "https://github.com/acburdine/google-caja-bower#ghost",
|
||||
"grunt": "1.5.3",
|
||||
"grunt-shell": "4.0.0",
|
||||
"keymaster": "https://github.com/madrobby/keymaster.git",
|
||||
"liquid-fire": "0.34.0",
|
||||
"liquid-wormhole": "2.1.5",
|
||||
|
|
|
@ -38,10 +38,10 @@ module.exports = function (grunt) {
|
|||
|
||||
// Runs ember dev
|
||||
grunt.registerTask('ember', 'Build JS & templates for development',
|
||||
['subgrunt:dev']);
|
||||
['shell:ember:dev']);
|
||||
|
||||
// Production asset build
|
||||
grunt.registerTask('prod', 'Build JS & templates for production', 'subgrunt:prod');
|
||||
grunt.registerTask('prod', 'Build JS & templates for production', 'shell:ember:prod');
|
||||
|
||||
// --- Configuration
|
||||
const cfg = {
|
||||
|
@ -96,7 +96,7 @@ module.exports = function (grunt) {
|
|||
admin: {
|
||||
cmd: function () {
|
||||
logBuildingAdmin(grunt);
|
||||
return 'grunt subgrunt:watch';
|
||||
return 'grunt shell:ember:watch';
|
||||
},
|
||||
bg: grunt.option('admin') ? false : true,
|
||||
stdout: function (chunk) {
|
||||
|
@ -118,17 +118,8 @@ module.exports = function (grunt) {
|
|||
}
|
||||
},
|
||||
stderr: function (chunk) {
|
||||
const skipFilter = grunt.option('admin') ? false : [
|
||||
/- building/
|
||||
].some(function (regexp) {
|
||||
return regexp.test(chunk);
|
||||
});
|
||||
|
||||
const errorFilter = grunt.option('admin') ? false : [
|
||||
/^>>/
|
||||
].some(function (regexp) {
|
||||
return regexp.test(chunk);
|
||||
});
|
||||
const skipFilter = /- building/.test(chunk);
|
||||
const errorFilter = /^>>/.test(chunk);
|
||||
|
||||
if (!skipFilter) {
|
||||
hasBuiltAdmin = errorFilter ? hasBuiltAdmin : true;
|
||||
|
@ -151,26 +142,29 @@ module.exports = function (grunt) {
|
|||
}
|
||||
},
|
||||
|
||||
// grunt-subgrunt
|
||||
// Run grunt tasks in submodule Gruntfiles
|
||||
subgrunt: {
|
||||
options: {
|
||||
npmInstall: false,
|
||||
npmPath: 'yarn'
|
||||
},
|
||||
shell: {
|
||||
ember: {
|
||||
command: function (mode) {
|
||||
const liveReloadBaseUrl = config.getSubdir() || '/ghost/';
|
||||
|
||||
dev: {
|
||||
'../admin': 'shell:ember:dev'
|
||||
},
|
||||
|
||||
prod: {
|
||||
'../admin': 'shell:ember:prod'
|
||||
},
|
||||
|
||||
watch: {
|
||||
projects: {
|
||||
'../admin': ['shell:ember:watch', '--live-reload-base-url="' + config.getSubdir() + '/ghost/"']
|
||||
switch (mode) {
|
||||
case 'dev':
|
||||
return 'npm run build';
|
||||
case 'prod':
|
||||
return 'npm run build:prod';
|
||||
case 'watch':
|
||||
return `npm run start -- --live-reload-base-url=${liveReloadBaseUrl} --live-reload-port=4201`;
|
||||
}
|
||||
},
|
||||
options: {
|
||||
execOptions: {
|
||||
cwd: '../admin'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
options: {
|
||||
preferLocal: true
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -199,7 +193,7 @@ module.exports = function (grunt) {
|
|||
grunt.loadNpmTasks('grunt-contrib-symlink');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.loadNpmTasks('grunt-express-server');
|
||||
grunt.loadNpmTasks('grunt-subgrunt');
|
||||
grunt.loadNpmTasks('grunt-shell');
|
||||
|
||||
// This little bit of weirdness gives the express server chance to shutdown properly
|
||||
const waitBeforeExit = () => {
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
"grunt-contrib-symlink": "1.0.0",
|
||||
"grunt-contrib-watch": "1.1.0",
|
||||
"grunt-express-server": "0.5.4",
|
||||
"grunt-subgrunt": "1.3.0",
|
||||
"grunt-shell": "4.0.0",
|
||||
"inquirer": "8.2.4",
|
||||
"jwks-rsa": "2.1.4",
|
||||
"mocha": "10.0.0",
|
||||
|
|
12
yarn.lock
12
yarn.lock
|
@ -4843,7 +4843,7 @@ async-promise-queue@^1.0.3, async-promise-queue@^1.0.5:
|
|||
async "^2.4.1"
|
||||
debug "^2.6.8"
|
||||
|
||||
async@^2.1.2, async@^2.4.1, async@^2.6.0, async@^2.6.1, async@^2.6.2:
|
||||
async@^2.4.1, async@^2.6.0, async@^2.6.1, async@^2.6.2:
|
||||
version "2.6.4"
|
||||
resolved "https://registry.yarnpkg.com/async/-/async-2.6.4.tgz#706b7ff6084664cd7eae713f6f965433b5504221"
|
||||
integrity sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==
|
||||
|
@ -12467,7 +12467,7 @@ glob@^6.0.1:
|
|||
once "^1.3.0"
|
||||
path-is-absolute "^1.0.0"
|
||||
|
||||
glob@^7.0.0, glob@^7.0.4, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6:
|
||||
glob@^7.0.4, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6:
|
||||
version "7.2.3"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b"
|
||||
integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==
|
||||
|
@ -12736,14 +12736,6 @@ grunt-shell@4.0.0:
|
|||
npm-run-path "^2.0.0"
|
||||
strip-ansi "^6.0.1"
|
||||
|
||||
grunt-subgrunt@1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/grunt-subgrunt/-/grunt-subgrunt-1.3.0.tgz#0b77c057a7b22ba15ef5977b7c5992a75f5e4181"
|
||||
integrity sha512-rioBokPl1wlwjvTIAlisB/QE1vZpMtIE8S4T1hxH8fGESriajeLqBr8a9qh7nTAI+M2/yWjGGrQLJtL/VGvPSA==
|
||||
dependencies:
|
||||
async "^2.1.2"
|
||||
glob "^7.0.0"
|
||||
|
||||
grunt@1.5.3:
|
||||
version "1.5.3"
|
||||
resolved "https://registry.yarnpkg.com/grunt/-/grunt-1.5.3.tgz#3214101d11257b7e83cf2b38ea173b824deab76a"
|
||||
|
|
Loading…
Add table
Reference in a new issue