-
-
Notifications
You must be signed in to change notification settings - Fork 381
Add NodeJS website using mise supporting node versions per site #974
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "scripts": [ | ||
| "composer install", | ||
| "cp $PROJECT_PATH/.env .env" | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| <?php | ||
|
|
||
| namespace App\Enums; | ||
|
|
||
| use App\Contracts\VitoEnum; | ||
| use App\Traits\HasEnumHelpers; | ||
|
|
||
| enum NodePackageManager: string implements VitoEnum | ||
| { | ||
| use HasEnumHelpers; | ||
|
|
||
| case Npm = 'npm'; | ||
| case Pnpm = 'pnpm'; | ||
| case Yarn = 'yarn'; | ||
|
|
||
| public function getColor(): string | ||
| { | ||
| return 'default'; | ||
| } | ||
|
|
||
| public function getText(): string | ||
| { | ||
| return match ($this) { | ||
| self::Npm => 'npm', | ||
| self::Pnpm => 'pnpm', | ||
| self::Yarn => 'yarn', | ||
| }; | ||
| } | ||
|
|
||
| public function installCommand(): string | ||
| { | ||
| return match ($this) { | ||
| self::Npm => 'npm install', | ||
| self::Pnpm => 'pnpm install', | ||
| self::Yarn => 'yarn install', | ||
| }; | ||
| } | ||
|
|
||
| public function buildCommand(): string | ||
| { | ||
| return match ($this) { | ||
| self::Npm => 'npm run build', | ||
| self::Pnpm => 'pnpm run build', | ||
| self::Yarn => 'yarn build', | ||
| }; | ||
| } | ||
|
|
||
| public function startCommand(): string | ||
| { | ||
| return match ($this) { | ||
| self::Npm => 'npm start', | ||
| self::Pnpm => 'pnpm start', | ||
| self::Yarn => 'yarn start', | ||
| }; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| <?php | ||
|
|
||
| namespace App\SSH\Mise; | ||
|
|
||
| use App\Exceptions\SSHError; | ||
| use App\Models\Server; | ||
| use App\Models\Site; | ||
|
|
||
| class Mise | ||
| { | ||
| public function __construct(protected Server $server) {} | ||
|
|
||
| /** | ||
| * @throws SSHError | ||
| */ | ||
| public function ensureInstalled(): void | ||
| { | ||
| $this->server->ssh()->exec( | ||
| view('ssh.mise.ensure-installed'), | ||
| 'ensure-mise-installed' | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * @throws SSHError | ||
| */ | ||
| public function isInstalled(): bool | ||
| { | ||
| $result = $this->server->ssh()->exec('which mise || echo "not-found"'); | ||
|
|
||
| return ! str_contains($result, 'not-found'); | ||
| } | ||
|
|
||
| /** | ||
| * @throws SSHError | ||
| */ | ||
| public function installRuntime(Site $site, string $runtime, string $version): void | ||
| { | ||
| $this->server->ssh($site->user)->exec( | ||
| view('ssh.mise.install-runtime', [ | ||
| 'runtime' => $runtime, | ||
| 'version' => $version, | ||
| ]), | ||
| 'mise-install-'.$runtime.'-'.$version, | ||
| $site->id | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file appears to be unrelated to the PR's purpose of adding NodeJS website support using mise. The .easytree.json configuration seems to be a project setup file that was accidentally included in this pull request. Consider removing it if it's not intentionally part of this change.