mirror of
https://github.com/bs-community/blessing-skin-plugins.git
synced 2025-01-09 04:07:51 +08:00
add script for creating plugin
This commit is contained in:
parent
f24aff75d9
commit
ba17160ec0
@ -8,5 +8,5 @@ charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.php]
|
||||
[*.{php,ps1}]
|
||||
indent_size = 4
|
||||
|
69
create.ps1
Normal file
69
create.ps1
Normal file
@ -0,0 +1,69 @@
|
||||
param (
|
||||
[Parameter(Mandatory, Position = 0)]
|
||||
[string]
|
||||
$Id,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[string]
|
||||
$Title,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[string]
|
||||
$Description,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[string]
|
||||
$Author,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[string]
|
||||
$Namespace,
|
||||
|
||||
[Parameter()]
|
||||
[string]
|
||||
$Url,
|
||||
|
||||
[Parameter()]
|
||||
[switch]
|
||||
[Alias('Views')]
|
||||
$View,
|
||||
|
||||
[Parameter()]
|
||||
[switch]
|
||||
[Alias('Assets')]
|
||||
$Asset,
|
||||
|
||||
[Parameter()]
|
||||
[switch]
|
||||
$Lang
|
||||
)
|
||||
|
||||
$manifest = [PSCustomObject]@{
|
||||
name = $Id
|
||||
title = $Title
|
||||
version = '0.1.0'
|
||||
description = $Description
|
||||
author = $Author
|
||||
url = $Url
|
||||
namespace = $Namespace
|
||||
require = @{
|
||||
'blessing-skin-server' = '^5.0.0'
|
||||
}
|
||||
enchants = @{}
|
||||
}
|
||||
|
||||
New-Item "./$Id/src" -ItemType Directory | Out-Null
|
||||
ConvertTo-Json $manifest | Set-Content "./$Id/package.json"
|
||||
Set-Content -Value "<?php`n`nreturn function () {};" -Path "./$Id/bootstrap.php"
|
||||
|
||||
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
|
||||
}
|
Loading…
Reference in New Issue
Block a user