Skip to content

Commit 3b83097

Browse files
committed
simplify build script on the php side
1 parent a7e27ed commit 3b83097

File tree

6 files changed

+38
-10
lines changed

6 files changed

+38
-10
lines changed

build.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
$building = true;
4+
5+
echo 'Generating templates...' . PHP_EOL;
6+
require 'generate-templates.php';
7+
8+
echo 'Generating config...' . PHP_EOL;
9+
require 'generate-config.php';
10+
11+
echo 'Generating PHP environments...' . PHP_EOL;
12+
require 'generate-php-envs.php';
13+
14+
echo 'Generating registered commands...' . PHP_EOL;
15+
require 'generate-registered-commands.php';
16+
17+
echo 'Formatting...' . PHP_EOL;
18+
exec('npm run format');
19+
20+
echo 'Build complete!' . PHP_EOL;

generate-config.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,6 @@
5252
"export type GeneratedConfigKey = '" . implode("' | '", $keys) . "';" . PHP_EOL
5353
);
5454

55-
exec('npm run format');
55+
if (!isset($building)) {
56+
exec('npm run format');
57+
}

generate-php-envs.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,6 @@
120120
json_encode($packageJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL
121121
);
122122

123-
exec('npm run format');
123+
if (!isset($building)) {
124+
exec('npm run format');
125+
}

generate-registered-commands.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@
1212
"export type RegisteredCommand = \"" . implode('" | "', $commands) . "\";\n"
1313
);
1414

15-
exec('npm run format');
15+
if (!isset($building)) {
16+
exec('npm run format');
17+
}

generate-templates.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@
1717
file_put_contents(__DIR__ . '/src/templates/' . pathinfo($template, PATHINFO_FILENAME) . '.ts', $content);
1818
}
1919

20-
exec('npm run format');
20+
if (!isset($building)) {
21+
exec('npm run format');
22+
}

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,11 @@
284284
"default": true,
285285
"description": "Automatically add spacing around Blade echo and comment tags."
286286
},
287+
"Laravel.pint.runOnSave": {
288+
"type": "boolean",
289+
"default": false,
290+
"description": "Automatically run Pint on the current file when saved."
291+
},
287292
"Laravel.appBinding.diagnostics": {
288293
"type": "boolean",
289294
"default": true,
@@ -625,11 +630,6 @@
625630
"default": true,
626631
"generated": true,
627632
"description": "Enable completion for view."
628-
},
629-
"Laravel.pint.runOnSave": {
630-
"type": "boolean",
631-
"default": false,
632-
"description": "Automatically run Pint on the current file when saved."
633633
}
634634
}
635635
}
@@ -644,7 +644,7 @@
644644
"watch": "npm-run-all -p watch:*",
645645
"watch:esbuild": "node esbuild.js --watch",
646646
"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
647-
"vscode:prepublish": "php generate-templates.php && php generate-config.php && php generate-php-envs.php && php generate-registered-commands.php && ./precheck && npm run package",
647+
"vscode:prepublish": "php build.php && ./precheck && npm run package",
648648
"package": "npm run check-types && node esbuild.js --production",
649649
"installLocal": "vsce package && code --install-extension ./vscode-laravel-$npm_package_version.vsix"
650650
},

0 commit comments

Comments
 (0)