In this chapter we will build hello into a package, check it, publish it, and install it by name, the same way we installed WordPress. By the end, example-hello will be one of Nextweb's installed packages.
We're still in the shell we opened from the hello folder.
Build the package
pkg create example-hello 0.1.0Building example-hello 0.1.0 for example (internal)...
Built and registered dist/example-hello_0.1.0_all.zip.enc
owner example (you)
files 1; source not encrypted
package key akek-2604fb770018
sha256 bc20b0111fd16cd1be5bd5c02b2ad6cd8d7d75c09400369a77e138834b68e6f6
size 1435 bytes
Next: pkg validate, then pkg publish.Notice the new file, hello/dist/example-hello_0.1.0_all.zip.enc. That one file is our whole application, encrypted. The all in its name means it runs on every platform Nextweb supports, because Node.js comes from Nextweb rather than from our package.
Registered matters: Nextweb told the license server about this exact file. Only registered files get the key that opens them, so a file that was changed afterwards, or built by someone else, won't install.
Check it
pkg validateValidating /home/you/nextweb-tour/hello/dist/example-hello_0.1.0_all.zip.enc
ok header: example-hello 0.1.0, build da23340d852de1f5, internal, owner example
ok package key: sealed to example's package key akek-2604fb770018
ok owner: example (acc_5886c0cfd4eaa7ee)
ok package key release: released for this file (registered build of example) to your license
ok contents: the package inside opens and passes the publish checks
ok source layer: none (the source is not encrypted)
Static checks passed.
No VM checks: list platforms in .nextwebrc (validate.platforms), or pass --vm.Each line is one check, and the fourth is the one that matters most: our license was given the key for this file, so it will install. The last line is about a deeper check that starts a fresh virtual machine and runs the endpoints from .nextwebrc against the installed package. It needs virtualization on this computer, so we skip it here.
Publish it
pkg publishnote: no VM check report for this file (optional: pkg validate --vm)
Publishing example-hello-0.1.0-all to https://cdn.nextwebjs.com...
Published: example-hello-0.1.0-all (1435 bytes, sha256 bc20b0111fd16cd1be5bd5c02b2ad6cd8d7d75c09400369a77e138834b68e6f6)
It installs only on your own license: pkg install example-helloThe note is about the virtual machine check we skipped; it is optional, and it doesn't stop the upload. The last line says where this package installs: only on our own license, because it is internal and ours.
A published version is final. To change the application, we build a new version, 0.1.1, and publish that.
Install it by name
We leave this shell and open one in the nextweb-tour folder, where we install software:
exitcd ..
./nextwebpkg install example-helloResolving dependencies...
Architecture: x64 (auto-detected)
Installation order: example-hello
Installing 1 package(s)...
Installing example-hello...
example-hello 0.1.0 installed successfullyWhat we have now
Our application, published and installed by name, exactly like the packages Nextweb publishes. Next, we'll deploy it as a website.