@chrisivey01/builder 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.
Files changed (3) hide show
  1. package/index.d.ts +8 -0
  2. package/index.js +18 -5
  3. package/package.json +8 -3
package/index.d.ts CHANGED
@@ -47,6 +47,10 @@ export type BuilderOptions = {
47
47
  * - Port for web dev server. Defaults to 5173
48
48
  */
49
49
  webDevPort?: number;
50
+ /**
51
+ * - Server IP address for remote access. Checks SERVER_IP or HOST env vars if not provided
52
+ */
53
+ serverIP?: string;
50
54
  /**
51
55
  * - Build configurations for different targets
52
56
  */
@@ -55,4 +59,8 @@ export type BuilderOptions = {
55
59
  * - Additional esbuild define values
56
60
  */
57
61
  define?: Record<string, string>;
62
+ /**
63
+ * - Whether to generate source maps. Defaults to true
64
+ */
65
+ sourceMaps?: boolean;
58
66
  };
package/index.js CHANGED
@@ -20,15 +20,27 @@ import { basename, resolve } from 'path';
20
20
  * @property {number} [restartTimeout] - Timeout for restart requests in milliseconds. Defaults to 2000
21
21
  * @property {number} [debounceDelay] - Debounce delay for rebuilds in milliseconds. Defaults to 500
22
22
  * @property {number} [webDevPort] - Port for web dev server. Defaults to 5173
23
+ * @property {string} [serverIP] - Server IP address for remote access. Checks SERVER_IP or HOST env vars if not provided
23
24
  * @property {Record<string, BuildConfig>} [builds] - Build configurations for different targets
24
25
  * @property {Record<string, string>} [define] - Additional esbuild define values
26
+ * @property {boolean} [sourceMaps] - Whether to generate source maps. Defaults to true
25
27
  */
26
28
 
27
29
  /**
28
- * Get the local network IP address
29
- * @returns {string} The local IP address or fallback to 127.0.0.1
30
+ * Get the network IP address for remote access
31
+ * Checks environment variables first (SERVER_IP or HOST) for remote development
32
+ * @returns {string} The network IP address or fallback to 127.0.0.1
30
33
  */
31
- function getLocalIP() {
34
+ function getNetworkIP() {
35
+ // Check environment variables first for remote development
36
+ if (process.env.SERVER_IP) {
37
+ return process.env.SERVER_IP;
38
+ }
39
+ if (process.env.HOST) {
40
+ return process.env.HOST;
41
+ }
42
+
43
+ // Try to get from network interfaces
32
44
  const nets = networkInterfaces();
33
45
  for (const name of Object.keys(nets)) {
34
46
  for (const net of nets[name]) {
@@ -51,10 +63,11 @@ export async function build(options = {}) {
51
63
  const resource_name = options.resourceName || basename(resolve(cwd));
52
64
  const args = options.args || process.argv.slice(2);
53
65
  const IS_WATCH = args.includes('--watch');
66
+ const SOURCE_MAPS = options.sourceMaps !== undefined ? options.sourceMaps : !args.includes('--no-sourcemaps');
54
67
  const IS_REDM = args.includes('--redm');
55
68
  const HAS_WEB_DIR = fs.existsSync(resolve(cwd, './web'));
56
69
  const PORT = IS_REDM ? 4700 : 4689;
57
- const SERVER_IP = getLocalIP();
70
+ const SERVER_IP = options.serverIP || getNetworkIP();
58
71
 
59
72
  // Configuration defaults
60
73
  const config = {
@@ -156,7 +169,7 @@ export async function build(options = {}) {
156
169
  bundle: true,
157
170
  entryPoints: [resolve(cwd, `./${name}/main.ts`)],
158
171
  outfile: resolve(cwd, `dist/${name}.js`),
159
- sourcemap: true,
172
+ sourcemap: SOURCE_MAPS,
160
173
  logLevel: 'info',
161
174
  define: {
162
175
  GAME: IS_REDM ? '"REDM"' : '"FIVEM"',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrisivey01/builder",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Build tool for FiveM/RedM resources with watch mode and auto-restart",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -13,6 +13,9 @@
13
13
  "index.d.ts",
14
14
  "cli.js"
15
15
  ],
16
+ "scripts": {
17
+ "prepublishOnly": "tsc index.js --declaration --allowJs --emitDeclarationOnly"
18
+ },
16
19
  "keywords": [
17
20
  "fivem",
18
21
  "redm",
@@ -22,11 +25,13 @@
22
25
  ],
23
26
  "author": "Chris Ivey",
24
27
  "license": "MIT",
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
25
31
  "dependencies": {
26
32
  "esbuild": "^0.27.2"
27
33
  },
28
34
  "devDependencies": {
29
35
  "typescript": "^5.9.3"
30
- },
31
- "scripts": {}
36
+ }
32
37
  }