Skip to content

Build cleanup is non-portable and consecutive builds fail #212

Description

@dajiaohuang

Summary

The package build script does not clean generated output portably or sequentially, and a second consecutive build fails on Windows.

Affected version

  • @larksuiteoapi/node-sdk 1.73.0
  • main at f54b49f3566c52b54c598194b7ed3015e3e24224

Current script

package.json defines:

"build": "rm -r lib es types & rollup -c"

Reproduction

On Windows 10 with Node 24.14.1 and Yarn 1.22.22:

  1. Remove lib, es, and types so the first run is clean.
  2. Run corepack yarn build: it exits 0 and produces all three outputs.
  3. Run the same command again: it exits 1 with TS5055 because types/index.d.ts is treated as an input that would be overwritten.

The shell also reports that rm is not recognized, so existing output is never removed. A sentinel placed in lib survives the cleanup step.

On POSIX shells, the single & backgrounds rm; it does not sequence cleanup before Rollup, so cleanup and build can race.

Expected behavior

yarn build should remove lib, es, and types synchronously using a cross-platform command, then run Rollup. Repeating the build should succeed without relying on manually cleaned output.

Impact

Local and release builds can fail or consume stale generated declarations/artifacts depending on platform and timing. Because npm pack publishes the existing lib, es, and types directories and there is no prepack, stale output can also reach a package assembled from an uncleared workspace.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions