mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Extracted dev tooling to separate script
refs https://github.com/TryGhost/Toolbox/issues/426 - we're going to need to support more complex combinations of dev commands soon, with other packages optionally running and env variables being altered - this command pulls out a lot of the dev env scripting into a single scripts - also cleans up the use of grunt-shell so we can remove the dependency
This commit is contained in:
parent
3056e3cb51
commit
2bff2a22e0
5 changed files with 53 additions and 46 deletions
50
.github/dev.js
vendored
Normal file
50
.github/dev.js
vendored
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
const path = require('path');
|
||||||
|
const concurrently = require('concurrently');
|
||||||
|
|
||||||
|
const config = require('../ghost/core/core/shared/config');
|
||||||
|
const liveReloadBaseUrl = config.getSubdir() || '/ghost/';
|
||||||
|
|
||||||
|
const DASH_DASH_ARGS = process.argv.filter(a => a.startsWith('--')).map(a => a.slice(2));
|
||||||
|
|
||||||
|
let commands = [];
|
||||||
|
|
||||||
|
const COMMAND_GHOST = {
|
||||||
|
name: 'ghost',
|
||||||
|
command: 'yarn nodemon -q -i ghost/admin -i ghost/core/content -i ghost/core/core/built',
|
||||||
|
prefixColor: 'blue',
|
||||||
|
env: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
const COMMAND_ADMIN = {
|
||||||
|
name: 'admin',
|
||||||
|
command: `yarn start --live-reload-base-url=${liveReloadBaseUrl} --live-reload-port=4201`,
|
||||||
|
cwd: path.resolve(__dirname, '../ghost/admin'),
|
||||||
|
prefixColor: 'green',
|
||||||
|
env: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (DASH_DASH_ARGS.includes('ghost')) {
|
||||||
|
commands = [COMMAND_GHOST];
|
||||||
|
} else if (DASH_DASH_ARGS.includes('admin')) {
|
||||||
|
commands = [COMMAND_ADMIN];
|
||||||
|
} else {
|
||||||
|
commands = [COMMAND_GHOST, COMMAND_ADMIN];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!commands.length) {
|
||||||
|
console.log(`No commands provided`);
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
const {result} = concurrently(commands, {
|
||||||
|
prefix: 'name',
|
||||||
|
killOthers: ['failure', 'success']
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
await result;
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
})();
|
|
@ -1,30 +1,6 @@
|
||||||
const config = require('./core/shared/config');
|
|
||||||
|
|
||||||
module.exports = function (grunt) {
|
module.exports = function (grunt) {
|
||||||
// --- Configuration
|
// --- Configuration
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
shell: {
|
|
||||||
ember: {
|
|
||||||
command: function (mode) {
|
|
||||||
const liveReloadBaseUrl = config.getSubdir() || '/ghost/';
|
|
||||||
|
|
||||||
switch (mode) {
|
|
||||||
case 'watch':
|
|
||||||
return `yarn start --live-reload-base-url=${liveReloadBaseUrl} --live-reload-port=4201`;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
execOptions: {
|
|
||||||
cwd: '../admin'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
options: {
|
|
||||||
preferLocal: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// grunt-contrib-symlink
|
// grunt-contrib-symlink
|
||||||
// Create symlink for git hooks
|
// Create symlink for git hooks
|
||||||
symlink: {
|
symlink: {
|
||||||
|
@ -44,5 +20,4 @@ module.exports = function (grunt) {
|
||||||
|
|
||||||
// Load all grunt tasks
|
// Load all grunt tasks
|
||||||
grunt.loadNpmTasks('grunt-contrib-symlink');
|
grunt.loadNpmTasks('grunt-contrib-symlink');
|
||||||
grunt.loadNpmTasks('grunt-shell');
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -197,7 +197,6 @@
|
||||||
"eslint": "8.23.1",
|
"eslint": "8.23.1",
|
||||||
"grunt": "1.5.3",
|
"grunt": "1.5.3",
|
||||||
"grunt-contrib-symlink": "1.0.0",
|
"grunt-contrib-symlink": "1.0.0",
|
||||||
"grunt-shell": "4.0.0",
|
|
||||||
"html-validate": "7.5.0",
|
"html-validate": "7.5.0",
|
||||||
"inquirer": "8.2.4",
|
"inquirer": "8.2.4",
|
||||||
"jwks-rsa": "2.1.4",
|
"jwks-rsa": "2.1.4",
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev:debug": "DEBUG_COLORS=true DEBUG=@tryghost*,ghost:* yarn dev",
|
"dev:debug": "DEBUG_COLORS=true DEBUG=@tryghost*,ghost:* yarn dev",
|
||||||
"dev:admin": "yarn workspace ghost run grunt shell:ember:watch",
|
"dev:admin": "node .github/dev.js --admin",
|
||||||
"dev:ghost": "nodemon -q -i ghost/admin -i ghost/core/content -i ghost/core/core/built",
|
"dev:ghost": "node .github/dev.js --ghost",
|
||||||
"dev": "concurrently -c \"blue,green\" --kill-others -n ghost,admin \"yarn dev:ghost\" \"yarn dev:admin\"",
|
"dev": "node .github/dev.js",
|
||||||
"fix": "yarn cache clean && rm -rf node_modules && yarn",
|
"fix": "yarn cache clean && rm -rf node_modules && yarn",
|
||||||
"knex-migrator": "yarn workspace ghost run knex-migrator",
|
"knex-migrator": "yarn workspace ghost run knex-migrator",
|
||||||
"lint": "yarn workspaces run lint",
|
"lint": "yarn workspaces run lint",
|
||||||
|
|
17
yarn.lock
17
yarn.lock
|
@ -7717,14 +7717,6 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.4.1, chalk@^2.4
|
||||||
escape-string-regexp "^1.0.5"
|
escape-string-regexp "^1.0.5"
|
||||||
supports-color "^5.3.0"
|
supports-color "^5.3.0"
|
||||||
|
|
||||||
chalk@^3.0.0:
|
|
||||||
version "3.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4"
|
|
||||||
integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==
|
|
||||||
dependencies:
|
|
||||||
ansi-styles "^4.1.0"
|
|
||||||
supports-color "^7.1.0"
|
|
||||||
|
|
||||||
character-entities-html4@^1.0.0:
|
character-entities-html4@^1.0.0:
|
||||||
version "1.1.4"
|
version "1.1.4"
|
||||||
resolved "https://registry.yarnpkg.com/character-entities-html4/-/character-entities-html4-1.1.4.tgz#0e64b0a3753ddbf1fdc044c5fd01d0199a02e125"
|
resolved "https://registry.yarnpkg.com/character-entities-html4/-/character-entities-html4-1.1.4.tgz#0e64b0a3753ddbf1fdc044c5fd01d0199a02e125"
|
||||||
|
@ -13225,15 +13217,6 @@ grunt-legacy-util@~2.0.1:
|
||||||
underscore.string "~3.3.5"
|
underscore.string "~3.3.5"
|
||||||
which "~2.0.2"
|
which "~2.0.2"
|
||||||
|
|
||||||
grunt-shell@4.0.0:
|
|
||||||
version "4.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/grunt-shell/-/grunt-shell-4.0.0.tgz#9b04a18a59c3113f24391a3fb5625320538cbd1c"
|
|
||||||
integrity sha512-dHFy8VZDfWGYLTeNvIHze4PKXGvIlDWuN0UE7hUZstTQeiEyv1VmW1MaDYQ3X5tE3bCi3bEia1gGKH8z/f1czQ==
|
|
||||||
dependencies:
|
|
||||||
chalk "^3.0.0"
|
|
||||||
npm-run-path "^2.0.0"
|
|
||||||
strip-ansi "^6.0.1"
|
|
||||||
|
|
||||||
grunt@1.5.3:
|
grunt@1.5.3:
|
||||||
version "1.5.3"
|
version "1.5.3"
|
||||||
resolved "https://registry.yarnpkg.com/grunt/-/grunt-1.5.3.tgz#3214101d11257b7e83cf2b38ea173b824deab76a"
|
resolved "https://registry.yarnpkg.com/grunt/-/grunt-1.5.3.tgz#3214101d11257b7e83cf2b38ea173b824deab76a"
|
||||||
|
|
Loading…
Add table
Reference in a new issue