Skip to content

Commit

Permalink
Merge pull request #23 from Nailington/patch-3
Browse files Browse the repository at this point in the history
One Script to Rule Them All
  • Loading branch information
GreenyDEV committed Aug 14, 2023
2 parents 5988a43 + df34645 commit 7615438
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 36 deletions.
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,37 @@ See [Examples](https://github.com/NebulaServices/Dynamic/tree/main/examples);

## Getting started (How to run)

### Method 1
### Method 1

1. Clone and Change directory into Dynamic
1. Clone and change directory into Dynamic
```bash
git clone https://GitHub.com/NebulaServices/dynamic.git && cd Dynamic
git clone https://github,com/NebulaServices/Dynamic.git && cd Dynamic
```

2. Give bash file permissions
```bash
chmod +x ./bin/run.sh
```

3. Run bash file
2. Run bash script and follow the instructions in the script
```bash
./bin/run.sh
./bin/start.sh
```


### Method 2

1. Clone and change directory into Dynamic
```bash
git clone https://github.com/NebulaServices/dynamic.git && cd Dynamic
git clone https://github.com/NebulaServices/Dynamic.git && cd Dynamic
```

2. Install dependencies
```bash
npm i
```

3. Run the server
3. Build Dynamic Bundles
```bash
npm run build
```

4. Run the server
```bash
npm start
```
Expand Down
6 changes: 0 additions & 6 deletions bin/build.sh

This file was deleted.

13 changes: 0 additions & 13 deletions bin/run.sh

This file was deleted.

102 changes: 102 additions & 0 deletions bin/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/bin/bash
echo "Welcome To Noctura!"

#Navigating to the project root
scriptDir="${0%/*}"
cd $scriptDir
cd ../
echo "Project Directory: $(pwd)"

while [[ $devAns != "dev" ]] || [[ $devAns != "prod" ]]
do
echo "Dev or Prod? dev/prod"
read devAns
if [[ $devAns == "dev" ]] || [[ $devAns == "prod" ]]
then
break
else
echo "Invalid Input"
fi
done

echo "Checking if packages are installed"
if ls | grep -q node_modules
then
echo "node_modules found"

while [[ $cleanAns != "y" ]] || [[ $cleanAns != "n" ]]
do
echo "Would you like to reinstall? y/n"
read cleanAns
if [[ $cleanAns == "y" ]] || [[ $cleanAns == "n" ]]
then
break
else
echo "Invalid Input"
fi
done

if [[ $cleanAns = "y" ]]
then
echo "Cleaning node_modules"
rm -rf node_modules
echo "Installing node_modules"
npm install
elif [[ $cleanAns = "n" ]]
then
echo "Skipping packages"
fi

else
echo "node_modules not found"

while [[ $installAns != "y" ]] || [[ $installAns != "n" ]]
do
echo "Would you like to install? y/n"
read installAns
if [[ $installAns == "y" ]] || [[ $installAns == "n" ]]
then
break
else
echo "Invalid Input"
fi
done

if [[ $installAns == "y" ]]
then
echo "Installing node_modules"
npm install
elif [[ $installAns == "n" ]]
then
echo "Skipping packages"
fi
fi

while [[ $buildAns != "build" ]] || [[ $buildAns != "start" ]] || [[ $buildAns != "both" ]]
do
echo "Would you like to build, start, or both? build/start/both"
read buildAns
if [[ $buildAns == "build" ]] || [[ $buildAns == "start" ]] || [[ $buildAns == "both" ]]
then
break
else
echo "Invalid Input"
fi
done

if [[ $buildAns == "build" ]]
then
echo "Building Dynamic"
npm run build:$devAns
elif [[ $buildAns == "start" ]]
then
echo "Starting Dynamic"
npm run start
elif [[ $buildAns == "both" ]]
then
echo "Doing Both!"
echo "Building Dynamic"
npm run build:$devAns
echo "Starting Dynamic :)"
npm run start
fi
2 changes: 1 addition & 1 deletion docs/configuration/encoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Example:

If this fits your need Change your `encoding` value to `plain`

### Plain
### Base64
Base64 is a encoding algorithm that allows you to transform any characters into an alphabet which consists of Latin letters, digits, plus, and slash. Thanks to it, Dynamic can hide URLs by turning the letters of the URL into numbers.

Example:
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ For absolutely no logging, change the value in your configuration to `0`
If you only want errors in console, but want to ignore warnings, this is the level for you! Turn the value in your configuration to `1`

## Indecisive
Lookin for both Errors and Warnings? Change the value in your configuration to `2`
Looking for both Errors and Warnings? Change the value in your configuration to `2`

## The everything burger
Exactly what it sounds like, errors + warnings + info. Set the value in your configuration to `2`
3 changes: 2 additions & 1 deletion esbuild.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ await copyFile("./lib/dynamic.config.js", "./dist/dynamic.config.js");

console.log(await esbuild.analyzeMetafile((await worker.rebuild()).metafile));

console.timeEnd("esbuild");
console.timeEnd("esbuild");
process.exit(0);
3 changes: 2 additions & 1 deletion esbuild.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,5 @@ await copyFile("./lib/dynamic.config.js", "./dist/dynamic.config.js");

console.log(await esbuild.analyzeMetafile((worker.metafile)));

console.timeEnd("esbuild");
console.timeEnd("esbuild");
process.exit(0);
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"start": "node --max-http-header-size=50000 index",
"build:dev": "node esbuild.dev.js",
"build:prod": "node esbuild.prod.js"
"build:prod": "node esbuild.prod.js",
"build": "node esbuild.prod.js"
},
"keywords": [],
"author": "",
Expand Down

0 comments on commit 7615438

Please sign in to comment.