From 76ce64de2110f03c33ef368b92d3277928fb7e23 Mon Sep 17 00:00:00 2001 From: filesite Date: Tue, 15 Aug 2023 19:04:42 +0800 Subject: [PATCH] cloud and hero install script ready --- .gitignore | 2 ++ install_cloud.sh | 11 +++++++++++ install_hero.sh | 8 ++++++++ package.json | 6 ++++++ test/cloud_test.mjs | 9 +++++++++ test/start_cloud.mjs | 14 ++++++++++++++ 6 files changed, 50 insertions(+) create mode 100644 .gitignore create mode 100644 install_cloud.sh create mode 100644 install_hero.sh create mode 100644 package.json create mode 100644 test/cloud_test.mjs create mode 100644 test/start_cloud.mjs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..15813be --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +package-lock.json +node_modules/ diff --git a/install_cloud.sh b/install_cloud.sh new file mode 100644 index 0000000..0eab1d4 --- /dev/null +++ b/install_cloud.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +# install cloud +npm i --save @ulixee/cloud + +# start cloud +npx @ulixee/cloud start + +echo "Manual url:" +echo "https://ulixee.org/docs/cloud/" + diff --git a/install_hero.sh b/install_hero.sh new file mode 100644 index 0000000..f31996e --- /dev/null +++ b/install_hero.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# install hero +npm i --save @ulixee/hero + +echo "Manual url:" +echo "https://ulixee.org/docs/hero/" + diff --git a/package.json b/package.json new file mode 100644 index 0000000..176d218 --- /dev/null +++ b/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "@ulixee/cloud": "^2.0.0-alpha.24", + "@ulixee/hero": "^2.0.0-alpha.24" + } +} diff --git a/test/cloud_test.mjs b/test/cloud_test.mjs new file mode 100644 index 0000000..fdc1648 --- /dev/null +++ b/test/cloud_test.mjs @@ -0,0 +1,9 @@ +import Hero from '@ulixee/hero'; + +(async () => { + const hero = new Hero({ connectionToCore: 'ws://192.168.3.13:1818' }); + await hero.goto('https://filesite.io'); + const title = await hero.document.title; + console.log('Page title', title); + await hero.close(); +})(); diff --git a/test/start_cloud.mjs b/test/start_cloud.mjs new file mode 100644 index 0000000..5f1993f --- /dev/null +++ b/test/start_cloud.mjs @@ -0,0 +1,14 @@ +//Documents: https://ulixee.org/docs/cloud/modules/cloud-node#constructor +import { CloudNode } from '@ulixee/cloud'; + +(async () => { + const cloudNode = new CloudNode({ + port: 1818, + cloudType: 'private' + }); + await cloudNode.listen(); + console.log(`CloudNode started on port ${await cloudNode.port}`); +})().catch(error => { + console.log('ERROR starting Ulixee CloudNode', error); + process.exit(1); +});