Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish @wp-playground/remote (types only) (#1924)
Publishes the `@wp-playground/remote` package with only type definitions, as per discussion in #1725. I've tested the changes introduced here locally, using [verdaccio](https://verdaccio.org/), and can confirm that the issues with missing types (namely `PlaygroundClient`) are fixed. I took the liberty to fix some small things I noticed, and made sure to add context in commit messages, when necessary. ## Package contents ``` . ├── lib │ ├── progress-bar │ │ └── index.d.ts │ ├── boot-playground-remote.d.ts │ ├── config.d.ts │ ├── create-memoized-fetch.d.ts │ ├── index.d.ts │ ├── offline-mode-cache.d.ts │ ├── playground-client.d.ts │ ├── setup-fetch-network-transport.d.ts │ ├── worker-thread.d.ts │ └── worker-utils.d.ts ├── index.d.ts └── package.json ``` ## Testing instructions Install [verdaccio](https://verdaccio.org/): ```shell npm install -g verdaccio ``` Run it: ```shell verdaccio ``` > There would probably be a smarter way to test this without modifying the files below, but this got the job done for me. Edit `tools/scripts/publish.mjs` so that the `spawnSync` call takes an extra `--registry` argument: ```js spawnSync('npm', ['publish', '--access', 'public', tag ? `--tag ${tag}` : '', '--registry', 'http://localhost:4873/'], { ``` Edit the `publish` command in `packages/playground/client/project.json` so that it looks something like: ```json "command": "node tools/scripts/publish.mjs playground-client 2.0.0 test", ``` Edit the `publish` command in `packages/playground/remote/project.json` so that it looks something like: ```json "command": "node tools/scripts/publish.mjs playground-remote 0.0.1 test", ``` Publish both packages to verdaccio: ```shell npx nx publish playground-remote npx nx publish playground-client ``` Clone the test repo and configure it to use the verdaccio registry: ```shell cd some-dir git clone [email protected]:psrpinto/playground-ts-test.git cd playground-ts-test # Will create a .npmrc file in the current directory. npm set registry http://localhost:4873/ --location project ``` Edit `package.json` of the test repo so that it references the version of `@wp-playground/client` you published above: ```json "@wp-playground/client": "^2.0.0", ``` Then `npm install`. Open the test repo in your IDE, navigate to `src/playground/Playground.tsx` and make sure the `PlaygroundClient` has correct completion, and that you can navigate to its file.
- Loading branch information