Writing modules
We've already heard that a module for an app shell created with Piral is called a pilet. Pilets are developed like most frontend applications – with the small exception that pilets are not self-contained applications, but closer to independent libraries.
If we want to start a new pilet, we have two options: we can use the integrated tooling to scaffold a new project with the right setup or start from scratch as we did with the app shell. When we have published the emulator, we can scaffold a new project from the command line:
npm init pilet --source <package-name> --bundler webpack --registry https://registry.npmjs.org/ --defaults
This will initialize a new npm
project with a package.json
file representing a pilet. The pilet will be targeted at the previously published emulator package. For bundling purposes, we use again webpack
. If a private npm registry was used for publishing the emulator, the URL in the command needs to be adjusted too...