@aventara/build 1.0.0-rc.4 → 1.0.0-rc.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # @aventara/build
2
2
 
3
+ ## 1.0.0-rc.8
4
+
5
+ 1.0.0-rc.5, rc.6 and rc.7 were tagged but never published; 1.0.0-rc.8 contains everything listed under them and the changes below.
6
+
7
+ ### Patch Changes
8
+
9
+ - 1c8e4ee: `aventara-build --check` says what changed when the prebuilt Contracts file is stale, in the same words as the
10
+ `AVENTARA_PREBUILT_STALE` warning at startup. Before, anything outside a single Resource read "an input that belongs
11
+ to no single Resource, the core version or the file format changed". Now it names the versions or the inputs:
12
+
13
+ ```text
14
+ aventara-build: src/generated/aventara/contracts.generated.ts is stale: it was built by @aventara/core 1.0.0-rc.7, and this is 1.0.0-rc.8. Run aventara-build (npm run aventara:prepare) and deploy the file it writes.
15
+ aventara-build: src/generated/aventara/contracts.generated.ts is stale: Resource User changed and the configuration or model outside the Resources changed since it was written. Run aventara-build (npm run aventara:prepare) and deploy the file it writes.
16
+ ```
17
+
18
+ It also names a file format or protocol version that differs, the Resources that are new or gone, and a file that
19
+ no longer reads as a prebuilt Contracts file.
20
+
21
+ - Updated dependencies [1c8e4ee]
22
+ - @aventara/core@1.0.0-rc.8
23
+
24
+ ## 1.0.0-rc.7
25
+
26
+ 1.0.0-rc.5 and 1.0.0-rc.6 were tagged but never published; 1.0.0-rc.7 contains everything listed under them and the changes below.
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies [f917c1c]
31
+ - @aventara/core@1.0.0-rc.7
32
+
33
+ ## 1.0.0-rc.6
34
+
35
+ 1.0.0-rc.5 was tagged but never published. 1.0.0-rc.6 contains everything listed under 1.0.0-rc.5 and the fix below.
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies [1cf72e0]
40
+ - @aventara/core@1.0.0-rc.6
41
+
42
+ ## 1.0.0-rc.5
43
+
44
+ ### Patch Changes
45
+
46
+ - Updated dependencies [4795ff1]
47
+ - Updated dependencies [9e178ca]
48
+ - @aventara/core@1.0.0-rc.5
49
+
3
50
  ## 1.0.0-rc.4
4
51
 
5
52
  ### Patch Changes
package/dist/cli.js CHANGED
@@ -54,11 +54,6 @@ function parse(argv) {
54
54
  }
55
55
  return { check };
56
56
  }
57
- function listed(names) {
58
- return names.length < 2
59
- ? names.join("")
60
- : `${names.slice(0, -1).join(", ")} and ${names.at(-1)}`;
61
- }
62
57
  function counted(count) {
63
58
  return `${count} Resource${count === 1 ? "" : "s"}`;
64
59
  }
@@ -137,7 +132,7 @@ export async function runBuild(argv, projectDirectory, output) {
137
132
  output.stdout(wrote(writeContractsFile(projectDirectory, generated.contracts, compiled), generated.contracts, counted(resources)));
138
133
  return 0;
139
134
  }
140
- const contracts = await checkContractsFile(projectDirectory, generated.contracts, compiled);
135
+ const contracts = await checkContractsFile(projectDirectory, generated.contracts, compiled, project.internal.prebuiltFileChanges);
141
136
  if (contracts.kind === "fresh") {
142
137
  output.stdout(`aventara-build: ${generated.resources}, ${generated.computedFields} and ${generated.contracts} are up to date.`);
143
138
  return 0;
@@ -147,18 +142,7 @@ export async function runBuild(argv, projectDirectory, output) {
147
142
  deploy: true,
148
143
  what: contracts.kind === "missing"
149
144
  ? "is missing"
150
- : `is stale: ${[
151
- ...(contracts.resources.length === 0
152
- ? []
153
- : [
154
- `the inputs of ${listed(contracts.resources)} changed since it was written`,
155
- ]),
156
- ...(contracts.shared
157
- ? [
158
- "an input that belongs to no single Resource, the core version or the file format changed",
159
- ]
160
- : []),
161
- ].join("; ")}`,
145
+ : `is stale: ${contracts.changes.join("; ")}`,
162
146
  }));
163
147
  return 1;
164
148
  }
@@ -5,7 +5,7 @@ import { readGeneratedFile, writeGeneratedFile, } from "../project/generated-fil
5
5
  export function writeContractsFile(projectDirectory, contractsFile, compiled) {
6
6
  return writeGeneratedFile(projectDirectory, contractsFile, compiled.source);
7
7
  }
8
- export async function checkContractsFile(projectDirectory, contractsFile, compiled) {
8
+ export async function checkContractsFile(projectDirectory, contractsFile, compiled, changesOf) {
9
9
  const file = path.join(projectDirectory, contractsFile);
10
10
  const text = readGeneratedFile(projectDirectory, contractsFile);
11
11
  if (text === undefined) {
@@ -15,9 +15,21 @@ export async function checkContractsFile(projectDirectory, contractsFile, compil
15
15
  return { kind: "fresh" };
16
16
  }
17
17
  const previous = await previousContracts(projectDirectory, file);
18
- return previous === undefined
19
- ? { kind: "stale", resources: [], shared: true }
20
- : difference(previous, compiled.prebuilt);
18
+ if (previous === undefined) {
19
+ return {
20
+ kind: "stale",
21
+ changes: ["it could not be read as a prebuilt Contracts file"],
22
+ };
23
+ }
24
+ const changes = changesOf(previous, compiled.prebuilt);
25
+ return {
26
+ kind: "stale",
27
+ changes: changes.length > 0
28
+ ? changes
29
+ : [
30
+ "its text is not what this build writes, though it records the same core version, file format and inputs",
31
+ ],
32
+ };
21
33
  }
22
34
  async function previousContracts(projectDirectory, file) {
23
35
  const jiti = createJiti(pathToFileURL(path.join(projectDirectory, "package.json")).href, { moduleCache: false, fsCache: false, interopDefault: false });
@@ -31,21 +43,3 @@ async function previousContracts(projectDirectory, file) {
31
43
  return undefined;
32
44
  }
33
45
  }
34
- function difference(previous, current) {
35
- const before = previous.fingerprints.resources;
36
- const after = current.fingerprints.resources;
37
- const resources = [
38
- ...new Set([...Object.keys(before), ...Object.keys(after)]),
39
- ]
40
- .filter((name) => before[name] !== after[name])
41
- .sort();
42
- const shared = previous.fingerprints.shared !== current.fingerprints.shared ||
43
- previous.core !== current.core ||
44
- previous.protocol !== current.protocol ||
45
- previous.format !== current.format;
46
- return {
47
- kind: "stale",
48
- resources,
49
- shared: shared || resources.length === 0,
50
- };
51
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aventara/build",
3
- "version": "1.0.0-rc.4",
3
+ "version": "1.0.0-rc.8",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "Compiles an Aventara application's Contracts at build time, for serverless and edge cold starts.",
6
6
  "type": "module",
@@ -19,14 +19,14 @@
19
19
  "jiti": "2.7.0"
20
20
  },
21
21
  "peerDependencies": {
22
- "@aventara/core": "1.0.0-rc.4",
22
+ "@aventara/core": "1.0.0-rc.8",
23
23
  "typescript": ">=5.7.0 <7"
24
24
  },
25
25
  "publishConfig": {
26
26
  "access": "public"
27
27
  },
28
28
  "devDependencies": {
29
- "@aventara/core": "1.0.0-rc.4",
29
+ "@aventara/core": "1.0.0-rc.8",
30
30
  "@types/node": "24.10.1",
31
31
  "typescript": "^5.9.2"
32
32
  },