Skip to content

Commit

Permalink
Ensure all NPM packages have readmes included in their builds (#2156)
Browse files Browse the repository at this point in the history
## Motivation for the change, related issues

This PR ensures all public package builds include a  README.md file,
because some of our NPM packages don't include a readme on the npmjs.com
package page.

The readmes exist in project folders, but before this PR they were not
added to the built version of the package.

## Implementation details

Add `build:README` step to these public packages:

- @php-wasm/cli
- @php-wasm/progress
- @php-wasm/scopes
- @php-wasm/web-service-worker
- @wp-playground/blueprints
- @wp-playground/cli
- @wp-playground/client
- @wp-playground/components
- @wp-playground/remote
- @wp-playground/sync

## Testing Instructions (or ideally a Blueprint)

- Remove the `dist` folder if it exists
- Run `npm run build`
- Check that all PHP-wasm builds have a README.md
```
find dist/packages/php-wasm -mindepth 1 -maxdepth 1 -type d '!' -exec test -e '{}/README.md' \; -print
```
- The above command should only return
`dist/packages/php-wasm/out-tsc-phpwasm-node` which isn't a package
- Check that all Playground builds have a README.md
```
find dist/packages/playground -mindepth 1 -maxdepth 1 -type d '!' -exec test -e '{}/README.md' \; -print
```
- The above command should only return
`dist/packages/playground/website` which isn't a published package
  • Loading branch information
bgrgicak authored Feb 27, 2025
1 parent 9b76ef5 commit b9a1267
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 15 deletions.
13 changes: 13 additions & 0 deletions packages/php-wasm/cli/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
"projectType": "library",
"targets": {
"build": {
"executor": "nx:noop",
"dependsOn": ["build:README"]
},
"build:README": {
"executor": "nx:run-commands",
"options": {
"commands": [
"cp packages/php-wasm/cli/README.md dist/packages/php-wasm/cli"
]
},
"dependsOn": ["build:package-json"]
},
"build:package-json": {
"executor": "@wp-playground/nx-extensions:package-json",
"options": {
"tsConfig": "packages/php-wasm/cli/tsconfig.lib.json",
Expand Down
13 changes: 13 additions & 0 deletions packages/php-wasm/progress/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
"projectType": "library",
"targets": {
"build": {
"executor": "nx:noop",
"dependsOn": ["build:README"]
},
"build:README": {
"executor": "nx:run-commands",
"options": {
"commands": [
"cp packages/php-wasm/progress/README.md dist/packages/php-wasm/progress"
]
},
"dependsOn": ["build:package-json"]
},
"build:package-json": {
"executor": "@wp-playground/nx-extensions:package-json",
"options": {
"tsConfig": "packages/php-wasm/progress/tsconfig.lib.json",
Expand Down
13 changes: 13 additions & 0 deletions packages/php-wasm/scopes/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
"projectType": "library",
"targets": {
"build": {
"executor": "nx:noop",
"dependsOn": ["build:README"]
},
"build:README": {
"executor": "nx:run-commands",
"options": {
"commands": [
"cp packages/php-wasm/scopes/README.md dist/packages/php-wasm/scopes"
]
},
"dependsOn": ["build:package-json"]
},
"build:package-json": {
"executor": "@wp-playground/nx-extensions:package-json",
"options": {
"tsConfig": "packages/php-wasm/scopes/tsconfig.lib.json",
Expand Down
15 changes: 10 additions & 5 deletions packages/php-wasm/web-service-worker/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@
"projectType": "library",
"targets": {
"build": {
"executor": "@wp-playground/nx-extensions:package-json",
"executor": "nx:noop",
"dependsOn": ["build:README"]
},
"build:README": {
"executor": "nx:run-commands",
"options": {
"tsConfig": "packages/php-wasm/web-service-worker/tsconfig.lib.json",
"outputPath": "dist/packages/php-wasm/web-service-worker",
"buildTarget": "php-wasm-web-service-worker:build:bundle:production"
}
"commands": [
"cp packages/php-wasm/web-service-worker/README.md dist/packages/php-wasm/web-service-worker"
]
},
"dependsOn": ["build:package-json"]
},
"build:package-json": {
"executor": "@wp-playground/nx-extensions:package-json",
Expand Down
13 changes: 13 additions & 0 deletions packages/playground/blueprints/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
"projectType": "library",
"targets": {
"build": {
"executor": "nx:noop",
"dependsOn": ["build:README"]
},
"build:README": {
"executor": "nx:run-commands",
"options": {
"commands": [
"cp packages/playground/blueprints/README.md dist/packages/playground/blueprints"
]
},
"dependsOn": ["build:package-json"]
},
"build:package-json": {
"executor": "@wp-playground/nx-extensions:package-json",
"options": {
"tsConfig": "packages/playground/blueprints/tsconfig.lib.json",
Expand Down
13 changes: 13 additions & 0 deletions packages/playground/cli/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
"projectType": "library",
"targets": {
"build": {
"executor": "nx:noop",
"dependsOn": ["build:README"]
},
"build:README": {
"executor": "nx:run-commands",
"options": {
"commands": [
"cp packages/playground/cli/README.md dist/packages/playground/cli"
]
},
"dependsOn": ["build:package-json"]
},
"build:package-json": {
"executor": "@wp-playground/nx-extensions:package-json",
"options": {
"tsConfig": "packages/playground/cli/tsconfig.lib.json",
Expand Down
24 changes: 14 additions & 10 deletions packages/playground/client/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,26 @@
"projectType": "library",
"targets": {
"build": {
"executor": "nx:noop",
"dependsOn": ["build:README"]
},
"build:README": {
"executor": "nx:run-commands",
"options": {
"commands": [
"cp packages/playground/client/README.md dist/packages/playground/client"
]
},
"dependsOn": ["build:package-json"]
},
"build:package-json": {
"executor": "@wp-playground/nx-extensions:package-json",
"options": {
"tsConfig": "packages/playground/client/tsconfig.lib.json",
"outputPath": "dist/packages/playground/client",
"buildTarget": "playground-client:build:bundle:production"
},
"dependsOn": ["build:README", "build:rollup-declarations"]
"dependsOn": ["build:rollup-declarations"]
},
"build:rollup-declarations": {
"executor": "nx:run-commands",
Expand All @@ -26,15 +39,6 @@
},
"dependsOn": ["build:bundle"]
},
"build:README": {
"executor": "nx:run-commands",
"options": {
"commands": [
"cp packages/playground/client/README.md dist/packages/playground/client"
]
},
"dependsOn": ["build:bundle"]
},
"build:bundle": {
"executor": "@nx/vite:build",
"outputs": ["{options.outputPath}"],
Expand Down
13 changes: 13 additions & 0 deletions packages/playground/components/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
"projectType": "library",
"targets": {
"build": {
"executor": "nx:noop",
"dependsOn": ["build:README"]
},
"build:README": {
"executor": "nx:run-commands",
"options": {
"commands": [
"cp packages/playground/components/README.md dist/packages/playground/components"
]
},
"dependsOn": ["build:vite"]
},
"build:vite": {
"executor": "@nx/vite:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
Expand Down
13 changes: 13 additions & 0 deletions packages/playground/remote/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
"projectType": "library",
"targets": {
"build": {
"executor": "nx:noop",
"dependsOn": ["build:README"]
},
"build:README": {
"executor": "nx:run-commands",
"options": {
"commands": [
"cp packages/playground/remote/README.md dist/packages/playground/remote"
]
},
"dependsOn": ["build:vite"]
},
"build:vite": {
"executor": "@nx/vite:build",
"outputs": ["{options.outputPath}"],
"options": {
Expand Down
13 changes: 13 additions & 0 deletions packages/playground/sync/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@
"tags": ["scope:web-client"],
"targets": {
"build": {
"executor": "nx:noop",
"dependsOn": ["build:README"]
},
"build:README": {
"executor": "nx:run-commands",
"options": {
"commands": [
"cp packages/playground/sync/README.md dist/packages/playground/sync"
]
},
"dependsOn": ["build:vite"]
},
"build:vite": {
"executor": "@nx/vite:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
Expand Down

0 comments on commit b9a1267

Please sign in to comment.