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

Add oclif to existing project #999

Closed
toymachiner62 opened this issue Oct 14, 2022 · 2 comments · Fixed by #1366
Closed

Add oclif to existing project #999

toymachiner62 opened this issue Oct 14, 2022 · 2 comments · Fixed by #1366
Labels
enhancement New feature or request

Comments

@toymachiner62
Copy link

Do you want to request a feature or report a bug?

Request a feature (unless it already exists)

What is the current behavior?

I can't run oclif generate myprojec and point to my existing project and have just the necessary files added there.

What is the expected behavior?

Essentially I want a way to add oclif to an existing project

@mdonnalley mdonnalley added unlikely Feature we are unlikely to implement idea and removed idea labels Mar 5, 2024
@mdonnalley mdonnalley added enhancement New feature or request and removed unlikely Feature we are unlikely to implement labels Apr 3, 2024
@joshcanhelp
Copy link
Contributor

joshcanhelp commented Apr 3, 2024

I can take a crack at this one. From poking around and trying things out, it seems like the three things that need to be done, at a minimum, are:

  • Install @oclif/core if not
  • Add the ./bin/* files. Because those are different between the CJS and ESM examples, we'll need to ask the user what module type they're using and maybe try to auto-detect.
  • Add the following to package.json:
{
	// ...
	"oclif": {
		"commands": "./dist/commands"
	}
}

Questions:

  • Do we need to do anything else in this command? From my testing, this was the bare minimum to get ./bin/run.js command working.
  • Are there any other config values we should be setting in package.json?

CC @mdonnalley

@mdonnalley
Copy link
Contributor

we'll need to ask the user what module type they're using and maybe try to auto-detect.

I think detecting the module type would be the best user experience here

Are there any other config values we should be setting in package.json?

oclif generate will also set the bin which gets set in oclif.bin and in bin. It's not necessary for running bin/run.js but will be necessary once it's published.

If the package.json already has a bin you could use that to populate oclif.bin

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

Successfully merging a pull request may close this issue.

3 participants