Skip to content

Conversation

hiddewie
Copy link
Contributor

@hiddewie hiddewie commented Mar 10, 2021

This is a followup PR of #295. Concurrent downloads work well, but the filesystem move call throws an error in fs-extra when the file already exists... It should replace it of course.

Reference documentation: https://github.com/jprichardson/node-fs-extra/blob/master/docs/move-sync.md

Sorry I did not notice it in previous testing. All the tests currently mock the filesystem library, so I cannot simulate an existing file.

Example (anonymized) output of current 2.2.0 version:

...
Compile the schemas /XXXXXX/har.schema.yaml to /XXXXXX
Compiling /XXXXXX/har.schema.yaml with name har.
Compile the schemas /XXXXXX/index.schema.yaml to /XXXXXX/generated
Compiling /XXXXXX/index.schema.yaml with name Index.
Compile the schemas /XXXXXX/configuration.schema.yaml to /XXXXXX/generated
Compiling /XXXXXX/configuration.schema.yaml with name BotConfiguration.
Download 5.0.1 ...
Download 5.0.1 ...
Downloaded 5.0.1
/XXXXXX/node_modules/fs-extra/lib/move-sync/move-sync.js:25
  if (fs.existsSync(dest)) throw new Error('dest already exists.')
                           ^
Error: dest already exists.
    at doRename (/XXXXXX/node_modules/fs-extra/lib/move-sync/move-sync.js:25:34)
    at Object.moveSync (/XXXXXX/node_modules/fs-extra/lib/move-sync/move-sync.js:17:10)
    at WriteStream.<anonymous> (/XXXXXX/node_modules/@openapitools/openapi-generator-cli/main.js:863:74)
    at WriteStream.emit (node:events:390:22)
    at finish (node:internal/streams/writable:741:10)
    at finishMaybe (node:internal/streams/writable:723:9)
    at afterWrite (node:internal/streams/writable:510:3)
    at onwrite (node:internal/streams/writable:483:7)
    at node:internal/fs/streams:392:5
    at FSReqCallback.wrapper [as oncomplete] (node:fs:663:5)
[main] INFO  o.o.codegen.DefaultGenerator - Generating with dryRun=false
[main] WARN  o.o.c.ignore.CodegenIgnoreProcessor - Output directory does not exist, or is inaccessible. No file (.openapi-generator-ignore) will be evaluated.
[main] INFO  o.o.codegen.DefaultGenerator - OpenAPI Generator: typescript-axios (client)
[main] INFO  o.o.codegen.DefaultGenerator - Generator 'typescript-axios' is considered stable.
[main] INFO  o.o.c.l.AbstractTypeScriptClientCodegen - Hint: Environment variable 'TS_POST_PROCESS_FILE' (optional) not defined. E.g. to format the source code, please try 'export TS_POST_PROCESS_FILE="/usr/local/bin/prettier --write"' (Linux/Mac)
...

@kay-schecker kay-schecker changed the base branch from master to fix/297 March 10, 2021 12:25
@kay-schecker kay-schecker merged commit bf618d1 into OpenAPITools:fix/297 Mar 10, 2021
@github-actions
Copy link

🎉 This PR is included in version 2.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants