Closed jgaehring closed 10 months ago
Name | Link |
---|---|
Latest commit | 6365afd2c52ed17802f21203ef81f016bf845c39 |
Latest deploy log | https://app.netlify.com/sites/happy-dubinsky-808218/deploys/64f15ffb9fdf990008d3e78b |
Deploy Preview | https://deploy-preview-525--happy-dubinsky-808218.netlify.app/ |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
This took a lot of trial and error to make sure all the
field-scripts
would work from both the monorepo environment as well as for standalone field modules vianpm-init
(aka,npm create
). It also took some careful consideration of how exactly to structure the dependency graph, what to publish as their own packages, what utilities to include where, etc.In the end, however, I really like the way the pieces all fell into place, with a total of 4 packages now published on the npm registry under the
@farmos.org
scope:create-field-module
: This is actually the smallest part of all this, a simple node script does the actual scaffolding based on a template field module, with a brief questionaire for provided with some help from the prompts library.field-kit
: The application core itself is used as the development environment to provide context for field modules in the browser. I went back and forth whether to make this a dependency offield-scripts
or just includefield-scripts
as part offield-kit
and pull the whole thing in as one big dependency (the latter option is proved quite inconvenient for versioning with npm's publishing/unpublishing policies, as I soon learned). Ultimately, the best solution was to makefield-kit
a peer dependency offield-scripts
, and just include it and all offield-script
's other dependencies as dev dependencies in the template'spackage.json
.field-components
: This is our component library, which is set up as its own package so it can be used in other applications potentially; field modules do not need them installed as a dependency in the final build, as they're registered globally by Field Kit and will be available at runtime, but Field Kit itself needs to install it as a part of the development environment.field-scripts
: This is where the real meat is. The main scripts for the dev server,develop-module
, and the build processbuild-module
are contained here. These are what Field Kit has already been using internally for a while now, and they were always intended to work with field modules from the start, it just took some tweaking to make sure it all worked outside of the monorepo environment.There is a
README
with full instructions, but the beauty of this can be tried out with just a few simple commands:And with that, you're off and running with a full dev environment, no other requirements but Node.js. I'm hoping to record a little demo some time before the next monthly call.
Resolves #422.