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

Improve lookup of stuff #1

Open
jstcki opened this issue Aug 25, 2015 · 3 comments
Open

Improve lookup of stuff #1

jstcki opened this issue Aug 25, 2015 · 3 comments

Comments

@jstcki
Copy link
Contributor

jstcki commented Aug 25, 2015

Currently packup can be run in one of three ways:

  • packup (looks for an index.js in the current directory, uses that as entry file)
  • packup somedir (looks for an index.js in the somedir, uses that as entry file)
  • packup somedir/somefile.js (uses this file as entry file)

The directory of the entry file is also set as webpack resolve.root and contentBase.

Additionally, it looks for a package.json and an index.html in the directory of the entry file and uses those if available. Otherwise it supplies dummy package info (only used for populating the index.html template) and uses its own index.html template file.

The problem is, that in our current setup package.json and index.html most often are not located in the same directory as the entry file. The actual code is in another directory, most often src. So we would either need another way to resolve the locations of necessary files outside this directory (e.g. using node-resolve) or allow other configuration options for packup. I prefer the former, although we may restrict lookup to only one level above the root directory.

Edit: Not sure if node-resolve would work as I expected

@grossbart
Copy link
Contributor

How about passing a package.json to Packup instead of an index.js and taking the value for the index script from the main configuration?

To start a new project we could create a copy/pasteable script that creates an initial package.json with an entry for Packup. This way each project clearly specifies the version of Packup it needs and we don't have to install Packup globally. But maybe this is not what we wanted to have with Packup, namely a binary that is available everywhere to run anything … Oh well :)

Regarding the HTML file: we haven't really experimented with it yet, but having the templated index.html maybe obliviates the need for a real index.html.

@jstcki
Copy link
Contributor Author

jstcki commented Aug 25, 2015

I'm not even sure the index.html template is that useful. And as far as I can tell, it's the only place we even use the information from package.json. Using the main property would be a pretty good approach though …

And yes, a global packup would only be useful for quick experiments but nothing more. I'd never put preferGlobal: true anywhere 😄

@jstcki
Copy link
Contributor Author

jstcki commented Aug 25, 2015

We could also use the entry property of a webpack config … but then we're back to needing a configuration.

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

No branches or pull requests

2 participants