mirror of
https://github.com/aljazceru/pear-docs.git
synced 2025-12-17 06:24:24 +01:00
Updating guides (1.5.0) (#154)
* Remove `--` for app option passthrough Changed since `paparam` was used for parsing command line options: 85892a6a32a84ae42a548f8e3ac0b5dbedd70c80 Now uses `cmd.rest` for app args. * Use `Pear.config.args` for howto scripts * Update "starting a pear desktop project" guide to match template * Remove `--no-ask-trust` flag from `pear run` cli doc This command was replaced by `--no-ask` which was already in the documentation. Updated a reference to `--no-ask-trust` in the 'Sharing a Pear Application' guide. * Fix typos in "Releasing a Pear Application" guide * Correct application storage folder name in hyperbee howto * Add missing `test/index.test.js` in project structure for terminal guide * Remove language about app continuing to run This is no longer true at least as of pear: v0.5114.pqbzjhqyonxprx8hghxexnmctw75mr91ewqw5dxe1zmntfyaddqy / v1.5.0 * Fix extra indention in example code for hypercore howto * Format json in `_template.json` example * Add instructions to set up a minimal `package.json` for testing template Without this, the next step of `pear run --dev .` does not work since `pear` expects a `package.json` file. * Rename hyperbee reader app in hyperdrive howto to avoid name conflict Naming only matters if someone is following the guides and starts each guide from the same root directory. If they do, then `bee-reader-app` from the hyperdrive conflicts with the `bee-reader-app` from the hyperbee howto. * Remove unrelated youtube tutorial from hyperswarm howto * Update guide/creating-a-pear-init-template.md Co-authored-by: David Mark Clements <huperekchunow@googlemail.com> * Fix spelling mistake Co-authored-by: David Mark Clements <huperekchunow@googlemail.com> --------- Co-authored-by: David Mark Clements <huperekchunow@googlemail.com>
This commit is contained in:
@@ -78,37 +78,37 @@ Replace the contents of `_template.json` with
|
||||
|
||||
```json
|
||||
{
|
||||
"params": [
|
||||
{
|
||||
"name": "name",
|
||||
"prompt": "name"
|
||||
},
|
||||
{
|
||||
"name": "main",
|
||||
"default": "index.html",
|
||||
"prompt": "main",
|
||||
"validation": "(value) => value.endsWith('.html')",
|
||||
"msg": "must have an .html file extension"
|
||||
},
|
||||
{
|
||||
"name": "height",
|
||||
"validation": "(value) => Number.isInteger(+value)",
|
||||
"prompt": "height",
|
||||
"msg": "must be an integer"
|
||||
},
|
||||
{
|
||||
"name": "width",
|
||||
"validation": "(value) => Number.isInteger(+value)",
|
||||
"prompt": "width",
|
||||
"msg": "must be an integer"
|
||||
},
|
||||
{
|
||||
"name": "license",
|
||||
"default": "Apache-2.0",
|
||||
"prompt": "license"
|
||||
}
|
||||
]
|
||||
}
|
||||
"params": [
|
||||
{
|
||||
"name": "name",
|
||||
"prompt": "name"
|
||||
},
|
||||
{
|
||||
"name": "main",
|
||||
"default": "index.html",
|
||||
"prompt": "main",
|
||||
"validation": "(value) => value.endsWith('.html')",
|
||||
"msg": "must have an .html file extension"
|
||||
},
|
||||
{
|
||||
"name": "height",
|
||||
"validation": "(value) => Number.isInteger(+value)",
|
||||
"prompt": "height",
|
||||
"msg": "must be an integer"
|
||||
},
|
||||
{
|
||||
"name": "width",
|
||||
"validation": "(value) => Number.isInteger(+value)",
|
||||
"prompt": "width",
|
||||
"msg": "must be an integer"
|
||||
},
|
||||
{
|
||||
"name": "license",
|
||||
"default": "Apache-2.0",
|
||||
"prompt": "license"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## App Content
|
||||
@@ -166,6 +166,21 @@ Replace the contents of `index.html` file with :
|
||||
</html>
|
||||
```
|
||||
|
||||
Temporarily set the contents of `package.json` to:
|
||||
|
||||
```json
|
||||
{
|
||||
"pear": {
|
||||
"name": "pear-init-template-tutorial",
|
||||
"type": "desktop"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This is the minimal requirements for a Pear Application `package.json` to run.
|
||||
This will allow us to test the template's `index.html` as a pear desktop
|
||||
app.
|
||||
|
||||
Run the application using:
|
||||
|
||||
```bash
|
||||
@@ -216,4 +231,4 @@ pear init [dir]
|
||||
|
||||
Here replace `[dir]` with the local template directory path. This can also be a `pear://` link.
|
||||
|
||||
This should now initialize a new Pear project from the created template.
|
||||
This should now initialize a new Pear project from the created template.
|
||||
|
||||
@@ -39,7 +39,7 @@ pear release production
|
||||
```
|
||||
|
||||
|
||||
Run `pear release help` for more info on the command.
|
||||
Run `pear help release` for more info on the command.
|
||||
|
||||
|
||||
Keep in mind that changes to an application can only propagate to peers when the application is being seeded:
|
||||
@@ -61,7 +61,7 @@ Opening the application with `pear run <link>` will **not** output the log, beca
|
||||
The latest staged changes of a released application can be previewed with the `--checkout` flag:
|
||||
|
||||
```
|
||||
pear run <link> --checkout=staged
|
||||
pear run --checkout=staged <link>
|
||||
```
|
||||
|
||||
The value of the `--checkout` flag may be `staged`, `released` (the default) or a number referring to a specific version length.
|
||||
|
||||
@@ -85,7 +85,7 @@ As long as the process is running the application is being seeded. If other peer
|
||||
|
||||
## Step 4. Run the app on another machine
|
||||
|
||||
It's important that the application seeding process from the former step is up and running otherwise peers will not be able to reach connect and replicate state.
|
||||
It's important that the application seeding process from the former step is up and running otherwise peers will not be able to connect and replicate state.
|
||||
|
||||
With another machine or friend that has `pear` installed execute the `pear run <link>` command to load the application directly peer-to-peer. So with the same example application link it would be:
|
||||
|
||||
@@ -111,7 +111,7 @@ The trust dialog is a security mechanism in Pear that appears when the user trie
|
||||
|
||||

|
||||
|
||||
> During development with `pear run --dev`, applications are automatically trusted, as they are assumed to be safe for testing purposes. Trust dialog can be suppressed using the `--no-ask-trust` flag with `pear run` in which case the application will automatically decline unknown keys.
|
||||
> During development with `pear run --dev`, applications are automatically trusted, as they are assumed to be safe for testing purposes. Trust dialog can be suppressed using the `--no-ask` flag with `pear run` in which case the application will automatically decline unknown keys.
|
||||
|
||||
The application has no state when it's opened for the first time, so the application may show a loader until it's ready to reveal.
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ Now Pear watches project files. When they change, the app is automatically reloa
|
||||
|
||||
While keeping the `pear run --dev .` command running, open `index.html` in an editor.
|
||||
|
||||
Change `<h1>chat</h1>` to `<h1>Hello world</h1>`.
|
||||
Change `<h1>desktop</h1>` to `<h1>Hello world</h1>`.
|
||||
|
||||
The app should now show:
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ This creates the base project structure.
|
||||
|
||||
- `package.json`. App configuration. Notice the `pear` property.
|
||||
- `index.js`. App entrypoint.
|
||||
- `test/index.test.js`. Test skeleton.
|
||||
|
||||
## Step 2. Verify Everything Works
|
||||
|
||||
@@ -27,9 +28,7 @@ pear run --dev .
|
||||
|
||||
> A directory or link needs to be specified with `pear run`, here `.` denotes the current Project directory.
|
||||
|
||||
The app will now run. Note that it will keep running until you exit with `ctrl + c`.
|
||||
|
||||
That's all there is to getting a Pear Terminal project started.
|
||||
The app will now run. That's all there is to getting a Pear Terminal project started.
|
||||
|
||||
|
||||
## Next
|
||||
|
||||
Reference in New Issue
Block a user