amxxpack 1.5.0-beta.2 β†’ 1.5.0-beta.3

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.
package/README.md CHANGED
@@ -1,5 +1,13 @@
1
- # πŸ“¦ AMXXPack πŸ‡ΊπŸ‡¦ [![npm](https://img.shields.io/npm/v/amxxpack/beta.svg)](https://www.npmjs.com/package/amxxpack/v/beta)
2
- Simple build system and **CLI** for **AMX Mod X** projects.
1
+ # πŸ“¦ AMXXPack πŸ‡ΊπŸ‡¦
2
+
3
+ [![npm version](https://img.shields.io/npm/v/amxxpack/beta.svg)](https://www.npmjs.com/package/amxxpack/v/beta)
4
+ [![License](https://img.shields.io/github/license/Hedgefog/node-amxxpack)](https://github.com/Hedgefog/node-amxxpack/blob/master/LICENSE)
5
+ [![npm downloads](https://img.shields.io/npm/dm/amxxpack)](https://www.npmjs.com/package/amxxpack/v/beta)
6
+ [![GitHub issues](https://img.shields.io/github/issues/Hedgefog/node-amxxpack)](https://github.com/Hedgefog/node-amxxpack/issues)
7
+ [![Dependencies Status](https://img.shields.io/librariesio/release/npm/amxxpack)](https://libraries.io/npm/amxxpack)
8
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Hedgefog/node-amxxpack/pulls)
9
+
10
+ Build system and **CLI** for **AMX Mod X** and **SourceMod** projects.
3
11
 
4
12
  ---
5
13
 
@@ -9,9 +17,16 @@ Simple build system and **CLI** for **AMX Mod X** projects.
9
17
  - [Requirements](#-requirements)
10
18
  - [Installation](#-installation)
11
19
  - [Quick start](#-quick-start)
20
+ - [Examples](#-examples)
21
+ - [Basic Project Structure](#basic-project-structure)
22
+ - [Configuration Examples](#configuration-examples)
23
+ - [Development Workflow](#development-workflow-examples)
24
+ - [Integration Examples](#integration-examples)
12
25
  - [Commands](#-commands)
13
26
  - [Advanced configuration](#-advanced-configuration)
14
27
  - [Using with SourceMod](#using-with-sourcemod)
28
+ - [Troubleshooting](#-troubleshooting)
29
+ - [Contributing](#-contributing)
15
30
  - [License](#-license)
16
31
 
17
32
  ---
@@ -20,43 +35,61 @@ Simple build system and **CLI** for **AMX Mod X** projects.
20
35
 
21
36
  This system will be useful for projects with multiple plugins and assets. Using the command-line interface you can build an entire project with a single command. It also supports hot rebuild to keep your plugins and assets up to date during the work.
22
37
 
38
+ Check out projects [built with **AMXXPack**](https://github.com/search?q=path%3A.amxxpack*.json&type=code)
39
+
23
40
  ---
24
41
 
25
42
  ## πŸ“š Features
26
- - βš™ Flexible configuration
27
- - πŸ”₯ Hot reload
28
- - 🧸 Assets builder
43
+
44
+ ### πŸ›  Build System
45
+ - βš™ Flexible JSON-based configuration
46
+ - πŸ—ƒοΈ Multi-plugin project support
47
+ - πŸ”„ Incremental builds with caching
48
+ - 🎯 Selective plugin compilation
49
+ - πŸ“ Support for multiple input directories
50
+ - πŸ”§ Customizable output structure
51
+ - πŸ”₯ Hot reload for rapid development
52
+
53
+ ### 🧩 Plugin Development
54
+ - πŸ”— Third-party dependencies management
55
+ - πŸ“₯ Automatic compiler downloads
56
+ - πŸ“š Generating new files using CLI commands
57
+ - ⛓️ Support for both **AMX Mod X** and **SourceMod**
58
+
59
+ ### 🧸 Asset Management
60
+ - πŸ” Glob pattern filtering
29
61
 
30
62
  ---
31
63
 
32
- ## πŸ”„Requirements
33
- - Node.js 10.0.0+
64
+ ## πŸ”„ Requirements
65
+ - Node.js 16.0.0 or higher
34
66
 
35
67
  ---
36
68
 
37
69
  ## πŸ”§ Installation
38
70
  **AMXXPack** is available through the npm registry.
39
- Installation can be done using the `npm i amxxpack@1.5.0-beta.2` command:
71
+ Installation can be done using the `npm i amxxpack@beta` command:
40
72
  ```
41
- npm install amxxpack
73
+ npm install amxxpack@beta
42
74
  ```
43
75
 
44
76
  or install it globally to use as a system command
45
77
  ```
46
- npm install -g amxxpack
78
+ npm install -g amxxpack@beta
47
79
  ```
48
80
 
49
81
  ---
50
82
 
51
-
52
83
  ## β–Ά Quick start
53
84
  - Open a terminal inside the project directory (existing or create a new one)
54
- - Execute `npm install amxxpack@1.5.0-beta.2 -g` command to install `amxxpack` globally
85
+ - Execute `npm install amxxpack@beta -g` command to install `amxxpack` globally
55
86
  - Execute `amxxpack create .` command to create a new config
56
87
  - Execute `amxxpack install` to download project dependencies (compiler, thirdparty etc.)
57
88
  - Use `amxxpack build` command to build the project
58
89
  - Use `amxxpack watch` command to build the project and watch changes
59
90
 
91
+ ---
92
+
60
93
  ## πŸ“‹ Commands
61
94
  - `amxxpack create <name>` - create new project
62
95
  - `--git` - initialize git
@@ -93,6 +126,161 @@ npm install -g amxxpack
93
126
 
94
127
  ---
95
128
 
129
+ ## πŸ“‹ Examples
130
+
131
+ ### Basic Project Structure
132
+
133
+ Here's a typical **AMXXPack** project structure:
134
+
135
+ ```
136
+ myproject/
137
+ β”œβ”€β”€ .thirdparty/ # Third-party dependencies
138
+ β”‚
139
+ β”œβ”€β”€ assets/ # Game assets
140
+ β”‚ β”œβ”€β”€ models/
141
+ β”‚ └── sounds/
142
+ β”‚
143
+ β”œβ”€β”€ src/
144
+ β”‚ β”œβ”€β”€ scripts/ # Plugin source files
145
+ β”‚ β”‚ β”œβ”€β”€ plugin1.sma
146
+ β”‚ β”‚ └── plugin2.sma
147
+ β”‚ └── include/ # Include files
148
+ β”‚ β”œβ”€β”€ constants.inc
149
+ β”‚ └── stocks.inc
150
+ β”‚
151
+ β”œβ”€β”€ .amxxpack.json # Project configuration
152
+ └── package.json # NPM configuration
153
+ ```
154
+
155
+ ### Configuration Examples
156
+
157
+ #### Basic Configuration
158
+ ```json
159
+ {
160
+ "type": "amxmodx",
161
+ "compiler": {
162
+ "version": "1.9",
163
+ "addons": ["cstrike"]
164
+ },
165
+ "input": {
166
+ "scripts": "./src/scripts",
167
+ "include": "./src/include",
168
+ "assets": "./assets"
169
+ },
170
+ "output": {
171
+ "base": "./dist",
172
+ "plugins": "./addons/amxmodx/plugins",
173
+ "scripts": "./addons/amxmodx/scripting",
174
+ "include": "./addons/amxmodx/scripting/include",
175
+ "assets": "."
176
+ }
177
+ }
178
+ ```
179
+
180
+ #### Advanced Configuration with Third-party Dependencies
181
+ ```json
182
+ {
183
+ "type": "amxmodx",
184
+ "compiler": {
185
+ "version": "1.9",
186
+ "addons": ["cstrike"]
187
+ },
188
+ "thirdparty": {
189
+ "dependencies": [
190
+ { "name": "somemodule", "url": "https://website/somemodule-v100.zip" }
191
+ ]
192
+ },
193
+ "include": [
194
+ "./.compiler/include",
195
+ "./.thirdparty/somemodule/include"
196
+ ],
197
+ "input": {
198
+ "scripts": [
199
+ { "dir": "./src/scripts", "output": { "prefix": "mymod_" } },
200
+ { "dir": "./somemodule/scripts" }
201
+ ],
202
+ "include": ["./src/include"],
203
+ "assets": [
204
+ { "dir": "./assets" },
205
+ { "dir": "./somemodule/models", "output": { "dest": "./models" } }
206
+ ]
207
+ },
208
+ "output": {
209
+ "base": "./dist",
210
+ "plugins": "./addons/amxmodx/plugins",
211
+ "scripts": "./addons/amxmodx/scripting",
212
+ "include": "./addons/amxmodx/scripting/include",
213
+ "assets": "."
214
+ }
215
+ }
216
+ ```
217
+
218
+ ### Development Workflow Examples
219
+
220
+ 1. **Starting a New Project**
221
+ ```bash
222
+ # Create a new directory
223
+ mkdir myproject
224
+ cd myproject
225
+
226
+ # Initialize the project
227
+ amxxpack create . --git --type amxmodx
228
+
229
+ # Install dependencies
230
+ amxxpack install
231
+
232
+ # Generate a new plugin
233
+ amxxpack generate script mymod_core --author "Your Name" --version "1.0.0"
234
+
235
+ # Start development with hot reload
236
+ amxxpack build --watch
237
+ ```
238
+
239
+ 2. **Working with Multiple Plugins**
240
+ ```bash
241
+ # Compile specific plugins
242
+ amxxpack compile "mymod_core.sma"
243
+ amxxpack compile "mymod_*.sma"
244
+ amxxpack compile "features/*.sma"
245
+
246
+ # Build entire project
247
+ amxxpack build
248
+
249
+ # Watch for changes
250
+ amxxpack build --watch
251
+ ```
252
+
253
+ 3. **Using with Version Control**
254
+ ```bash
255
+ # Typical .gitignore entries
256
+ node_modules/
257
+ .compiler/
258
+ .thirdparty/
259
+ dist/
260
+ *.amxx
261
+ ```
262
+
263
+ ### Integration Examples
264
+
265
+ 1. **CI/CD Pipeline (GitHub Actions)**
266
+ ```yaml
267
+ name: Build
268
+
269
+ on: [push, pull_request]
270
+
271
+ jobs:
272
+ build:
273
+ runs-on: ubuntu-latest
274
+ steps:
275
+ - uses: actions/checkout@v5
276
+ - uses: actions/setup-node@v5
277
+ with:
278
+ node-version: '22'
279
+ - run: npm install -g amxxpack@beta
280
+ - run: amxxpack install
281
+ - run: amxxpack build
282
+ ```
283
+
96
284
  ## 🦸 Advanced configuration
97
285
 
98
286
  ### Third-party dependencies
@@ -174,16 +362,28 @@ You can use multiple directories as builder inputs, just specify an array of dir
174
362
  }
175
363
  ```
176
364
 
177
- ### Input options
178
- You can specify additional options for the input directories.
365
+ ### Configuring input and output
366
+ You can specify additional output options for the input directories.
367
+ Output options can be specified in the input configuration or in the output configuration. Specifying options in the input configuration will override output configuration for specific input.
179
368
 
180
369
  #### Flat compilation
181
- `flat` option is used to specify if the scripts should be compiled in a flat directory structure even if `rules.flatCompilation` is disabled.
370
+ `flat` option is used to specify if the input directory should be copied using a flat directory structure.
371
+ By default only `assets` are compiled without a flat directory structure.
182
372
 
183
373
  ```json
184
374
  {
185
375
  "input": {
186
- "scripts": ["./src/scripts", { "dir": "./src/scripts", "flat": false }]
376
+ "scripts": ["./src/scripts", { "dir": "./src/scripts", "output": { "flat": false } }]
377
+ }
378
+ }
379
+ ```
380
+
381
+ Same option can be specified for the output directories:
382
+
383
+ ```json
384
+ {
385
+ "output": {
386
+ "scripts": { "dir": "./dist/scripts", "flat": false }
187
387
  }
188
388
  }
189
389
  ```
@@ -194,7 +394,16 @@ You can specify additional options for the input directories.
194
394
  ```json
195
395
  {
196
396
  "input": {
197
- "scripts": ["./src/scripts", { "dir": "./src/scripts", "prefix": "test_" }]
397
+ "scripts": ["./src/scripts", { "dir": "./src/scripts", "output": { "prefix": "test_" } }]
398
+ }
399
+ }
400
+ ```
401
+
402
+ For output directories:
403
+ ```json
404
+ {
405
+ "output": {
406
+ "scripts": { "dir": "./dist/scripts", "prefix": "test_" }
198
407
  }
199
408
  }
200
409
  ```
@@ -206,7 +415,16 @@ You can specify additional options for the input directories.
206
415
  ```json
207
416
  {
208
417
  "input": {
209
- "scripts": ["./src/scripts", { "dir": "./src/scripts", "dest": "sub" }]
418
+ "scripts": ["./src/scripts", { "dir": "./src/scripts", "output": { "dest": "sub" } }]
419
+ }
420
+ }
421
+ ```
422
+
423
+ For output directories:
424
+ ```json
425
+ {
426
+ "output": {
427
+ "scripts": { "dir": "./dist/scripts", "dest": "sub" }
210
428
  }
211
429
  }
212
430
  ```
@@ -292,7 +510,7 @@ If you use **SourceMod** with **AMXXPack** you should set `type` to `sourcemod`
292
510
  {
293
511
  "type": "sourcemod",
294
512
  "compiler": {
295
- "version": "1.12.0",
513
+ "version": "1.12",
296
514
  }
297
515
  }
298
516
  ```
@@ -1,4 +1,4 @@
1
- import { IAssetInput, IResolvedProjectConfig, IScriptInput } from '../types';
1
+ import { IResolvedInput, IResolvedProjectConfig } from '../types';
2
2
  export interface IBuildOptions {
3
3
  noCache?: boolean;
4
4
  ignoreErrors?: boolean;
@@ -6,7 +6,7 @@ export interface IBuildOptions {
6
6
  export default class AmxxBuilder {
7
7
  private projectConfig;
8
8
  private options;
9
- private pluginsCache;
9
+ private cache;
10
10
  private scriptsPathPattern;
11
11
  private includePathPattern;
12
12
  private assetsPathPattern;
@@ -22,15 +22,16 @@ export default class AmxxBuilder {
22
22
  watchScripts(): Promise<void>;
23
23
  watchInclude(): Promise<void>;
24
24
  watchAssets(): Promise<void>;
25
- updateScript(srcPath: string): Promise<boolean>;
26
- updateAsset(filePath: string, assetInput: IAssetInput): Promise<boolean>;
27
- updateInclude(filePath: string): Promise<boolean>;
28
- compileScript(filePath: string, options: IScriptInput): Promise<boolean>;
29
- executeCompiler(srcPath: string, options: IScriptInput): Promise<boolean>;
25
+ updateScript(srcPath: string, options: IResolvedInput): Promise<boolean>;
26
+ updateAsset(filePath: string, options: IResolvedInput): Promise<boolean>;
27
+ updateInclude(filePath: string, input: IResolvedInput): Promise<boolean>;
28
+ updatePlugin(srcPath: string, options: IResolvedInput): Promise<boolean>;
29
+ compileScript(srcPath: string, options: IResolvedInput): Promise<boolean>;
30
30
  private buildDir;
31
31
  private watchDir;
32
- private initPluginCache;
32
+ private initCache;
33
33
  private getNativeIncludes;
34
34
  private execPathFilter;
35
35
  private getScriptOptions;
36
+ private resolveDestPath;
36
37
  }