Skip to content

Commit

Permalink
Merge pull request #3 from haruharu-1105/feature/0.0.3
Browse files Browse the repository at this point in the history
Feature/0.0.3
  • Loading branch information
haruharu-1105 authored Feb 4, 2025
2 parents 3addc5c + 67cd304 commit efaf46b
Show file tree
Hide file tree
Showing 16 changed files with 2,069 additions and 48 deletions.
94 changes: 94 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: "Bug Report"
description: "アプリの不具合を報告します"
title: "[Bug]: "
body:
- type: markdown
attributes:
value: |
# 不具合報告ありがとうございます!
- type: markdown
attributes:
value: |
## お手数ですが、上記の「Title」と問1~7を記入後に下部の「Submit new Issue」ボタンを押して報告して下さいな。
- type: dropdown
id: feature
attributes:
label: "問1, どの機能に関する不具合ですか?"
options:
- 画像の読み込み(ファイル・ドラッグ&ドロップ・クリップボード)
- パレットの生成
- パレットのダウンロード
- ユーザーインターフェース(UI)
- その他
validations:
required: true

- type: input
id: other_feature
attributes:
label: "【任意】「その他」を選択した場合、詳細を入力してください"
placeholder: "例:カラーピッカー"

- type: textarea
id: problem
attributes:
label: "問2, 不具合の内容"
description: |
どのような不具合が発生しましたか?詳細を記入してください
value: |
### 発生した問題
例: 画像をアップロードしても、パレットが生成されない。
### 期待する動作
例: 画像をアップロードしたら、自動的にパレットが生成される。
### 再現手順
1. xxx画像をアップロード
2. 「パレット生成」ボタンを押す
3. エラーが発生する or 画面が変わらない
- type: dropdown
id: device
attributes:
label: "問3, どの環境でアプリを使用しましたか?"
options:
- Windows
- macOS
- Linux
- iOS
- Android
- その他
validations:
required: true

- type: dropdown
id: browsers
attributes:
label: "問4, どのブラウザで問題が発生しましたか?"
multiple: true
options:
- Chrome
- Safari
- Microsoft Edge
- Firefox
- その他

- type: input
id: version
attributes:
label: "問5, アプリのバージョン情報"
description: "アプリの左上に表示されるバージョン情報を記入してください"

- type: textarea
id: error_log
attributes:
label: "問6, エラーメッセージ・コンソールログがあれば貼り付けてください"
placeholder: "エラーが発生した場合、開発者ツール(F12キー)でコンソールログを取得し、ここに貼り付けてください"

- type: textarea
id: extras
attributes:
label: "問7, 特記事項(再現頻度、追加情報)"
placeholder: "特記事項があれば記入してください"
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: X
url: https://x.com/haruharu1105_ai
about: Feel free to drop a DM if you have any questions!
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Ignore file extensions
# log file
# Log file
*.log
# Shortcut file
*.lnk
# WinMerge backup file
*.bak
4 changes: 4 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
cd /d "%~dp0"
powershell -ExecutionPolicy Bypass -File "build.ps1"
timeout /T 30
141 changes: 141 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# build.ps1

# 作業ディレクトリをスクリプトのあるディレクトリに変更
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
Set-Location $scriptDir

# ==========================
# 設定
# ==========================
$template_file = "src/index.template.html"
# JavaScriptファイルの読み込み順を定義
$jsFiles = @(
"src/color-helper.js",
"src/ui.js",
"src/theme-manager.js",
"src/main.js"
)

# ==========================
# BuildProcess クラス
# ==========================
class BuildProcess {
[string]$artifactFile
[array]$inputFiles # 入力ファイルリスト
[array]$jsFiles
[string]$templateFile
[string]$outputFile

BuildProcess($templateFile, $jsFiles) {
$this.templateFile = $templateFile
$this.jsFiles = $jsFiles
$this.outputFile = "dist/index.html"
$this.artifactFile = "dist/build_artifacts_hashes.txt"
$this.inputFiles = @($templateFile) + $jsFiles
}

# ファイルをUTF-8で読み込む(BOMなし)
[string] ReadFileUTF8($path) {
if (-not (Test-Path $path)) {
Write-Host "!!: ファイルが見つかりません -> $path"
exit 1
}
Write-Host "OK: ファイルを読み込みました -> $path"
return Get-Content -Raw -Path $path -Encoding UTF8
}

# ファイルをUTF-8 (BOMなし) で書き込む
WriteFileUTF8NoBOM($path, $content) {
try {
$encoding = New-Object System.Text.UTF8Encoding($false)
$writer = [System.IO.StreamWriter]::new($path, $false, $encoding)
$writer.Write($content)
$writer.Close()
Write-Host "OK: $path をBOMなしUTF-8で保存しました。"
return
} catch {
Write-Host "NG: ファイル書き込みに失敗しました -> $path"
exit 1
}
}

# ハッシュ生成
GenerateFileHashes() {
Write-Host "`n=== ビルド構成物の証跡ハッシュを生成 ==="
"Build Input Hashes:" | Out-File $this.artifactFile -Encoding utf8
foreach ($file in $this.inputFiles) {
if (Test-Path $file) {
$hash = (Get-FileHash $file -Algorithm SHA256).Hash
"$($file): $hash" | Out-File $this.artifactFile -Append -Encoding utf8
} else {
"$($file): Not Found" | Out-File $this.artifactFile -Append -Encoding utf8
Write-Host "!!: ファイルが見つかりません、ハッシュを記録できません。 -> $file"
exit 1
}
}

# ビルド生成物のハッシュ
"`nBuild Output Hash:" | Out-File $this.artifactFile -Append -Encoding utf8
if (Test-Path $this.outputFile) {
$outputHash = (Get-FileHash $this.outputFile -Algorithm SHA256).Hash
"$($this.outputFile): $outputHash" | Out-File $this.artifactFile -Append -Encoding utf8
} else {
"$($this.outputFile): Not Generated" | Out-File $this.artifactFile -Append -Encoding utf8
Write-Host "!!: 生成物が見つからないため、ハッシュを記録できません。"
exit 1
}
}

# ファイルのバックアップを作成 (_backup を付加)
BackupFile($filePath) {
if (Test-Path $filePath) {
$backupFile = $filePath -replace '\.([^\.]+)$', '_backup.$1' # "index.html" → "index_backup.html"
Copy-Item -Path $filePath -Destination $backupFile -Force
Write-Host "OK: バックアップを作成しました -> $backupFile"
} else {
Write-Host "!!: バックアップ不要($filePath が存在しないためスキップ)"
}
}

# ビルド処理
Build() {
Write-Host "`n=== ビルド処理を開始 ==="

# テンプレートファイルの読み込み
$template = $this.ReadFileUTF8($this.templateFile)
if ($template -eq "") {
Write-Host "NG: テンプレートの読み込みに失敗したため、処理を中断します。"
exit 1
}

# すべてのJSファイルの内容を結合
$jsContent = ""
foreach ($file in $this.jsFiles) {
$jsContent += $this.ReadFileUTF8($file)
}

# テンプレート内のプレースホルダーを置換
$template = $template -replace '<!-- INLINE_JS -->', $jsContent

# バックアップ作成
$this.BackupFile($this.outputFile)

# 出力ファイルを書き込む(BOMなしUTF-8)
$this.WriteFileUTF8NoBOM($this.outputFile, $template)

# ビルド生成物のハッシュ
$this.GenerateFileHashes()

Write-Host "`n=== ビルド完了 ==="
Write-Host "成果物: $($this.outputFile)"
Write-Host "アーティファクトファイル: $($this.artifactFile)"
}
}

# ==========================
# ビルドプロセス開始
# ==========================
$buildProcess = [BuildProcess]::new($template_file, $jsFiles)
$buildProcess.Build()

exit 0
9 changes: 9 additions & 0 deletions build_artifacts_hashes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Build Input Hashes:
src/index.template.html: B3AB2757D8C5AF5D128CBD4DB97C35ADC68CB9A09491A8B7247C8C977B581479
src/color-helper.js: 8061A9DB52C9CC49C751FF6C9E330B426C628C901449CE919DA3AF68C303BB68
src/ui.js: C9CECE5ECBB7859B5C051699BEDC76D28570899973828194329A4AFC04EE8AAF
src/theme-manager.js: 67FFD14CE96958672D4D3A51FE3D7359092710C4524EADD1FE94629A0A0B8583
src/main.js: CB3CB83F984B1FF869893759DEA2A3139F25A2DA9EAC9E76F686F4027DD4D912

Build Output Hash:
index.html: D7A84F5DA2DE5E2033BC4BC04B4D1E1481D1DF2C88CA60DFA6B2E771321B7AAF
2 changes: 2 additions & 0 deletions dist/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Backup files before build
index_backup.html
9 changes: 9 additions & 0 deletions dist/build_artifacts_hashes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Build Input Hashes:
src/index.template.html: 875F6B8FC0B3D8B62AA07F27B887847D5DCB2C48FAEFFDF0B566E9180A07F6A8
src/color-helper.js: 1D73020EB32436A197B84C7A725410B54042721352B6003E8586D23E5739FE82
src/ui.js: DBA3E477F0F4B1437A79E81F5736D3610633F991E95D1D5E57322901E451F2C5
src/theme-manager.js: C3979DE7E835A489B69953FF0A7FB94D54D32F24F34421A65065C3A00148216A
src/main.js: CB3CB83F984B1FF869893759DEA2A3139F25A2DA9EAC9E76F686F4027DD4D912

Build Output Hash:
dist/index.html: 7C39495FA7A607A37942F064136ED3F847E66176E308F175140BDAE8A8A87433
Loading

0 comments on commit efaf46b

Please sign in to comment.