-
Notifications
You must be signed in to change notification settings - Fork 38
/
create.ps1
69 lines (58 loc) · 1.47 KB
/
create.ps1
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
param (
[Parameter(Mandatory, Position = 0)]
[string]
$Id,
[Parameter(Mandatory)]
[string]
$Author,
[Parameter(Mandatory)]
[string]
$Namespace,
[Parameter()]
[string]
$Url,
[Parameter()]
[switch]
[Alias('Views')]
$View,
[Parameter()]
[switch]
[Alias('Assets')]
$Asset
)
$manifest = [PSCustomObject]@{
name = $Id
title = "$Namespace::general.title"
version = '0.1.0'
description = "$Namespace::general.description"
author = $Author
url = $Url
namespace = $Namespace
require = @{
'blessing-skin-server' = '^5.0.0'
}
enchants = @{
icon = @{
fa = ''
bg = ''
}
}
}
Set-Location ./plugins
New-Item "./$Id/src" -ItemType Directory | Out-Null
New-Item "./$Id/lang/en" -ItemType Directory | Out-Null
New-Item "./$Id/lang/zh_CN" -ItemType Directory | Out-Null
ConvertTo-Json $manifest | Set-Content "./$Id/package.json"
Set-Content -Value "<?php`n`nreturn function () {};" -Path "./$Id/bootstrap.php"
Set-Content -Value "title: `ndescription: " -Path "./$Id/lang/en/general.yml"
Set-Content -Value "title: `ndescription: " -Path "./$Id/lang/zh_CN/general.yml"
if ($View) {
New-Item "./$Id/views" -ItemType Directory | Out-Null
}
if ($Asset) {
New-Item "./$Id/assets" -ItemType Directory | Out-Null
}
if ($Lang) {
New-Item "./$Id/lang" -ItemType Directory | Out-Null
}
Set-Location ..