Skip to content

Commit 3666386

Browse files
committed
refactor writing files
1 parent 058653d commit 3666386

File tree

7 files changed

+183
-177
lines changed

7 files changed

+183
-177
lines changed

package-lock.json

Lines changed: 145 additions & 145 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@
4141
},
4242
"homepage": "https://github.com/abaplint/transpiler_poc#readme",
4343
"devDependencies": {
44-
"@abaplint/core": "^2.115.16",
44+
"@abaplint/core": "^2.115.17",
4545
"@eslint/compat": "^2.0.1",
4646
"@eslint/eslintrc": "^3.3.3",
4747
"@eslint/js": "^9.39.2",
4848
"@types/chai": "^4.3.20",
4949
"@types/mocha": "^10.0.10",
50-
"@types/node": "^24.10.8",
50+
"@types/node": "^24.10.9",
5151
"@types/sql.js": "^1.4.9",
52-
"@typescript-eslint/eslint-plugin": "^8.53.0",
53-
"@typescript-eslint/parser": "^8.53.0",
52+
"@typescript-eslint/eslint-plugin": "^8.53.1",
53+
"@typescript-eslint/parser": "^8.53.1",
5454
"chai": "^4.5.0",
5555
"cross-fetch": "^4.1.0",
5656
"dotenv": "^17.2.3",
@@ -59,8 +59,8 @@
5959
"fast-xml-parser": "^5.3.3",
6060
"globals": "^16.5.0",
6161
"mocha": "^11.7.5",
62-
"pg": "^8.17.1",
63-
"pg-cursor": "^2.16.1",
62+
"pg": "^8.17.2",
63+
"pg-cursor": "^2.16.2",
6464
"snowflake-sdk": "^2.3.3",
6565
"source-map-support": "^0.5.21",
6666
"sql.js": "^1.13.0",

packages/cli/package-lock.json

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
"author": "abaplint",
2828
"license": "MIT",
2929
"devDependencies": {
30-
"@abaplint/core": "^2.115.16",
30+
"@abaplint/core": "^2.115.17",
3131
"@abaplint/transpiler": "^2.12.25",
3232
"@types/glob": "^8.1.0",
33-
"@types/node": "^24.10.8",
33+
"@types/node": "^24.10.9",
3434
"@types/progress": "^2.0.7",
3535
"glob": "=7.2.0",
3636
"progress": "^2.0.3",

packages/cli/src/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ async function loadLib(config: ITranspilerConfig): Promise<Transpiler.IFile[]> {
7272

7373
function writeObjects(outputFiles: Transpiler.IOutputFile[], config: ITranspilerConfig, outputFolder: string, files: Transpiler.IFile[]) {
7474
const writeSourceMaps = config.write_source_map || false;
75+
const filesToWrite: {path: string, contents: string}[] = [];
76+
7577
for (const output of outputFiles) {
7678
let contents = output.chunk.getCode();
7779
if (writeSourceMaps === true
@@ -92,14 +94,18 @@ function writeObjects(outputFiles: Transpiler.IOutputFile[], config: ITranspiler
9294
map = map.replace(`"${f.filename}"`, withPath);
9395
}
9496
}
95-
fs.writeFileSync(outputFolder + path.sep + name, map);
97+
filesToWrite.push({path: outputFolder + path.sep + name, contents: map});
9698
}
9799

98100
if (output.object.type.toUpperCase() === "PROG") {
99101
// hmm, will this work for INCLUDEs ?
100102
contents = `if (!globalThis.abap) await import("./_init.mjs");\n` + contents;
101103
}
102-
fs.writeFileSync(outputFolder + path.sep + output.filename, contents);
104+
filesToWrite.push({path: outputFolder + path.sep + output.filename, contents});
105+
}
106+
107+
for (const file of filesToWrite) {
108+
fs.writeFileSync(file.path, file.contents);
103109
}
104110
}
105111

packages/transpiler/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/transpiler/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"author": "abaplint",
3030
"license": "MIT",
3131
"dependencies": {
32-
"@abaplint/core": "^2.115.16",
32+
"@abaplint/core": "^2.115.17",
3333
"source-map": "^0.7.6"
3434
},
3535
"devDependencies": {

0 commit comments

Comments
 (0)