Sfoglia il codice sorgente

ref: update build stuff

Sv443 1 anno fa
parent
commit
4f1f707a93

+ 5 - 4
.github/workflows/build-and-publish.yml

@@ -16,10 +16,10 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        node-version: [18.x]
+        node-version: [20.x]
     steps:
-      - uses: actions/checkout@v3
-      - uses: actions/setup-node@v3
+      - uses: actions/checkout@v4
+      - uses: actions/setup-node@v4
         with:
           node-version: ${{ matrix.node-version }}
       - name: Install dependencies
@@ -29,10 +29,11 @@ jobs:
           npm run build
           npm run build-all
       - name: Create dist folder artifact
-        uses: actions/upload-artifact@v3
+        uses: actions/upload-artifact@v4
         with:
           name: dist
           path: dist/
+          retention-days: 2
       - name: Create Release
         uses: changesets/action@v1
         id: changesets

+ 6 - 6
.github/workflows/lint-and-analyze.yml

@@ -12,11 +12,11 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        node-version: [18.x]
+        node-version: [20.x]
 
     steps:
-      - uses: actions/checkout@v3
-      - uses: actions/setup-node@v3
+      - uses: actions/checkout@v4
+      - uses: actions/setup-node@v4
         with:
           node-version: ${{ matrix.node-version }}
       - name: Install dependencies
@@ -36,10 +36,10 @@ jobs:
         language: ["javascript"]
 
     steps:
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
       - name: Initialize CodeQL
-        uses: github/codeql-action/init@v2
+        uses: github/codeql-action/init@v3
         with:
           languages: ${{ matrix.language }}
       - name: Perform CodeQL Analysis
-        uses: github/codeql-action/analyze@v2
+        uses: github/codeql-action/analyze@v3

+ 6 - 6
tools/post-build-global.mts

@@ -1,5 +1,5 @@
-import { access, constants as fsconstants, readFile, writeFile } from "fs/promises";
-import { resolve } from "path";
+import { access, constants as fsconstants, readFile, writeFile } from "node:fs/promises";
+import { resolve } from "node:path";
 import pkg from "../package.json" assert { type: "json" };
 
 const { exit } = process;
@@ -37,13 +37,13 @@ async function run() {
 // ==/OpenUserJS==
 `;
 
-  const initialScript = await readFile(iifeBundlePath, "utf8");
+  const initialBundle = await readFile(iifeBundlePath, "utf8");
 
-  const finalScript = `${libHeader}\nvar UserUtils = ${initialScript}`
+  const finalBundle = `${libHeader}\nvar UserUtils = ${initialBundle}`
     .replace(/^\s*'use strict';\s*(\r?\n){1,2}/gm, "");
 
-  await writeFile(iifeBundlePath, finalScript, "utf8");
-  console.log(`Global script at path '${iifeBundlePath}' has been updated`);
+  await writeFile(iifeBundlePath, finalBundle, "utf8");
+  console.log(`\x1b[32mGlobal bundle at path \x1b[0m'${iifeBundlePath}'\x1b[32m has been updated\x1b[0m`);
 
   setImmediate(() => exit(0));
 }