2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

Switched to Nx runner for more tasks

- this switches us to using Nx for `ghost:dev`, which means we can
  configure its dependencies and ensure that the TS projects are built
  beforehand
- also switches to Nx for `ghost:archive` so we don't need to run
  `build:ts` for all `yarn` commands
This commit is contained in:
Daniel Lockyer 2023-07-13 11:14:08 +02:00 committed by Daniel Lockyer
parent e990cbba01
commit 9f40c90e07
5 changed files with 23 additions and 5 deletions

View file

@ -25,7 +25,7 @@ let commands = [];
const COMMAND_GHOST = {
name: 'ghost',
// Note: if this isn't working for you, please use Node 18 and above
command: 'node --watch index.js',
command: 'nx run ghost:dev',
cwd: path.resolve(__dirname, '../../ghost/core'),
prefixColor: 'blue',
env: {}

View file

@ -52,9 +52,13 @@ jobs:
- name: Install dependencies
run: yarn
- name: Build packages
run: yarn nx run-many -t build:ts
- name: Run migrations
working-directory: ghost/core
run: yarn knex-migrator init
- name: Get Playwright version
id: playwright-version
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> $GITHUB_OUTPUT

View file

@ -158,7 +158,7 @@ jobs:
- name: Build packages
if: steps.cache_built_packages.outputs.cache-hit != 'true'
run: yarn prepare
run: yarn nx run-many -t build:ts
outputs:
dependency_cache_key: ${{ steps.compute_lockfile_hash.outputs.hash }}

View file

@ -21,7 +21,7 @@
"license": "MIT",
"scripts": {
"archive": "npm pack",
"start": "node index",
"dev": "node --watch index.js",
"build": "postcss core/frontend/public/ghost.css --no-map --use cssnano -o core/frontend/public/ghost.min.css",
"test": "yarn test:unit",
"test:base": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js",
@ -260,5 +260,19 @@
"@tryghost/logging": "2.4.4",
"moment": "2.24.0",
"moment-timezone": "0.5.23"
},
"nx": {
"targets": {
"archive": {
"dependsOn": [
"^build:ts"
]
},
"dev": {
"dependsOn": [
"^build:ts"
]
}
}
}
}

View file

@ -20,7 +20,7 @@
"**/node_modules/**"
],
"scripts": {
"archive": "yarn workspace ghost run archive",
"archive": "nx run ghost:archive",
"build": "nx run-many -t build",
"dev:debug": "DEBUG_COLORS=true DEBUG=@tryghost*,ghost:* yarn dev",
"dev:admin": "node .github/scripts/dev.js --admin",
@ -35,7 +35,7 @@
"main": "yarn main:monorepo && yarn main:submodules",
"main:monorepo": "git checkout main && git pull ${GHOST_UPSTREAM:-origin} main && yarn",
"main:submodules": "git submodule sync && git submodule update && git submodule foreach \"git checkout main && git pull ${GHOST_UPSTREAM:-origin} main && yarn\"",
"prepare": "husky install .github/hooks && nx run-many -t build:ts"
"prepare": "husky install .github/hooks"
},
"resolutions": {
"@elastic/elasticsearch": "8.5.0",