diff --git a/ghost/core/Gruntfile.js b/ghost/core/Gruntfile.js index 0c66b58bb1..5ad4ab3d93 100644 --- a/ghost/core/Gruntfile.js +++ b/ghost/core/Gruntfile.js @@ -1,42 +1,14 @@ const config = require('./core/shared/config'); 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 - const cfg = { + grunt.initConfig({ shell: { ember: { command: function (mode) { const liveReloadBaseUrl = config.getSubdir() || '/ghost/'; switch (mode) { - case 'dev': - return 'yarn build'; - case 'prod': - return 'yarn build:prod'; case 'watch': return `yarn start --live-reload-base-url=${liveReloadBaseUrl} --live-reload-port=4201`; } @@ -68,14 +40,9 @@ module.exports = function (grunt) { dest: '.git/hooks' } } - }; - - // --- Grunt Initialisation + }); // Load all grunt tasks grunt.loadNpmTasks('grunt-contrib-symlink'); grunt.loadNpmTasks('grunt-shell'); - - // Load the configuration - grunt.initConfig(cfg); }; diff --git a/ghost/core/package.json b/ghost/core/package.json index 2959ad9503..6472246c95 100644 --- a/ghost/core/package.json +++ b/ghost/core/package.json @@ -21,9 +21,8 @@ "license": "MIT", "scripts": { "start": "node index", - "dev:admin": "grunt dev:admin", - "setup": "knex-migrator init && grunt symlink && grunt init || (exit 0)", - "build": "grunt build", + "setup": "knex-migrator init && grunt symlink && yarn build || (exit 0)", + "build": "yarn workspace ghost-admin run build", "test": "yarn test:unit", "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", @@ -46,7 +45,7 @@ "lint:code": "yarn lint:server && yarn lint:shared && yarn lint:frontend", "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", - "prepack": "grunt release && yarn build:css" + "prepack": "yarn workspace ghost-admin run build:prod && yarn build:css" }, "engines": { "node": "^14.17.0 || ^16.13.0", diff --git a/package.json b/package.json index 94d21545df..37dd82effe 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ ], "scripts": { "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": "concurrently -c \"blue,green\" --kill-others -n ghost,admin \"yarn dev:ghost\" \"yarn dev:admin\"", "fix": "yarn cache clean && rm -rf node_modules && yarn",