@sanctumterra/raknet 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  const _RaknetClient = require("../src/client/RaknetClient");
6
6
  const client = new _RaknetClient.RakNetClient("127.0.0.1", 19132);
7
7
  (async ()=>{
8
- console.log(await client.connect(()=>{
8
+ await client.connect(()=>{
9
9
  console.log("Received Response");
10
- }));
10
+ });
11
11
  })();
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const { RakNetClient } = require("../dist/index");
2
+ const { RakNetClient } = require("../index");
3
3
  const client = new RakNetClient("127.0.0.1", 19132);
4
4
  (async ()=>{
5
5
  console.log(await client.ping());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanctumterra/raknet",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "emitDeclarationOnly": true,
@@ -1,24 +0,0 @@
1
- name: Publish Package to npmjs
2
-
3
- on:
4
- push:
5
- branches: master
6
-
7
- jobs:
8
- build:
9
- permissions:
10
- id-token: write
11
- contents: read
12
- runs-on: ubuntu-latest
13
- steps:
14
- - uses: actions/checkout@v4
15
- - uses: actions/setup-node@v4
16
- with:
17
- node-version: '20.x'
18
- registry-url: 'https://registry.npmjs.org'
19
- - run: npm install
20
- - run: npm run build
21
- - run: npm publish --access=public
22
- env:
23
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
24
-
package/build.js DELETED
@@ -1,102 +0,0 @@
1
- const swc = require("@swc/core");
2
- const fs = require("fs");
3
- const path = require("path");
4
-
5
- const ignoredPaths = [
6
- '.git',
7
- 'node_modules',
8
- 'tsconfig.json',
9
- 'package.json',
10
- 'dist',
11
- 'package-lock.json',
12
- 'yarn.lock',
13
- '.swcrc',
14
- '.gitignore',
15
- 'tokens',
16
- 'build.js'
17
- ];
18
-
19
- const allowedExtensions = ['.ts', '.js', '.mjs', '.cjs', '.tsx', '.jsx', '.json'];
20
-
21
- const mkdirSyncRecursive = (directory) => {
22
- const parentDirectory = path.dirname(directory);
23
- if (!fs.existsSync(parentDirectory)) {
24
- mkdirSyncRecursive(parentDirectory);
25
- }
26
- if (!fs.existsSync(directory)) {
27
- fs.mkdirSync(directory);
28
- }
29
- };
30
-
31
- const compile = async (filePath) => {
32
- const sourceCode = fs.readFileSync(filePath, "utf-8");
33
- const { code } = await swc.transform(sourceCode, {
34
- filename: path.basename(filePath),
35
- jsc: {
36
- parser: {
37
- syntax: "typescript",
38
- tsx: true,
39
- dynamicImport: true,
40
- decorators: true
41
- },
42
- target: "es2021",
43
- loose: true,
44
- externalHelpers: true
45
- },
46
- module: {
47
- type: "commonjs"
48
- }
49
- });
50
- return code;
51
- };
52
-
53
- const compileDirectory = async (srcDir, outDir) => {
54
- try {
55
- const files = fs.readdirSync(srcDir);
56
-
57
- for (const file of files) {
58
- const fullPath = path.join(srcDir, file);
59
- const outPath = path.join(outDir, file.replace(/\.(ts|tsx)$/, '.js'));
60
-
61
- if (ignoredPaths.includes(file)) {
62
- continue;
63
- }
64
-
65
- try {
66
- const stats = fs.lstatSync(fullPath);
67
- if (stats.isDirectory()) {
68
- if (!fs.existsSync(outPath)) mkdirSyncRecursive(outPath);
69
- await compileDirectory(fullPath, outPath);
70
- } else {
71
- const ext = path.extname(file).toLowerCase();
72
- if (!allowedExtensions.includes(ext)) {
73
- console.log(`Skipping file with unsupported extension: ${fullPath}`);
74
- continue;
75
- }
76
-
77
- if (ext === ".json") {
78
- mkdirSyncRecursive(path.dirname(outPath));
79
- fs.copyFileSync(fullPath, outPath);
80
- } else {
81
- const compiledCode = await compile(fullPath);
82
- mkdirSyncRecursive(path.dirname(outPath));
83
- fs.writeFileSync(outPath, compiledCode);
84
- }
85
- }
86
- } catch (error) {
87
- console.error(`Error processing ${fullPath}:`, error.message);
88
- }
89
- }
90
- } catch (error) {
91
- console.error(`Error reading directory ${srcDir}:`, error.message);
92
- }
93
- };
94
-
95
- const srcDir = process.cwd();
96
- const outDir = path.join(srcDir, 'dist');
97
-
98
- compileDirectory(srcDir, outDir).then(() => {
99
- console.log("Compilation complete.");
100
- }).catch(err => {
101
- console.error("Compilation failed:", err);
102
- });