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

21
vite.config.ts

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

Loading…
Cancel
Save