Skip to content

Commit 5013e86

Browse files
committed
Added a main publish script
1 parent 125d2e4 commit 5013e86

File tree

7 files changed

+75
-39
lines changed

7 files changed

+75
-39
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.vs/
2+
Publish/
23

34
*.user

FanScript.Cli/publish.ps1

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,13 @@
11
Param (
22
[Parameter(Mandatory)]
3-
[string]$version
3+
[string[]]$profiles
44
)
55

6-
$profiles = 'win-x64', 'win-arm64', 'linux-x64', 'linux-arm64'
76
$publishDir = './bin/Publish'
87

98
foreach ($profile in $profiles) {
109
Write-Host "Publishing $profile"
1110
dotnet publish -o "$publishDir/$profile/" --sc -c 'Release' -r $profile
1211
}
1312

14-
Write-Host "Published $($profiles.Count) profile(s)"
15-
16-
New-Item -Path $publishDir -Name "Compressed" -ItemType "directory" -Force
17-
18-
$currentDir = Split-Path -Path (Get-Location) -Leaf
19-
20-
foreach ($profile in $profiles) {
21-
$fromDir = "$publishDir/$profile/*"
22-
$toFile = "$publishDir/Compressed/$($currentDir)_$($profile)_$version.zip"
23-
Write-Host "Comressing $fromDir to $toFile"
24-
25-
Compress-Archive -Path $fromDir -CompressionLevel 'Optimal' -DestinationPath $toFile -Force
26-
}
27-
28-
Write-Host "Compressed builds into archives"
29-
Write-Host "Done"
13+
Write-Host "Published $($profiles.Count) profile(s)"

FanScript.LangServer/publish.ps1

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,13 @@
11
Param (
22
[Parameter(Mandatory)]
3-
[string]$version
3+
[string[]]$profiles
44
)
55

6-
$profiles = 'win-x64', 'win-arm64', 'linux-x64', 'linux-arm64'
76
$publishDir = './bin/Publish'
87

98
foreach ($profile in $profiles) {
109
Write-Host "Publishing $profile"
1110
dotnet publish -o "$publishDir/$profile/" --sc -c 'Release' -r $profile
1211
}
1312

14-
Write-Host "Published $($profiles.Count) profile(s)"
15-
16-
New-Item -Path $publishDir -Name "Compressed" -ItemType "directory" -Force
17-
18-
$currentDir = Split-Path -Path (Get-Location) -Leaf
19-
20-
foreach ($profile in $profiles) {
21-
$fromDir = "$publishDir/$profile/*"
22-
$toFile = "$publishDir/Compressed/$($currentDir)_$($profile)_$version.zip"
23-
Write-Host "Comressing $fromDir to $toFile"
24-
25-
Compress-Archive -Path $fromDir -CompressionLevel 'Optimal' -DestinationPath $toFile -Force
26-
}
27-
28-
Write-Host "Compressed builds into archives"
29-
Write-Host "Done"
13+
Write-Host "Published $($profiles.Count) profile(s)"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Documentation can be found [here](https://github.com/BitcoderCZ/FanScript-Docume
99

1010
## VSCode Extension
1111
To run the extension:
12-
- run `npm install` in the VSCodeExtension folder
12+
- install [vscode](https://code.visualstudio.com/download) (duh) and [node](https://nodejs.org/en/download/package-manager)
1313
- run `npm install` in the VSCodeExtension/client folder
1414
- open vscode
1515
- open folder, select VSCodeExtension

VSCodeExtension/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
out
22
node_modules
33
client/server
4-
.vscode-test
4+
.vscode-test
5+
FanScript.LangServer*

VSCodeExtension/client/src/extension.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* ------------------------------------------------------------------------------------------ */
55

66
import * as path from 'path';
7+
import * as os from 'os';
78
import { workspace, ExtensionContext } from 'vscode';
89

910
import {
@@ -16,7 +17,7 @@ import {
1617
let client: LanguageClient;
1718

1819
export function activate(context: ExtensionContext) {
19-
const serverExecutable = path.join(context.extensionPath, 'FanScript.LangServer.exe');
20+
const serverExecutable = path.join(context.extensionPath, os.platform() === 'win32' ? 'FanScript.LangServer.exe' : 'FanScript.LangServer');
2021

2122
// Configure the server options to use stdio
2223
const serverOptions: ServerOptions = {

publish.ps1

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
Param (
2+
[Parameter(Mandatory)]
3+
[string]$version
4+
)
5+
6+
$profiles = 'win-x64', 'win-arm64', 'linux-x64', 'linux-arm64'
7+
8+
Function Publish-Proj
9+
{
10+
Param (
11+
[Parameter(Mandatory)]
12+
[string]$DirName
13+
)
14+
15+
Write-Host "Publishing $DirName"
16+
try
17+
{
18+
Push-Location "./$DirName"
19+
./publish.ps1 $profiles
20+
}
21+
finally
22+
{
23+
Pop-Location
24+
}
25+
}
26+
27+
Publish-Proj 'FanScript.Cli'
28+
Publish-Proj 'FanScript.LangServer'
29+
30+
$publishDir = 'Publish'
31+
32+
Write-Host 'Copying files'
33+
34+
New-Item -Path . -Name $publishDir -ItemType "directory" -Force > $null
35+
36+
foreach ($profile in $profiles) {
37+
New-Item -Path $publishDir -Name $profile -ItemType "directory" -Force
38+
$outDir = "./$publishDir/$profile"
39+
40+
New-Item -Path $outDir -Name "Cli" -ItemType "directory" -Force > $null
41+
Copy-Item -Path "./FanScript.Cli/bin/Publish/$profile/*" -Destination "$outDir/Cli"
42+
43+
New-Item -Path $outDir -Name "VSCodeExtension" -ItemType "directory" -Force > $null
44+
$extensionDir = "$outDir/VSCodeExtension"
45+
Copy-Item -Path "./FanScript.LangServer/bin/Publish/$profile/*" -Destination $extensionDir
46+
Copy-Item -Path "./VSCodeExtension/*" -Destination $extensionDir -Filter * -Exclude 'node_modules','FanScript.LangServer*' -Recurse -Force
47+
48+
# for some fucking reason -Exclude doesn't work in subdirectories, so the client/node_modules dir has to be deleted
49+
$clientModulesDir = "$extensionDir/client/node_modules"
50+
if (Test-Path $clientModulesDir) {
51+
Remove-Item -Path $clientModulesDir -Recurse -Force
52+
}
53+
}
54+
55+
Write-Host 'Compressing folders'
56+
57+
foreach ($profile in $profiles) {
58+
$fromDir = "./$publishDir/$profile/*"
59+
$toFile = "./$publishDir/FanScript_$($profile)_$version.zip"
60+
Write-Host "Comressing $fromDir to $toFile"
61+
62+
Compress-Archive -Path $fromDir -CompressionLevel 'Optimal' -DestinationPath $toFile -Force
63+
}
64+
65+
Write-Host 'Done'

0 commit comments

Comments
 (0)