unjs / mkdist

Lightweight file-to-file transpiler.
MIT License
357 stars 25 forks source link

The option cleanDist was never added to args of citty #216

Open metaory opened 5 months ago

metaory commented 5 months ago

Environment

Name Version
mkdist --version 1.5.0
node --version v22.0.0
npm --version 10.5.1
lsb_release -ds Arch Linux
uname -mr 6.8.7-arch1-1 x86_64

Reproduction

create fresh

# create a tmp dir and navigate to
cd $(mktemp -d)

# initialize empty package.json
npm init -y

# set package "type" to "module
# add "start" to package scripts
npm pkg set type="module" scripts.start="node src/index.js"

# create src/
mkdir src

# write some dummy console
echo 'console.log("xyzzy");' > src/index.js

# build for esm
npx mkdist --dist=dist --format=esm --ext=mjs

# build for cjs
npx mkdist --dist=dist --format=cjs --ext=cjs

# check dist/ files
tree dist

dist
└── index.cjs

1 directory, 1 file

every build is cleaning the dist/

Describe the bug

every build is cleaning the dist/ I'm aware the cleanDist option was added f613c17 but no cli arg was ever added

cd $(mktemp -d); npm init -y; npm pkg set type="module" scripts.start="node src/index.js"
mkdir src; echo 'console.log("xyzzy");' > src/index.js

npx mkdist --dist=dist --format=esm --ext=mjs
npx mkdist --dist=dist --format=cjs --ext=cjs

tree dist
dist
└── index.cjs

1 directory, 1 file

Additional context

I've just made a PR for this issue, will link here shortly UPDATE: #217

Logs

No response

metaory commented 5 months ago

added this fix PR: fix(cli): fixed cleanDist with addition of --no-clean option #217