stonyx 0.2.3-alpha.63 → 0.2.3-alpha.65
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
|
@@ -13,12 +13,14 @@
|
|
|
13
13
|
## Quick Start
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npm install -g stonyx
|
|
16
|
+
npm install -g stonyx@beta
|
|
17
17
|
stonyx new my-app
|
|
18
18
|
cd my-app
|
|
19
19
|
stonyx serve
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
Install from the `beta` channel: npm's `latest` tag still points at `0.2.2`, which predates the CLI (no `stonyx` binary, and its postinstall fails), and promoting a stable release is pending a release decision (abofs/stonyx#123). See [Why not `latest`](docs/modules.md#why-not-latest).
|
|
23
|
+
|
|
22
24
|
The `new` command walks you through module selection and generates a ready-to-run project. From there, the CLI handles bootstrapping:
|
|
23
25
|
|
|
24
26
|
```bash
|
|
@@ -31,15 +33,15 @@ Stonyx reads `config/environment.ts` (preferred) or `config/environment.js`, ini
|
|
|
31
33
|
|
|
32
34
|
## Exports
|
|
33
35
|
|
|
34
|
-
| Import
|
|
35
|
-
|
|
36
|
-
| `stonyx` | `Stonyx` class (default), `waitForModule(name)` |
|
|
37
|
-
| `stonyx/config` |
|
|
38
|
-
| `stonyx/log` |
|
|
36
|
+
| Import | Exports |
|
|
37
|
+
|--------|---------|
|
|
38
|
+
| `stonyx` | `Stonyx` class (default), `waitForModule(name)`; type `StoynxConfig` |
|
|
39
|
+
| `stonyx/config` | The Stonyx config object (default), bound at first import |
|
|
40
|
+
| `stonyx/log` | The Chronicle logger (default), bound at first import |
|
|
39
41
|
| `stonyx/lifecycle` | `runStartupHooks(modules)`, `runShutdownHooks(modules)` |
|
|
40
42
|
| `stonyx/test-helpers` | `setupIntegrationTests(hooks)` |
|
|
41
43
|
|
|
42
|
-
`stonyx/config` and `stonyx/log` throw
|
|
44
|
+
`stonyx/config` and `stonyx/log` throw at import time if Stonyx is not yet initialized, so a static `import` of either fails the importing module even if the value is never read. Import them only from code that loads after bootstrap (your app code under `stonyx serve`, or a module's `init()` path). Their default export is bound once, at first import, so it does not follow an in-process reboot (see [Testing](docs/testing.md#booting-stonyx-more-than-once-in-one-process)). See the [API Reference](docs/api.md) for details.
|
|
43
45
|
|
|
44
46
|
## Documentation
|
|
45
47
|
|
package/dist/cli/new.js
CHANGED
|
@@ -234,7 +234,7 @@ export default config;
|
|
|
234
234
|
}
|
|
235
235
|
export function generateSetupTs() {
|
|
236
236
|
return `// Test setup: bootstrap Stonyx with the consumer config before qunit runs.
|
|
237
|
-
//
|
|
237
|
+
// Loaded via \`node --import ./test/setup.ts\`.
|
|
238
238
|
import { pathToFileURL } from 'url';
|
|
239
239
|
|
|
240
240
|
const cwd = process.cwd();
|
|
@@ -371,7 +371,7 @@ export async function scaffoldProject(projectDir, appName, selectedModules) {
|
|
|
371
371
|
await createFile(path.join(projectDir, 'test', 'acceptance', '.gitkeep'), '');
|
|
372
372
|
// Create test config (TS)
|
|
373
373
|
await createFile(path.join(projectDir, 'test', 'config', 'environment.ts'), generateTestEnvironmentTs());
|
|
374
|
-
// Create
|
|
374
|
+
// Create test harness files (setup bootstraps Stonyx, zz-exit-test drains event loop)
|
|
375
375
|
await createFile(path.join(projectDir, 'test', 'setup.ts'), generateSetupTs());
|
|
376
376
|
await createFile(path.join(projectDir, 'test', 'zz-exit-test.ts'), generateZzExitTestTs());
|
|
377
377
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Install-and-boot invariant I1 — "one core".
|
|
3
3
|
*
|
|
4
4
|
* At `Stonyx.start()`, every discovered module must resolve the SAME physical
|
|
5
5
|
* `stonyx` package root as the running core. Otherwise the app has two
|
|
@@ -11,7 +11,7 @@ export declare const CONFIG_NOT_FOUND_PREFIX = "Config not found:";
|
|
|
11
11
|
* with `CONFIG_NOT_FOUND_PREFIX`, because `main.ts`'s `NODE_ENV=test` catch
|
|
12
12
|
* swallows that prefix and must not swallow this.
|
|
13
13
|
*
|
|
14
|
-
* This is
|
|
14
|
+
* This is install-and-boot invariant I2 — "no silent
|
|
15
15
|
* decline". Before #105 the two states were literally indistinguishable:
|
|
16
16
|
* measured against `stonyx@0.2.3-beta.95`, a consumer with `config/environment.ts`
|
|
17
17
|
* and the same consumer after `mv config/environment.js config/environment.xyz`
|
|
@@ -43,7 +43,7 @@ export const CONFIG_NOT_FOUND_PREFIX = 'Config not found:';
|
|
|
43
43
|
* with `CONFIG_NOT_FOUND_PREFIX`, because `main.ts`'s `NODE_ENV=test` catch
|
|
44
44
|
* swallows that prefix and must not swallow this.
|
|
45
45
|
*
|
|
46
|
-
* This is
|
|
46
|
+
* This is install-and-boot invariant I2 — "no silent
|
|
47
47
|
* decline". Before #105 the two states were literally indistinguishable:
|
|
48
48
|
* measured against `stonyx@0.2.3-beta.95`, a consumer with `config/environment.ts`
|
|
49
49
|
* and the same consumer after `mv config/environment.js config/environment.xyz`
|