interactivethings / packup

WIP: A no-config development tool for modern web apps
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

Improve lookup of stuff #1

Open jstcki opened 9 years ago

jstcki commented 9 years ago

Currently packup can be run in one of three ways:

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 commented 9 years ago

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 commented 9 years ago

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 :smile:

jstcki commented 9 years ago

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