fix platform

This commit is contained in:
rizrmd 2024-05-28 14:14:11 +07:00
parent 9b543bc391
commit b33b7c3db6
4 changed files with 23 additions and 5 deletions

View File

@ -8,6 +8,7 @@ import { user } from "../../../entity/user";
import { conns } from "../../../entity/conn"; import { conns } from "../../../entity/conn";
import { sendWS } from "../../../sync-handler"; import { sendWS } from "../../../sync-handler";
import { SyncType } from "../../../type"; import { SyncType } from "../../../type";
import { platform } from "os";
export const initTypings = async ( export const initTypings = async (
root: string, root: string,
id_site: string, id_site: string,
@ -42,7 +43,9 @@ export const initTypings = async (
spawn: Bun.spawn({ spawn: Bun.spawn({
cmd: [ cmd: [
...`${dir.path( ...`${dir.path(
"node_modules/.bin/tsc" platform() === "win32"
? "node_modules/.bin/tsc.exe"
: "node_modules/.bin/tsc"
)} --watch --moduleResolution node --emitDeclarationOnly --outFile ../typings.d.ts --declaration --noEmit false`.split( )} --watch --moduleResolution node --emitDeclarationOnly --outFile ../typings.d.ts --declaration --noEmit false`.split(
" " " "
), ),

View File

@ -2,9 +2,10 @@ import { createId } from "@paralleldrive/cuid2";
import brotliPromise from "brotli-wasm"; import brotliPromise from "brotli-wasm";
import { Glob, spawn } from "bun"; import { Glob, spawn } from "bun";
import { dir } from "dir"; import { dir } from "dir";
import { build, context } from "esbuild"; import { build } from "esbuild";
import { fdir } from "fdir"; import { fdir } from "fdir";
import { statSync } from "fs"; import { statSync } from "fs";
import { platform } from "os";
import { import {
copyAsync, copyAsync,
existsAsync, existsAsync,
@ -53,7 +54,11 @@ if (build_all) {
const args = [ const args = [
"node", "node",
dir.path("node_modules/.bin/parcel"), dir.path(
platform() === "win32"
? "node_modules/.bin/parcel.exe"
: "node_modules/.bin/parcel"
),
"build", "build",
"./src/index.tsx", "./src/index.tsx",
// "--no-optimize", // "--no-optimize",

View File

@ -2,6 +2,7 @@ import { spawn } from "bun";
import { existsAsync, readAsync } from "fs-jetpack"; import { existsAsync, readAsync } from "fs-jetpack";
import { dir } from "../../utils/dir"; import { dir } from "../../utils/dir";
import { g } from "../../utils/global"; import { g } from "../../utils/global";
import { platform } from "os";
export const prepareAPITypes = async () => { export const prepareAPITypes = async () => {
const out: string[] = []; const out: string[] = [];
@ -36,7 +37,11 @@ export const ${name} = {
const args = [ const args = [
process.execPath, process.execPath,
dir.path("node_modules/.bin/tsc"), dir.path(
platform() === "win32"
? "node_modules/.bin/tsc.exe"
: "node_modules/.bin/tsc"
),
dir.path("app/srv/exports.ts"), dir.path("app/srv/exports.ts"),
"--declaration", "--declaration",
"--emitDeclarationOnly", "--emitDeclarationOnly",

View File

@ -2,6 +2,7 @@ import { spawn } from "bun";
import { dirAsync } from "fs-jetpack"; import { dirAsync } from "fs-jetpack";
import { dir } from "./dir"; import { dir } from "./dir";
import { g } from "./global"; import { g } from "./global";
import { platform } from "os";
const decoder = new TextDecoder(); const decoder = new TextDecoder();
export const parcelBuild = async () => { export const parcelBuild = async () => {
@ -9,7 +10,11 @@ export const parcelBuild = async () => {
const args = [ const args = [
"node", "node",
dir.path("node_modules/.bin/parcel"), dir.path(
platform() === "win32"
? "node_modules/.bin/parcel.exe"
: "node_modules/.bin/parcel"
),
g.mode === "dev" ? "watch" : "build", g.mode === "dev" ? "watch" : "build",
"./src/index.tsx", "./src/index.tsx",
g.mode === "dev" ? "--no-hmr" : "--no-optimize", g.mode === "dev" ? "--no-hmr" : "--no-optimize",