Skip to content

Commit

Permalink
Specify lerna/nx task dependencies
Browse files Browse the repository at this point in the history
* see https://lerna.js.org/docs/concepts/task-pipeline-configuration
* upgrade lerna
* ran lerna repair
* specify ignore cache in grunt tasks, just to ensure no change there
* add clean task (handy for cache busting too)
* alphabetize scripts
  • Loading branch information
igorschoester committed Apr 28, 2024
1 parent 109f72b commit 2c8f1a6
Show file tree
Hide file tree
Showing 7 changed files with 1,374 additions and 1,958 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ temp/
.svn
.tmp
.cache/phpunit/cache/
.nx/cache

############
## Composer
Expand Down
8 changes: 4 additions & 4 deletions config/grunt/task-config/aliases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

# Compile the JavaScript packages that need it.
'build:packages':
- 'shell:yarn:build --ignore @yoast/wordpress-seo'
- 'shell:yarn:build --ignore @yoast/wordpress-seo --skip-nx-cache'

# Build JavaScript from assets to development
'build:js':
- 'clean:build-assets-js'
- 'shell:yarn:build --scope @yoast/wordpress-seo'
- 'shell:yarn:build --scope @yoast/wordpress-seo --skip-nx-cache'

# Build CSS for development
'build:css':
Expand Down Expand Up @@ -107,9 +107,9 @@ release:
- 'release:css'
# Compile the JavaScript packages that need it.
'release:packages':
- 'shell:yarn-prod:build --ignore @yoast/wordpress-seo'
- 'shell:yarn-prod:build --ignore @yoast/wordpress-seo --skip-nx-cache'
'release:js':
- 'shell:yarn-prod:build --scope @yoast/wordpress-seo'
- 'shell:yarn-prod:build --scope @yoast/wordpress-seo --skip-nx-cache'

# Build CSS for production
'release:css':
Expand Down
4 changes: 2 additions & 2 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"npmClient": "yarn",
"useWorkspaces": true,
"version": "independent",
"includeMergedTags": true,
"ignoreChanges": [
"packages/js/**"
]
],
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
44 changes: 44 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"targetDefaults": {
"test": {
"dependsOn": [
"^build"
]
},
"build": {
"outputs": [
"{projectRoot}/build"
],
"cache": true
},
"build:js": {
"outputs": [
"{projectRoot}/build"
],
"cache": true
},
"build:css": {
"outputs": [
"{projectRoot}/build"
],
"cache": true
},
"build:json": {
"outputs": [
"{projectRoot}/build"
],
"cache": true
}
},
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"namedInputs": {
"default": [
"{projectRoot}/**/*",
"sharedGlobals"
],
"sharedGlobals": [ ],
"production": [
"default"
]
}
}
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@
]
},
"scripts": {
"build": "lerna run build",
"build:css": "postcss css/dist/*.css --verbose --replace",
"clean": "lerna run clean",
"lint": "yarn lint:packages && yarn lint:tooling",
"lint:packages": "lerna run lint",
"lint:tooling": "eslint . --max-warnings=0",
"test": "lerna run test",
"build": "lerna run build",
"build:css": "postcss css/dist/*.css --verbose --replace",
"webpack-analyze-bundle": "wp-scripts build --config config/webpack/webpack.config.js --webpack-bundle-analyzer",
"start": "wp-scripts start --config config/webpack/webpack.config.js --webpack-src-dir=packages/**/src",
"sync:wp-deps": "node config/scripts/sync-wp-dependencies.js"
"sync:wp-deps": "node config/scripts/sync-wp-dependencies.js",
"test": "lerna run test",
"webpack-analyze-bundle": "wp-scripts build --config config/webpack/webpack.config.js --webpack-bundle-analyzer"
},
"devDependencies": {
"@babel/core": "^7.24.4",
Expand All @@ -57,7 +58,7 @@
"grunt-git": "^1.0.14",
"grunt-prompt": "^1.3.3",
"grunt-shell": "^3.0.1",
"lerna": "^6.4.1",
"lerna": "^8.1.2",
"lodash": "^4.17.21",
"mini-css-extract-plugin": "^2.5.1",
"node-fetch": "^2.6.1",
Expand Down
10 changes: 10 additions & 0 deletions packages/js/nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"targets": {
"build": {
"outputs": [
"{workspaceRoot}/js/dist",
"{workspaceRoot}/css/dist"
]
}
}
}

0 comments on commit 2c8f1a6

Please sign in to comment.