-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert JS package to yarn workspace (#5160)
### What - [x] Move `web-viewer-react` package into its own folder at the same level as `web-viewer` - [x] Add a root `package.json` in `rerun_js` with `workspaces` property pointing at the two packages - [x] Update CI to use workspaces ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using newly built examples: [app.rerun.io](https://app.rerun.io/pr/5160/index.html) * Using examples from latest `main` build: [app.rerun.io](https://app.rerun.io/pr/5160/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [app.rerun.io](https://app.rerun.io/pr/5160/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! - [PR Build Summary](https://build.rerun.io/pr/5160) - [Docs preview](https://rerun.io/preview/af65e980271dd584decd5ac1934443dd6a9fb86d/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/af65e980271dd584decd5ac1934443dd6a9fb86d/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
- Loading branch information
Showing
24 changed files
with
385 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
**/node_modules | ||
**/package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"licenses": [ | ||
{ | ||
"type": "MIT" | ||
}, | ||
{ | ||
"type": "Apache-2.0" | ||
} | ||
], | ||
"private": true, | ||
"workspaces": [ | ||
"web-viewer", | ||
"web-viewer-react" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env node | ||
// @ts-check | ||
|
||
import { | ||
$, | ||
fs, | ||
script_dir, | ||
path, | ||
fail, | ||
inferTag, | ||
isPublished, | ||
} from "./common.mjs"; | ||
|
||
const root_dir = path.resolve(script_dir, ".."); | ||
|
||
if (!process.env.NODE_AUTH_TOKEN) { | ||
fail( | ||
`"NODE_AUTH_TOKEN" env is not set. https://docs.npmjs.com/creating-and-viewing-access-tokens`, | ||
); | ||
} | ||
|
||
/** @type {{ workspaces: string[] }} */ | ||
const root_package_json = JSON.parse( | ||
fs.readFileSync(path.join(root_dir, "package.json"), "utf-8"), | ||
); | ||
|
||
const all_packages = await Promise.all( | ||
root_package_json.workspaces.map(async (pkg) => { | ||
const dir = path.join(root_dir, pkg); | ||
const { name, version } = JSON.parse( | ||
fs.readFileSync(path.join(dir, "package.json"), "utf-8"), | ||
); | ||
const published = await isPublished(name, version); | ||
|
||
return { dir, name, version, published }; | ||
}), | ||
); | ||
|
||
const unpublished = all_packages.filter((pkg) => { | ||
if (pkg.published) { | ||
console.log(`${pkg.name}@${pkg.version} is already published`); | ||
return false; | ||
} | ||
return true; | ||
}); | ||
|
||
if (unpublished.length === 0) { | ||
console.log("nothing to publish"); | ||
process.exit(0); | ||
} | ||
|
||
$(`yarn install`, { cwd: root_dir }); | ||
|
||
for (const pkg of unpublished) { | ||
console.log(`building ${pkg.name}@${pkg.version}`); | ||
$(`npm run build`, { cwd: pkg.dir }); | ||
} | ||
|
||
for (const pkg of unpublished) { | ||
console.log(`publishing ${pkg.name}@${pkg.version}`); | ||
const tag = inferTag(pkg.version); | ||
$(`npm publish --tag ${tag}`, { cwd: pkg.dir }); | ||
} |
Oops, something went wrong.