Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The relative paths to generate.js and log.js in the forge project are hardcoded in the generators #158

Open
ms14981 opened this issue Feb 1, 2023 · 2 comments
Labels
enhancement New feature or request high-priority

Comments

@ms14981
Copy link
Contributor

ms14981 commented Feb 1, 2023

At the very least, we need a warning comment in the forge project in the log.js and generate.js files.

Can we expose the files more publicly to make the behaviour more explicit? https://docs.npmjs.com/cli/v9/configuring-npm/package-json#files

References:

  • const generate = require("../../../openapi-forge/src/generate"); in utils.js in JS generator.
  • const generate = require("../../../openapi-forge/src/generate"); in features\support\base.ts in TS generator.
  • const log = require("../src/log.js"); in CICD\compareTestResults.js in forge project
  • const log = require("../src/log.js"); in CICD\updateWebpage.js in forge project
  • path.join(__dirname, "..", "..", generator) in the test-generators command. This enforces the location of the file with this code AND the location of the generators supplied to test-generators.
@ColinEberhardt
Copy link
Collaborator

My preference would be to make this more clear, using a combination of using the files property, or additional logging, or similar.

Previously the various paths were passed as CLI args, but this resulted in additional complexity elsewhere - see #141

@ColinEberhardt
Copy link
Collaborator

Actually, I think there is a completely different and more conventional approach. Rather than considering these as files, we should consider this part of the public API for openapi-forge. Currently the API is a CLI tool, however, it could also provide a programmatic API.

With this in mind, the conventional approach would be to add an index.js file, which exports the public behaviour, and is pointed to via the main property of the package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request high-priority
Projects
None yet
Development

No branches or pull requests

2 participants