@metaverse-systems/the-seed 1.0.2 → 1.2.0
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/.aiignore +5 -0
- package/.eslintrc.json +3 -1
- package/.vscode/settings.json +14 -0
- package/README.md +530 -0
- package/dist/Build.d.ts +10 -0
- package/dist/Build.js +60 -21
- package/dist/Build.js.map +1 -1
- package/dist/Config.d.ts +2 -2
- package/dist/Config.js +7 -5
- package/dist/Config.js.map +1 -1
- package/dist/Dependencies.d.ts +7 -0
- package/dist/Dependencies.js +76 -0
- package/dist/Dependencies.js.map +1 -0
- package/dist/Package.d.ts +45 -0
- package/dist/Package.js +249 -0
- package/dist/Package.js.map +1 -0
- package/dist/ResourcePak.d.ts +26 -0
- package/dist/ResourcePak.js +110 -0
- package/dist/ResourcePak.js.map +1 -0
- package/dist/Scopes.d.ts +9 -6
- package/dist/Scopes.js.map +1 -1
- package/dist/Template.d.ts +2 -1
- package/dist/Template.js +28 -25
- package/dist/Template.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/scripts/BuildCLI.js +8 -5
- package/dist/scripts/BuildCLI.js.map +1 -1
- package/dist/scripts/ConfigCLI.js +1 -1
- package/dist/scripts/ConfigCLI.js.map +1 -1
- package/dist/scripts/DependenciesCLI.d.ts +3 -0
- package/dist/scripts/DependenciesCLI.js +58 -0
- package/dist/scripts/DependenciesCLI.js.map +1 -0
- package/dist/scripts/PackageCLI.d.ts +3 -0
- package/dist/scripts/PackageCLI.js +38 -0
- package/dist/scripts/PackageCLI.js.map +1 -0
- package/dist/scripts/ResourcePakCLI.d.ts +3 -0
- package/dist/scripts/ResourcePakCLI.js +37 -0
- package/dist/scripts/ResourcePakCLI.js.map +1 -0
- package/dist/scripts/the-seed.js +19 -0
- package/dist/scripts/the-seed.js.map +1 -1
- package/dist/types.d.ts +42 -1
- package/native/binding.gyp +20 -0
- package/native/src/addon.cpp +60 -0
- package/package.json +4 -1
- package/src/Build.ts +73 -23
- package/src/Config.ts +9 -7
- package/src/Dependencies.ts +73 -0
- package/src/Package.ts +287 -0
- package/src/ResourcePak.ts +129 -0
- package/src/Scopes.ts +4 -4
- package/src/Template.ts +27 -25
- package/src/index.ts +16 -0
- package/src/scripts/BuildCLI.ts +8 -5
- package/src/scripts/ConfigCLI.ts +3 -3
- package/src/scripts/DependenciesCLI.ts +57 -0
- package/src/scripts/PackageCLI.ts +42 -0
- package/src/scripts/ResourcePakCLI.ts +38 -0
- package/src/scripts/the-seed.ts +19 -0
- package/src/types.ts +46 -1
- package/structure.md +0 -3
- package/test/Build.test.ts +223 -0
- package/test/Config.test.ts +11 -5
- package/test/Dependencies.test.ts +153 -0
- package/test/Package.test.ts +631 -0
- package/test/ResourcePak.test.ts +69 -0
- package/test/Scopes.test.ts +15 -7
- package/test/Template.test.ts +187 -0
package/.aiignore
ADDED
package/.eslintrc.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"chat.promptFilesRecommendations": {
|
|
3
|
+
"speckit.constitution": true,
|
|
4
|
+
"speckit.specify": true,
|
|
5
|
+
"speckit.plan": true,
|
|
6
|
+
"speckit.tasks": true,
|
|
7
|
+
"speckit.implement": true
|
|
8
|
+
},
|
|
9
|
+
"chat.tools.terminal.autoApprove": {
|
|
10
|
+
".specify/scripts/bash/": true,
|
|
11
|
+
".specify/scripts/powershell/": true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
package/README.md
CHANGED
|
@@ -1 +1,531 @@
|
|
|
1
1
|
# @metaverse-systems/the-seed
|
|
2
|
+
|
|
3
|
+
A CLI tool and TypeScript library for scaffolding, building, and cross-compiling C++ ECS projects built on the libecs-cpp framework. It provides project templates, dependency management, native and Windows cross-compilation workflows, and a programmatic API for integration into custom tooling.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
The project consists of four repositories with a linear dependency chain:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
libecs-cpp --> libthe-seed --> the-seed --> the-seed-vscode
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**libecs-cpp** -- A C++20 Entity Component System framework providing Manager, Container, Entity, Component, System, Timing, and Uuid classes. Built with GNU Autotools and distributed via pkg-config as `ecs-cpp`.
|
|
14
|
+
GitHub: https://github.com/metaverse-systems/libecs-cpp
|
|
15
|
+
|
|
16
|
+
**libthe-seed** -- A C++20 engine runtime that depends on libecs-cpp. Provides LibraryLoader, ComponentLoader, SystemLoader, JSONLoader, ResourcePak, NameParser, and DependencyLister. Built with GNU Autotools and distributed via pkg-config as `the-seed`.
|
|
17
|
+
GitHub: https://github.com/metaverse-systems/libthe-seed
|
|
18
|
+
|
|
19
|
+
**the-seed** -- A TypeScript CLI tool and npm package (`@metaverse-systems/the-seed`) with a C++ N-API native addon (node-gyp). Wraps DependencyLister for shared library dependency analysis. Provides 7 CLI commands for scaffolding, building, and packaging.
|
|
20
|
+
GitHub: https://github.com/metaverse-systems/the-seed
|
|
21
|
+
|
|
22
|
+
**the-seed-vscode** -- A TypeScript VS Code extension that depends on `@metaverse-systems/the-seed`. Provides the "The Seed: Create ResourcePak" command for creating resource paks from within the editor.
|
|
23
|
+
GitHub: https://github.com/metaverse-systems/the-seed-vscode
|
|
24
|
+
|
|
25
|
+
## Prerequisites
|
|
26
|
+
|
|
27
|
+
### Required
|
|
28
|
+
|
|
29
|
+
- Node.js v16+ and npm
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
sudo apt install build-essential libtool pkg-config autoconf automake curl git
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Optional: Windows Cross-Compilation
|
|
36
|
+
|
|
37
|
+
These packages are only needed if you intend to cross-compile projects for Windows:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
sudo apt install mingw-w64-x86-64-dev g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64 wine wine64
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm install -g @metaverse-systems/the-seed
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Verify the installation:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
the-seed help
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Expected output:
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
Usage: the-seed <command>
|
|
59
|
+
|
|
60
|
+
Commands:
|
|
61
|
+
config
|
|
62
|
+
scopes
|
|
63
|
+
template
|
|
64
|
+
build
|
|
65
|
+
dependencies
|
|
66
|
+
package
|
|
67
|
+
resource-pak
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Quick Start
|
|
71
|
+
|
|
72
|
+
### Step 1: Configure the installation prefix
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
the-seed config edit
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
? Installation prefix? ~/the-seed
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
This creates `~/the-seed/config.json` with your chosen prefix.
|
|
83
|
+
|
|
84
|
+
### Step 2: Create a scope
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
the-seed scopes add
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
? Name for scope? my-project
|
|
92
|
+
? Your name? Jane Developer
|
|
93
|
+
? Your email? jane@example.com
|
|
94
|
+
? Your URL? https://example.com
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The scope `@my-project` is saved to your configuration.
|
|
98
|
+
|
|
99
|
+
### Step 3: Create a component from a template
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
the-seed template component
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```text
|
|
106
|
+
? Choose scope for component: @my-project
|
|
107
|
+
? Choose name for component: hello-world
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
This creates the project directory at `~/the-seed/projects/@my-project/hello-world/` with autotools build files and a `package.json` containing build scripts.
|
|
111
|
+
|
|
112
|
+
### Step 4: Install dependencies
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
cd ~/the-seed/projects/@my-project/hello-world
|
|
116
|
+
the-seed dependencies install
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
```text
|
|
120
|
+
Checking ecs-cpp... not installed
|
|
121
|
+
Cloning libecs-cpp...
|
|
122
|
+
Building libecs-cpp...
|
|
123
|
+
Checking the-seed... not installed
|
|
124
|
+
Cloning libthe-seed...
|
|
125
|
+
Building libthe-seed...
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
This clones and builds the required C++ libraries into your prefix.
|
|
129
|
+
|
|
130
|
+
### Step 5: Build the project
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
the-seed build native
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
```text
|
|
137
|
+
Completed ./autogen.sh
|
|
138
|
+
Completed configure
|
|
139
|
+
Completed make
|
|
140
|
+
Completed make install
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The compiled binary or library is installed to `~/the-seed/x86_64-linux-gnu/`.
|
|
144
|
+
|
|
145
|
+
## Directory Structure
|
|
146
|
+
|
|
147
|
+
After configuration and building, the installation prefix has the following layout:
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
~/the-seed/
|
|
151
|
+
+-- config.json # Configuration file (prefix, scopes)
|
|
152
|
+
+-- include/ # Shared headers
|
|
153
|
+
+-- projects/ # Scaffolded projects organized by scope
|
|
154
|
+
| +-- @scope-name/
|
|
155
|
+
| +-- project-name/
|
|
156
|
+
+-- x86_64-linux-gnu/ # Native Linux target
|
|
157
|
+
| +-- bin/ # Compiled binaries
|
|
158
|
+
| +-- lib/
|
|
159
|
+
| +-- pkgconfig/ # pkg-config files
|
|
160
|
+
+-- x86_64-w64-mingw32/ # Windows cross-compilation target
|
|
161
|
+
+-- bin/ # Cross-compiled binaries
|
|
162
|
+
+-- lib/
|
|
163
|
+
+-- pkgconfig/ # pkg-config files
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## CLI Reference
|
|
167
|
+
|
|
168
|
+
### config
|
|
169
|
+
|
|
170
|
+
Manage the-seed configuration.
|
|
171
|
+
|
|
172
|
+
| Subcommand | Description |
|
|
173
|
+
|------------|-------------|
|
|
174
|
+
| `list` | Print the path to `config.json` and its contents (default) |
|
|
175
|
+
| `edit` | Interactively set the installation prefix |
|
|
176
|
+
| `scopes list` | Print the list of configured scope names |
|
|
177
|
+
| `scopes help` | Print help for config scopes subcommands |
|
|
178
|
+
|
|
179
|
+
`the-seed config edit` prompts:
|
|
180
|
+
|
|
181
|
+
```text
|
|
182
|
+
? Installation prefix? ~/the-seed
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
If no `config.json` exists, `config list` suggests running `config edit`.
|
|
186
|
+
|
|
187
|
+
### scopes
|
|
188
|
+
|
|
189
|
+
Manage project scopes. Scopes group projects under a namespace (e.g., `@my-org`).
|
|
190
|
+
|
|
191
|
+
| Subcommand | Description |
|
|
192
|
+
|------------|-------------|
|
|
193
|
+
| `help` | Print all subcommands with descriptions (default) |
|
|
194
|
+
| `list` | Print configured scope names |
|
|
195
|
+
| `add` | Interactively create a new scope |
|
|
196
|
+
| `edit` | Interactively edit an existing scope |
|
|
197
|
+
| `delete` | Interactively delete a scope |
|
|
198
|
+
|
|
199
|
+
`the-seed scopes add` prompts:
|
|
200
|
+
|
|
201
|
+
```text
|
|
202
|
+
? Name for scope? my-project
|
|
203
|
+
? Your name? Jane Developer
|
|
204
|
+
? Your email? jane@example.com
|
|
205
|
+
? Your URL? https://example.com
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Scope names are automatically prefixed with `@` if not already present.
|
|
209
|
+
|
|
210
|
+
`the-seed scopes edit` and `scopes delete` prompt you to select from existing scopes. If no scopes exist, an error message is printed.
|
|
211
|
+
|
|
212
|
+
### template
|
|
213
|
+
|
|
214
|
+
Scaffold new C++ projects from built-in templates.
|
|
215
|
+
|
|
216
|
+
| Subcommand | Description |
|
|
217
|
+
|------------|-------------|
|
|
218
|
+
| `help` | List available templates (default) |
|
|
219
|
+
| `component` | Create a new ECS component project |
|
|
220
|
+
| `system` | Create a new ECS system project |
|
|
221
|
+
| `program` | Create a new standalone program project |
|
|
222
|
+
|
|
223
|
+
All three template types prompt for a scope and a project name:
|
|
224
|
+
|
|
225
|
+
```text
|
|
226
|
+
? Choose scope for component: @my-project
|
|
227
|
+
? Choose name for component: hello-world
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Template variable substitutions applied during scaffolding:
|
|
231
|
+
|
|
232
|
+
| Variable | Replaced With |
|
|
233
|
+
|----------|---------------|
|
|
234
|
+
| `SKELETON` | Project name |
|
|
235
|
+
| `SKELETON_` | Project name with `-` replaced by `_` |
|
|
236
|
+
| `AUTHOR_EMAIL` | Scope author email |
|
|
237
|
+
| `AUTHOR_URL` | Scope author URL |
|
|
238
|
+
|
|
239
|
+
The generated `package.json` includes build scripts:
|
|
240
|
+
|
|
241
|
+
```json
|
|
242
|
+
{
|
|
243
|
+
"scripts": {
|
|
244
|
+
"build": "the-seed build native",
|
|
245
|
+
"build-win64": "the-seed build windows"
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
The `component` and `system` templates include a `.pc.in` file for pkg-config. The `program` template does not.
|
|
251
|
+
|
|
252
|
+
### build
|
|
253
|
+
|
|
254
|
+
Build and cross-compile projects using GNU Autotools.
|
|
255
|
+
|
|
256
|
+
| Subcommand | Arguments | Description |
|
|
257
|
+
|------------|-----------|-------------|
|
|
258
|
+
| `help` | | Print usage and available targets |
|
|
259
|
+
| `native` | | Full build for Linux (autogen, configure, make, install) |
|
|
260
|
+
| `windows` | | Full cross-compile for Windows (autogen, configure with mingw host, make, install) |
|
|
261
|
+
| (none) | | Incremental build (make + make install only, no reconfigure) |
|
|
262
|
+
|
|
263
|
+
Target directory mapping:
|
|
264
|
+
|
|
265
|
+
| Target | Host Flag | Install Prefix |
|
|
266
|
+
|--------|-----------|----------------|
|
|
267
|
+
| `native` | (none) | `<prefix>/x86_64-linux-gnu` |
|
|
268
|
+
| `windows` | `--host=x86_64-w64-mingw32` | `<prefix>/x86_64-w64-mingw32` |
|
|
269
|
+
|
|
270
|
+
During `configure`, `PKG_CONFIG_PATH` is set to `<prefix>/<target>/lib/pkgconfig/` so that dependencies installed in the prefix are found.
|
|
271
|
+
|
|
272
|
+
Build steps for `native` and `windows`:
|
|
273
|
+
|
|
274
|
+
1. `./autogen.sh`
|
|
275
|
+
2. `make distclean` (errors ignored)
|
|
276
|
+
3. `./configure --prefix=<prefix>/<target> [--host=x86_64-w64-mingw32]`
|
|
277
|
+
4. `make -j`
|
|
278
|
+
5. `make install`
|
|
279
|
+
|
|
280
|
+
Running `the-seed build` without a subcommand performs only steps 4 and 5.
|
|
281
|
+
|
|
282
|
+
### dependencies
|
|
283
|
+
|
|
284
|
+
Check and install C++ library dependencies (libecs-cpp and libthe-seed).
|
|
285
|
+
|
|
286
|
+
| Subcommand | Arguments | Description |
|
|
287
|
+
|------------|-----------|-------------|
|
|
288
|
+
| `help` | | Print usage |
|
|
289
|
+
| `check` | `[target]` | Check if ecs-cpp and the-seed libraries are installed |
|
|
290
|
+
| `install` | `[target]` | Clone and build missing libraries from GitHub |
|
|
291
|
+
|
|
292
|
+
The `target` argument defaults to `native`. For each missing library, the `install` command clones the repository from GitHub and builds it with autotools into the target prefix:
|
|
293
|
+
|
|
294
|
+
- `ecs-cpp`: Cloned from `https://github.com/metaverse-systems/libecs-cpp.git`
|
|
295
|
+
- `the-seed`: Cloned from `https://github.com/metaverse-systems/libthe-seed.git`
|
|
296
|
+
|
|
297
|
+
Running an unknown subcommand prints "Invalid command" with a pointer to `help`.
|
|
298
|
+
|
|
299
|
+
### package
|
|
300
|
+
|
|
301
|
+
Create distributable packages by resolving binaries and their shared library dependencies.
|
|
302
|
+
|
|
303
|
+
```text
|
|
304
|
+
Usage: the-seed package <output-directory> <project-dir> [project-dir2] ...
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
| Argument | Description |
|
|
308
|
+
|----------|-------------|
|
|
309
|
+
| `output-directory` | Directory where resolved files are copied |
|
|
310
|
+
| `project-dir` | One or more project directories to package |
|
|
311
|
+
|
|
312
|
+
Behavior:
|
|
313
|
+
|
|
314
|
+
1. Validates that all directories exist
|
|
315
|
+
2. Parses `src/Makefile.am` for binary type (`bin_PROGRAMS` or `lib_LTLIBRARIES`)
|
|
316
|
+
3. Resolves compiled binaries from `src/.libs/`
|
|
317
|
+
4. Resolves transitive project dependencies from `package.json` and `node_modules`
|
|
318
|
+
5. Analyzes shared library dependencies using the native DependencyLister addon
|
|
319
|
+
6. Copies all resolved files to the output directory
|
|
320
|
+
|
|
321
|
+
Search paths for shared library resolution include `<prefix>/<target>/lib`, `<prefix>/<target>/bin`, and MinGW cross-compiler runtime directories.
|
|
322
|
+
|
|
323
|
+
### resource-pak
|
|
324
|
+
|
|
325
|
+
Create and manage resource pak files for bundling assets.
|
|
326
|
+
|
|
327
|
+
| Subcommand | Arguments | Description |
|
|
328
|
+
|------------|-----------|-------------|
|
|
329
|
+
| `help` | | List subcommands (default) |
|
|
330
|
+
| `create` | | Interactively create a new resource pak project |
|
|
331
|
+
| `add` | `<resource-name> <filename>` | Add a resource entry to the current project |
|
|
332
|
+
| `build` | | Build a `.pak` file from the current project |
|
|
333
|
+
|
|
334
|
+
`the-seed resource-pak create` prompts:
|
|
335
|
+
|
|
336
|
+
```text
|
|
337
|
+
? Choose scope for resource pak: @my-project
|
|
338
|
+
? Choose name for resource pak: my-assets
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
This creates a project directory at `<prefix>/projects/<scope>/<name>/` with a `package.json` containing a `resources` array.
|
|
342
|
+
|
|
343
|
+
`the-seed resource-pak add <name> <filename>` reads `package.json` from the current directory and adds a resource entry with `name`, `filename`, and `size`. If a resource with the same name already exists, it is skipped.
|
|
344
|
+
|
|
345
|
+
`the-seed resource-pak build` reads `package.json` from the current directory and produces a `.pak` file. The file format consists of a JSON header (containing the name, a zero-padded 10-digit header size, and resource metadata) followed by a newline and the concatenated raw resource bytes.
|
|
346
|
+
|
|
347
|
+
## API Reference
|
|
348
|
+
|
|
349
|
+
### Classes
|
|
350
|
+
|
|
351
|
+
#### Config
|
|
352
|
+
|
|
353
|
+
Manages the-seed configuration file.
|
|
354
|
+
|
|
355
|
+
```typescript
|
|
356
|
+
constructor(configDir?: string)
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
**Properties**:
|
|
360
|
+
|
|
361
|
+
| Property | Type | Description |
|
|
362
|
+
|----------|------|-------------|
|
|
363
|
+
| `configDir` | `string` | Path to the configuration directory (default: `~/the-seed`) |
|
|
364
|
+
| `configFile` | `string` | Configuration filename (`/config.json`) |
|
|
365
|
+
| `config` | `ConfigType` | The loaded configuration object |
|
|
366
|
+
|
|
367
|
+
**Methods**:
|
|
368
|
+
|
|
369
|
+
| Method | Return Type | Description |
|
|
370
|
+
|--------|-------------|-------------|
|
|
371
|
+
| `loadConfig()` | `void` | Load configuration from disk; creates default if missing |
|
|
372
|
+
| `saveConfig()` | `void` | Write current configuration to disk |
|
|
373
|
+
| `getQuestions()` | `object[]` | Return inquirer prompt questions for configuration |
|
|
374
|
+
| `parseAnswers(answers: { prefix: string })` | `void` | Apply prompt answers to the configuration |
|
|
375
|
+
|
|
376
|
+
#### Scopes
|
|
377
|
+
|
|
378
|
+
Manages project scopes within the configuration.
|
|
379
|
+
|
|
380
|
+
```typescript
|
|
381
|
+
constructor(config: Config)
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
**Properties**:
|
|
385
|
+
|
|
386
|
+
| Property | Type | Description |
|
|
387
|
+
|----------|------|-------------|
|
|
388
|
+
| `config` | `Config` | The Config instance to read/write scopes from |
|
|
389
|
+
|
|
390
|
+
**Methods**:
|
|
391
|
+
|
|
392
|
+
| Method | Return Type | Description |
|
|
393
|
+
|--------|-------------|-------------|
|
|
394
|
+
| `askWhichScope()` | `object[]` | Return inquirer prompt to select an existing scope |
|
|
395
|
+
| `askNewScope()` | `object[]` | Return inquirer prompts for creating a new scope |
|
|
396
|
+
| `askEditScope(defaults?: ScopeDefaultsType)` | `object[]` | Return inquirer prompts for editing a scope |
|
|
397
|
+
| `createOrEditScope(answers: ScopeAnswersType)` | `void` | Save a scope from prompt answers |
|
|
398
|
+
| `deleteScope(scope: string)` | `void` | Remove a scope from configuration |
|
|
399
|
+
| `getScopes()` | `string[]` | Return array of scope names |
|
|
400
|
+
| `getScope(scope: string)` | `ScopeType` | Return a specific scope by name |
|
|
401
|
+
| `getQuestions(defaults: { scopeName?: string })` | `object[]` | Return inquirer prompts with optional defaults |
|
|
402
|
+
|
|
403
|
+
#### Package
|
|
404
|
+
|
|
405
|
+
Resolves project binaries and their shared library dependencies for packaging.
|
|
406
|
+
|
|
407
|
+
```typescript
|
|
408
|
+
constructor(config: Config)
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
**Properties**:
|
|
412
|
+
|
|
413
|
+
| Property | Type | Description |
|
|
414
|
+
|----------|------|-------------|
|
|
415
|
+
| `config` | `Config` | The Config instance for prefix and target paths |
|
|
416
|
+
|
|
417
|
+
**Methods**:
|
|
418
|
+
|
|
419
|
+
| Method | Return Type | Description |
|
|
420
|
+
|--------|-------------|-------------|
|
|
421
|
+
| `getSearchPaths()` | `string[]` | Return library search paths for the current target |
|
|
422
|
+
| `parseMakefileAm(projectDir: string)` | `{ type: "program" \| "library"; name: string } \| null` | Parse src/Makefile.am for binary type and name |
|
|
423
|
+
| `resolveBinaryPaths(projectDir: string)` | `string[]` | Resolve compiled binary paths from src/.libs/ |
|
|
424
|
+
| `getPackageDeps(projectDir: string, visited?: Set<string>)` | `string[]` | Recursively resolve project dependencies |
|
|
425
|
+
| `resolveDependencies(binaryPaths: string[], searchPaths: string[])` | `DependencyResultType` | Analyze shared library dependencies using native addon |
|
|
426
|
+
| `run(outputDir: string, projectDirs: string[])` | `void` | Execute full packaging workflow |
|
|
427
|
+
|
|
428
|
+
### Types
|
|
429
|
+
|
|
430
|
+
```typescript
|
|
431
|
+
interface AuthorType {
|
|
432
|
+
name: string;
|
|
433
|
+
email: string;
|
|
434
|
+
url: string;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
interface ConfigType {
|
|
438
|
+
prefix: string;
|
|
439
|
+
scopes: ScopesType;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
interface ScopeType {
|
|
443
|
+
author: AuthorType;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
interface ScopesType {
|
|
447
|
+
[index: string]: ScopeType;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
interface ScopeAnswersType {
|
|
451
|
+
scopeName: string;
|
|
452
|
+
authorName: string;
|
|
453
|
+
authorEmail: string;
|
|
454
|
+
authorURL: string;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
interface ScopeDefaultsType {
|
|
458
|
+
name?: string;
|
|
459
|
+
email?: string;
|
|
460
|
+
url?: string;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
interface ResourceType {
|
|
464
|
+
name: string;
|
|
465
|
+
filename: string;
|
|
466
|
+
size: number;
|
|
467
|
+
attributes?: { [key: string]: string };
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
interface PackageType {
|
|
471
|
+
author: AuthorType;
|
|
472
|
+
name: string;
|
|
473
|
+
license: string;
|
|
474
|
+
version: string;
|
|
475
|
+
scripts: {
|
|
476
|
+
[index: string]: string;
|
|
477
|
+
};
|
|
478
|
+
resources: ResourceType[];
|
|
479
|
+
main?: string;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
interface ScriptArgsType {
|
|
483
|
+
binName: string;
|
|
484
|
+
args: string[];
|
|
485
|
+
configDir: string;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
interface DependencyResultType {
|
|
489
|
+
dependencies: Record<string, string[]>;
|
|
490
|
+
errors: Record<string, string>;
|
|
491
|
+
}
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### Import Example
|
|
495
|
+
|
|
496
|
+
```typescript
|
|
497
|
+
import {
|
|
498
|
+
Config,
|
|
499
|
+
Scopes,
|
|
500
|
+
Package,
|
|
501
|
+
AuthorType,
|
|
502
|
+
ConfigType,
|
|
503
|
+
ScopeType,
|
|
504
|
+
ScopesType,
|
|
505
|
+
ScopeAnswersType,
|
|
506
|
+
ScopeDefaultsType,
|
|
507
|
+
ResourceType,
|
|
508
|
+
PackageType,
|
|
509
|
+
ScriptArgsType,
|
|
510
|
+
DependencyResultType
|
|
511
|
+
} from "@metaverse-systems/the-seed";
|
|
512
|
+
|
|
513
|
+
// Initialize configuration
|
|
514
|
+
const config = new Config();
|
|
515
|
+
|
|
516
|
+
// List all scopes
|
|
517
|
+
const scopes = new Scopes(config);
|
|
518
|
+
console.log(scopes.getScopes());
|
|
519
|
+
|
|
520
|
+
// Package a project
|
|
521
|
+
const pkg = new Package(config);
|
|
522
|
+
pkg.run("./output", ["./my-project"]);
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
## License
|
|
526
|
+
|
|
527
|
+
MIT -- See [LICENSE](LICENSE) for details.
|
|
528
|
+
|
|
529
|
+
## Author
|
|
530
|
+
|
|
531
|
+
Tim Schwartz <tim@metaverse.systems>
|
package/dist/Build.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import Config from "./Config";
|
|
2
|
+
import { BuildStep } from "./types";
|
|
3
|
+
export declare const targets: {
|
|
4
|
+
[key: string]: string;
|
|
5
|
+
};
|
|
2
6
|
declare class Build {
|
|
3
7
|
config: Config;
|
|
4
8
|
target: string;
|
|
@@ -8,5 +12,11 @@ declare class Build {
|
|
|
8
12
|
reconfigure: (target: string) => void;
|
|
9
13
|
compile: () => void;
|
|
10
14
|
install: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* Returns an ordered array of BuildStep objects for the given target and mode.
|
|
17
|
+
* @param target - 'native' or 'windows'
|
|
18
|
+
* @param fullReconfigure - if true, includes autogen/distclean/configure steps; if false, only compile+install
|
|
19
|
+
*/
|
|
20
|
+
getSteps: (target: string, fullReconfigure: boolean) => BuildStep[];
|
|
11
21
|
}
|
|
12
22
|
export default Build;
|