Compare commits
24 Commits
f26cf6404e
...
v0.0.1-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c1599f8c3 | |||
| 5cb71e5547 | |||
| c0d67c2a16 | |||
| 26b018ee3e | |||
| 44fdf49555 | |||
| afe795edd5 | |||
| a0856d171a | |||
| 5ed4a6c081 | |||
| 7a4840ef95 | |||
| c3473ca60e | |||
| 646735565f | |||
| a354004201 | |||
| 942be59715 | |||
| 70e376c939 | |||
| 62a1ad83ab | |||
| 47c5a47ffa | |||
| 9bd6e1fc04 | |||
| 73600055fc | |||
| 80907a89a9 | |||
| 2472374157 | |||
| b72a10db94 | |||
| d097988dfd | |||
| cb9e8e1107 | |||
| 7bb7df788e |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -4,6 +4,10 @@ frontend/.tanstack/
|
|||||||
frontend/.output/
|
frontend/.output/
|
||||||
frontend/.nitro/
|
frontend/.nitro/
|
||||||
releases/
|
releases/
|
||||||
|
LstWrapper/bin
|
||||||
|
LstWrapper/publish
|
||||||
|
LstWrapper/obj
|
||||||
|
scripts/tmp
|
||||||
|
|
||||||
# ---> Go
|
# ---> Go
|
||||||
# If you prefer the allow list template instead of the deny list, see community template:
|
# If you prefer the allow list template instead of the deny list, see community template:
|
||||||
@@ -184,3 +188,5 @@ test-results/
|
|||||||
backend/go.sum
|
backend/go.sum
|
||||||
BUILD_NUMBER
|
BUILD_NUMBER
|
||||||
scripts/resetDanger.js
|
scripts/resetDanger.js
|
||||||
|
LstWrapper/Program_vite_as_Static.txt
|
||||||
|
scripts/stopPool.go
|
||||||
|
|||||||
@@ -9,19 +9,53 @@
|
|||||||
"publish": false
|
"publish": false
|
||||||
},
|
},
|
||||||
"hooks": {
|
"hooks": {
|
||||||
|
"before:init": "node ./scripts/read-build-number.js",
|
||||||
"after:release": "node ./scripts/create-gitea-release.js ${version}"
|
"after:release": "node ./scripts/create-gitea-release.js ${version}"
|
||||||
},
|
},
|
||||||
"github": false,
|
"github": false,
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"@release-it/conventional-changelog": {
|
"@release-it/conventional-changelog": {
|
||||||
"preset": "conventionalcommits",
|
"preset": {
|
||||||
|
"name": "conventionalcommits",
|
||||||
|
"types": [
|
||||||
|
{ "type": "feat", "section": "🌟 Enhancements" },
|
||||||
|
{ "type": "fix", "section": "🐛 Bug fixes" },
|
||||||
|
{ "type": "chore", "section": "📝 Chore" },
|
||||||
|
{ "type": "docs", "section": "📚 Documentation" },
|
||||||
|
{ "type": "style", "section": "📚 Style" },
|
||||||
|
{ "type": "refactor", "section": "🛠️ Code Refactor" },
|
||||||
|
{
|
||||||
|
"type": "perf",
|
||||||
|
|
||||||
|
"section": "🚀 Performance"
|
||||||
|
},
|
||||||
|
{ "type": "test", "section": "📝 Testing Code" },
|
||||||
|
{
|
||||||
|
"type": "ci",
|
||||||
|
|
||||||
|
"section": "📈 Project changes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "build",
|
||||||
|
"hidden": false,
|
||||||
|
"section": "📈 Project Builds"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"commitUrlFormat": "{{host}}/{{owner}}/{{repository}}/commit/{{hash}}",
|
||||||
|
"compareUrlFormat": "{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}",
|
||||||
|
"issueUrlFormat": "{{host}}/{{owner}}/{{repository}}/issues/{{id}}",
|
||||||
|
"userUrlFormat": "{{host}}/{{user}}"
|
||||||
|
},
|
||||||
"infile": "CHANGELOG.md",
|
"infile": "CHANGELOG.md",
|
||||||
"config": ".versionrc.json"
|
"header": "# Changelog\n\nAll notable changes to LST will be documented in this file.\n",
|
||||||
|
"releaseCommitMessageFormat": "chore(release): {{currentTag}}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gitea": {
|
"@release-it/gitea": {
|
||||||
"host": "https://${GITEA_URL}",
|
"host": "https://${GITEA_URL}",
|
||||||
"tokenRef": "GITEA_TOKEN"
|
"tokenRef": "GITEA_TOKEN",
|
||||||
|
"releaseName": "v${version} (build ${BUILD_NUMBER})",
|
||||||
|
"releaseNotes": "node ./scripts/get-changelog-entry.js ${version}"
|
||||||
},
|
},
|
||||||
|
|
||||||
"files": ["package.json", "CHANGELOG.md"]
|
"files": ["package.json", "CHANGELOG.md"]
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"types": [
|
|
||||||
{ "type": "feat", "section": "🌟 Enhancements" },
|
|
||||||
{ "type": "fix", "section": "🐛 Bug fixes" },
|
|
||||||
{ "type": "chore", "hidden": false, "section": "📝 Chore" },
|
|
||||||
{ "type": "docs", "section": "📚 Documentation" },
|
|
||||||
{ "type": "style", "hidden": true },
|
|
||||||
{ "type": "refactor", "section": "🛠️ Code Refactor" },
|
|
||||||
{ "type": "perf", "hidden": false, "section": "🚀 Performance" },
|
|
||||||
{ "type": "test", "section": "📝 Testing Code" },
|
|
||||||
{ "type": "ci", "hidden": false, "section": "📈 Project changes" },
|
|
||||||
{ "type": "build", "hidden": true, "section": "📈 Project Builds" }
|
|
||||||
],
|
|
||||||
"commitUrlFormat": "https://git.tuffraid.net/cowch/logistics_support_tool/commits/{{hash}}",
|
|
||||||
"compareUrlFormat": "https://git.tuffraid.net/cowch/logistics_support_tool/compare/{{previousTag}}...{{currentTag}}",
|
|
||||||
"header": "# All changes to lst are shown below.\nReleases are combined zip of backend and frontend."
|
|
||||||
}
|
|
||||||
32
CHANGELOG.md
32
CHANGELOG.md
@@ -1,5 +1,37 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to LST will be documented in this file.
|
||||||
|
|
||||||
|
|
||||||
|
## [0.0.1-alpha.4](https://git.tuffraid.net/cowch/logistics_support_tool/compare/v0.0.1-alpha.3...v0.0.1-alpha.4) (2025-07-16)
|
||||||
|
|
||||||
|
### 📈 Project changes
|
||||||
|
|
||||||
|
* **build:** changes to ignore the tmp folder in the scripts ([26b018e](https://git.tuffraid.net/cowch/logistics_support_tool/commit/26b018ee3eb408ab3c5ddd9e886987deb3334720))
|
||||||
|
* **createzip:** changes to include the script folder ([5cb71e5](https://git.tuffraid.net/cowch/logistics_support_tool/commit/5cb71e55476f91a48d095f80be2cea3b6793f8e6))
|
||||||
|
|
||||||
|
### 📈 Project Builds
|
||||||
|
|
||||||
|
* **build:** script created to build lstv2 and copy over before zipping up also cleanup ([c0d67c2](https://git.tuffraid.net/cowch/logistics_support_tool/commit/c0d67c2a16695e40af7ec52f86fc54344f3b889c))
|
||||||
|
|
||||||
|
## [0.0.1-alpha.3](https://git.tuffraid.net/cowch/logistics_support_tool/compare/v0.0.1-alpha.2...v0.0.1-alpha.3) (2025-07-16)
|
||||||
|
|
||||||
|
### 🌟 Enhancements
|
||||||
|
|
||||||
|
* **scripts:** 2 new scripts for the build process ([afe795e](https://git.tuffraid.net/cowch/logistics_support_tool/commit/afe795edd588b823e5459a6762f787152a49a8cb))
|
||||||
|
|
||||||
|
### 🛠️ Code Refactor
|
||||||
|
|
||||||
|
* **build:** changes to show more details when we run the build stuff ([5ed4a6c](https://git.tuffraid.net/cowch/logistics_support_tool/commit/5ed4a6c081e29da6600949ed2b811551e6a947f7))
|
||||||
|
* **createzip:** change the name from release to createZip ([6467355](https://git.tuffraid.net/cowch/logistics_support_tool/commit/646735565f28153c0750e7788b349b384bd5c5de))
|
||||||
|
* **package.json:** changes to the scripts ([7a4840e](https://git.tuffraid.net/cowch/logistics_support_tool/commit/7a4840ef95c86a96e3b8a2e8af124a55af2b01b4))
|
||||||
|
* **release-it:** changes to the build process and changelog ([c3473ca](https://git.tuffraid.net/cowch/logistics_support_tool/commit/c3473ca60e7e92f68cdff4e4a35bfcff2e7ae37b))
|
||||||
|
* **releases:** simplified the functions ([a0856d1](https://git.tuffraid.net/cowch/logistics_support_tool/commit/a0856d171a404c3adf52591b3c9da4fae53322d3))
|
||||||
|
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
## [0.0.1-alpha.2](https://git.tuffraid.net/cowch/logistics_support_tool/compare/v0.0.1-alpha.1...v0.0.1-alpha.2) (2025-07-16)
|
||||||
|
|
||||||
## [0.0.3-alpha.22](https://git.tuffraid.net/cowch/logistics_support_tool/compare/v0.0.3-alpha.21...v0.0.3-alpha.22) (2025-07-12)
|
## [0.0.3-alpha.22](https://git.tuffraid.net/cowch/logistics_support_tool/compare/v0.0.3-alpha.21...v0.0.3-alpha.22) (2025-07-12)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|||||||
9
LstWrapper/LstWrapper.csproj
Normal file
9
LstWrapper/LstWrapper.csproj
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
85
LstWrapper/Program.cs
Normal file
85
LstWrapper/Program.cs
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using System.Net.Http;
|
||||||
|
|
||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
// to build the binary dotnet publish -c Release -o ./publish
|
||||||
|
// Go backend
|
||||||
|
builder.Services.AddHttpClient("GoBackend", client =>
|
||||||
|
{
|
||||||
|
client.BaseAddress = new Uri("http://localhost:8080");
|
||||||
|
client.Timeout = TimeSpan.FromSeconds(30);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Node frontend
|
||||||
|
builder.Services.AddHttpClient("NodeFrontend", client =>
|
||||||
|
{
|
||||||
|
client.BaseAddress = new Uri("http://localhost:3000");
|
||||||
|
client.Timeout = TimeSpan.FromSeconds(30);
|
||||||
|
});
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
|
app.UseStaticFiles();
|
||||||
|
|
||||||
|
app.Use((Func<HttpContext, Func<Task>, Task>)(async (context, next) =>
|
||||||
|
{
|
||||||
|
var clientFactory = context.RequestServices.GetRequiredService<IHttpClientFactory>();
|
||||||
|
|
||||||
|
var isApiRequest =
|
||||||
|
context.Request.Path.StartsWithSegments("/api") ||
|
||||||
|
context.Request.Path.StartsWithSegments("/graphql") ||
|
||||||
|
context.Request.Path.StartsWithSegments("/auth") ||
|
||||||
|
!context.Request.Method.Equals("GET", StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var client = clientFactory.CreateClient(isApiRequest ? "GoBackend" : "NodeFrontend");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var requestUri = context.Request.Path + context.Request.QueryString;
|
||||||
|
|
||||||
|
var request = new HttpRequestMessage(
|
||||||
|
new HttpMethod(context.Request.Method),
|
||||||
|
requestUri);
|
||||||
|
|
||||||
|
foreach (var header in context.Request.Headers)
|
||||||
|
{
|
||||||
|
if (!request.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray()))
|
||||||
|
{
|
||||||
|
request.Content ??= new StreamContent(context.Request.Body);
|
||||||
|
request.Content.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context.Request.ContentLength > 0 || context.Request.Headers.ContainsKey("Transfer-Encoding"))
|
||||||
|
{
|
||||||
|
request.Content = new StreamContent(context.Request.Body);
|
||||||
|
}
|
||||||
|
|
||||||
|
var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, context.RequestAborted);
|
||||||
|
|
||||||
|
context.Response.StatusCode = (int)response.StatusCode;
|
||||||
|
|
||||||
|
foreach (var header in response.Headers)
|
||||||
|
{
|
||||||
|
context.Response.Headers[header.Key] = header.Value.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var header in response.Content.Headers)
|
||||||
|
{
|
||||||
|
context.Response.Headers[header.Key] = header.Value.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
context.Response.Headers.Remove("transfer-encoding");
|
||||||
|
|
||||||
|
await response.Content.CopyToAsync(context.Response.Body);
|
||||||
|
}
|
||||||
|
catch (HttpRequestException ex)
|
||||||
|
{
|
||||||
|
context.Response.StatusCode = isApiRequest ? 503 : 502;
|
||||||
|
await context.Response.WriteAsync($"{(isApiRequest ? "Go API" : "Frontend")} unavailable: {ex.Message}");
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
app.Run();
|
||||||
23
LstWrapper/Properties/launchSettings.json
Normal file
23
LstWrapper/Properties/launchSettings.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||||
|
"profiles": {
|
||||||
|
"http": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"applicationUrl": "http://localhost:5015",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"https": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"applicationUrl": "https://localhost:7208;http://localhost:5015",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
LstWrapper/appsettings.Development.json
Normal file
8
LstWrapper/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
LstWrapper/appsettings.json
Normal file
9
LstWrapper/appsettings.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
||||||
15
LstWrapper/web.config
Normal file
15
LstWrapper/web.config
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<location path="." inheritInChildApplications="false">
|
||||||
|
<system.webServer>
|
||||||
|
<handlers>
|
||||||
|
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||||
|
</handlers>
|
||||||
|
<aspNetCore processPath="dotnet"
|
||||||
|
arguments=".\LstWrapper.dll"
|
||||||
|
stdoutLogEnabled="true"
|
||||||
|
stdoutLogFile=".\logs\stdout"
|
||||||
|
hostingModel="inprocess" />
|
||||||
|
</system.webServer>
|
||||||
|
</location>
|
||||||
|
</configuration>
|
||||||
6
LstWrapper/wwwroot/index.html
Normal file
6
LstWrapper/wwwroot/index.html
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<p>The new begining to lst</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -16,10 +16,14 @@ func main() {
|
|||||||
c.JSON(200, gin.H{"message": "pong"})
|
c.JSON(200, gin.H{"message": "pong"})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
r.Any("/api", errorApiLoc)
|
||||||
r.Any("/", errorLoc)
|
r.Any("/", errorLoc)
|
||||||
r.Run(":8080")
|
r.Run(":8080")
|
||||||
}
|
}
|
||||||
|
|
||||||
func errorLoc(c *gin.Context) {
|
func errorLoc(c *gin.Context) {
|
||||||
c.JSON(http.StatusOK, gin.H{"message": "welcome to lst system you might have just encountered an incorrect area of the app"})
|
c.JSON(http.StatusBadRequest, gin.H{"message": "welcome to lst system you might have just encountered an incorrect area of the app"})
|
||||||
|
}
|
||||||
|
func errorApiLoc(c *gin.Context) {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"message": "looks like you have encountered an api route that dose not exist"})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,16 +2,22 @@
|
|||||||
services:
|
services:
|
||||||
lst_backend:
|
lst_backend:
|
||||||
# build: . # Tell Docker Compose to build the image using the Dockerfile in the current directory
|
# build: . # Tell Docker Compose to build the image using the Dockerfile in the current directory
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./backend/Dockerfile
|
||||||
image: git.tuffraid.net/cowch/logistics_support_tool:backend-latest
|
image: git.tuffraid.net/cowch/logistics_support_tool:backend-latest
|
||||||
container_name: lst_backend # A friendly name for your running container
|
container_name: lst_backend # A friendly name for your running container
|
||||||
volumes:
|
volumes:
|
||||||
- /path/to/frontend/backend:/data
|
- /path/to/backend/data:/data
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
lst_frontend:
|
lst_frontend:
|
||||||
# build: . # Tell Docker Compose to build the image using the Dockerfile in the current directory
|
# build: . # Tell Docker Compose to build the image using the Dockerfile in the current directory
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./frontend/Dockerfile
|
||||||
image: git.tuffraid.net/cowch/logistics_support_tool:frontend-latest
|
image: git.tuffraid.net/cowch/logistics_support_tool:frontend-latest
|
||||||
container_name: lst_frontend # A friendly name for your running container
|
container_name: lst_frontend # A friendly name for your running container
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "logistics_support_tool",
|
"name": "logistics_support_tool",
|
||||||
"version": "0.0.3-alpha.22",
|
"version": "0.0.1-alpha.4",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "logistics_support_tool",
|
"name": "logistics_support_tool",
|
||||||
"version": "0.0.3-alpha.22",
|
"version": "0.0.1-alpha.4",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dotenv": "^17.2.0",
|
"dotenv": "^17.2.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "logistics_support_tool",
|
"name": "logistics_support_tool",
|
||||||
"version": "0.0.1-alpha.1",
|
"version": "0.0.1-alpha.4",
|
||||||
"description": "This is the new logisitcs support tool",
|
"description": "This is the new logisitcs support tool",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
@@ -11,8 +11,7 @@
|
|||||||
"docker:front": "docker build -t logistics_support_tool:frontend-latest -f frontend/Dockerfile ./frontend",
|
"docker:front": "docker build -t logistics_support_tool:frontend-latest -f frontend/Dockerfile ./frontend",
|
||||||
"docker:back": "docker build -t logistics_support_tool:backend-latest -f backend/Dockerfile ./backend",
|
"docker:back": "docker build -t logistics_support_tool:backend-latest -f backend/Dockerfile ./backend",
|
||||||
"docker": "powershell -File ./scripts/dockerBuild.ps1",
|
"docker": "powershell -File ./scripts/dockerBuild.ps1",
|
||||||
"release:createZip": "powershell -File ./scripts/release.ps1",
|
"createZip": "powershell -File ./scripts/createZip.ps1",
|
||||||
"release:gitea": "node ./scripts/create-gitea-release.js",
|
|
||||||
"release": "release-it --verbose --non-interactive --preRelease=alpha",
|
"release": "release-it --verbose --non-interactive --preRelease=alpha",
|
||||||
"commit": "cz"
|
"commit": "cz"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,12 @@ $rootDir = Join-Path $scriptDir ".."
|
|||||||
$releaseScript = Join-Path $scriptDir "release.ps1"
|
$releaseScript = Join-Path $scriptDir "release.ps1"
|
||||||
$packageJsonPath = Join-Path $rootDir "package.json"
|
$packageJsonPath = Join-Path $rootDir "package.json"
|
||||||
|
|
||||||
|
# tmp scripts to get lstv2 into this build and zipped up with everything
|
||||||
|
. (Join-Path $PSScriptRoot "lstV2Build.ps1")
|
||||||
|
|
||||||
|
# will run the lstv2 build first so we know for sure its copied over
|
||||||
|
Build-LstV2-And-Copy
|
||||||
|
|
||||||
# Path to BUILD_NUMBER file, assuming root is one level up from scripts
|
# Path to BUILD_NUMBER file, assuming root is one level up from scripts
|
||||||
$buildNumberFile = Join-Path $scriptDir "..\BUILD_NUMBER"
|
$buildNumberFile = Join-Path $scriptDir "..\BUILD_NUMBER"
|
||||||
$envFile = Join-Path $rootDir ".env"
|
$envFile = Join-Path $rootDir ".env"
|
||||||
@@ -21,7 +27,7 @@ if (Test-Path $envFile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (-not $env:BUILD_NAME) {
|
if (-not $env:BUILD_NAME) {
|
||||||
Write-Warning "BUILD_NAME environment variable is not set. Cannot create BUILD_NUMBER file"
|
Write-Warning "BUILD_NAME environment variable is not set. Please make sure you have entered the correct info the env"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,10 +117,50 @@ function Update-BuildNumber {
|
|||||||
|
|
||||||
Write-Host "Fronend build finished successfully."
|
Write-Host "Fronend build finished successfully."
|
||||||
Pop-Location
|
Pop-Location
|
||||||
|
|
||||||
|
Write-Host "Building wrapper"
|
||||||
|
Push-Location $rootDir/LstWrapper
|
||||||
|
dotnet publish -c Release -o ./publish
|
||||||
|
|
||||||
|
Pop-Location
|
||||||
|
|
||||||
|
try {
|
||||||
Update-BuildNumber
|
Update-BuildNumber
|
||||||
|
|
||||||
Write-Host "Zipping up the release"
|
Write-Host "Zipping up the release"
|
||||||
npm run release:createZip
|
npm run createZip
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "Failed to create release zip"
|
||||||
|
}
|
||||||
|
|
||||||
|
$choice = Read-Host "Are we going to create a release? y/N"
|
||||||
|
if ($choice -eq "y" -or $choice -eq "Y") {
|
||||||
|
Write-Host "Creating release..."
|
||||||
|
|
||||||
|
# This will:
|
||||||
|
# 1. Update version in package.json
|
||||||
|
# 2. Generate changelog
|
||||||
|
# 3. Create git tag
|
||||||
|
# 4. Push to remote
|
||||||
|
# 5. Create Gitea release via our script
|
||||||
|
|
||||||
|
npm run release
|
||||||
|
|
||||||
|
# deleteing the temp folder so we always cleaned up
|
||||||
|
Delete-Tmp-Folder
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "Failed to create Gitea release"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Warning "Release process failed: $_"
|
||||||
|
|
||||||
|
# deleteing the temp folder so we always cleaned up
|
||||||
|
Delete-Tmp-Folder
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,151 +1,64 @@
|
|||||||
const version = process.argv[2];
|
|
||||||
if (!version) {
|
|
||||||
console.error("Version not passed to create-gitea-release.js");
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
import fetch from "node-fetch";
|
import fetch from "node-fetch";
|
||||||
import dotenv from "dotenv";
|
import dotenv from "dotenv";
|
||||||
|
|
||||||
dotenv.config({ path: "./.env" });
|
dotenv.config({ path: "./.env" });
|
||||||
|
|
||||||
// Resolve the directory of the current script
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
// Absolute path to BUILD_NUMBER
|
const version = process.argv[2];
|
||||||
const buildNumberPath = path.resolve(__dirname, "../BUILD_NUMBER");
|
if (!version) {
|
||||||
|
console.error("Version not passed to create-gitea-release.js");
|
||||||
// Load build number from BUILD_NUMBER file
|
process.exit(1);
|
||||||
let buildNumber = "0";
|
|
||||||
try {
|
|
||||||
const rawBuild = fs.readFileSync(buildNumberPath, "utf8");
|
|
||||||
console.log("Raw build", rawBuild);
|
|
||||||
buildNumber = rawBuild.trim();
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
console.warn("BUILD_NUMBER file not found, defaulting to 0");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const fullVersion = `${version}.${buildNumber}`;
|
|
||||||
|
|
||||||
const { GITEA_URL, GITEA_USERNAME, GITEA_REPO, GITEA_TOKEN } = process.env;
|
const { GITEA_URL, GITEA_USERNAME, GITEA_REPO, GITEA_TOKEN } = process.env;
|
||||||
if (!GITEA_URL || !GITEA_USERNAME || !GITEA_REPO || !GITEA_TOKEN) {
|
if (!GITEA_URL || !GITEA_USERNAME || !GITEA_REPO || !GITEA_TOKEN) {
|
||||||
console.error("Missing required environment variables");
|
console.error("Missing required environment variables");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 1: Generate or update CHANGELOG.md
|
const getChangelogContent = async () => {
|
||||||
// console.log("Generating CHANGELOG.md...");
|
|
||||||
// const result = spawnSync(
|
|
||||||
// "npx",
|
|
||||||
// [
|
|
||||||
// "conventional-changelog",
|
|
||||||
// "-p",
|
|
||||||
// "conventionalcommits",
|
|
||||||
// "-i",
|
|
||||||
// "CHANGELOG.md",
|
|
||||||
// "-s",
|
|
||||||
// "-r",
|
|
||||||
// "0",
|
|
||||||
// ],
|
|
||||||
// { stdio: "inherit", shell: true }
|
|
||||||
// );
|
|
||||||
|
|
||||||
// if (result.status !== 0) {
|
|
||||||
// console.error("Failed to generate changelog");
|
|
||||||
// process.exit(1);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Corrected function to get the latest changelog entry from CHANGELOG.md
|
|
||||||
const getLatestChangelog = async () => {
|
|
||||||
try {
|
try {
|
||||||
const changelogPath = path.resolve(__dirname, "../CHANGELOG.md");
|
const changelogPath = path.resolve(__dirname, "../CHANGELOG.md");
|
||||||
console.log(`Attempting to read changelog from: ${changelogPath}`); // Debugging line
|
const content = await fs.readFile(changelogPath, "utf8");
|
||||||
const changelogContent = await fs.readFile(changelogPath, "utf8");
|
|
||||||
console.log(
|
|
||||||
"Changelog content read successfully (first 200 chars):",
|
|
||||||
changelogContent.substring(0, 200)
|
|
||||||
); // Debugging line
|
|
||||||
|
|
||||||
const lines = changelogContent.trim().split(/\r?\n/);
|
// Extract the section for the current version
|
||||||
|
const versionHeading = `## [${version}]`;
|
||||||
|
const sections = content.split(/(?=^## \[)/m); // Split at version headings
|
||||||
|
|
||||||
let latestReleaseNotes = [];
|
if (sections.length < 2) {
|
||||||
let inLatestRelease = false;
|
console.warn("Couldn't find version section in changelog");
|
||||||
let foundFirstHeading = false;
|
return "No changelog content available.";
|
||||||
|
|
||||||
// Regex to match a conventional changelog heading format: "## [version](url) (date)"
|
|
||||||
// The key is to correctly parse the URL part in parentheses.
|
|
||||||
const releaseHeadingRegex = /^## \[.*?\]\(.*?\)\s\(.*\)$/;
|
|
||||||
|
|
||||||
for (const line of lines) {
|
|
||||||
// Trim each line to handle potential leading/trailing spaces when matching
|
|
||||||
const trimmedLine = line.trim();
|
|
||||||
|
|
||||||
if (trimmedLine.match(releaseHeadingRegex)) {
|
|
||||||
if (!foundFirstHeading) {
|
|
||||||
// This is the first (latest) release heading we encounter
|
|
||||||
inLatestRelease = true;
|
|
||||||
foundFirstHeading = true;
|
|
||||||
// We skip the heading line itself from the notes body
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
// This is a subsequent release heading, meaning we've passed the latest release's content
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are currently inside the latest release block, add the line
|
// The first section is the latest version
|
||||||
if (inLatestRelease) {
|
const latestSection = sections[1];
|
||||||
latestReleaseNotes.push(trimmedLine); // Use trimmedLine here
|
return latestSection.trim();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clean up the collected notes by filtering out empty lines if they are not meaningful content
|
|
||||||
// and joining them back, then trimming.
|
|
||||||
const cleanedNotes = latestReleaseNotes
|
|
||||||
.filter((line) => line !== "") // Remove truly empty lines
|
|
||||||
.join("\n")
|
|
||||||
.trim();
|
|
||||||
|
|
||||||
if (cleanedNotes) {
|
|
||||||
console.log(
|
|
||||||
"Successfully extracted latest changelog notes:\n",
|
|
||||||
cleanedNotes
|
|
||||||
);
|
|
||||||
return cleanedNotes;
|
|
||||||
} else {
|
|
||||||
console.warn(
|
|
||||||
"Could not find any content for the latest changelog entry in CHANGELOG.md. This might mean the file is empty, or the regex for headings is incorrect, or there's no content after the heading."
|
|
||||||
);
|
|
||||||
return "No changelog notes available.";
|
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Error reading or parsing CHANGELOG.md:", err);
|
console.error("Error reading changelog:", err);
|
||||||
throw err;
|
return "No changelog content available.";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const releaseNotes = await getLatestChangelog();
|
const createOrUpdateRelease = async (releaseNotes) => {
|
||||||
|
|
||||||
// Step 3: Create or update Gitea release
|
|
||||||
const createOrUpdateRelease = async () => {
|
|
||||||
const tagName = `v${version}`;
|
const tagName = `v${version}`;
|
||||||
const apiBase = `https://${GITEA_URL}/api/v1/repos/${GITEA_USERNAME}/${GITEA_REPO}`;
|
const apiBase = `https://${GITEA_URL}/api/v1/repos/${GITEA_USERNAME}/${GITEA_REPO}`;
|
||||||
|
|
||||||
|
try {
|
||||||
const existing = await fetch(`${apiBase}/releases/tags/${tagName}`, {
|
const existing = await fetch(`${apiBase}/releases/tags/${tagName}`, {
|
||||||
headers: { Authorization: `token ${GITEA_TOKEN}` },
|
headers: { Authorization: `token ${GITEA_TOKEN}` },
|
||||||
});
|
});
|
||||||
|
|
||||||
let release;
|
|
||||||
|
|
||||||
if (existing.ok) {
|
if (existing.ok) {
|
||||||
|
// Update existing release
|
||||||
const existingRelease = await existing.json();
|
const existingRelease = await existing.json();
|
||||||
console.log(`Release ${tagName} already exists. Updating it.`);
|
console.log(`Updating existing release ${tagName}`);
|
||||||
|
|
||||||
const updateResponse = await fetch(
|
const response = await fetch(
|
||||||
`${apiBase}/releases/${existingRelease.id}`,
|
`${apiBase}/releases/${existingRelease.id}`,
|
||||||
{
|
{
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
@@ -157,22 +70,21 @@ const createOrUpdateRelease = async () => {
|
|||||||
name: tagName,
|
name: tagName,
|
||||||
body: releaseNotes,
|
body: releaseNotes,
|
||||||
draft: false,
|
draft: false,
|
||||||
prerelease: true,
|
prerelease: false, // Change to true if you want prereleases
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!updateResponse.ok) {
|
if (!response.ok)
|
||||||
const errorText = await updateResponse.text();
|
throw new Error(`Failed to update release: ${response.status}`);
|
||||||
throw new Error(
|
const release = await response.json();
|
||||||
`Failed to update release: ${updateResponse.status} - ${errorText}`
|
console.log("Release updated:", release.html_url);
|
||||||
);
|
return release;
|
||||||
}
|
|
||||||
|
|
||||||
release = await updateResponse.json();
|
|
||||||
console.log("Release updated:", release.html_url || release.url);
|
|
||||||
} else if (existing.status === 404) {
|
} else if (existing.status === 404) {
|
||||||
const createResponse = await fetch(`${apiBase}/releases`, {
|
// Create new release
|
||||||
|
console.log(`Creating new release ${tagName}`);
|
||||||
|
|
||||||
|
const response = await fetch(`${apiBase}/releases`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `token ${GITEA_TOKEN}`,
|
Authorization: `token ${GITEA_TOKEN}`,
|
||||||
@@ -180,73 +92,33 @@ const createOrUpdateRelease = async () => {
|
|||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
tag_name: tagName,
|
tag_name: tagName,
|
||||||
name: `Release ${fullVersion}`,
|
name: `Release ${version}`,
|
||||||
body: releaseNotes,
|
body: releaseNotes,
|
||||||
draft: false,
|
draft: false,
|
||||||
prerelease: true,
|
prerelease: false, // Change to true if you want prereleases
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!createResponse.ok) {
|
if (!response.ok)
|
||||||
const errorText = await createResponse.text();
|
throw new Error(`Failed to create release: ${response.status}`);
|
||||||
throw new Error(
|
const release = await response.json();
|
||||||
`Failed to create release: ${createResponse.status} - ${errorText}`
|
console.log("Release created:", release.html_url);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
release = await createResponse.json();
|
|
||||||
console.log("Release created:", release.html_url || release.url);
|
|
||||||
} else {
|
|
||||||
const errorText = await existing.text();
|
|
||||||
throw new Error(
|
|
||||||
`Failed to check release: ${existing.status} - ${errorText}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return release;
|
return release;
|
||||||
|
} else {
|
||||||
|
throw new Error(`Failed to check release: ${existing.status}`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error in createOrUpdateRelease:", error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const uploadAsset = async (release) => {
|
|
||||||
const apiUrl = `https://${GITEA_URL}/api/v1/repos/${GITEA_USERNAME}/${GITEA_REPO}/releases/assets?tag=${release.tag_name}`;
|
|
||||||
const filePath = `releases/release-${fullVersion}.zip`;
|
|
||||||
|
|
||||||
if (!(await fs.pathExists(filePath))) {
|
|
||||||
console.warn(`Zip file not found: ${filePath}. Skipping asset upload.`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const FormData = (await import("form-data")).default;
|
|
||||||
const form = new FormData();
|
|
||||||
form.append("name", `release-${fullVersion}.zip`);
|
|
||||||
form.append("attachment", fs.createReadStream(filePath));
|
|
||||||
|
|
||||||
const response = await fetch(apiUrl, {
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
Authorization: `token ${GITEA_TOKEN}`,
|
|
||||||
...form.getHeaders(),
|
|
||||||
},
|
|
||||||
body: form,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
const errorText = await response.text();
|
|
||||||
throw new Error(
|
|
||||||
`Failed to upload asset: ${response.status} - ${errorText}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const asset = await response.json();
|
|
||||||
console.log("Asset uploaded:", asset.browser_download_url || asset.url);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Run everything
|
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
const release = await createOrUpdateRelease();
|
const releaseNotes = await getChangelogContent();
|
||||||
// await uploadAsset(release); // fix this later and just update the readme.
|
await createOrUpdateRelease(releaseNotes);
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
console.error(err);
|
console.error("Release failed:", error);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -66,17 +66,41 @@ if ($existingZips.Count -gt $keepReleases) {
|
|||||||
|
|
||||||
Write-Host "`nPackaging release: $($zipName)"
|
Write-Host "`nPackaging release: $($zipName)"
|
||||||
|
|
||||||
$filesToInclude = @(
|
# Create a temporary staging directory
|
||||||
"backend\lst_backend.exe",
|
$tempStageDir = New-Item -ItemType Directory -Path (Join-Path $env:TEMP "lst_staging") -Force
|
||||||
"frontend\.nitro",
|
|
||||||
"frontend\.tanstack",
|
# Copy files to organized structure
|
||||||
"frontend\.output",
|
$filesToCopy = @(
|
||||||
"frontend\public",
|
@{ Source = "backend\lst_backend.exe"; Destination = "backend\lst_backend.exe" },
|
||||||
"package.json",
|
@{ Source = "LstWrapper\publish"; Destination = "lstwrapper\" },
|
||||||
"CHANGELOG.md",
|
@{ Source = "frontend\.nitro"; Destination = "frontend\.nitro" },
|
||||||
"README.md"
|
@{ Source = "frontend\.tanstack"; Destination = "frontend\.tanstack" },
|
||||||
|
@{ Source = "frontend\.output"; Destination = "frontend\.output" },
|
||||||
|
@{ Source = "frontend\public"; Destination = "frontend\public" },
|
||||||
|
@{ Source = "package.json"; Destination = "package.json" },
|
||||||
|
@{ Source = "CHANGELOG.md"; Destination = "CHANGELOG.md" },
|
||||||
|
@{ Source = "README.md"; Destination = "README.md" },
|
||||||
|
# scripts to be copied over
|
||||||
|
@{ Source = "scripts\tmp"; Destination = "scripts\tmp" }
|
||||||
|
@{ Source = "scripts\iisControls.ps1"; Destination = "scripts\iisControls.ps1" }
|
||||||
)
|
)
|
||||||
|
|
||||||
Compress-Archive -Path $filesToInclude -DestinationPath $zipPath
|
foreach ($file in $filesToCopy) {
|
||||||
|
$destPath = Join-Path $tempStageDir $file.Destination
|
||||||
|
New-Item -ItemType Directory -Path (Split-Path $destPath -Parent) -Force | Out-Null
|
||||||
|
Copy-Item -Path $file.Source -Destination $destPath -Recurse -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create the zip from the staged directory
|
||||||
|
Compress-Archive -Path "$tempStageDir\*" -DestinationPath $zipPath
|
||||||
|
|
||||||
|
# Clean up temporary directory
|
||||||
|
Remove-Item $tempStageDir -Recurse -Force
|
||||||
|
|
||||||
Write-Host "`nRelease package created at: $($zipPath)"
|
Write-Host "`nRelease package created at: $($zipPath)"
|
||||||
|
Write-Host "Organized structure:"
|
||||||
|
Write-Host "- backend/"
|
||||||
|
Write-Host "- frontend/"
|
||||||
|
Write-Host "- lstwrapper/"
|
||||||
|
Write-Host "- CHANGELOG.md"
|
||||||
|
Write-Host "- README.md"
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
Write-Host "Building the docker images for front and backend"
|
Write-Host "Building the docker images for front and backend"
|
||||||
docker build -t logistics_support_tool:frontend-latest -f ../frontend/Dockerfile --no-cache ../frontend
|
docker build -t logistics_support_tool:frontend-latest -f ./frontend/Dockerfile --no-cache ./frontend
|
||||||
docker build -t logistics_support_tool:backend-latest -f ../backend/Dockerfile --no-cache ../backend
|
docker build -t logistics_support_tool:backend-latest -f ./backend/Dockerfile --no-cache ./backend
|
||||||
|
|
||||||
Write-Host "Tagging the builds with latest this is for testing test basically."
|
Write-Host "Tagging the builds with latest this is for testing test basically."
|
||||||
docker tag logistics_support_tool:frontend-latest git.tuffraid.net/cowch/logistics_support_tool:frontend-latest
|
docker tag logistics_support_tool:frontend-latest git.tuffraid.net/cowch/logistics_support_tool:frontend-latest
|
||||||
|
|||||||
42
scripts/get-changelog-entry.js
Normal file
42
scripts/get-changelog-entry.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import fs from "fs-extra";
|
||||||
|
import path from "path";
|
||||||
|
import { fileURLToPath } from "url";
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
|
const version = process.argv[2];
|
||||||
|
if (!version) {
|
||||||
|
console.error("Version argument is required");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getChangelogEntry() {
|
||||||
|
try {
|
||||||
|
const changelogPath = path.resolve(__dirname, "../../CHANGELOG.md");
|
||||||
|
const content = await fs.readFile(changelogPath, "utf8");
|
||||||
|
|
||||||
|
// Find the section for this version
|
||||||
|
const versionHeader = `## [${version}]`;
|
||||||
|
const sections = content.split(versionHeader);
|
||||||
|
|
||||||
|
if (sections.length < 2) {
|
||||||
|
console.warn(`No changelog entry found for version ${version}`);
|
||||||
|
return `Release ${version}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract the content for this version
|
||||||
|
const versionContent = sections[1].split("\n## ")[0].trim();
|
||||||
|
|
||||||
|
// Add the version header back
|
||||||
|
return `${versionHeader}\n${versionContent}`;
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error reading changelog:", error);
|
||||||
|
return `Release ${version}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output the changelog entry (release-it will capture this stdout)
|
||||||
|
getChangelogEntry()
|
||||||
|
.then(console.log)
|
||||||
|
.catch(() => process.exit(1));
|
||||||
46
scripts/iisControls.ps1
Normal file
46
scripts/iisControls.ps1
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
param (
|
||||||
|
[string]$ServerName,
|
||||||
|
[string]$AppPoolName,
|
||||||
|
[string]$StopOrStart
|
||||||
|
)
|
||||||
|
|
||||||
|
write-host $StopOrStart
|
||||||
|
if ($StopOrStart -eq "stop") {
|
||||||
|
Invoke-Command -ComputerName $ServerName -Credential $cred -ScriptBlock {
|
||||||
|
param($AppPoolName)
|
||||||
|
|
||||||
|
Import-Module WebAdministration
|
||||||
|
Write-Host "Stopping AppPool '$AppPoolName' on $($env:COMPUTERNAME)"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Stop-WebAppPool -Name $AppPoolName -ErrorAction Stop
|
||||||
|
|
||||||
|
Start-Sleep -Seconds 2
|
||||||
|
$state = (Get-WebAppPoolState -Name $AppPoolName).Value
|
||||||
|
Write-Host "Result: $state"
|
||||||
|
} catch {
|
||||||
|
Write-Error $_.Exception.Message
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
} -ArgumentList $AppPoolName
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($StopOrStart -eq "start"){
|
||||||
|
Invoke-Command -ComputerName $ServerName -Credential $cred -ScriptBlock {
|
||||||
|
param($AppPoolName)
|
||||||
|
|
||||||
|
Import-Module WebAdministration
|
||||||
|
Write-Host "Starting AppPool '$AppPoolName' on $($env:COMPUTERNAME)"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Start-WebAppPool -Name $AppPoolName
|
||||||
|
Start-Sleep -Seconds 2
|
||||||
|
$state = (Get-WebAppPoolState -Name $AppPoolName).Value
|
||||||
|
Write-Host "Result: $state"
|
||||||
|
} catch {
|
||||||
|
Write-Error $_.Exception.Message
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
} -ArgumentList $AppPoolName
|
||||||
|
}
|
||||||
|
|
||||||
67
scripts/lstV2Build.ps1
Normal file
67
scripts/lstV2Build.ps1
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#This is only temp until we make the entire transtion over to just this app...... long time but working on build process
|
||||||
|
$lstv2Loc = "C:\Users\matthes01\Documents\lstV2"
|
||||||
|
$lstv2BuildsDir = Join-Path $lstv2Loc "builds"
|
||||||
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||||
|
$tmpLoc = Join-Path $scriptDir "\tmp"
|
||||||
|
|
||||||
|
|
||||||
|
function Build-LstV2-And-Copy {
|
||||||
|
if (Test-Path $tmpLoc) {
|
||||||
|
Write-Host "Temp folder for lst builds exist, moving to run the build function."
|
||||||
|
} else {
|
||||||
|
Write-Host "Tmp Folder dose not exist we will create it."
|
||||||
|
New-Item -Path $scriptDir -Name "tmp" -ItemType "Directory"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Jumping into lstV2 to build it."
|
||||||
|
Push-Location $lstv2Loc
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
Write-Host "LSTV2 Finished building."
|
||||||
|
|
||||||
|
Write-Host "Copy the latest build to the tmpLoc"
|
||||||
|
|
||||||
|
# Get all build files and sort by creation time
|
||||||
|
$buildFiles = Get-ChildItem -Path $lstv2BuildsDir -File -Filter "*.zip" |
|
||||||
|
Sort-Object LastWriteTime -Descending
|
||||||
|
|
||||||
|
if ($buildFiles.Count -eq 0) {
|
||||||
|
Write-Error "No build files found in $lstv2BuildsDir"
|
||||||
|
Pop-Location
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get the most recent build
|
||||||
|
$latestBuild = $buildFiles[0]
|
||||||
|
$destinationPath = Join-Path $tmpLoc $latestBuild.Name
|
||||||
|
|
||||||
|
Write-Host "Copying latest build: $($latestBuild.Name)"
|
||||||
|
Write-Host "Created: $($latestBuild.LastWriteTime)"
|
||||||
|
Write-Host "Size: $([math]::Round($latestBuild.Length/1MB, 2)) MB"
|
||||||
|
|
||||||
|
# Copy the file
|
||||||
|
try {
|
||||||
|
Copy-Item -Path $latestBuild.FullName -Destination $destinationPath -Force
|
||||||
|
Write-Host "Successfully copied to: $destinationPath"
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Error "Failed to copy build file: $_"
|
||||||
|
Pop-Location
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
|
||||||
|
function Delete-Tmp-Folder
|
||||||
|
{
|
||||||
|
Write-Host "Removing the temp folder to keep it all clean"
|
||||||
|
if (Test-Path $tmpLoc) {
|
||||||
|
Remove-Item -Path $tmpLoc -Recurse
|
||||||
|
}else {
|
||||||
|
Write-Host "Tmp folder dose not exist, nothing to delete."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
24
scripts/read-build-number.js
Normal file
24
scripts/read-build-number.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* This is for release-it to be able to post the new build number in the releases
|
||||||
|
*/
|
||||||
|
|
||||||
|
import fs from "fs-extra";
|
||||||
|
import path from "path";
|
||||||
|
import { fileURLToPath } from "url";
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
|
async function readBuildNumber() {
|
||||||
|
try {
|
||||||
|
const buildNumberPath = path.resolve(__dirname, "../BUILD_NUMBER");
|
||||||
|
const buildNumber = (await fs.readFile(buildNumberPath, "utf8")).trim();
|
||||||
|
process.env.BUILD_NUMBER = buildNumber;
|
||||||
|
console.log(`Build number: ${buildNumber}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error reading BUILD_NUMBER:", error);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
readBuildNumber();
|
||||||
Reference in New Issue
Block a user