Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 22
fix: fix invalid path to node with sh execution#1213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
531a61c3c6fe5c6b65158b48fc783db697916d2effd94b9f466206671627281File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| #!/usr/bin/env node | ||
| import '@app/dotenv.js'; | ||
| import { execa } from 'execa'; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,30 @@ | ||
| import { readFileSync } from 'node:fs'; | ||
| import { homedir } from 'node:os'; | ||
| import { dirname, join } from 'node:path'; | ||
| import { join } from 'node:path'; | ||
| import { fileURLToPath } from 'node:url'; | ||
| const getPackageJsonVersion = () => { | ||
| try { | ||
| // Use import.meta.resolve to get the URL of package.json | ||
| const packageJsonUrl = import.meta.resolve('../package.json'); | ||
| const packageJsonPath = fileURLToPath(packageJsonUrl); | ||
| const packageJson = readFileSync(packageJsonPath, 'utf-8'); | ||
| const packageJsonObject = JSON.parse(packageJson); | ||
| return packageJsonObject.version; | ||
| // Try different possible locations for package.json | ||
| const possibleLocations = ['../package.json', '../../package.json']; | ||
| for (const location of possibleLocations) { | ||
| try { | ||
| const packageJsonUrl = import.meta.resolve(location); | ||
| const packageJsonPath = fileURLToPath(packageJsonUrl); | ||
| const packageJson = readFileSync(packageJsonPath, 'utf-8'); | ||
| const packageJsonObject = JSON.parse(packageJson); | ||
| if (packageJsonObject.version) { | ||
| return packageJsonObject.version; | ||
| } | ||
| } catch { | ||
| // Continue to next location if this one fails | ||
| } | ||
| } | ||
elibosley marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| // If we get here, we couldn't find a valid package.json in any location | ||
| console.error('Could not find package.json in any of the expected locations'); | ||
| return undefined; | ||
elibosley marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } catch (error) { | ||
| console.error('Failed to load package.json:', error); | ||
| return undefined; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -90,6 +90,12 @@ export default defineConfig(({ mode }): ViteUserConfig => { | ||
| entryFileNames: '[name].js', | ||
| format: 'es', | ||
| interop: 'auto', | ||
| banner: (chunk) => { | ||
| if (chunk.fileName === 'main.js' || chunk.fileName === 'cli.js') { | ||
| return '#!/usr/local/node/bin/node\n'; | ||
elibosley marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| return ''; | ||
| }, | ||
| }, | ||
| preserveEntrySignatures: 'strict', | ||
| external: [ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -907,9 +907,11 @@ fi | ||
| # Create symlink to unraid-api binary (to allow usage elsewhere) | ||
| ln -sf /usr/local/node/bin/node /usr/local/bin/node | ||
| ln -sf ${unraid_binary_path} /usr/local/sbin/unraid-api | ||
elibosley marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ln -sf ${unraid_binary_path} /usr/bin/unraid-api | ||
| logger "Starting flash backup (if enabled)" | ||
| echo "/etc/rc.d/rc.flash_backup start" | at -M now &>/dev/null | ||
| . /root/.bashrc | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.