From af627e8bdeee80108a48489ba9df148a3335e582 Mon Sep 17 00:00:00 2001 From: Saurav Sahu Date: Sun, 7 Feb 2021 19:39:05 +0530 Subject: [PATCH 1/7] move hello-world demo to samples folder --- package-lock.json | 22 +++++++++++++++++++ package.json | 1 + {demo => samples/hello-world}/.editorconfig | 0 {demo => samples/hello-world}/.gitignore | 0 .../hello-world}/.vscode/extensions.json | 0 {demo => samples/hello-world}/livereload.sh | 0 .../hello-world}/package-lock.json | 2 +- {demo => samples/hello-world}/package.json | 2 +- {demo => samples/hello-world}/src/App.svelte | 15 ++++++++++--- {demo => samples/hello-world}/src/app.ts | 0 {demo => samples/hello-world}/tsconfig.json | 0 .../hello-world}/webpack.config.js | 0 12 files changed, 37 insertions(+), 5 deletions(-) rename {demo => samples/hello-world}/.editorconfig (100%) rename {demo => samples/hello-world}/.gitignore (100%) rename {demo => samples/hello-world}/.vscode/extensions.json (100%) rename {demo => samples/hello-world}/livereload.sh (100%) rename {demo => samples/hello-world}/package-lock.json (99%) rename {demo => samples/hello-world}/package.json (95%) rename {demo => samples/hello-world}/src/App.svelte (59%) rename {demo => samples/hello-world}/src/app.ts (100%) rename {demo => samples/hello-world}/tsconfig.json (100%) rename {demo => samples/hello-world}/webpack.config.js (100%) diff --git a/package-lock.json b/package-lock.json index c04f9ae..0cc8c52 100644 --- a/package-lock.json +++ b/package-lock.json @@ -922,6 +922,11 @@ "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" }, + "is-docker": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.1.1.tgz", + "integrity": "sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw==" + }, "is-fullwidth-code-point": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", @@ -946,6 +951,14 @@ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, + "is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "requires": { + "is-docker": "^2.0.0" + } + }, "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", @@ -1212,6 +1225,15 @@ "wrappy": "1" } }, + "open": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/open/-/open-7.4.0.tgz", + "integrity": "sha512-PGoBCX/lclIWlpS/R2PQuIR4NJoXh6X5AwVzE7WXnWRGvHg7+4TBCgsujUgiPpm0K1y4qvQeWnCWVTpTKZBtvA==", + "requires": { + "is-docker": "^2.0.0", + "is-wsl": "^2.1.1" + } + }, "os-locale": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", diff --git a/package.json b/package.json index 7715a9d..3ccaf39 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ }, "dependencies": { "@nodegui/react-nodegui": "^0.9.0", + "open": "^7.4.0", "phin": "^3.5.1" } } diff --git a/demo/.editorconfig b/samples/hello-world/.editorconfig similarity index 100% rename from demo/.editorconfig rename to samples/hello-world/.editorconfig diff --git a/demo/.gitignore b/samples/hello-world/.gitignore similarity index 100% rename from demo/.gitignore rename to samples/hello-world/.gitignore diff --git a/demo/.vscode/extensions.json b/samples/hello-world/.vscode/extensions.json similarity index 100% rename from demo/.vscode/extensions.json rename to samples/hello-world/.vscode/extensions.json diff --git a/demo/livereload.sh b/samples/hello-world/livereload.sh similarity index 100% rename from demo/livereload.sh rename to samples/hello-world/livereload.sh diff --git a/demo/package-lock.json b/samples/hello-world/package-lock.json similarity index 99% rename from demo/package-lock.json rename to samples/hello-world/package-lock.json index c9c17ae..35bb41a 100644 --- a/demo/package-lock.json +++ b/samples/hello-world/package-lock.json @@ -108,7 +108,7 @@ } }, "@nodegui/svelte-nodegui": { - "version": "file:../dist" + "version": "file:../../dist" }, "@tsconfig/svelte": { "version": "1.0.10", diff --git a/demo/package.json b/samples/hello-world/package.json similarity index 95% rename from demo/package.json rename to samples/hello-world/package.json index 38ce425..be7e5d3 100644 --- a/demo/package.json +++ b/samples/hello-world/package.json @@ -10,7 +10,7 @@ }, "dependencies": { "@nodegui/nodegui": "^0.25.0", - "@nodegui/svelte-nodegui": "file:../dist" + "@nodegui/svelte-nodegui": "file:../../dist" }, "devDependencies": { "@nodegui/packer": "^1.4.1", diff --git a/demo/src/App.svelte b/samples/hello-world/src/App.svelte similarity index 59% rename from demo/src/App.svelte rename to samples/hello-world/src/App.svelte index 2948a6f..7ce5efa 100644 --- a/demo/src/App.svelte +++ b/samples/hello-world/src/App.svelte @@ -1,20 +1,28 @@ - Some text with actual children - + {/each} + {/if} + - {#if rootFolder} Server Address: {serverAddress} {/if} + \ No newline at end of file diff --git a/samples/file-share/src/pages/choose-root.svelte b/samples/file-share/src/pages/choose-root.svelte index a8d2ae9..89ee718 100644 --- a/samples/file-share/src/pages/choose-root.svelte +++ b/samples/file-share/src/pages/choose-root.svelte @@ -1,13 +1,13 @@ @@ -92,7 +92,7 @@ import ServerStatus from "../components/server-status.svelte"; text="Drag and drop a folder"/> @@ -106,11 +106,11 @@ import ServerStatus from "../components/server-status.svelte"; #heading { font-size: 16; - color: 'white'; margin-bottom: 16; } #root_folder_area { - padding: 16; + padding: 32; + background-color: '#414445' } \ No newline at end of file diff --git a/samples/file-share/src/utils.ts b/samples/file-share/src/utils.ts new file mode 100644 index 0000000..73ebc7b --- /dev/null +++ b/samples/file-share/src/utils.ts @@ -0,0 +1,11 @@ +import * as os from 'os' + +export const getNetworkAddresses = () => { + const interfaces = require('os').networkInterfaces() + const addresses = Object + .keys(interfaces) + .reduce((acc, key) => [...acc, ...interfaces[key]], []) + .filter(p => p.family === 'IPv4') + .map(p => p.address) + return addresses; +} \ No newline at end of file From 01867f7d91f2e1467187cda172df37f61e4cb4c0 Mon Sep 17 00:00:00 2001 From: Saurav Sahu Date: Sun, 7 Feb 2021 21:23:11 +0530 Subject: [PATCH 5/7] revert back hello-world to original sample --- samples/hello-world/src/App.svelte | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/samples/hello-world/src/App.svelte b/samples/hello-world/src/App.svelte index 7ce5efa..2948a6f 100644 --- a/samples/hello-world/src/App.svelte +++ b/samples/hello-world/src/App.svelte @@ -1,28 +1,20 @@ - Welcome to Svelte NodeGUI! 😎️ - 1. - - {/each} - {/if} + +{#if fileLocation !== null} + + Serving file: + {fileLocation} + + Server running at: + +{/if} diff --git a/samples/file-share/src/stores/root-folder.ts b/samples/file-share/src/stores/root-folder.ts deleted file mode 100644 index e080259..0000000 --- a/samples/file-share/src/stores/root-folder.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { writable } from 'svelte/store' - -export const rootFolder = writable(null); \ No newline at end of file diff --git a/samples/file-share/src/stores/root.ts b/samples/file-share/src/stores/root.ts new file mode 100644 index 0000000..ab7bcae --- /dev/null +++ b/samples/file-share/src/stores/root.ts @@ -0,0 +1,4 @@ +import { writable } from 'svelte/store' +import type { RootFile } from '../typings' + +export const root = writable({ fileLocation: null, serverAddress: null }); \ No newline at end of file diff --git a/samples/file-share/src/typings.ts b/samples/file-share/src/typings.ts index fc35085..cbd5cc4 100644 --- a/samples/file-share/src/typings.ts +++ b/samples/file-share/src/typings.ts @@ -1,4 +1,9 @@ export type AppData = { name: string, description: string +} + +export type RootFile = { + fileLocation: string, + serverAddress: string } \ No newline at end of file