0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2024-12-30 22:34:01 -05:00

Moved yarn main functionality up to root yarn script

- since we've turned the repo into a monorepo, the `yarn main` scripts
  have lived in their original place under `ghost/core` package.json and
  Gruntfile.js
- for one, we want to remove grunt because it's terribly old and our use
  is hacked together
- secondly, `yarn main` applies to the monorepo + submodules as a whole,
  and not just the Ghost core folder
- this commit extracts the functionality into yarn scripts in the
  top-level and removes the dependency that was required
This commit is contained in:
Daniel Lockyer 2022-07-25 18:21:04 +02:00
parent 5235d67fed
commit c376587288
No known key found for this signature in database
GPG key ID: D21186F0B47295AD
4 changed files with 3 additions and 72 deletions

View file

@ -140,45 +140,6 @@ module.exports = function (grunt) {
}
},
// grunt-shell
// Command line tools where it's easier to run a command directly than configure a grunt plugin
shell: {
main: {
command: function () {
const upstream = grunt.option('upstream') || process.env.GHOST_UPSTREAM || 'upstream';
grunt.log.writeln('Pulling down the latest main from ' + upstream);
return `
git submodule sync && \
git submodule update
if ! git diff --exit-code --quiet --ignore-submodules=untracked; then
echo "Working directory is not clean, do you have uncommitted changes? Please commit, stash or discard changes to continue."
exit 1
fi
git checkout main
if git config remote.${upstream}.url > /dev/null; then
git pull ${upstream} main
else
git pull origin main
fi
yarn && \
git submodule foreach "
git checkout main
if git config remote.${upstream}.url > /dev/null; then
git pull ${upstream} main
else
git pull origin main
fi
"
`;
}
}
},
// grunt-contrib-clean
// Clean up files as part of other tasks
clean: {
@ -286,7 +247,6 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-symlink');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-express-server');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-subgrunt');
grunt.loadNpmTasks('grunt-update-submodules');

View file

@ -24,7 +24,6 @@
"dev": "grunt dev",
"dev:debug": "DEBUG=ghost:* grunt dev",
"setup": "knex-migrator init && grunt symlink && grunt init || (exit 0)",
"main": "grunt shell:main && grunt subgrunt:init",
"build": "grunt build",
"test": "yarn test:unit",
"test:single": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js --timeout=60000",
@ -207,7 +206,6 @@
"grunt-contrib-symlink": "1.0.0",
"grunt-contrib-watch": "1.1.0",
"grunt-express-server": "0.5.4",
"grunt-shell": "4.0.0",
"grunt-subgrunt": "1.3.0",
"grunt-update-submodules": "0.4.1",
"inquirer": "8.2.4",

View file

@ -21,7 +21,9 @@
"setup": "yarn && yarn workspace ghost run setup",
"start": "yarn workspace ghost run start",
"test": "yarn workspaces run test",
"main": "git pull && yarn && yarn workspace ghost run main"
"main": "yarn main:monorepo && yarn main:submodules",
"main:monorepo": "git checkout main && git pull ${GHOST_UPSTREAM:-origin} main && yarn && yarn workspace ghost run grunt subgrunt:init",
"main:submodules": "git submodule sync && git submodule update && git submodule foreach \"git checkout main && git pull ${GHOST_UPSTREAM:-origin} main && yarn\""
},
"resolutions": {
"@tryghost/logging": "2.2.3",

View file

@ -3358,14 +3358,6 @@ chalk@^2.0.0, chalk@^2.4.1:
escape-string-regexp "^1.0.5"
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:
version "1.1.4"
resolved "https://registry.yarnpkg.com/character-entities-html4/-/character-entities-html4-1.1.4.tgz#0e64b0a3753ddbf1fdc044c5fd01d0199a02e125"
@ -6082,15 +6074,6 @@ grunt-legacy-util@~2.0.1:
underscore.string "~3.3.5"
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-subgrunt@1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/grunt-subgrunt/-/grunt-subgrunt-1.3.0.tgz#0b77c057a7b22ba15ef5977b7c5992a75f5e4181"
@ -9158,13 +9141,6 @@ normalize-url@^6.0.1, normalize-url@~6.1.0:
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a"
integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==
npm-run-path@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
integrity sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==
dependencies:
path-key "^2.0.0"
npmlog@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-5.0.1.tgz#f06678e80e29419ad67ab964e0fa69959c1eb8b0"
@ -9595,11 +9571,6 @@ path-is-absolute@^1.0.0:
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==
path-key@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"
integrity sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==
path-key@^3.1.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"