chore(cli): bundle with bun target node and publish from staged dir#2637
chore(cli): bundle with bun target node and publish from staged dir#2637RomanHotsiy wants to merge 10 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: b902fbf The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1772635755 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1772635755
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1772635755
# or
npm install @redocly/respect-core@0.0.0-snapshot.1772635755 |
tatomyr
left a comment
There was a problem hiding this comment.
Had a brief look. Will give it another pass later.
| import { performance } from 'node:perf_hooks'; | ||
| import { default as redoc } from 'redoc'; | ||
|
|
||
| import packageJson from '../../../package.json' with { type: 'json' }; |
There was a problem hiding this comment.
It probably makes more sense to import it from utils/package.js.
| import { createRequire } from 'node:module'; | ||
|
|
||
| const packageJson = createRequire(import.meta.url ?? __dirname)('../../package.json'); | ||
| import packageJson from '../../package.json' with { type: 'json' }; |
There was a problem hiding this comment.
I vaguely recall there was an issue with this syntax, probably somewhere in our other products, so we decided to stick with createRequire during migration to ESM. Have you tested your changes with Realm/Reunite?
| } | ||
|
|
||
| function cleanUpStyledComponentWarnings(str: string): string { | ||
| return str.replace(/^styled-components: it looks like an unknown prop .*?(?:\r?\n|$)/gm, ''); |
There was a problem hiding this comment.
I don't see the message anywhere. Why do wee need this?
| const result = spawnSync(command, args, { | ||
| cwd: rootDir, | ||
| stdio: 'inherit', | ||
| shell: process.platform === 'win32', |
There was a problem hiding this comment.
Are we going to publish from Win?
| with: | ||
| node-version: 24 | ||
| cache: npm | ||
| - uses: oven-sh/setup-bun@v2 |
There was a problem hiding this comment.
Does this imply Redocly CLI won't get executed on a system without Bun installed?
What/Why/How?
bun build --target node) instead of the previous TypeScript-only compile flow.createRequire('../../package.json')patterns with static JSON imports in CLI runtime paths.build-docstemplate fallback so bundled artifacts do not depend ontemplate.hbsbeing present as a filesystem asset.package.jsonmutation/restore with a staged publish directory (packages/cli/.publish) andpublishConfig.directorysochangeset publishpublishes from the staged manifest/artifacts.bin/cli.js, bundledlib/index.js,README.md,LICENSE, and a strippedpackage.json(no deps/devDeps/scripts).Reference
Testing
npm --workspace packages/cli run compilenode packages/cli/lib/index.js --helpnpm run typechecknpm run pack:preparenpm run release(no unpublished packages in this run; verified publish-dir prepare/cleanup path)Screenshots (optional)
Check yourself
Security