Browse Source

fix: update package json scripts commands

pull/477/head
Dan Ditomaso 1 year ago
parent
commit
fc713f55fe
  1. 8
      package.json
  2. 21
      vite.config.ts

8
package.json

@ -5,7 +5,7 @@
"description": "Meshtastic web client",
"license": "GPL-3.0-only",
"scripts": {
"build": "deno run -A npm:vite build",
"build": "vite build",
"build:analyze": "BUNDLE_ANALYZE=true deno task build",
"lint": "deno lint src/",
"lint:fix": "deno lint --fix src/",
@ -13,10 +13,10 @@
"dev": "deno task dev:ui",
"dev:ui": "deno run -A npm:vite dev",
"dev:scan": "VITE_DEBUG_SCAN=true deno task dev:ui",
"test": "deno run vitest",
"test": "deno run -A npm:vitest",
"test:ui": "deno task test --ui",
"preview": "deno run --allow-net npm:vite preview",
"package": "deno run -A npm:gzipper c -i html,js,css,png,ico,svg,webmanifest,txt dist dist/output && deno run -A --allow-run tar -cvf dist/build.tar -C ./dist/output/ ."
"preview": "deno run -A npm:vite preview",
"package": "gzipper c -i html,js,css,png,ico,svg,webmanifest,txt dist dist/output && tar -cvf dist/build.tar -C ./dist/output/ ."
},
"repository": {
"type": "git",

21
vite.config.ts

@ -2,22 +2,16 @@ import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { VitePWA } from 'vite-plugin-pwa';
import path from 'node:path';
import { execSync } from 'node:child_process';
let hash = '';
try {
const process = new Deno.Command('git', {
args: ['rev-parse', '--short', 'HEAD'],
stdout: 'piped'
});
const output = await process.output();
hash = new TextDecoder().decode(output.stdout).trim();
hash = execSync('git rev-parse --short HEAD', { encoding: 'utf8' }).trim();
} catch (error) {
console.error('Error getting git hash:', error);
hash = 'DEV';
}
console.log('Commit hash:', hash);
export default defineConfig({
plugins: [
react(),
@ -38,11 +32,12 @@ export default defineConfig({
},
resolve: {
alias: {
'@app': path.resolve(Deno.cwd(), './src'),
'@pages': path.resolve(Deno.cwd(), './src/pages'),
'@components': path.resolve(Deno.cwd(), './src/components'),
'@core': path.resolve(Deno.cwd(), './src/core'),
'@layouts': path.resolve(Deno.cwd(), './src/layouts'),
// Using Node's path and process.cwd() instead of Deno.cwd()
'@app': path.resolve(process.cwd(), './src'),
'@pages': path.resolve(process.cwd(), './src/pages'),
'@components': path.resolve(process.cwd(), './src/components'),
'@core': path.resolve(process.cwd(), './src/core'),
'@layouts': path.resolve(process.cwd(), './src/layouts'),
},
},
server: {

Loading…
Cancel
Save