Skip to content

Commit

Permalink
Devlink Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
adrolli committed Feb 12, 2025
1 parent 203441e commit 152a85c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 13 deletions.
50 changes: 38 additions & 12 deletions packages/devlink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ It is used to link the packages from the `moox` monorepo into a project. It runs
## Installation

```bash
cp composer.json.example composer.json
cp .env.example .env
composer require moox/devlink
php artisan vendor:publish --tag="devlink-config"
```
Expand All @@ -32,49 +34,73 @@ packages/*
!packages/**/
# Ensure empty directories can be committed
!packages/*/.gitkeep
# Ignore all files in packages-linked/ (for Windows)
packages-linked/*
```

## Configuration

The configuration is done in the `config/devlink.php` file.

```php
'base_paths' => [
// 'path/to/base/path',
],

'packages' => [
// 'package-name',
],
'packages_path' => 'packages',

'base_paths' => [
base_path('../moox/packages'),
],

'packages' => [
'moox/tag',
],

```

## Command

The devlink command will create a `packages` directory in the root of the project and symlink the packages from the configured base paths.

```bash
php artisan moox:devlink

php artisan moox:devlink

```

It will also update the `composer.json` file to include the packages in the `require` section and the `repositories` section.

Finally, it will run `composer update`.

You can have local packages mixed with the symlinked packages in your `/packages` folder.

![Moox Devlink](./devlink-mix.jpg)

### Changing branches

If you need to change the branches for ANY of the involved repositories, you just need to run the command again, it will automatically update the symlinks for the current branch.

```bash
php artisan moox:devlink

php artisan moox:devlink

```

> ⚠️ **Important**
> If you forget to run the command, when CHANGING BRANCHES ON ANY OF THE REPOS, you will surely run into a 500 error, that drives you nuts.
## Mac

Mac works out of the box. You can have local packages mixed with the symlinked packages in your `/packages` folder.

![Moox Devlink](./devlink-mix.jpg)

## Windows

On Windows there are most probably some issues with the symlinks. If you run into issues, you can either globally or project-wise disable the symlinks or do the following:

```php

'packages_path' => 'packages-linked',

```

Devlink will then link the packages into the `packages-linked` folder.

## Security Vulnerabilities

Please review [our security policy](https://github.com/mooxphp/moox/security/policy) on how to report security vulnerabilities.
Expand Down
2 changes: 1 addition & 1 deletion packages/devlink/src/Commands/LinkPackages.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct()
}

$this->composerJsonPath = base_path('composer.json');
$this->packagesPath = base_path('packages');
$this->packagesPath = config('devlink.packages_path', base_path('packages'));
}

public function handle(): void
Expand Down

0 comments on commit 152a85c

Please sign in to comment.