Skip to content

Commit 477ae83

Browse files
committed
New status wip (#749)
1 parent 9f3a1c5 commit 477ae83

19 files changed

+228
-372
lines changed

README.md

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,52 +19,44 @@ php artisan vendor:publish --tag="devlink-config"
1919

2020
```bash
2121

22-
# Ignore all files in packages/ (including symlinks)
22+
# Devlink
23+
# ignore symlinks in packages/
2324
packages/*
24-
# Allow tracking of real directories inside packages/
2525
!packages/**/
26-
# Ensure empty directories can be committed
2726
!packages/*/.gitkeep
28-
# for windows
27+
# and for windows
2928
/packageslocal/*
3029

3130
```
3231

3332
2. Configure your paths and packages in the `config/devlink.php` file and change the package path in the `.env` file, if needed (Windows users should set the `DEVLINK_PACKAGES_PATH` variable to `packageslocal`).
3433

35-
3. When running `devlink:status`:
34+
3. When running `php init.php`
3635

37-
- Lists all packages that are currently devlinked
38-
- Lists all packages that are configured but not devlinked
39-
- Lists all packages that are not configured, but devlinked
40-
- Shows the configuration and the deploy status of each package
36+
- Creates a `.env` file from `.env.example`
37+
- Copies `composer.json-deploy` to `composer.json`
38+
- Runs `composer install`
4139

42-
4. When running `devlink:link`:
40+
4. When running `devlink:status`:
41+
42+
- Shows the configuration and status of each package
43+
- Shows the link status (Linked, Unlinked, Deployed)
44+
- Shows the update status (Up-to-date, Outdated)
45+
46+
5. When running `devlink:link`:
4347

4448
- Creates the packages folder, if it does not exist
45-
- Creates backup of original composer.json → composer.json.original
4649
- Creates symlinks for all configured packages
4750
- Updates composer.json with development configuration
4851
- Creates composer.json-deploy for production use
4952
- Asks to run `composer install`
5053
- Asks to run `php artisan optimize:clear`
5154
- Asks to run `php artisan queue:restart`
5255

53-
5. When running `devlink:unlink`:
54-
55-
- Removes all symlinks
56-
- Deletes the packages folder, if empty
57-
- Creates a backup of composer.json to composer.json-backup
58-
- Restores original composer.json from composer.json-original
59-
- Asks to run `composer install`
60-
- Asks to run `php artisan optimize:clear`
61-
- Asks to run `php artisan queue:restart`
62-
6356
6. When running `devlink:deploy`:
6457

6558
- Removes all symlinks
6659
- Deletes the packages folder, if empty
67-
- Creates a backup of composer.json to composer.json-backup
6860
- Restores production-ready composer.json from composer.json-deploy
6961
- Asks to run `composer install`
7062
- Asks to run `php artisan optimize:clear`
@@ -73,17 +65,9 @@ packages/*
7365
7. CI Safety Net - `deploy.sh`:
7466

7567
- If composer.json-deploy exists in the repository:
76-
- the script will restore it as composer.json
77-
- rename composer.json-original to composer.json-backup
78-
- Commit and push the change in GH action
79-
- This ensures no development configuration reaches production
80-
81-
## Changing branches
82-
83-
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.
84-
85-
> ⚠️ **Important**
86-
> 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.
68+
- Remove all symlinks from /packages
69+
- rename composer.json-deploy to composer.json
70+
- Commit and push the change in your GitHub Action
8771

8872
## Mac
8973

@@ -93,7 +77,7 @@ Mac works out of the box. You can have local packages mixed with the symlinked p
9377

9478
## Windows
9579

96-
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:
80+
On Windows there are most probably some issues with ignoring symlinks. If you run into issues, you can either globally or project-wise disable the symlinks or do the following:
9781

9882
```env
9983
DEVLINK_PACKAGES_PATH=packageslocal

ROADMAP.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# Roadmap
22

3+
This is the roadmap for the devlink package.
4+
35
## Current tasks
46

5-
- [ ] Private packages are not yet handled (copied and wired with path)
6-
- [ ] Need to delete private packages in the link and unlink steps then
7-
- [ ] There is probably an unclear state, because we do not yet use `-backup` yet
8-
- [ ] For the shell script, we also need to check if `-original` and `-backup` are correct
7+
We are working on the following tasks from top to bottom. Please don't forget to update the roadmap when a task is completed.
8+
9+
- [ ] ... no open tasks at the moment ...
10+
11+
## Ideas
12+
13+
- [ ] Deploy: new feature: last version for all packages instead of \*

config/devlink.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

config/devlink.php

Lines changed: 17 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121
$public_base_path = env('DEVLINK_PUBLIC_PATH', '../moox/packages');
2222
$private_base_path = env('DEVLINK_PRIVATE_PATH', 'disabled');
2323

24+
/*
25+
|--------------------------------------------------------------------------
26+
| Private Packages Repo URL
27+
|--------------------------------------------------------------------------
28+
|
29+
| The URL of the Moox package repository. Can be set in the .env file.
30+
|
31+
*/
32+
$private_repo_url = env('DEVLINK_PRIVATE_REPO_URL', 'https://pkg.moox.pro/');
33+
2434
return [
2535

2636
/*
@@ -53,201 +63,153 @@
5363
// Moox
5464
'audit' => [
5565
'active' => false,
56-
'linked' => true,
5766
'path' => $public_base_path.'/audit',
5867
'type' => 'public',
59-
'deploy' => true,
6068
],
6169
'backup-server-ui' => [
6270
'active' => false,
63-
'linked' => true,
6471
'path' => $public_base_path.'/backup-server-ui',
6572
'type' => 'public',
66-
'deploy' => true,
6773
],
6874
'builder' => [
6975
'active' => false,
70-
'linked' => true,
7176
'path' => $public_base_path.'/builder',
7277
'type' => 'public',
73-
'deploy' => false,
7478
],
7579
'category' => [
7680
'active' => false,
77-
'linked' => true,
7881
'path' => $public_base_path.'/category',
7982
'type' => 'public',
80-
'deploy' => true,
8183
],
8284
'core' => [
8385
'active' => false,
84-
'linked' => true,
8586
'path' => $public_base_path.'/core',
8687
'type' => 'public',
87-
'deploy' => true,
8888
],
8989
'devlink' => [
9090
'active' => false,
9191
'linked' => false,
9292
'path' => $public_base_path.'/devlink',
9393
'type' => 'public',
94-
'deploy' => false,
9594
],
9695
'devops' => [
9796
'active' => false,
98-
'linked' => true,
9997
'path' => $public_base_path.'/devops',
10098
'type' => 'public',
101-
'deploy' => true,
10299
],
103100
'expiry' => [
104101
'active' => false,
105-
'linked' => true,
106102
'path' => $public_base_path.'/expiry',
107103
'type' => 'public',
108-
'deploy' => true,
109104
],
110105
'flags' => [
111106
'active' => false,
112-
'linked' => true,
113107
'path' => $public_base_path.'/flags',
114108
'type' => 'public',
115-
'deploy' => true,
116109
],
117110
'jobs' => [
118111
'active' => false,
119-
'linked' => true,
120112
'path' => $public_base_path.'/jobs',
121113
'type' => 'public',
122-
'deploy' => true,
123114
],
124115
'login-link' => [
125116
'active' => false,
126-
'linked' => true,
127117
'path' => $public_base_path.'/login-link',
128118
'type' => 'public',
129-
'deploy' => true,
130119
],
131120
'notifications' => [
132121
'active' => false,
133-
'linked' => true,
134122
'path' => $public_base_path.'/notifications',
135123
'type' => 'public',
136-
'deploy' => true,
137124
],
138125
'passkey' => [
139126
'active' => false,
140-
'linked' => true,
141127
'path' => $public_base_path.'/passkey',
142128
'type' => 'public',
143-
'deploy' => true,
144129
],
145130
'press' => [
146131
'active' => false,
147-
'linked' => true,
148132
'path' => $public_base_path.'/press',
149133
'type' => 'public',
150-
'deploy' => true,
151134
],
152135
'security' => [
153136
'active' => false,
154-
'linked' => true,
155137
'path' => $public_base_path.'/security',
156138
'type' => 'public',
157-
'deploy' => true,
158139
],
159140
'sync' => [
160141
'active' => false,
161-
'linked' => true,
162142
'path' => $public_base_path.'/sync',
163143
'type' => 'public',
164-
'deploy' => true,
165144
],
166145
'tag' => [
167146
'active' => false,
168-
'linked' => true,
169147
'path' => $public_base_path.'/tag',
170148
'type' => 'public',
171-
'deploy' => true,
172149
],
173150
'trainings' => [
174151
'active' => false,
175-
'linked' => true,
176152
'path' => $public_base_path.'/trainings',
177153
'type' => 'public',
178-
'deploy' => true,
179154
],
180155
'user' => [
181156
'active' => false,
182-
'linked' => true,
183157
'path' => $public_base_path.'/user',
184158
'type' => 'public',
185-
'deploy' => true,
186159
],
187160
'user-device' => [
188161
'active' => false,
189-
'linked' => true,
190162
'path' => $public_base_path.'/user-device',
191163
'type' => 'public',
192-
'deploy' => true,
193164
],
194165
'user-session' => [
195166
'active' => false,
196-
'linked' => true,
197167
'path' => $public_base_path.'/user-session',
198168
'type' => 'public',
199-
'deploy' => true,
200169
],
201170

202171
// Moox Pro
203172
'connect' => [
204173
'active' => false,
205-
'linked' => true,
206174
'path' => $private_base_path.'/connect',
175+
'repo_url' => $private_repo_url,
207176
'type' => 'private',
208-
'deploy' => true,
209177
],
210178
'creator' => [
211179
'active' => false,
212-
'linked' => true,
213180
'path' => $private_base_path.'/creator',
181+
'repo_url' => $private_repo_url,
214182
'type' => 'private',
215-
'deploy' => false,
216183
],
217184
'data' => [
218185
'active' => false,
219-
'linked' => true,
220186
'path' => $private_base_path.'/data',
187+
'repo_url' => $private_repo_url,
221188
'type' => 'private',
222-
'deploy' => true,
223189
],
224190
'localize' => [
225191
'active' => false,
226-
'linked' => true,
227192
'path' => $private_base_path.'/localize',
193+
'repo_url' => $private_repo_url,
228194
'type' => 'private',
229-
'deploy' => true,
230195
],
231196
'media' => [
232197
'active' => false,
233-
'linked' => true,
234198
'path' => $private_base_path.'/media',
199+
'repo_url' => $private_repo_url,
235200
'type' => 'private',
236-
'deploy' => true,
237201
],
238202
'page' => [
239203
'active' => false,
240-
'linked' => true,
241204
'path' => $private_base_path.'/page',
205+
'repo_url' => $private_repo_url,
242206
'type' => 'private',
243-
'deploy' => true,
244207
],
245208
'permission' => [
246209
'active' => false,
247-
'linked' => true,
248210
'path' => $private_base_path.'/permission',
211+
'repo_url' => $private_repo_url,
249212
'type' => 'private',
250-
'deploy' => true,
251213
],
252214
],
253215

deploy.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
#!/bin/bash
22

33
if [ -f "composer.json-deploy" ]; then
4-
# Remove all symlinks from /packages
54
find packages -type l -delete
6-
# Remove the packages folder if empty
7-
if [ -z "$(ls -A packages)" ]; then
8-
rm packages
9-
fi
105
cp composer.json-deploy composer.json
11-
composer install
126
fi

init.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
if (file_exists('.env')) {
4+
echo "Error: .env file already exists.\n";
5+
exit(1);
6+
}
7+
8+
$env = file_get_contents('.env.example');
9+
10+
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
11+
$env = str_replace('DEVLINK_PACKAGES_PATH=packages', 'DEVLINK_PACKAGES_PATH=packageslocal', $env);
12+
if (strpos($env, 'DEVLINK_PACKAGES_PATH=packageslocal') === false) {
13+
$env = $env."\nDEVLINK_PACKAGES_PATH=packageslocal";
14+
}
15+
}
16+
17+
file_put_contents('.env', $env);
18+
19+
if (file_exists('composer.json-deploy')) {
20+
copy('composer.json-deploy', 'composer.json');
21+
}
22+
23+
exec('composer install');

0 commit comments

Comments
 (0)