Skip to content

Commit

Permalink
Fix import for libs, clean output to remove emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinaisslaying committed Mar 19, 2024
1 parent 04bdd27 commit e2d2b2b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ RUN corepack enable pnpm
RUN CI=true pnpm i
# Compile new dist file
RUN npx tsc-transpile-only
# Compile library module so it is readable by src
RUN pnpm run lib-compile
# Remove non-dist files
RUN rm -rf src/ @types/ .env.production
# Start the process within the container
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@
},
"scripts": {
"preinstall": "npx only-allow pnpm",
"compile": "rm -rf dist/ && tsc",
"compile": "rm -rf dist/ && tsc && pnpm run lib-compile",
"start": "node --max-old-space-size=4096 dist/src/app",
"pm2": "pm2 start dist/src/app.js --name 'DEL'",
"css-compile": "sh ./scripts/css_build.sh",
"lib-compile": "mkdir ./dist/node_modules/ && cp -R ./node_modules/lib-comparison/ ./dist/node_modules/lib-comparison/ && tsc ./dist/node_modules/lib-comparison/libs.ts",
"snyk-protect": "snyk-protect",
"prepare": "pnpm run snyk-protect",
"pretty": "npx prettier --write src/"
Expand Down
15 changes: 12 additions & 3 deletions src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,27 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import { libs } from "lib-comparison/libs";
import { libs } from "../node_modules/lib-comparison/libs.js";

function cleanLibName(lib: string) {
if (lib.includes(" 🍴🪦")) return lib.replace(" 🍴🪦", "");
if (lib.includes(" 🍴")) return lib.replace(" 🍴", "");
if (lib.includes(" 🪦")) return lib.replace(" 🪦", "");
if (lib.includes("🪦")) return lib.replace("🪦", "");
return lib;
}

async function setup() {
console.log("Setup: Updating libraries...");
await global.db.collection("libraries").drop();
for (const lib of libs) {
await global.db
.collection("libraries")
.updateOne(
{ _id: lib.name },
{ _id: cleanLibName(lib.name) },
{
$set: {
_id: lib.name,
_id: cleanLibName(lib.name),
language: lib.language,
link: lib.url
}
Expand Down

0 comments on commit e2d2b2b

Please sign in to comment.