Skip to content

Commit

Permalink
cr
Browse files Browse the repository at this point in the history
  • Loading branch information
filip131311 committed Jan 13, 2025
1 parent 90b7c1e commit 3ce3969
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 39 deletions.
2 changes: 1 addition & 1 deletion packages/vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@
"vscode:package": "vsce package",
"vscode:prepublish": "npm run package",
"build:extension-debug": "node scripts/buildExtensionCode.mjs debug",
"build:extension": "node scripts/buildExtensionCode.mjs prod",
"build:extension": "node scripts/buildExtensionCode.mjs production",
"build:webview": "vite build --mode production && cp ./node_modules/@vscode/codicons/dist/codicon.* dist/.",
"build:sim-server-debug": "bash ./scripts/build-sim-server-debug.sh dist",
"build:sim-server": "bash ./scripts/install-sim-server-release-build.sh dist",
Expand Down
39 changes: 19 additions & 20 deletions packages/vscode-extension/scripts/buildExtensionCode.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@ import fs from "fs";

const [mode] = process.argv.slice(2);

let buildConfig = {
entryPoints: ["./src/extension.ts"],
bundle: true,
outfile: "./dist/extension.js",
external: ["vscode"],
format: "cjs",
platform: "node",
};

// build extension code
if (mode === "debug") {
await esbuild.build({
entryPoints: ["./src/extension.ts"],
bundle: true,
outfile: "./dist/extension.js",
external: ["vscode"],
format: "cjs",
platform: "node",
buildConfig = {
...buildConfig,
sourcemap: true,
});
} else if (mode === "prod") {
};
}
if (mode === "production") {
const licensesDir = "dist/third-party-licenses";

// Ensure the license directory exists
Expand Down Expand Up @@ -54,21 +59,15 @@ if (mode === "debug") {
},
};

await esbuild.build({
entryPoints: ["./src/extension.ts"],
bundle: true,
outfile: "./dist/extension.js",
buildConfig = {
...buildConfig,
plugins: [esbuildPluginLicense(licensePluginConfiguration)],
external: ["vscode"],
format: "cjs",
platform: "node",
minify: true,
});
} else {
console.error("The `prod` or `debug` must be provided as an argument");
process.exit(1);
};
}

await esbuild.build(buildConfig);

// add mapping to dist
const sourceMapMappingsPath = "node_modules/source-map/lib/mappings.wasm";
const newSourceMapMappingsPath = "dist/mappings.wasm";
Expand Down
17 changes: 6 additions & 11 deletions packages/vscode-extension/scripts/generateThirdPartyNotice.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@ const directoryPath = "dist/third-party-licenses";
const outputFile = "dist/THIRDPARTYNOTICE.json";

function readJsonFiles() {
return fs.promises
.readdir(directoryPath, { withFileTypes: true })
.then((entries) => {
const filePromises = entries
.filter((entry) => entry.isFile() && entry.name.endsWith(".json"))
.map((entry) => fs.promises.readFile(path.join(directoryPath, entry.name), "utf8"));
return Promise.all(filePromises);
})
.then((files) => {
return files.map((file) => JSON.parse(file));
});
return fs.promises.readdir(directoryPath, { withFileTypes: true }).then((entries) => {
const filePromises = entries
.filter((entry) => entry.isFile() && entry.name.endsWith(".json"))
.map((entry) => require(path.join("..", directoryPath, entry.name)));
return Promise.all(filePromises);
});
}

function mergeLibraries(dataArrays) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ sim_server_tag=$(git -C ../simulator-server describe --tags)
echo "Downloading simulator-server binaries for tag $sim_server_tag"

echo "Removing existing simulator-server binaries if necessary..."
for file in "$output_dir"/simulator-server*; do
if [ -f "$file" ]; then
echo "Removing existing file $file"
rm -f "$file"
fi
done
rm -f $output_dir/simulator-server*

# Download simulator-server binaries using gh CLI and place them in the output directory with correct file mode
gh release download $sim_server_tag -R software-mansion-labs/simulator-server -p "simulator-server*" -D "$output_dir"
Expand All @@ -57,7 +52,6 @@ else
fi

gh release download $sim_server_tag -R software-mansion-labs/simulator-server -p "THIRDPARTY.json" -D "$output_dir"/"third-party-licenses"
chmod +x "$output_dir"/"third-party-licenses"

echo "Operation completed successfully."

0 comments on commit 3ce3969

Please sign in to comment.