Added defaults to Nx build step

refs https://github.com/TryGhost/DevOps/issues/122

- this allows us to DRY up some of the other configuration we have
  dotted around and fixes a niche bug with overlapping builds that we
  were seeing before, because Nx should only allow one build at a time
This commit is contained in:
Daniel Lockyer 2023-12-13 10:26:33 +01:00 committed by Daniel Lockyer
parent efec8b5fba
commit a9c9202b5c
5 changed files with 31 additions and 40 deletions

View File

@ -55,13 +55,13 @@ const adminXApps = '@tryghost/admin-x-demo,@tryghost/admin-x-settings';
const COMMANDS_ADMINX = [{
name: 'adminXDeps',
command: 'while [ 1 ]; do nx watch --projects=apps/admin-x-design-system,apps/admin-x-framework -- nx run \\$NX_PROJECT_NAME:build --skip-nx-cache; done',
command: 'while [ 1 ]; do nx watch --projects=apps/admin-x-design-system,apps/admin-x-framework -- nx run \\$NX_PROJECT_NAME:build; done',
cwd: path.resolve(__dirname, '../..'),
prefixColor: '#C35831',
env: {}
}, {
name: 'adminX',
command: `nx run-many --projects=${adminXApps} --targets=build && nx run-many --projects=${adminXApps} --parallel=${adminXApps.length} --targets=dev`,
command: `nx run-many --projects=${adminXApps} --parallel=${adminXApps.length} --targets=dev`,
cwd: path.resolve(__dirname, '../../apps/admin-x-settings'),
prefixColor: '#C35831',
env: {}

View File

@ -25,7 +25,7 @@
"lint": "yarn run lint:code && yarn run lint:test",
"lint:code": "eslint --ext .js,.ts,.cjs,.tsx --cache src",
"lint:test": "eslint -c test/.eslintrc.cjs --ext .js,.ts,.cjs,.tsx --cache test",
"test:unit": "yarn nx build && vitest run",
"test:unit": "vitest run",
"test:acceptance": "NODE_OPTIONS='--experimental-specifier-resolution=node --no-warnings' VITE_TEST=true playwright test",
"test:acceptance:slowmo": "TIMEOUT=100000 PLAYWRIGHT_SLOWMO=100 yarn test:acceptance --headed",
"test:acceptance:full": "ALL_BROWSERS=1 yarn test:acceptance",
@ -42,28 +42,19 @@
},
"nx": {
"targets": {
"build": {
"dev": {
"dependsOn": [
"build",
{
"projects": [
"@tryghost/admin-x-design-system",
"@tryghost/admin-x-framework"
],
"target": "build"
}
"^build"
]
},
"test:unit": {
"dependsOn": [
"^build"
]
},
"test:acceptance": {
"dependsOn": [
"test:acceptance",
{
"projects": [
"@tryghost/admin-x-design-system",
"@tryghost/admin-x-framework"
],
"target": "build"
}
"^build"
]
}
}

View File

@ -100,16 +100,15 @@
},
"nx": {
"targets": {
"build": {
"dev": {
"dependsOn": [
"build",
{"projects": ["@tryghost/admin-x-design-system"], "target": "build"}
"^build"
]
},
"test:unit": {
"dependsOn": [
"test:unit",
{"projects": ["@tryghost/admin-x-design-system"], "target": "build"}
"^build"
]
}
}

View File

@ -66,28 +66,15 @@
},
"nx": {
"targets": {
"build": {
"dev": {
"dependsOn": [
"build",
{
"projects": [
"@tryghost/admin-x-design-system",
"@tryghost/admin-x-framework"
],
"target": "build"
}
"^build"
]
},
"test:acceptance": {
"dependsOn": [
"test:acceptance",
{
"projects": [
"@tryghost/admin-x-design-system",
"@tryghost/admin-x-framework"
],
"target": "build"
}
"^build"
]
}
}

14
nx.json
View File

@ -22,6 +22,20 @@
]
},
"targetDefaults": {
"build": {
"dependsOn": [
"^build"
],
"inputs": [
"default",
"^default"
],
"outputs": [
"{projectRoot}/dist",
"{projectRoot}/es",
"{projectRoot}/umd"
]
},
"build:ts": {
"dependsOn": [
"^build:ts"