sst 2.23.0 → 2.23.2

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/bootstrap.d.ts CHANGED
@@ -2,4 +2,4 @@ export declare const useBootstrap: () => Promise<{
2
2
  version: string;
3
3
  bucket: string;
4
4
  }>;
5
- export declare function bootstrapSST(): Promise<void>;
5
+ export declare function bootstrapSST(cdkBucket: string): Promise<void>;
package/bootstrap.js CHANGED
@@ -37,9 +37,13 @@ export const useBootstrap = Context.memo(async () => {
37
37
  : "Updating bootstrap stack").start();
38
38
  if (needToBootstrapCDK) {
39
39
  await bootstrapCDK();
40
+ // fetch bootstrap status
41
+ cdkStatus = await loadCDKStatus();
42
+ if (cdkStatus.status !== "ready")
43
+ throw new VisibleError("Failed to load bootstrap stack status");
40
44
  }
41
45
  if (needToBootstrapSST) {
42
- await bootstrapSST();
46
+ await bootstrapSST(cdkStatus.bucket);
43
47
  // fetch bootstrap status
44
48
  sstStatus = await loadSSTStatus();
45
49
  if (sstStatus.status !== "ready")
@@ -60,18 +64,31 @@ async function loadCDKStatus() {
60
64
  if (!stacks || stacks.length === 0)
61
65
  return { status: "bootstrap" };
62
66
  // Check CDK bootstrap stack deployed successfully
63
- if (!["CREATE_COMPLETE", "UPDATE_COMPLETE"].includes(stacks[0].StackStatus)) {
67
+ if (![
68
+ "CREATE_COMPLETE",
69
+ "UPDATE_COMPLETE",
70
+ "UPDATE_ROLLBACK_COMPLETE",
71
+ ].includes(stacks[0].StackStatus)) {
64
72
  return { status: "bootstrap" };
65
73
  }
66
74
  // Check CDK bootstrap stack is up to date
67
75
  // note: there is no a programmatical way to get the minimal required version
68
76
  // of CDK bootstrap stack. We are going to hardcode it to 14 for now,
69
77
  // which is the latest version as of CDK v2.62.2
70
- const output = stacks[0].Outputs?.find((o) => o.OutputKey === "BootstrapVersion");
71
- if (!output || parseInt(output.OutputValue) < 14) {
78
+ let version;
79
+ let bucket;
80
+ const output = stacks[0].Outputs?.forEach((o) => {
81
+ if (o.OutputKey === "BootstrapVersion") {
82
+ version = parseInt(o.OutputValue);
83
+ }
84
+ else if (o.OutputKey === "BucketName") {
85
+ bucket = o.OutputValue;
86
+ }
87
+ });
88
+ if (!version || version < 14 || !bucket) {
72
89
  return { status: "update" };
73
90
  }
74
- return { status: "ready" };
91
+ return { status: "ready", version, bucket };
75
92
  }
76
93
  catch (e) {
77
94
  if (e.name === "ValidationError" &&
@@ -133,7 +150,7 @@ async function loadSSTStatus() {
133
150
  }
134
151
  return { status: "ready", version, bucket };
135
152
  }
136
- export async function bootstrapSST() {
153
+ export async function bootstrapSST(cdkBucket) {
137
154
  const { region, bootstrap, cdk } = useProject().config;
138
155
  // Create bootstrap stack
139
156
  const app = new App();
@@ -157,10 +174,10 @@ export async function bootstrapSST() {
157
174
  Tags.of(app).add(key, value);
158
175
  }
159
176
  // Create S3 bucket to store stacks metadata
160
- const bucket = bootstrap?.useExistingBucket
177
+ const bucket = bootstrap?.useCdkBucket
161
178
  ? {
162
- bucketName: bootstrap.useExistingBucket,
163
- bucketArn: `arn:${stack.partition}:s3:::${bootstrap.useExistingBucket}`,
179
+ bucketName: cdkBucket,
180
+ bucketArn: `arn:${stack.partition}:s3:::${cdkBucket}`,
164
181
  }
165
182
  : new Bucket(stack, region, {
166
183
  encryption: BucketEncryption.S3_MANAGED,
@@ -1,18 +1,9 @@
1
- const PACKAGE_MATCH = [
2
- "sst",
3
- "astro-sst",
4
- "aws-cdk",
5
- "@aws-cdk",
6
- "constructs",
7
- "svelte-kit-sst",
8
- "solid-start-sst",
9
- ];
1
+ const PACKAGE_MATCH = ["aws-cdk", "@aws-cdk"];
10
2
  const FIELDS = ["dependencies", "devDependencies"];
11
3
  export const update = (program) => program.command("update [version]", "Update your SST and CDK packages", (yargs) => yargs.positional("version", {
12
4
  type: "string",
13
5
  describe: "Optionally specify a version to update to",
14
6
  }), async (args) => {
15
- const { green, yellow } = await import("colorette");
16
7
  const fs = await import("fs/promises");
17
8
  const path = await import("path");
18
9
  const { fetch } = await import("undici");
@@ -41,33 +32,33 @@ export const update = (program) => program.command("update [version]", "Update y
41
32
  const metadata = await fetch(`https://registry.npmjs.org/sst/${args.version || "latest"}`).then((resp) => resp.json());
42
33
  const results = new Map();
43
34
  const tasks = files.map(async (file) => {
44
- const data = await fs
45
- .readFile(file)
46
- .then((x) => x.toString())
47
- .then(JSON.parse);
35
+ const data = await fs.readFile(file).then((x) => x.toString());
36
+ // Note: preserve ending new line characters in package.json
37
+ const tailingNewline = data.match(/\r?\n$/)?.[0];
38
+ const json = JSON.parse(data);
48
39
  for (const field of FIELDS) {
49
- const deps = data[field];
50
- if (!deps)
51
- continue;
52
- for (const [pkg, existing] of Object.entries(deps)) {
53
- if (!PACKAGE_MATCH.some((x) => pkg.startsWith(x)))
54
- continue;
40
+ const deps = json[field];
41
+ for (const [pkg, existing] of Object.entries(deps || {})) {
55
42
  const desired = (() => {
56
- // Both sst and astro-sst should be sharing the same version
57
43
  if ([
58
44
  "sst",
59
45
  "astro-sst",
60
46
  "svelte-kit-sst",
61
47
  "solid-start-sst",
62
- ].includes(pkg))
48
+ ].includes(pkg)) {
63
49
  return metadata.version;
64
- if (pkg === "constructs")
50
+ }
51
+ else if (pkg === "constructs") {
65
52
  return metadata.dependencies.constructs;
66
- if (pkg.endsWith("alpha"))
67
- return metadata.dependencies["@aws-cdk/aws-apigatewayv2-alpha"];
68
- return metadata.dependencies["aws-cdk-lib"];
53
+ }
54
+ else if (pkg.startsWith("aws-cdk") ||
55
+ pkg.startsWith("@aws-cdk")) {
56
+ return pkg.endsWith("alpha")
57
+ ? metadata.dependencies["@aws-cdk/aws-apigatewayv2-alpha"]
58
+ : metadata.dependencies["aws-cdk-lib"];
59
+ }
69
60
  })();
70
- if (existing === desired)
61
+ if (!desired || existing === desired)
71
62
  continue;
72
63
  let arr = results.get(file);
73
64
  if (!arr) {
@@ -79,7 +70,7 @@ export const update = (program) => program.command("update [version]", "Update y
79
70
  }
80
71
  }
81
72
  if (results.has(file)) {
82
- await fs.writeFile(file, JSON.stringify(data, null, 2));
73
+ await fs.writeFile(file, `${JSON.stringify(json, null, 2)}${tailingNewline ?? ""}`);
83
74
  }
84
75
  });
85
76
  await Promise.all(tasks);
@@ -23,6 +23,7 @@ import { Effect, PolicyStatement } from "aws-cdk-lib/aws-iam";
23
23
  import { StringParameter } from "aws-cdk-lib/aws-ssm";
24
24
  import { Platform } from "aws-cdk-lib/aws-ecr-assets";
25
25
  import { useBootstrap } from "../bootstrap.js";
26
+ import { Colors } from "../cli/colors.js";
26
27
  const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
27
28
  const supportedRuntimes = {
28
29
  container: CDKRuntime.FROM_IMAGE,
@@ -223,6 +224,8 @@ export class Function extends CDKFunction {
223
224
  logRetentionRetryOptions: logRetention && { maxRetries: 100 },
224
225
  });
225
226
  useDeferredTasks().add(async () => {
227
+ if (props.runtime === "container")
228
+ Colors.line(`➜ Building the container image for the "${this.node.id}" function...`);
226
229
  // Build function
227
230
  const result = await useRuntimeHandlers().build(this.node.addr, "deploy");
228
231
  if (result.type === "error") {
package/constructs/Job.js CHANGED
@@ -3,6 +3,7 @@ import path from "path";
3
3
  import fs from "fs/promises";
4
4
  import { Construct } from "constructs";
5
5
  import { Duration as CdkDuration } from "aws-cdk-lib/core";
6
+ import { Platform } from "aws-cdk-lib/aws-ecr-assets";
6
7
  import { PolicyStatement, Effect } from "aws-cdk-lib/aws-iam";
7
8
  import { AssetCode, Code, Runtime, Function as CdkFunction, } from "aws-cdk-lib/aws-lambda";
8
9
  import { Project, LinuxBuildImage, BuildSpec, ComputeType, } from "aws-cdk-lib/aws-codebuild";
@@ -15,7 +16,7 @@ import { bindEnvironment, bindPermissions, getReferencedSecrets, } from "./util/
15
16
  import { useDeferredTasks } from "./deferred_task.js";
16
17
  import { useProject } from "../project.js";
17
18
  import { useRuntimeHandlers } from "../runtime/handlers.js";
18
- import { Platform } from "aws-cdk-lib/aws-ecr-assets";
19
+ import { Colors } from "../cli/colors.js";
19
20
  const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
20
21
  /////////////////////
21
22
  // Construct
@@ -194,6 +195,8 @@ export class Job extends Construct {
194
195
  buildCodeBuildProjectCode() {
195
196
  const { handler, architecture, runtime, container } = this.props;
196
197
  useDeferredTasks().add(async () => {
198
+ if (runtime === "container")
199
+ Colors.line(`➜ Building the container image for the "${this.node.id}" job...`);
197
200
  // Build function
198
201
  const result = await useRuntimeHandlers().build(this.node.addr, "deploy");
199
202
  if (result.type === "error") {
@@ -22,6 +22,11 @@ export interface ServiceProps {
22
22
  * @default "."
23
23
  */
24
24
  path?: string;
25
+ /**
26
+ * Path to Dockerfile relative to the defined "path".
27
+ * @default "Dockerfile"
28
+ */
29
+ file?: string;
25
30
  /**
26
31
  * The amount of cpu allocated.
27
32
  * @default "0.25 vCPU"
@@ -188,10 +188,16 @@ export class Service extends Construct {
188
188
  Object.entries(props?.environment || {}).map(([key, value]) => this.addEnvironmentForService(key, value));
189
189
  useDeferredTasks().add(async () => {
190
190
  if (!app.isRunningSSTTest()) {
191
- Colors.line(`➜ Building container image for the "${this.node.id}" service`);
191
+ Colors.line(`➜ Building the container image for the "${this.node.id}" service...`);
192
192
  // Build app
193
- let dockerfile = "Dockerfile";
194
- if (!(await existsAsync(path.join(this.props.path, dockerfile)))) {
193
+ let dockerfile;
194
+ if (this.props.file) {
195
+ dockerfile = this.props.file;
196
+ }
197
+ else if (await existsAsync(path.join(this.props.path, "Dockerfile"))) {
198
+ dockerfile = "Dockerfile";
199
+ }
200
+ else {
195
201
  await this.createNixpacksBuilder();
196
202
  dockerfile = await this.runNixpacksBuild();
197
203
  }
@@ -328,10 +334,16 @@ export class Service extends Construct {
328
334
  // Bundle Cluster
329
335
  /////////////////////
330
336
  validateServiceExists() {
331
- const { path: servicePath } = this.props;
337
+ const { path: servicePath, file } = this.props;
332
338
  if (!fs.existsSync(servicePath)) {
333
339
  throw new Error(`No service found at "${path.resolve(servicePath)}"`);
334
340
  }
341
+ if (file) {
342
+ const dockerfilePath = path.join(servicePath, file);
343
+ if (!fs.existsSync(dockerfilePath)) {
344
+ throw new Error(`No Dockerfile found at "${dockerfilePath}". Make sure to set the "file" property to the path of the Dockerfile relative to "${servicePath}".`);
345
+ }
346
+ }
335
347
  }
336
348
  validateMemoryAndCpu() {
337
349
  const { memory, cpu } = this.props;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.23.0",
4
+ "version": "2.23.2",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
package/project.d.ts CHANGED
@@ -16,7 +16,7 @@ export interface ConfigOptions {
16
16
  disableParameterizedStackNameCheck?: boolean;
17
17
  };
18
18
  bootstrap?: {
19
- useExistingBucket?: string;
19
+ useCdkBucket?: boolean;
20
20
  stackName?: string;
21
21
  tags?: Record<string, string>;
22
22
  };
@@ -17,7 +17,7 @@ export const useJavaHandler = Context.memo(async () => {
17
17
  const handlers = useRuntimeHandlers();
18
18
  const processes = new Map();
19
19
  const sources = new Map();
20
- const handlerName = process.platform === "win32" ? `handler.exe` : `handler`;
20
+ const runningBuilds = new Map();
21
21
  handlers.register({
22
22
  shouldBuild: (input) => {
23
23
  if (!input.file.endsWith(".java"))
@@ -68,13 +68,26 @@ export const useJavaHandler = Context.memo(async () => {
68
68
  const buildTask = input.props.java?.buildTask || "build";
69
69
  const outputDir = input.props.java?.buildOutputDir || "distributions";
70
70
  sources.set(input.functionID, srcPath);
71
- try {
71
+ async function build() {
72
+ // build
72
73
  await execAsync(`${buildBinary} ${buildTask} -Dorg.gradle.logging.level=${process.env.DEBUG ? "debug" : "lifecycle"}`, {
73
74
  cwd: srcPath,
74
75
  });
76
+ // unzip
75
77
  const buildOutput = path.join(srcPath, "build", outputDir);
76
78
  const zip = (await fs.readdir(buildOutput)).find((f) => f.endsWith(".zip"));
77
- new AdmZip(path.join(buildOutput, zip)).extractAllTo(input.out);
79
+ await new Promise((resolve, reject) => {
80
+ const zipper = new AdmZip(path.join(buildOutput, zip));
81
+ zipper.extractAllToAsync(input.out, false, false, (err) => err ? reject(err) : resolve(undefined));
82
+ });
83
+ }
84
+ try {
85
+ // Run gradle build once per directory. Otherwise they'll interfere
86
+ // with one another
87
+ const buildPromise = runningBuilds.get(buildBinary) ?? build();
88
+ runningBuilds.set(buildBinary, buildPromise);
89
+ await buildPromise;
90
+ runningBuilds.delete(buildBinary);
78
91
  return {
79
92
  type: "success",
80
93
  handler: input.props.handler,
package/sst.mjs CHANGED
@@ -5522,7 +5522,7 @@ var init_java = __esm({
5522
5522
  const handlers = useRuntimeHandlers();
5523
5523
  const processes = /* @__PURE__ */ new Map();
5524
5524
  const sources = /* @__PURE__ */ new Map();
5525
- const handlerName = process.platform === "win32" ? `handler.exe` : `handler`;
5525
+ const runningBuilds = /* @__PURE__ */ new Map();
5526
5526
  handlers.register({
5527
5527
  shouldBuild: (input) => {
5528
5528
  if (!input.file.endsWith(".java"))
@@ -5579,7 +5579,7 @@ var init_java = __esm({
5579
5579
  const buildTask = input.props.java?.buildTask || "build";
5580
5580
  const outputDir = input.props.java?.buildOutputDir || "distributions";
5581
5581
  sources.set(input.functionID, srcPath);
5582
- try {
5582
+ async function build2() {
5583
5583
  await execAsync(
5584
5584
  `${buildBinary} ${buildTask} -Dorg.gradle.logging.level=${process.env.DEBUG ? "debug" : "lifecycle"}`,
5585
5585
  {
@@ -5590,7 +5590,21 @@ var init_java = __esm({
5590
5590
  const zip = (await fs13.readdir(buildOutput)).find(
5591
5591
  (f) => f.endsWith(".zip")
5592
5592
  );
5593
- new AdmZip(path15.join(buildOutput, zip)).extractAllTo(input.out);
5593
+ await new Promise((resolve2, reject) => {
5594
+ const zipper = new AdmZip(path15.join(buildOutput, zip));
5595
+ zipper.extractAllToAsync(
5596
+ input.out,
5597
+ false,
5598
+ false,
5599
+ (err) => err ? reject(err) : resolve2(void 0)
5600
+ );
5601
+ });
5602
+ }
5603
+ try {
5604
+ const buildPromise = runningBuilds.get(buildBinary) ?? build2();
5605
+ runningBuilds.set(buildBinary, buildPromise);
5606
+ await buildPromise;
5607
+ runningBuilds.delete(buildBinary);
5594
5608
  return {
5595
5609
  type: "success",
5596
5610
  handler: input.props.handler
@@ -5888,16 +5902,26 @@ async function loadCDKStatus() {
5888
5902
  );
5889
5903
  if (!stacks || stacks.length === 0)
5890
5904
  return { status: "bootstrap" };
5891
- if (!["CREATE_COMPLETE", "UPDATE_COMPLETE"].includes(stacks[0].StackStatus)) {
5905
+ if (![
5906
+ "CREATE_COMPLETE",
5907
+ "UPDATE_COMPLETE",
5908
+ "UPDATE_ROLLBACK_COMPLETE"
5909
+ ].includes(stacks[0].StackStatus)) {
5892
5910
  return { status: "bootstrap" };
5893
5911
  }
5894
- const output = stacks[0].Outputs?.find(
5895
- (o) => o.OutputKey === "BootstrapVersion"
5896
- );
5897
- if (!output || parseInt(output.OutputValue) < 14) {
5912
+ let version2;
5913
+ let bucket;
5914
+ const output = stacks[0].Outputs?.forEach((o) => {
5915
+ if (o.OutputKey === "BootstrapVersion") {
5916
+ version2 = parseInt(o.OutputValue);
5917
+ } else if (o.OutputKey === "BucketName") {
5918
+ bucket = o.OutputValue;
5919
+ }
5920
+ });
5921
+ if (!version2 || version2 < 14 || !bucket) {
5898
5922
  return { status: "update" };
5899
5923
  }
5900
- return { status: "ready" };
5924
+ return { status: "ready", version: version2, bucket };
5901
5925
  } catch (e) {
5902
5926
  if (e.name === "ValidationError" && e.message === `Stack with id ${stackName} does not exist`) {
5903
5927
  return { status: "bootstrap" };
@@ -5946,7 +5970,7 @@ async function loadSSTStatus() {
5946
5970
  }
5947
5971
  return { status: "ready", version: version2, bucket };
5948
5972
  }
5949
- async function bootstrapSST() {
5973
+ async function bootstrapSST(cdkBucket) {
5950
5974
  const { region, bootstrap: bootstrap2, cdk } = useProject().config;
5951
5975
  const app = new App();
5952
5976
  const stackName = bootstrap2?.stackName || SST_STACK_NAME;
@@ -5967,9 +5991,9 @@ async function bootstrapSST() {
5967
5991
  for (const [key, value] of Object.entries(bootstrap2?.tags || {})) {
5968
5992
  Tags.of(app).add(key, value);
5969
5993
  }
5970
- const bucket = bootstrap2?.useExistingBucket ? {
5971
- bucketName: bootstrap2.useExistingBucket,
5972
- bucketArn: `arn:${stack.partition}:s3:::${bootstrap2.useExistingBucket}`
5994
+ const bucket = bootstrap2?.useCdkBucket ? {
5995
+ bucketName: cdkBucket,
5996
+ bucketArn: `arn:${stack.partition}:s3:::${cdkBucket}`
5973
5997
  } : new Bucket(stack, region, {
5974
5998
  encryption: BucketEncryption.S3_MANAGED,
5975
5999
  removalPolicy: RemovalPolicy.DESTROY,
@@ -6133,9 +6157,12 @@ var init_bootstrap = __esm({
6133
6157
  ).start();
6134
6158
  if (needToBootstrapCDK) {
6135
6159
  await bootstrapCDK();
6160
+ cdkStatus = await loadCDKStatus();
6161
+ if (cdkStatus.status !== "ready")
6162
+ throw new VisibleError("Failed to load bootstrap stack status");
6136
6163
  }
6137
6164
  if (needToBootstrapSST) {
6138
- await bootstrapSST();
6165
+ await bootstrapSST(cdkStatus.bucket);
6139
6166
  sstStatus = await loadSSTStatus();
6140
6167
  if (sstStatus.status !== "ready")
6141
6168
  throw new VisibleError("Failed to load bootstrap stack status");
@@ -8825,15 +8852,6 @@ function secrets(program2) {
8825
8852
  }
8826
8853
 
8827
8854
  // src/cli/commands/update.ts
8828
- var PACKAGE_MATCH = [
8829
- "sst",
8830
- "astro-sst",
8831
- "aws-cdk",
8832
- "@aws-cdk",
8833
- "constructs",
8834
- "svelte-kit-sst",
8835
- "solid-start-sst"
8836
- ];
8837
8855
  var FIELDS = ["dependencies", "devDependencies"];
8838
8856
  var update = (program2) => program2.command(
8839
8857
  "update [version]",
@@ -8843,7 +8861,6 @@ var update = (program2) => program2.command(
8843
8861
  describe: "Optionally specify a version to update to"
8844
8862
  }),
8845
8863
  async (args) => {
8846
- const { green, yellow } = await import("colorette");
8847
8864
  const fs19 = await import("fs/promises");
8848
8865
  const path22 = await import("path");
8849
8866
  const { fetch } = await import("undici");
@@ -8873,29 +8890,27 @@ var update = (program2) => program2.command(
8873
8890
  ).then((resp) => resp.json());
8874
8891
  const results = /* @__PURE__ */ new Map();
8875
8892
  const tasks = files.map(async (file) => {
8876
- const data2 = await fs19.readFile(file).then((x) => x.toString()).then(JSON.parse);
8893
+ const data2 = await fs19.readFile(file).then((x) => x.toString());
8894
+ const tailingNewline = data2.match(/\r?\n$/)?.[0];
8895
+ const json = JSON.parse(data2);
8877
8896
  for (const field of FIELDS) {
8878
- const deps = data2[field];
8879
- if (!deps)
8880
- continue;
8881
- for (const [pkg, existing] of Object.entries(deps)) {
8882
- if (!PACKAGE_MATCH.some((x) => pkg.startsWith(x)))
8883
- continue;
8897
+ const deps = json[field];
8898
+ for (const [pkg, existing] of Object.entries(deps || {})) {
8884
8899
  const desired = (() => {
8885
8900
  if ([
8886
8901
  "sst",
8887
8902
  "astro-sst",
8888
8903
  "svelte-kit-sst",
8889
8904
  "solid-start-sst"
8890
- ].includes(pkg))
8905
+ ].includes(pkg)) {
8891
8906
  return metadata3.version;
8892
- if (pkg === "constructs")
8907
+ } else if (pkg === "constructs") {
8893
8908
  return metadata3.dependencies.constructs;
8894
- if (pkg.endsWith("alpha"))
8895
- return metadata3.dependencies["@aws-cdk/aws-apigatewayv2-alpha"];
8896
- return metadata3.dependencies["aws-cdk-lib"];
8909
+ } else if (pkg.startsWith("aws-cdk") || pkg.startsWith("@aws-cdk")) {
8910
+ return pkg.endsWith("alpha") ? metadata3.dependencies["@aws-cdk/aws-apigatewayv2-alpha"] : metadata3.dependencies["aws-cdk-lib"];
8911
+ }
8897
8912
  })();
8898
- if (existing === desired)
8913
+ if (!desired || existing === desired)
8899
8914
  continue;
8900
8915
  let arr = results.get(file);
8901
8916
  if (!arr) {
@@ -8907,7 +8922,10 @@ var update = (program2) => program2.command(
8907
8922
  }
8908
8923
  }
8909
8924
  if (results.has(file)) {
8910
- await fs19.writeFile(file, JSON.stringify(data2, null, 2));
8925
+ await fs19.writeFile(
8926
+ file,
8927
+ `${JSON.stringify(json, null, 2)}${tailingNewline ?? ""}`
8928
+ );
8911
8929
  }
8912
8930
  });
8913
8931
  await Promise.all(tasks);