Skip to content

Commit

Permalink
1.0.0-BETA.0 (#4)
Browse files Browse the repository at this point in the history
# v1.0.0-BETA.0

## Yes, we are finally in beta! 🎉

This release includes a lot of changes and improvements, so check the changelog to see what's new.

- [BREAKING] Drop support for all versions below Node.js v16.20.0
  - Our build system was improved and can't build in version 14 or lower anymore
  - Also, our load system uses features from Node.js v16.20.0, so we can't support older versions anymore

- [BREAKING] Message system was refactored
  - Instead of a crazy irc-inspired message system, we now use simple json objects
  - The send method was changed, and you will need to update your code to use the new one
  - Legacy "command" and "args" properties are now optional, and you probably won't need to use them anymore
  - New parameter "content" was added, this accepts anything and will be sent as the message content
  - The property "type" in message doesn't mean the client type anymore, now it means the message type (update your code to reflect this change)
  - Various other changes were made, so check IMessage interface to see all changes

- [BREAKING] ArunaCore is now an ES module
  - This doesn't affect the api, so your code probably will work without issues

- [DEPRECATED] Various methods from `WebSocketParser` were deprecated
  - They will be removed in some future version, so update your code to use the new methods

- [CHANGE] We changed the project structure
  - Say goodbye to multiples `node_modules` folders (we now use a single in the root and another in api only)
  - Now we use a single `package.json` file in the root of the project (and another in api only)
  - Now we use a single `tsconfig.json` file in the root of the project (and another in api only)
  - This reduces significantly the project size and build time (and also makes it easier to maintain)

- [CHANGE] Build system was improved
  - Since we have abandoned the multiple modules structure, we can now use a single build system
  - This includes the api (you don't need to build it separately anymore)

- [CHANGE] Increase WebSocket payload size limit
  - Now we support payloads up to 512kb

- [NEW] Add configuration system
  - Now you can configure the system (including server port) editing the  `bundle/config/config.json` file
  - You can also use enviroment `ARUNACORE_<PROPERTY>` variables to override the configuration file

- [NEW] Add `masterkey` to allow access to restricted endpoints and commands
  - You can set the masterkey in the configuration file or in the enviroment variable `ARUNACORE_MASTERKEY`
  - If a masterkey is not provided, all restricted endpoints and commands will be disabled and will return a `503` error

- [NEW] Create a connection structure
  - Usefull to store and manipulate connections

- [FIX] Timeouts not being cleared
  - This also reduces test time

- [FIX] HTTP server not responding unknown endpoints
  - Now it returns a `404` error _(as expected)_ instead just doing nothing and waiting for a timeout

- [FIX] HTTP doesn't support body
  - Since the default node http server doesn't support body, we've implemented a custom parser to support it

- [FIX] HTTP server routes begin case sensitive
  - Now all routes are case insensitive

- [CHORE] Update dependencies

- [CHORE] Improve documentation

- [CHORE] Create a changelog file to keep track of changes
  - Probably includes all changes from previous versions
  • Loading branch information
LoboMetalurgico authored Jan 2, 2024
2 parents 2f8ffe0 + 77fe213 commit afa3287
Show file tree
Hide file tree
Showing 98 changed files with 3,975 additions and 18,194 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src/scripts/*
build/**/*
dist/**/*
out/**/*
12 changes: 7 additions & 5 deletions websocket/.eslintrc → .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"capIsNew": ["off"],
"comma-dangle": ["error", "always-multiline"],
"computed-property-spacing": "warn",
"deprecation/deprecation": "warn",
"default-case": ["error", { "commentPattern": "^no default$" }],
"eol-last": ["error", "always"],
"indent": ["warn", 2, {"SwitchCase": 1}],
Expand All @@ -26,7 +27,7 @@
"max-len": [
"warn",
{
"code": 180,
"code": 250,
"ignoreComments": true,
"ignoreUrls": true
}
Expand Down Expand Up @@ -89,8 +90,9 @@
"globals": {},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfig.json" // <-- Point to your project's "tsconfig.json" or create a new one.
},
"plugins": ["prettier", "@typescript-eslint"]
}
"plugins": ["deprecation", "@typescript-eslint"]
}
17 changes: 10 additions & 7 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,25 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Node v12

- name: Install Node v16
uses: actions/setup-node@v3
with:
node-version: 12.x
node-version: 16.x

- name: Enforce npm 8
run: npm install -g [email protected]
- name: Run CI-Setup
working-directory: ./bundle
run: npm run cisetup

- name: Install dependencies
run: npm ci

- name: Run ESLint
working-directory: ./bundle
run: npm run eslint:fix

- name: Commit changes
uses: EndBug/add-and-commit@v4
with:
add: .
message: "(lint): Auto-fix linting errors"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81 changes: 57 additions & 24 deletions .github/workflows/gitpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,61 +7,94 @@ on:
branches: [main]

jobs:
job1:
tag:
name: Publish Tag
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: "Refresh tags"
id: refresh-tag
run: git fetch --tags --force

- id: set_var
name: Get Version
run: |
content=`cat ./bundle/package.json`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of optional handling for multi line json
echo "::set-output name=packageJson::$content"
run: echo ::set-output name=version::$(node -p "require('./package.json').version")

- name: Push Tag
id: tag
uses: anothrNick/github-tag-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
CUSTOM_TAG: "v${{ fromJson(steps.set_var.outputs.packageJson).version }}"
job2:
needs: job1
CUSTOM_TAG: "v${{ steps.set_var.outputs.version }}"
dist:
needs: tag
name: Create Dist Files
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 20.x

- name: Update npm
run: npm install -g npm@latest

- name: Install Dependencies
run: npm ci

- name: Generate Dist Files
run: npm run dist
release:
needs: dist
name: Publish Release
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: "Refresh tags"
id: tag
run: git fetch --tags --force

- id: set_var
name: Get Version
run: |
content=`cat ./bundle/package.json`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of optional handling for multi line json
echo "::set-output name=packageJson::$content"
run: echo ::set-output name=version::$(node -p "require('./package.json').version")

- name: Echo Debug
run: |
echo "${{ fromJson(steps.set_var.outputs.packageJson).version }}"
run: echo "${{ steps.set_var.outputs.version }}"

- name: Create GitHub release
uses: Roang-zero1/github-create-release-action@master
with:
prerelease_regex: ^v[0-9]\.[0-9]\.[0-9]\-
created_tag: v${{ fromJson(steps.set_var.outputs.packageJson).version }}
prerelease_regex: ^v[0-9]\.[0-9]\.[0-9]\-ALPHA\.[0-9]+$
created_tag: v${{ steps.set_var.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload release artifacts
uses: Roang-zero1/github-upload-release-artifacts-action@master
with:
args: "dist/arunacore.zip"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-docker:
needs: release
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Trigger Update Docker Image
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.BOT_SECRET }}
event-type: publish-docker-image
repository: ArunaBot/ArunaCore-Docker
17 changes: 3 additions & 14 deletions .github/workflows/packagePublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:
- name: Setup .npmrc (NPM)
uses: actions/setup-node@v3
with:
node-version: '12.x'
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
scope: '@arunabot'

- name: Enforce npm 8
run: npm install -g npm@8.x
- name: Update npm
run: npm install -g npm@latest

- name: Get Current version
id: current_version
Expand Down Expand Up @@ -57,14 +57,3 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

publish-docker:
needs: [publish]
if: needs.publish.result == 'success' && needs.publish.steps.compare_versions.outputs.skip != 'true'
runs-on: ubuntu-latest
steps:
- name: Trigger Update Docker Image
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.BOT_SECRET }}
event-type: publish-docker-image
repository: ArunaBot/ArunaCore-Docker
13 changes: 8 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@ jobs:

if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository

strategy:
matrix:
node-version: [16, 18, 20]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Node v12
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 12.x
node-version: ${{ matrix.node-version }}

- name: Update NPM
run: npm install -g [email protected]
- name: Install dependencies
run: npm ci

- name: Run Test
working-directory: ./bundle
run: npm run test
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,3 @@ configs/
# Misc
.breakpoints
.replit
package.json
!*/package.json
8 changes: 8 additions & 0 deletions .hintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": [
"development"
],
"hints": {
"typescript-config/is-valid": "off"
}
}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/Iron
25 changes: 0 additions & 25 deletions ArunaCore.code-workspace

This file was deleted.

Loading

0 comments on commit afa3287

Please sign in to comment.