Last active
January 4, 2019 08:12
-
-
Save nimzo6689/302fa57789a7a1366d352fa162215815 to your computer and use it in GitHub Desktop.
PowerShellでGoogleAppsScriptの環境構築する方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Scoopの環境構築 | |
Set-ExecutionPolicy RemoteSigned -scope CurrentUser | |
iex (new-object net.webclient).downloadstring('https://get.scoop.sh') | |
scoop install git | |
# CUIツールをインストール | |
scoop install nodejs-lts yarn | |
# GUIツールをインストール | |
scoop bucket add extras | |
scoop install vscode | |
# 以下、こちらのページを参考にさせていただきました。 | |
# https://qiita.com/suin/items/b264092eab3ce553f16a | |
# GoogleAppsScript用 | |
yarn add global @google/clasp | |
# Google Apps Script APIがオンになっていることを確認 | |
start https://script.google.com/home/usersettings | |
# claspコマンドをPATHに追加 | |
$oldUserPath = [Environment]::getEnvironmentVariable('PATH', 'User') | |
$oldMachinePath = [Environment]::getEnvironmentVariable('PATH', 'Machine') | |
$addedUserPath = (Resolve-Path ~\node_modules\.bin).Path | |
$newUserPath = "$addedUserPath;$oldUserPath" | |
[Environment]::setEnvironmentVariable('PATH', $newUserPath, 'User'); $env:PATH = "$oldMachinePath;$newUserPath" | |
# ログイン | |
clasp login | |
# claspでプロジェクトを作成 | |
$targetDir = "~\Repos\ToeicScoreRegistrar" | |
New-Item -ItemType Directory -Path "${targetDir}\src" | |
cd $targetDir | |
clasp create --type sheets --title (Split-Path $PWD -Leaf) --rootDir src | |
$scriptId = (cat .\.clasp.json | ConvertFrom-Json).scriptId | |
Remove-Item * | |
git clone --depth=1 https://github.com/howdy39/gas-clasp-starter.git . | |
yarn | |
$clasp = cat .\.clasp.json | ConvertFrom-Json | |
$clasp.scriptId = $scriptId | |
$clasp | ConvertTo-Json | Out-File -Encoding ascii .\.clasp.json | |
# コーディング | |
code . | |
# PUSH | |
yarn build | |
clasp push | |
clasp open |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment