-
-
Notifications
You must be signed in to change notification settings - Fork 406
Expand file tree
/
Copy pathMake.ps1
More file actions
87 lines (79 loc) · 2.39 KB
/
Make.ps1
File metadata and controls
87 lines (79 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# For WinOS under Powershell use this script instead of make
# Ensure you have file, pandoc and stylua installed
# scoop install file pandoc stylua
function Install-Deps
{
if (!(Test-Path "deps"))
{ New-Item -ItemType Directory -Path "deps"
}
$deps = @{
"plenary.nvim" = "https://github.com/nvim-lua/plenary.nvim.git"
"nvim-treesitter" = "https://github.com/nvim-treesitter/nvim-treesitter.git"
"mini.nvim" = "https://github.com/echasnovski/mini.nvim"
"panvimdoc" = "https://github.com/kdheepak/panvimdoc"
}
foreach ($name in $deps.Keys)
{
$path = "deps/$name"
if (!(Test-Path $path))
{
Write-Host "Pulling $name..." -ForegroundColor Cyan
git clone --filter=blob:none $($deps[$name]) $path
}
}
}
function Invoke-Format
{
Write-Host "Formatting..." -ForegroundColor Cyan
stylua tests/ lua/ -f ./stylua.toml
}
function Invoke-Docs
{
Install-Deps
Write-Host "Generating Docs..." -ForegroundColor Cyan
pandoc `
--metadata="project:codecompanion" `
--metadata="vimversion:NVIM v0.11" `
--metadata="titledatepattern:%Y %B %d" `
--metadata="toc:true" `
--metadata="incrementheadinglevelby:0" `
--metadata="treesitter:true" `
--metadata="dedupsubheadings:true" `
--metadata="ignorerawblocks:true" `
--metadata="docmapping:false" `
--metadata="docmappingproject:true" `
--lua-filter deps/panvimdoc/scripts/include-files.lua `
--lua-filter deps/panvimdoc/scripts/skip-blocks.lua `
--lua-filter scripts/panvimdoc-cleanup.lua `
-t deps/panvimdoc/scripts/panvimdoc.lua `
scripts/vimdoc.md `
-o doc/codecompanion.txt
}
function Invoke-Test
{
param($File)
Install-Deps
$env:HOME = $env:USERPROFILE
Write-Host "Testing..." -ForegroundColor Cyan
if ($File)
{
nvim --headless --noplugin -u ./scripts/minimal_init.lua -c "lua MiniTest.run_file('$File')"
} else
{
nvim --headless --noplugin -u ./scripts/minimal_init.lua -c "lua MiniTest.run()"
}
}
if ($args[0] -eq "format")
{ Invoke-Format
} elseif ($args[0] -eq "docs")
{ Invoke-Docs
} elseif ($args[0] -eq "test")
{ Invoke-Test
} elseif ($args[0] -eq "test_file")
{ Invoke-Test -File $args[1]
} else
{
Invoke-Format
Invoke-Docs
Invoke-Test
}