@quenty/nevermore-cli 4.39.0 → 4.40.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.
Files changed (28) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/commands/batch-command/batch-deploy-command.js +1 -1
  3. package/dist/commands/batch-command/batch-deploy-command.js.map +1 -1
  4. package/dist/commands/deploy-command/index.d.ts.map +1 -1
  5. package/dist/commands/deploy-command/index.js +5 -2
  6. package/dist/commands/deploy-command/index.js.map +1 -1
  7. package/dist/utils/batch/changed-packages-utils.d.ts +8 -1
  8. package/dist/utils/batch/changed-packages-utils.d.ts.map +1 -1
  9. package/dist/utils/batch/changed-packages-utils.js +10 -2
  10. package/dist/utils/batch/changed-packages-utils.js.map +1 -1
  11. package/dist/utils/build/deploy-config.d.ts +14 -0
  12. package/dist/utils/build/deploy-config.d.ts.map +1 -1
  13. package/dist/utils/build/deploy-config.js +8 -0
  14. package/dist/utils/build/deploy-config.js.map +1 -1
  15. package/dist/utils/deploy/deploy-metadata.d.ts +7 -1
  16. package/dist/utils/deploy/deploy-metadata.d.ts.map +1 -1
  17. package/dist/utils/deploy/deploy-metadata.js +13 -1
  18. package/dist/utils/deploy/deploy-metadata.js.map +1 -1
  19. package/dist/utils/deploy/deploy-metadata.test.js +25 -0
  20. package/dist/utils/deploy/deploy-metadata.test.js.map +1 -1
  21. package/package.json +2 -2
  22. package/src/commands/batch-command/batch-deploy-command.ts +11 -7
  23. package/src/commands/deploy-command/index.ts +15 -7
  24. package/src/utils/batch/changed-packages-utils.ts +18 -1
  25. package/src/utils/build/deploy-config.ts +22 -0
  26. package/src/utils/deploy/deploy-metadata.test.ts +28 -0
  27. package/src/utils/deploy/deploy-metadata.ts +17 -1
  28. package/tsconfig.tsbuildinfo +1 -1
@@ -36,6 +36,28 @@ export interface DeployConfig {
36
36
  targets: Record<string, DeployTargetConfig>;
37
37
  }
38
38
 
39
+ /**
40
+ * The subset of a resolved place that gets baked into the runtime manifest
41
+ * (see the nevermore-cli-manifest package). A deployed place carries the whole
42
+ * target's place table so it can resolve its siblings' IDs at runtime — e.g. a
43
+ * chapter place teleporting to another chapter without hard-coding place IDs.
44
+ */
45
+ export interface ManifestPlaceInfo {
46
+ /** Place name from a multi-place target (e.g. "chapter0"); absent for single-place targets. */
47
+ name?: string;
48
+ placeId: number;
49
+ universeId: number;
50
+ }
51
+
52
+ /** Project a resolved deploy place down to the fields stamped into the manifest. */
53
+ export function toManifestPlaceInfo(place: DeployTarget): ManifestPlaceInfo {
54
+ return {
55
+ name: place.name,
56
+ placeId: place.placeId,
57
+ universeId: place.universeId,
58
+ };
59
+ }
60
+
39
61
  function _isMultiPlace(
40
62
  target: DeployTargetConfig
41
63
  ): target is MultiPlaceTargetConfig {
@@ -84,6 +84,34 @@ describe('buildDeployMetadataAttributes', () => {
84
84
  );
85
85
  expect(attributes.Published).toBe(false);
86
86
  });
87
+
88
+ it('omits Places when no place table is given', () => {
89
+ const attributes = buildDeployMetadataAttributes({}, PLACE);
90
+ expect('Places' in attributes).toBe(false);
91
+ });
92
+
93
+ it('stamps Places as a JSON string preserving large IDs exactly', () => {
94
+ const attributes = buildDeployMetadataAttributes({}, PLACE, [
95
+ { name: 'chapter0', placeId: 97235312452456, universeId: 10192566764 },
96
+ { name: 'chapter1', placeId: 87639818897831, universeId: 10192566764 },
97
+ ]);
98
+ expect(typeof attributes.Places).toBe('string');
99
+ const parsed = JSON.parse(attributes.Places as string);
100
+ // Large place IDs must survive exactly (JSON text, not a float32 attribute).
101
+ expect(parsed).toEqual([
102
+ { name: 'chapter0', placeId: 97235312452456, universeId: 10192566764 },
103
+ { name: 'chapter1', placeId: 87639818897831, universeId: 10192566764 },
104
+ ]);
105
+ });
106
+
107
+ it('omits the name key for a single-place (nameless) target', () => {
108
+ const attributes = buildDeployMetadataAttributes({}, PLACE, [
109
+ { placeId: 123, universeId: 456 },
110
+ ]);
111
+ const parsed = JSON.parse(attributes.Places as string);
112
+ expect(parsed).toEqual([{ placeId: 123, universeId: 456 }]);
113
+ expect('name' in parsed[0]).toBe(false);
114
+ });
87
115
  });
88
116
 
89
117
  describe('packageUsesManifestAsync', () => {
@@ -7,6 +7,7 @@ import {
7
7
  } from '@quenty/nevermore-template-helpers';
8
8
  import { OutputHelper } from '@quenty/cli-output-helpers';
9
9
  import { type BuiltPlace } from '../build/build.js';
10
+ import { type ManifestPlaceInfo } from '../build/deploy-config.js';
10
11
 
11
12
  /** npm name of the package that ships the manifest module. */
12
13
  export const MANIFEST_PACKAGE_NAME = '@quenty/nevermoreclimanifest';
@@ -85,10 +86,16 @@ export interface DeployPlaceInfo {
85
86
  * round-trip through Lune serialization as float32, which silently corrupts IDs
86
87
  * above 2^24 (e.g. 123456789 -> 123456792). Strings are exact; the Luau reader
87
88
  * converts them back with `tonumber`.
89
+ *
90
+ * When `places` is given (the whole target's place table), it is stamped as a
91
+ * `Places` JSON-string attribute. The IDs inside stay numeric — a JSON string
92
+ * is exact text, and the Luau reader decodes it to 64-bit numbers, so the
93
+ * float32 hazard that forces the top-level IDs to be stringified doesn't apply.
88
94
  */
89
95
  export function buildDeployMetadataAttributes(
90
96
  git: GitDeployInfo,
91
- place: DeployPlaceInfo
97
+ place: DeployPlaceInfo,
98
+ places?: readonly ManifestPlaceInfo[]
92
99
  ): DeployMetadataAttributes {
93
100
  const attributes: DeployMetadataAttributes = {
94
101
  Deployed: true,
@@ -101,6 +108,15 @@ export function buildDeployMetadataAttributes(
101
108
  if (git.commit) attributes.Commit = git.commit;
102
109
  if (git.version) attributes.Version = git.version;
103
110
  if (git.branch) attributes.Branch = git.branch;
111
+ if (places && places.length > 0) {
112
+ attributes.Places = JSON.stringify(
113
+ places.map((p) => ({
114
+ name: p.name,
115
+ placeId: p.placeId,
116
+ universeId: p.universeId,
117
+ }))
118
+ );
119
+ }
104
120
  return attributes;
105
121
  }
106
122