Repository navigation
chore: mark internal packages private and clean up codegen scripts - #1819
Conversation
- Mark `@looker/sdk-codegen-scripts`, `@looker/sdk-codegen-utils`, and `@looker/wholly-artifact` as `"private": true`, remove `publishConfig`, and update their READMEs to note they are workspace-only packages no longer published to npm. - Keep all three packages in Release Please configuration so exact `@looker/*` workspace dependency pins stay synchronized. - Remove unused workspace dependencies on retired packages from `@looker/api-explorer` (`devDependencies`) and `@looker/run-it` (`dependencies`). - Update `packages/sdk-codegen-scripts/src/nodeUtils.ts` (`run()`) to use direct `spawnSync` process invocation (`shell: false`), add pure-Node `hasCommand()` PATH lookup, and update callers in `convert.ts`, `legacyGenerator.ts`, and `reformatter.ts`. - Update `packages/sdk-codegen-scripts/src/fetchSpec.ts` (`login()`) to send credentials in a form-encoded POST body (`application/x-www-form-urlencoded`) rather than URL query parameters. - Add unit tests in `packages/sdk-codegen-scripts/src/nodeUtils.spec.ts` and `packages/sdk-codegen-scripts/src/fetchSpec.spec.ts`.
There was a problem hiding this comment.
Code Review
This pull request marks several packages as private workspace-only packages and refactors command execution in nodeUtils.ts to use spawnSync instead of execSync for safer argument handling. It also updates formatters and generators to pass arguments as arrays, fixes parameter encoding in fetchSpec.ts, and adds unit tests. The review feedback identifies critical issues regarding Windows compatibility: hasCommand failing when commands already have extensions, spawnSync failing on Windows without a shell for batch files, and simple whitespace splitting breaking quoted arguments with spaces in legacyGenerator.ts.
Codegen Tests0 tests 0 ✅ 0s ⏱️ Results for commit 15e37d2. ♻️ This comment has been updated with latest results. |
Summary
Marks three internal/deprecated workspace packages as private so they are no longer published to npm, removes unused dependencies on them from published packages, and cleans up process invocation and login request formatting in
@looker/sdk-codegen-scripts:"private": trueand removedpublishConfiginpackages/sdk-codegen-scripts/package.json,packages/sdk-codegen-utils/package.json, andpackages/wholly-artifact/package.json.README.mdto state that it is private to this workspace and no longer published to npm.release-please-config.json,.release-please-manifest.json,release-please-config.json.template) so exact@looker/*workspace pins remain synchronized across releases (matching the other private workspace packages in this repo).@looker/sdk-codegen-scriptsfrompackages/api-explorer/package.json(devDependencies).@looker/sdk-codegen-utilsfrompackages/run-it/package.json(dependencies).@looker/sdk-codegen-scripts(nodeUtils.ts& callers):execSyncstring concatenation inpackages/sdk-codegen-scripts/src/nodeUtils.ts(run()) withspawnSync(command, args, { shell: false, ... }), preserving stderr forwarding on success and existingwarningvs.quit()error handling.hasCommand()PATH lookup innodeUtils.ts.packages/sdk-codegen-scripts/src/convert.ts: resolveswagger2openapi/swagger2openapi.jsdirectly viaprocess.execPathand pass''for-i.packages/sdk-codegen-scripts/src/legacyGenerator.ts: splitspec.optionson whitespace into separate argv elements, omitting empty tokens.packages/sdk-codegen-scripts/src/reformatter.ts(PythonFormatter,GoFormatter): usehasCommand('pipenv')/hasCommand('gofmt'), guard empty file lists, and pass...filesas separate arguments.@looker/sdk-codegen-scripts(fetchSpec.ts):login()to encodeclient_id/client_secretwithencodeParams(creds)from@looker/sdk-rtland send them in thePOSTbody withcontent-type: application/x-www-form-urlencoded(withqueryParams = undefinedand non-mutatingmergeOptions(props, ...)), matchingNodeSession._login().Testing
packages/sdk-codegen-scripts/src/nodeUtils.spec.tspackages/sdk-codegen-scripts/src/fetchSpec.spec.tsyarn lint:ts,yarn build, andyarn dedupe:ci(all passed,yarn.lockuntouched).packages/sdk-codegen(|-utils|-scripts)/src(19 passed, 2 skipped / 431 passed tests),packages/run-it/srcandpackages/api-explorer/src(74 passed, 3 skipped / 357 passed tests), andpackages/wholly-artifact/src/RowModel.spec.ts(30 passed tests).yarn convert spec/Looker.4.0.json ...produces byte-for-byte identical OpenAPI 3 output compared toorigin/main(cmpexit 0).