You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying to test out this program on one of my projects, but somehow I've been unable to succeed. I think I may be using it wrong but from the documentation I'm not entirely sure how this is happening.
My project uses Yarn workspaces, with the following structure:
My first intuition was to run cjstoesm packages/**/*.* since that's what the first example shows. That somehow causes it to attempt to create a directory named after the first file, which crashes:
$ cjstoesm packages/**/*.*
node:fs:1385
handleErrorFromBinding(ctx);
^
Error: EEXIST: file already exists, mkdir '/Users/msikma/Projects/callisto-test/packages/callisto-cli/package.json'
at Object.mkdirSync (node:fs:1385:3)
at Object.writeFile (file:///usr/local/lib/node_modules/cjstoesm/dist/cli/index.js:3348:24)
at Object.writeFile (/usr/local/lib/node_modules/cjstoesm/node_modules/typescript/lib/typescript.js:18750:14)
at printSourceFileOrBundle (/usr/local/lib/node_modules/cjstoesm/node_modules/typescript/lib/typescript.js:111960:16)
at emitJsFileOrBundle (/usr/local/lib/node_modules/cjstoesm/node_modules/typescript/lib/typescript.js:111836:13)
at emitSourceFileOrBundle (/usr/local/lib/node_modules/cjstoesm/node_modules/typescript/lib/typescript.js:111757:13)
at forEachEmittedFile (/usr/local/lib/node_modules/cjstoesm/node_modules/typescript/lib/typescript.js:111498:34)
at Object.emitFiles (/usr/local/lib/node_modules/cjstoesm/node_modules/typescript/lib/typescript.js:111738:9)
at emitWorker (/usr/local/lib/node_modules/cjstoesm/node_modules/typescript/lib/typescript.js:119072:33)
at /usr/local/lib/node_modules/cjstoesm/node_modules/typescript/lib/typescript.js:119049:72 {
errno: -17,
syscall: 'mkdir',
code: 'EEXIST',
path: '/Users/msikma/Projects/callisto-test/packages/callisto-cli/package.json'
}
Node.js v18.3.0
Then I saw that in the animated example, the glob is encased in quotes, which means it passes on the glob literally instead of expanding it first, so I tried that:
This worked on one package (although it killed all the empty lines in it and removed the copyright notice at the top for some reason, but that's a different issue), but somehow it failed to work on the callisto-core package. It just didn't detect it somehow. Same if I use packages/**.
I decided to try using the output directory option, so I ran cjstoesm "packages/**/*.*" "packages_new". Again this only worked for the callisto-cli package (which has only one index.js file) and not for the callisto-core package. It also did not replicate the package directory structure.
Is there some way I'm doing it wrong? What would be the appropriate invocation for my situation? Also, is there a way to prevent the converter from removing additional whitespace in my files? (Here's the old and new.) I appreciate any help!
The text was updated successfully, but these errors were encountered:
Question
I've been trying to test out this program on one of my projects, but somehow I've been unable to succeed. I think I may be using it wrong but from the documentation I'm not entirely sure how this is happening.
My project uses Yarn workspaces, with the following structure:
Each package has its own package.json.
My first intuition was to run
cjstoesm packages/**/*.*
since that's what the first example shows. That somehow causes it to attempt to create a directory named after the first file, which crashes:Then I saw that in the animated example, the glob is encased in quotes, which means it passes on the glob literally instead of expanding it first, so I tried that:
This worked on one package (although it killed all the empty lines in it and removed the copyright notice at the top for some reason, but that's a different issue), but somehow it failed to work on the
callisto-core
package. It just didn't detect it somehow. Same if I usepackages/**
.I decided to try using the output directory option, so I ran
cjstoesm "packages/**/*.*" "packages_new"
. Again this only worked for thecallisto-cli
package (which has only one index.js file) and not for thecallisto-core
package. It also did not replicate the package directory structure.Is there some way I'm doing it wrong? What would be the appropriate invocation for my situation? Also, is there a way to prevent the converter from removing additional whitespace in my files? (Here's the old and new.) I appreciate any help!
The text was updated successfully, but these errors were encountered: