mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-24 21:40:48 +02:00
fix(ci): adjust package-latest-version script (#398)
This commit is contained in:
+1
-4
@@ -1,7 +1,4 @@
|
|||||||
{
|
{
|
||||||
"tag": "alpha",
|
"tag": "alpha",
|
||||||
"changes": [
|
"changes": [".changes/persisted-scope-fix-oom.md", ".changes/v2-alpha.md"]
|
||||||
".changes/persisted-scope-fix-oom.md",
|
|
||||||
".changes/v2-alpha.md"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,10 +44,14 @@ https.get(url, options, (response) => {
|
|||||||
response.on("end", function () {
|
response.on("end", function () {
|
||||||
const data = JSON.parse(chunks.join(""));
|
const data = JSON.parse(chunks.join(""));
|
||||||
if (kind === "cargo") {
|
if (kind === "cargo") {
|
||||||
const versions = data.versions.filter((v) => v.num.startsWith(target));
|
if (data.versions) {
|
||||||
console.log(versions.length ? versions[0].num : "0.0.0");
|
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") {
|
} else if (kind === "npm") {
|
||||||
const versions = Object.keys(data.versions).filter((v) =>
|
const versions = Object.keys(data.versions || {}).filter((v) =>
|
||||||
v.startsWith(target)
|
v.startsWith(target)
|
||||||
);
|
);
|
||||||
console.log(versions[versions.length - 1] || "0.0.0");
|
console.log(versions[versions.length - 1] || "0.0.0");
|
||||||
|
|||||||
+11
-11
@@ -61,25 +61,25 @@ fn main() {
|
|||||||
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { upload } from '@tauri-apps/plugin-upload'
|
import { upload } from "@tauri-apps/plugin-upload";
|
||||||
|
|
||||||
upload(
|
upload(
|
||||||
'https://example.com/file-upload',
|
"https://example.com/file-upload",
|
||||||
'./path/to/my/file.txt',
|
"./path/to/my/file.txt",
|
||||||
(progress, total) => console.log(`Uploaded ${progress} of ${total} bytes`), // a callback that will be called with the upload progress
|
(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
|
{ "Content-Type": "text/plain" } // optional headers to send with the request
|
||||||
)
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { download } from "tauri-plugin-upload-api";
|
import { download } from "tauri-plugin-upload-api";
|
||||||
|
|
||||||
download(
|
download(
|
||||||
'https://example.com/file-download-link',
|
"https://example.com/file-download-link",
|
||||||
'./path/to/save/my/file.txt',
|
"./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
|
(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
|
{ "Content-Type": "text/plain" } // optional headers to send with the request
|
||||||
)
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|||||||
Reference in New Issue
Block a user