From 32d23ef5567422d72b4aa1094519c2357f98c2d4 Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 18:46:14 +0100 Subject: [PATCH 01/19] Update hello-world-long.md --- docs/hello-world-long.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/hello-world-long.md b/docs/hello-world-long.md index 2b6691d..caa30c4 100644 --- a/docs/hello-world-long.md +++ b/docs/hello-world-long.md @@ -45,8 +45,8 @@ frogasaurus ``` After doing that, you should notice that two files have appeared in your folder! -* `Hello/source/hello-embed.js` -* `Hello/source/hello-import.js` +* `Hello/hello-embed.js` +* `Hello/hello-import.js` Each file is a different version of your library.
Each version can be used in a different way.
From aa519610483db235d263e03e8c3a0cc0de7aaa3a Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 18:50:59 +0100 Subject: [PATCH 02/19] Update hello-world-long.md --- docs/hello-world-long.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/hello-world-long.md b/docs/hello-world-long.md index caa30c4..53eedaa 100644 --- a/docs/hello-world-long.md +++ b/docs/hello-world-long.md @@ -71,7 +71,7 @@ To use the `import` version... import it like this: #### `Hello/script.js` ```js -import { hello } from "./Hello-import.js` +import { hello } from "./hello-import.js` hello() ``` @@ -80,16 +80,14 @@ You could run `script.js` with this command: deno run script.js ``` -## Using the library (module) -Alternatively, you could use the `import` file as a javascript module: -#### `Hello/index.html` +Or you use it from within a module: +#### `Hello/index.html ```html - ``` From 3a915d467a85acdca11abcdb75e38f72f0f75c26 Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 18:52:24 +0100 Subject: [PATCH 03/19] Update hello-world-long.md --- docs/hello-world-long.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/hello-world-long.md b/docs/hello-world-long.md index 53eedaa..2240cdc 100644 --- a/docs/hello-world-long.md +++ b/docs/hello-world-long.md @@ -80,9 +80,10 @@ You could run `script.js` with this command: deno run script.js ``` -Or you use it from within a module: -#### `Hello/index.html +Or you could use the library from within a module: +#### `Hello/index.html` ```html + + +``` + +Use the `import` version like this: +```html +import { hello } from "./hello-import.js" +hello() +``` + +## Standalone +If you export a function called `main`, an extra file gets built:
+* `Hello/hello-standalone.js` + +You can run the `main` function by running the file:
+``` +deno run hello-standalone.js +``` + +Or... you could install it:
+``` +deno install --name hello hello-standalone.js +``` + +Then, you can call the `main` function from the command line: +``` +hello +``` From 0a56e07e1be7355adf868894697dc85095304030 Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 18:55:28 +0100 Subject: [PATCH 05/19] Update hello-world-short.md --- docs/hello-world-short.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hello-world-short.md b/docs/hello-world-short.md index f40d899..c882de0 100644 --- a/docs/hello-world-short.md +++ b/docs/hello-world-short.md @@ -11,7 +11,7 @@ deno install --allow-write=. --allow-read=. https://deno.land/x/frogasaurus/frog ## Writing the code Write all your code in a folder named `source`.
-#### `HelloWorld/source/hello.js +#### `HelloWorld/source/hello.js` ```js export const hello = () => { console.log("Hello world!") From ec755795515799b56a830f4484c4be86f7bf088d Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 18:55:50 +0100 Subject: [PATCH 06/19] Update hello-world-short.md --- docs/hello-world-short.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hello-world-short.md b/docs/hello-world-short.md index c882de0..603169d 100644 --- a/docs/hello-world-short.md +++ b/docs/hello-world-short.md @@ -1,4 +1,4 @@ - # Hello World Guide (long version) + # Hello World Guide (short version) This is a short guide on how to make your first library with Frogasaurus!
A longer version is available [here](hello-world-long.md). From aba9f1e3bda6a37c272eadf2502238e6ab7ca1a4 Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 18:57:03 +0100 Subject: [PATCH 07/19] Update hello-world-long.md --- docs/hello-world-long.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hello-world-long.md b/docs/hello-world-long.md index 2240cdc..e26e739 100644 --- a/docs/hello-world-long.md +++ b/docs/hello-world-long.md @@ -1,6 +1,6 @@ # Hello World Guide (long version) This is a long-winded guide on how to make your first library with Frogasaurus!
-A shorter version is *coming soon-ish*. +A shorter version is available [here](hello-world-short.md). ## Installing Before you start, you might need to install [deno](https://deno.land) (if you haven't already). From 07824ff4652664a7f0421a4becfa5221812255a1 Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 18:59:21 +0100 Subject: [PATCH 08/19] Create hello-world.md --- docs/hello-world.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 docs/hello-world.md diff --git a/docs/hello-world.md b/docs/hello-world.md new file mode 100644 index 0000000..36e5a28 --- /dev/null +++ b/docs/hello-world.md @@ -0,0 +1,4 @@ +# Hello World Guide +Which version of the guide would you like to see? +* [**long** version](hello-world-long.md) +* [**short** version](hello-world-short.md) From e73afb8de9fef13d6cdf3e4029e6d2c30ebdb8dc Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 18:59:41 +0100 Subject: [PATCH 09/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d5aa611..a66fea3 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you export a function called `main`...
An extra `-standalone.js` file will appear, that you can run in the command line with [deno](https://deno.land).
## What? I don't understand? -Check out the [Hello World Guide](docs/hello-world-long.md). +Check out the [Hello World Guide](docs/hello-world.md). ## Anything else I should know? Yes! There are some limitations! But it's all a secret (for now). From 58c806264af1855be7c27562d388cee5198e68f1 Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 19:01:19 +0100 Subject: [PATCH 10/19] Update hello-world-short.md --- docs/hello-world-short.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/hello-world-short.md b/docs/hello-world-short.md index 603169d..d401e54 100644 --- a/docs/hello-world-short.md +++ b/docs/hello-world-short.md @@ -40,7 +40,8 @@ Use the `embed` version like this: ``` Use the `import` version like this: -```html +#### `Hello/script.js` +```js import { hello } from "./hello-import.js" hello() ``` From fa84c50dc13d3e612da6fb077f2fe28071d85ac6 Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 19:03:08 +0100 Subject: [PATCH 11/19] Update hello-world-short.md --- docs/hello-world-short.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hello-world-short.md b/docs/hello-world-short.md index d401e54..b840ecf 100644 --- a/docs/hello-world-short.md +++ b/docs/hello-world-short.md @@ -11,7 +11,7 @@ deno install --allow-write=. --allow-read=. https://deno.land/x/frogasaurus/frog ## Writing the code Write all your code in a folder named `source`.
-#### `HelloWorld/source/hello.js` +#### `Hello/source/hello.js` ```js export const hello = () => { console.log("Hello world!") From 69f71e215952a671e119b0f6dcf114a9fa42bb9e Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 19:16:27 +0100 Subject: [PATCH 12/19] Create arguments.md --- docs/arguments.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 docs/arguments.md diff --git a/docs/arguments.md b/docs/arguments.md new file mode 100644 index 0000000..c95c4a5 --- /dev/null +++ b/docs/arguments.md @@ -0,0 +1,32 @@ +# Arguments Guide +Standalone frogasaurus libraries can take arguments.
+Let's make a library that says hello to a given name. + +### Greeter/source/greet.js +```js +export const main = (name) => { + console.log(`Hello ${name}!`) +} +``` + +Then, let's build it by using the usual command. +``` +frogasaurus +``` + +Our library is built! Let's install it to our command line! +``` +deno install --name greet greeter-standalone.js +``` + +Now, we can use our library with arguments in the command line to say hello to different people. + +This prints "Hello Lu!" +``` +greet Lu +``` + +This prints "Hello world!" +``` +greet world +``` From e186129c61d7c9cc3a109389f401a1e74aedb77d Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 19:16:52 +0100 Subject: [PATCH 13/19] Update arguments.md --- docs/arguments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/arguments.md b/docs/arguments.md index c95c4a5..d83737c 100644 --- a/docs/arguments.md +++ b/docs/arguments.md @@ -2,7 +2,7 @@ Standalone frogasaurus libraries can take arguments.
Let's make a library that says hello to a given name. -### Greeter/source/greet.js +#### `Greeter/source/greet.js` ```js export const main = (name) => { console.log(`Hello ${name}!`) From 2e89e0bf2d47c66d892e382481a140a20ebc9ca9 Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 19:21:42 +0100 Subject: [PATCH 14/19] Update arguments.md --- docs/arguments.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/arguments.md b/docs/arguments.md index d83737c..0a1b893 100644 --- a/docs/arguments.md +++ b/docs/arguments.md @@ -1,5 +1,7 @@ # Arguments Guide Standalone frogasaurus libraries can take arguments.
+ +# Single Argument Let's make a library that says hello to a given name. #### `Greeter/source/greet.js` @@ -30,3 +32,19 @@ This prints "Hello world!" ``` greet world ``` + +## Multiple Arguments +Multiple arguments work the same way.
+Let's make a library that adds two numbers together + +#### `Adder/source/add.js` +```js +export const main = (a, b) => { + return parseInt(a) + parseInt(b) +} +``` + +After following the same steps to install it, we can do something like this: +``` +add 3 2 +``` From 1e823f71d9f7e12e02866ede0e306f4324a88f5d Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 19:21:58 +0100 Subject: [PATCH 15/19] Update arguments.md --- docs/arguments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/arguments.md b/docs/arguments.md index 0a1b893..d5c54dc 100644 --- a/docs/arguments.md +++ b/docs/arguments.md @@ -1,7 +1,7 @@ # Arguments Guide Standalone frogasaurus libraries can take arguments.
-# Single Argument +## Single Argument Let's make a library that says hello to a given name. #### `Greeter/source/greet.js` From 6c46159a2835859df00b3886c870200e538c8aaa Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 19:23:45 +0100 Subject: [PATCH 16/19] Create guides.md --- docs/guides.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 docs/guides.md diff --git a/docs/guides.md b/docs/guides.md new file mode 100644 index 0000000..312cfc1 --- /dev/null +++ b/docs/guides.md @@ -0,0 +1,5 @@ +# Frogasaurus Guides +Here are some guides on how to use Frogasaurus: +* [Hello World Guide (long version)](hello-world-long.md) +* [Hello World Guide (short version)](hello-world-short.md) +* [Arguments](arguments.md) From dc646e24016d7708cde0f1eb8d206c8f5cd6dfa0 Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 19:24:19 +0100 Subject: [PATCH 17/19] Update guides.md --- docs/guides.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/guides.md b/docs/guides.md index 312cfc1..f956ac7 100644 --- a/docs/guides.md +++ b/docs/guides.md @@ -1,5 +1,5 @@ # Frogasaurus Guides Here are some guides on how to use Frogasaurus: -* [Hello World Guide (long version)](hello-world-long.md) -* [Hello World Guide (short version)](hello-world-short.md) -* [Arguments](arguments.md) +* [Hello World Guide (**long** version)](hello-world-long.md) +* [Hello World Guide (**short** version)](hello-world-short.md) +* [Arguments Guide](arguments.md) From 7fca67594c3be2ef0546048c8ddd030ee8703580 Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 19:27:40 +0100 Subject: [PATCH 18/19] Update hello-world-long.md --- docs/hello-world-long.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/hello-world-long.md b/docs/hello-world-long.md index e26e739..034d770 100644 --- a/docs/hello-world-long.md +++ b/docs/hello-world-long.md @@ -133,3 +133,7 @@ This lets you use your library from the command line: ``` hello ``` + +## Now what? +I don't know! It's up to you.
+Want to check out the full list of [guides](guides.md)? From 15020f934156c33a18b01ec941867ba9f7b72295 Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Fri, 2 Sep 2022 19:28:40 +0100 Subject: [PATCH 19/19] Update hello-world-short.md --- docs/hello-world-short.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/hello-world-short.md b/docs/hello-world-short.md index b840ecf..86e03cd 100644 --- a/docs/hello-world-short.md +++ b/docs/hello-world-short.md @@ -64,3 +64,6 @@ Then, you can call the `main` function from the command line: ``` hello ``` + +## Now what? +Maybe... explore more [guides](guides.md)?