Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One Script to Rule Them All #23

Merged
merged 3 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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