Skip to content

Commit fd8617d

Browse files
committed
chore: add scripts
1 parent aaf9733 commit fd8617d

9 files changed

Lines changed: 534 additions & 112 deletions

File tree

Installer/GhostDraw.Installer.wixproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
<InstallerPlatform>x64</InstallerPlatform>
88
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
99
<PublishDir>..\Src\GhostDraw\bin\Release\net8.0-windows\win-x64\publish\</PublishDir>
10-
<DefineConstants>PublishDir=$(PublishDir)</DefineConstants>
10+
<DefineConstants>PublishDir=$(PublishDir);ProductVersion=$(Version)</DefineConstants>
1111
</PropertyGroup>
1212
<ItemGroup>
13-
<Compile Include="HarvestedFiles.wxs" />
1413
<Compile Include="Product.wxs" />
1514
</ItemGroup>
1615
<ItemGroup>

Installer/Product.wxs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
33
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
4-
<?define ProductVersion="1.0.0" ?>
54
<?define ProductName="GhostDraw" ?>
65
<?define Manufacturer="RuntimeRascal" ?>
76
<?define UpgradeCode="A8B9C0D1-2E3F-4A5B-6C7D-8E9F0A1B2C3D" ?>

NPM_SCRIPTS.md

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
# NPM Scripts Documentation
2+
3+
This project uses npm scripts as a convenient interface for common development tasks. Below is a complete reference of all available scripts.
4+
5+
## Prerequisites
6+
7+
- Node.js 18+ and npm 9+
8+
- .NET 8 SDK
9+
- WiX Toolset 4.0.5 (for installer builds)
10+
11+
## Quick Start
12+
13+
```bash
14+
# Install dependencies and build
15+
npm run restore
16+
npm run build
17+
18+
# Run tests
19+
npm test
20+
21+
# Build installer
22+
npm run installer
23+
```
24+
25+
## Available Scripts
26+
27+
### Building
28+
29+
#### `npm run build`
30+
Build the entire solution in Debug configuration.
31+
```bash
32+
npm run build
33+
```
34+
35+
#### `npm run build:release`
36+
Build the entire solution in Release configuration.
37+
```bash
38+
npm run build:release
39+
```
40+
41+
#### `npm run restore`
42+
Restore NuGet package dependencies for the solution.
43+
```bash
44+
npm run restore
45+
```
46+
47+
### Testing
48+
49+
#### `npm test`
50+
Run all unit tests with normal verbosity.
51+
```bash
52+
npm test
53+
```
54+
55+
#### `npm run test:watch`
56+
Run tests in watch mode - automatically re-runs tests when code changes.
57+
```bash
58+
npm run test:watch
59+
```
60+
61+
### Publishing
62+
63+
#### `npm run publish`
64+
Publish the application as a self-contained Windows x64 executable.
65+
```bash
66+
npm run publish
67+
```
68+
69+
#### `npm run publish:ver`
70+
Publish the application with a specific version.
71+
```bash
72+
# Windows CMD
73+
set VER=1.2.3 && npm run publish:ver
74+
75+
# PowerShell
76+
$env:VER="1.2.3"; npm run publish:ver
77+
78+
# Git Bash
79+
VER=1.2.3 npm run publish:ver
80+
```
81+
82+
### Installer
83+
84+
#### `npm run installer`
85+
Build the complete installer (builds app, generates file list, creates MSI).
86+
```bash
87+
npm run installer
88+
```
89+
90+
#### `npm run installer:ver`
91+
Build the installer with a specific version.
92+
```bash
93+
# Windows CMD
94+
set VER=1.2.3 && npm run installer:ver
95+
96+
# PowerShell
97+
$env:VER="1.2.3"; npm run installer:ver
98+
99+
# Git Bash
100+
VER=1.2.3 npm run installer:ver
101+
```
102+
103+
#### `npm run installer:generate`
104+
Generate the WiX component file list from the published application.
105+
```bash
106+
npm run installer:generate
107+
```
108+
109+
### Release
110+
111+
#### `npm run release`
112+
Complete release build: clean, test, and build installer.
113+
```bash
114+
npm run release
115+
```
116+
117+
#### `npm run release:ver`
118+
Complete release build with a specific version.
119+
```bash
120+
# Windows CMD
121+
set VER=1.2.3 && npm run release:ver
122+
123+
# PowerShell
124+
$env:VER="1.2.3"; npm run release:ver
125+
126+
# Git Bash
127+
VER=1.2.3 npm run release:ver
128+
```
129+
130+
### Development
131+
132+
#### `npm run dev`
133+
Build and run the application in development mode.
134+
```bash
135+
npm run dev
136+
```
137+
138+
#### `npm run dev:watch`
139+
Run the application in watch mode - automatically rebuilds and restarts on code changes.
140+
```bash
141+
npm run dev:watch
142+
```
143+
144+
### Code Formatting
145+
146+
#### `npm run format`
147+
Format all code in the solution using dotnet-format.
148+
```bash
149+
npm run format
150+
```
151+
152+
#### `npm run format:check`
153+
Check if code formatting is correct without making changes.
154+
```bash
155+
npm run format:check
156+
```
157+
158+
### Cleaning
159+
160+
#### `npm run clean`
161+
Clean all build outputs and intermediate files.
162+
```bash
163+
npm run clean
164+
```
165+
166+
#### `npm run clean:installer`
167+
Clean only installer build outputs.
168+
```bash
169+
npm run clean:installer
170+
```
171+
172+
### Version Bumping
173+
174+
#### `npm run version:bump:patch`
175+
Bump the patch version (1.0.0 → 1.0.1).
176+
```bash
177+
npm run version:bump:patch
178+
```
179+
180+
#### `npm run version:bump:minor`
181+
Bump the minor version (1.0.0 → 1.1.0).
182+
```bash
183+
npm run version:bump:minor
184+
```
185+
186+
#### `npm run version:bump:major`
187+
Bump the major version (1.0.0 → 2.0.0).
188+
```bash
189+
npm run version:bump:major
190+
```
191+
192+
## Common Workflows
193+
194+
### Development Workflow
195+
```bash
196+
# Start development with watch mode
197+
npm run dev:watch
198+
199+
# In another terminal, run tests in watch mode
200+
npm run test:watch
201+
```
202+
203+
### Creating a Release
204+
```bash
205+
# Bump version
206+
npm run version:bump:minor
207+
208+
# Get the new version from package.json
209+
# Then build release with that version
210+
set VER=1.2.0 && npm run release:ver
211+
212+
# Or use the current package.json version
213+
npm run release
214+
```
215+
216+
### CI/CD Integration
217+
The npm scripts integrate seamlessly with the existing GitHub Actions workflows:
218+
- `.github/workflows/ci.yml` - Runs on every push to main
219+
- `.github/workflows/release.yml` - Runs on version tags (v*.*.*)
220+
221+
### Quick Build and Test
222+
```bash
223+
# Build everything and run tests
224+
npm run build && npm test
225+
226+
# Or for release configuration
227+
npm run build:release && npm test
228+
```
229+
230+
## Environment Variables
231+
232+
### `VER`
233+
Used by version-specific scripts to set the build version:
234+
```bash
235+
# Windows CMD
236+
set VER=1.2.3
237+
238+
# PowerShell
239+
$env:VER="1.2.3"
240+
241+
# Git Bash / Linux
242+
export VER=1.2.3
243+
```
244+
245+
## Notes
246+
247+
- All scripts run from the repository root directory
248+
- Installer scripts require the application to be published first
249+
- Version scripts use the `VER` environment variable
250+
- The installer output is placed in `Installer/bin/x64/Release/`

0 commit comments

Comments
 (0)