OJII3 / tuat-typst

知能情報システム工学実験表紙(Typst版)
3 stars 2 forks source link

Add install.bat file for Windows #7

Closed kitashimauni closed 4 months ago

kitashimauni commented 4 months ago

Windows用のインストールスクリプト(権限不要)

import "@local/tuat-typst:0.1.0": tuatTemplate でimportできた

自分の環境(PowerShell 7.4.1)では動作確認済み

OJII3 commented 4 months ago

おぉ嬉しい

OJII3 commented 4 months ago

これってLinuxのインストールスクリプトみたくコピペだけでインストールできるかな

.ps1ファイルならiexって言う、「その場でファイルをダウンロードして実行する」便利なコマンドがPowerShellでつかえるの知ってたんだけど…

OJII3 commented 4 months ago

あ!iex コマンドで .bat 実行できる可能性に気づいた

kitashimauni commented 4 months ago

curl -fsSL https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.batでファイルの取得はできるけど、文字列をバッチファイルとしてそのまま動かす方法は不明

iexを試してみたけど@echo offで引っかかってしまい、バッチファイルとして動かす方法はわからず…

kitashimauni commented 4 months ago

わからなかったのでinstall.ps1も作った curl -fsSL https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.ps1 | powershell - でインストール可能

(install.batもcurl -fsSL https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.bat | cmd - /qで動くけど、if文の度にMore?って出て邪魔になる)

kitashimauni commented 4 months ago

両方ちゃんと動くようになった install.batは全て1行で書いたので可読性はあれだけど…

curl -fsSL https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.bat | cmd - /q curl -fsSL https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.ps1 | powershell - のいずれかでインストール可能

OJII3 commented 4 months ago

インストールスクリプト自体はちゃんと動くんだけど、#import '@local/tuat-typst': tuatTemplate ができない. これっておま環?

Windows 11 Home

全部だめ

image

image

OJII3 commented 4 months ago

エラーがきもかった パスどうなってるんだ

❯ typst compile .\template.typ
error: file not found (searched at C:\Users\ojii3\AppData\Roaming\typst/packages/local/tuat-typst/0.1.0\typst.toml)
  ┌─ \\?\C:\Users\ojii3\Src\kitashimauni\tuat-typst\template.typ:1:8
  │
1 │ #import "@local/tuat-typst:0.1.0": tuatTemplate
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^
toufu-24 commented 4 months ago

少なくとも俺の環境のVSCode拡張のTypstでは,#import "@local/tuat-typst:0.1.0": tuatTemplateがちゃんと動いてそう

curl -fsSL https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.ps1 | powershell -でインストールした

success

OJII3 commented 4 months ago
❯ curl -fsSL https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.ps1 | powershell -
[info] DATA_DIR is set to: C:\Users\ojii3\AppData\Roaming
[info] git already installed
C:\Users\ojii3\AppData\Local\Temp/tuat-typst is already exist and delete this to continue

Confirm
Are you sure you want to perform this action?
Performing the operation "Remove Directory" on target
"C:\Users\ojii3\AppData\Local\Temp\tuat-typst".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove Directory" on target
"C:\Users\ojii3\AppData\Local\Temp\tuat-typst\.git".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove Directory" on target
"C:\Users\ojii3\AppData\Local\Temp\tuat-typst\.git\hooks".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove File" on target
"C:\Users\ojii3\AppData\Local\Temp\tuat-typst\.git\hooks\applypatch-msg.sample".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Remove-Item : Object reference not set to an instance of an object.
At line:3 char:5
+     Remove-Item "$TEMP_DIR" -Force -Recurse -Confirm
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Remove-Item], NullReferenceException
    + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.
   RemoveItemCommand

Canceled
OJII3 commented 4 months ago

ごめんこのエラーは関係なかった

OJII3 commented 4 months ago

AppData\Roaming\typstAppData\Local\Temp全部消してcurl -fsSL https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.ps1 | powershell - したらいけました。

kitashimauni commented 4 months ago

削除とかコピーの動作が怪しいかも

OJII3 commented 4 months ago

あ~わかった

OJII3 commented 4 months ago

まえにじぶんで書いたps1のカスコピーののこりかすかも

OJII3 commented 4 months ago
iwr https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.ps1 | iex

これでもいけた ダウンロードのほうは iwr でした

OJII3 commented 4 months ago

ps1bat のどちらが良いかという話がありまして

kitashimauni commented 4 months ago

実は.batのほうが動作は安定しているかもしれない

OJII3 commented 4 months ago

一旦マージします〜

OJII3 commented 4 months ago

あとでreadmeにbatのワンライナーインストールスクリプト貼る感じで