mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 00:11:49 +03:00
Cleaned up core package Gruntfile
- most of these tasks were duplicates or had been extracted out into npm/yarn scripts - in order to get closer to removing Grunt, I've cleaned up the majority of those script - this also removes an intermediate command to building Admin, so it starts ever so slightly quicker
This commit is contained in:
parent
5b6544504b
commit
e1984c8607
@ -1,42 +1,14 @@
|
|||||||
const config = require('./core/shared/config');
|
const config = require('./core/shared/config');
|
||||||
|
|
||||||
module.exports = function (grunt) {
|
module.exports = function (grunt) {
|
||||||
// grunt dev - use yarn dev instead!
|
|
||||||
// - Start a server & build assets on the fly whilst developing
|
|
||||||
grunt.registerTask('dev:admin', 'Dev Mode; run Admin with livereload', 'shell:ember:watch');
|
|
||||||
|
|
||||||
// grunt build -- use yarn build instead!
|
|
||||||
// - Builds the admin without a watch task
|
|
||||||
grunt.registerTask('build', 'Build admin app in development mode', 'ember');
|
|
||||||
|
|
||||||
// Runs the asset generation tasks for production and duplicates default-prod.html to default.html
|
|
||||||
grunt.registerTask('release', 'Release task - creates a final built zip', 'prod');
|
|
||||||
|
|
||||||
// --- Sub Commands
|
|
||||||
// Used to make other commands work
|
|
||||||
|
|
||||||
// Updates submodules, then installs and builds the admin for you
|
|
||||||
grunt.registerTask('init', 'Prepare the project for development', 'build');
|
|
||||||
|
|
||||||
// Runs ember dev
|
|
||||||
grunt.registerTask('ember', 'Build JS & templates for development',
|
|
||||||
['shell:ember:dev']);
|
|
||||||
|
|
||||||
// Production asset build
|
|
||||||
grunt.registerTask('prod', 'Build JS & templates for production', 'shell:ember:prod');
|
|
||||||
|
|
||||||
// --- Configuration
|
// --- Configuration
|
||||||
const cfg = {
|
grunt.initConfig({
|
||||||
shell: {
|
shell: {
|
||||||
ember: {
|
ember: {
|
||||||
command: function (mode) {
|
command: function (mode) {
|
||||||
const liveReloadBaseUrl = config.getSubdir() || '/ghost/';
|
const liveReloadBaseUrl = config.getSubdir() || '/ghost/';
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 'dev':
|
|
||||||
return 'yarn build';
|
|
||||||
case 'prod':
|
|
||||||
return 'yarn build:prod';
|
|
||||||
case 'watch':
|
case 'watch':
|
||||||
return `yarn start --live-reload-base-url=${liveReloadBaseUrl} --live-reload-port=4201`;
|
return `yarn start --live-reload-base-url=${liveReloadBaseUrl} --live-reload-port=4201`;
|
||||||
}
|
}
|
||||||
@ -68,14 +40,9 @@ module.exports = function (grunt) {
|
|||||||
dest: '.git/hooks'
|
dest: '.git/hooks'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
// --- Grunt Initialisation
|
|
||||||
|
|
||||||
// Load all grunt tasks
|
// Load all grunt tasks
|
||||||
grunt.loadNpmTasks('grunt-contrib-symlink');
|
grunt.loadNpmTasks('grunt-contrib-symlink');
|
||||||
grunt.loadNpmTasks('grunt-shell');
|
grunt.loadNpmTasks('grunt-shell');
|
||||||
|
|
||||||
// Load the configuration
|
|
||||||
grunt.initConfig(cfg);
|
|
||||||
};
|
};
|
||||||
|
@ -21,9 +21,8 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node index",
|
"start": "node index",
|
||||||
"dev:admin": "grunt dev:admin",
|
"setup": "knex-migrator init && grunt symlink && yarn build || (exit 0)",
|
||||||
"setup": "knex-migrator init && grunt symlink && grunt init || (exit 0)",
|
"build": "yarn workspace ghost-admin run build",
|
||||||
"build": "grunt build",
|
|
||||||
"test": "yarn test:unit",
|
"test": "yarn test:unit",
|
||||||
"test:single": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js --timeout=60000",
|
"test:single": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js --timeout=60000",
|
||||||
"test:all": "yarn test:unit && yarn test:integration && yarn test:e2e && yarn lint",
|
"test:all": "yarn test:unit && yarn test:integration && yarn test:e2e && yarn lint",
|
||||||
@ -46,7 +45,7 @@
|
|||||||
"lint:code": "yarn lint:server && yarn lint:shared && yarn lint:frontend",
|
"lint:code": "yarn lint:server && yarn lint:shared && yarn lint:frontend",
|
||||||
"lint": "yarn lint:server && yarn lint:shared && yarn lint:frontend && yarn lint:test",
|
"lint": "yarn lint:server && yarn lint:shared && yarn lint:frontend && yarn lint:test",
|
||||||
"build:css": "postcss core/frontend/public/ghost.css --no-map --use cssnano -o core/frontend/public/ghost.min.css",
|
"build:css": "postcss core/frontend/public/ghost.css --no-map --use cssnano -o core/frontend/public/ghost.min.css",
|
||||||
"prepack": "grunt release && yarn build:css"
|
"prepack": "yarn workspace ghost-admin run build:prod && yarn build:css"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^14.17.0 || ^16.13.0",
|
"node": "^14.17.0 || ^16.13.0",
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev:debug": "DEBUG=@tryghost*,ghost:* yarn dev",
|
"dev:debug": "DEBUG=@tryghost*,ghost:* yarn dev",
|
||||||
"dev:admin": "yarn workspace ghost run dev:admin",
|
"dev:admin": "yarn workspace ghost run grunt shell:ember:watch",
|
||||||
"dev:ghost": "nodemon -q -i ghost/admin -i ghost/core/content -i ghost/core/core/built",
|
"dev:ghost": "nodemon -q -i ghost/admin -i ghost/core/content -i ghost/core/core/built",
|
||||||
"dev": "concurrently -c \"blue,green\" --kill-others -n ghost,admin \"yarn dev:ghost\" \"yarn dev:admin\"",
|
"dev": "concurrently -c \"blue,green\" --kill-others -n ghost,admin \"yarn dev:ghost\" \"yarn dev:admin\"",
|
||||||
"fix": "yarn cache clean && rm -rf node_modules && yarn",
|
"fix": "yarn cache clean && rm -rf node_modules && yarn",
|
||||||
|
Loading…
Reference in New Issue
Block a user