Skip to content

Commit

Permalink
fix(ci): adjust package-latest-version script (tauri-apps#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed May 24, 2023
1 parent 43be6c7 commit b5aaf5d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
5 changes: 1 addition & 4 deletions .changes/pre.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"tag": "alpha",
"changes": [
".changes/persisted-scope-fix-oom.md",
".changes/v2-alpha.md"
]
"changes": [".changes/persisted-scope-fix-oom.md", ".changes/v2-alpha.md"]
}
10 changes: 7 additions & 3 deletions .scripts/covector/package-latest-version.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ https.get(url, options, (response) => {
response.on("end", function () {
const data = JSON.parse(chunks.join(""));
if (kind === "cargo") {
const versions = data.versions.filter((v) => v.num.startsWith(target));
console.log(versions.length ? versions[0].num : "0.0.0");
if (data.versions) {
const versions = data.versions.filter((v) => v.num.startsWith(target));
console.log(versions.length ? versions[0].num : "0.0.0");
} else {
console.log("0.0.0");
}
} else if (kind === "npm") {
const versions = Object.keys(data.versions).filter((v) =>
const versions = Object.keys(data.versions || {}).filter((v) =>
v.startsWith(target)
);
console.log(versions[versions.length - 1] || "0.0.0");
Expand Down
22 changes: 11 additions & 11 deletions plugins/upload/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,25 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:

```javascript
import { upload } from '@tauri-apps/plugin-upload'
import { upload } from "@tauri-apps/plugin-upload";

upload(
'https://example.com/file-upload',
'./path/to/my/file.txt',
(progress, total) => console.log(`Uploaded ${progress} of ${total} bytes`), // a callback that will be called with the upload progress
{ 'Content-Type': 'text/plain' } // optional headers to send with the request
)
"https://example.com/file-upload",
"./path/to/my/file.txt",
(progress, total) => console.log(`Uploaded ${progress} of ${total} bytes`), // a callback that will be called with the upload progress
{ "Content-Type": "text/plain" } // optional headers to send with the request
);
```

```javascript
import { download } from "tauri-plugin-upload-api";

download(
'https://example.com/file-download-link',
'./path/to/save/my/file.txt',
(progress, total) => console.log(`Downloaded ${progress} of ${total} bytes`), // a callback that will be called with the download progress
{ 'Content-Type': 'text/plain' } // optional headers to send with the request
)
"https://example.com/file-download-link",
"./path/to/save/my/file.txt",
(progress, total) => console.log(`Downloaded ${progress} of ${total} bytes`), // a callback that will be called with the download progress
{ "Content-Type": "text/plain" } // optional headers to send with the request
);
```

## Contributing
Expand Down

0 comments on commit b5aaf5d

Please sign in to comment.