Skip to content

Commit

Permalink
Merge pull request #229 from true-runes/development
Browse files Browse the repository at this point in the history
v2.0.0
  • Loading branch information
nikukyugamer authored Nov 28, 2022
2 parents b066034 + 8e0ebec commit b83fa23
Show file tree
Hide file tree
Showing 17 changed files with 3,465 additions and 3,356 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
node-version: [12.x, 14.x, 16.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.4.0
18.12.1
4 changes: 3 additions & 1 deletion .prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
module.exports = {
singleQuote: true,
trailingComma: all,
trailingComma: 'all',
semi: false,
tabWidth: 2,
}
15 changes: 15 additions & 0 deletions METHODS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 主要メソッド

## セレクトボックス(プルダウンメニュー)を設定する

## セルに色を付ける

## 「固定」の区切り線を入れる

## 「データの入力規則」を設定する

## シートやセルを保護する

## 「テキストの折り返し」を設定する

## 「チェックボックス」を設定する
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@
},
"homepage": "https://github.com/howdy39/gas-clasp-starter#readme",
"devDependencies": {
"@google/clasp": "^2.3.0",
"@types/google-apps-script": "^1.0.14",
"@types/jest": "25.1.4",
"@typescript-eslint/eslint-plugin": "2.23.0",
"@typescript-eslint/parser": "2.23.0",
"@google/clasp": "2.4.2",
"@types/google-apps-script": "1.0.56",
"@types/jest": "27.5.2",
"@typescript-eslint/eslint-plugin": "5.44.0",
"@typescript-eslint/parser": "5.44.0",
"cpx": "1.5.0",
"eslint": "6.8.0",
"eslint-config-prettier": "6.10.0",
"eslint-plugin-prettier": "3.1.2",
"gas-webpack-plugin": "1.0.2",
"jest": "^26.0.1",
"prettier": "1.19.1",
"eslint": "8.28.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-prettier": "4.2.1",
"gas-webpack-plugin": "2.3.0",
"jest": "27.5.1",
"prettier": "2.8.0",
"rimraf": "3.0.2",
"ts-jest": "^26.1.0",
"ts-loader": "6.2.1",
"typescript": "3.8.3",
"webpack": "4.42.0",
"webpack-cli": "3.3.11"
"ts-jest": "27.1.5",
"ts-loader": "9.4.1",
"typescript": "4.9.3",
"webpack": "5.75.0",
"webpack-cli": "4.10.0"
},
"jest": {
"transform": {
Expand Down
20 changes: 19 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
"config:base",
":timezone(Asia/Tokyo)"
],
"labels": [
"dependencies",
"renovate"
],
"dependencyDashboard": true,
"pin": {
"automerge": true
},
"packageRules": [
{
"matchPackagePatterns": [
"^.*"
],
"automerge": true
}
]
}
68 changes: 68 additions & 0 deletions src/addAggregationSheet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import Spreadsheet = GoogleAppsScript.Spreadsheet.Spreadsheet

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const getLatestAggregationSheetSuffixNumber: Function = (): number => {
const allSheetNames: string[] = getAllSheetNames()
const allAggregationSheetNames: string[] = allSheetNames.filter(
(sheetName) => sheetName.indexOf(prefixSheetName()) === 0,
)
const latestAggregationSheetName: string = allAggregationSheetNames
.sort()
.slice(-1)[0]
const latestAggregationSheetNumber = Number(
latestAggregationSheetName.replace(prefixSheetName(), ''),
)

return latestAggregationSheetNumber
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const nextAggregationSheetSuffixNumberByString: Function = (): string => {
const nextAggregationSheetSuffixNumberByString: string = (
'00' +
(getLatestAggregationSheetSuffixNumber() + 1)
).slice(-2)

return nextAggregationSheetSuffixNumberByString
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const nextAggregationSheetName: Function = (): string => {
const nextAggregationSheetName = `${prefixSheetName()}${nextAggregationSheetSuffixNumberByString()}`

return nextAggregationSheetName
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const writeInitialContents: Function = (): void => {
const spreadsheet: Spreadsheet = SpreadsheetApp.getActiveSpreadsheet()
const currentSheet = spreadsheet.getActiveSheet()
const aggregationSheetColumnNames: string[] = columnNames()

const varValues = [aggregationSheetColumnNames]
const lastColumnNumber = varValues[0].length
const lastRowNumber = varValues.length

const startRowNumberForInitialWriting = 1
const startColumnNumberForInitialWriting = 1
currentSheet
.getRange(
startRowNumberForInitialWriting,
startColumnNumberForInitialWriting,
lastRowNumber,
lastColumnNumber,
)
.setValues(varValues)
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const addAggregationSheet: Function = (): void => {
const spreadsheet = SpreadsheetApp.getActiveSpreadsheet()
spreadsheet.insertSheet(nextAggregationSheetName())
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const addAggregationSheetAndSort: Function = (): void => {
addAggregationSheet()
sortSheetsByJapanese()
}
5 changes: 0 additions & 5 deletions src/bar.ts

This file was deleted.

12 changes: 12 additions & 0 deletions src/concerns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const ll: Function = (argument: any): void => {
console.log(argument)
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const getAllSheetNames: Function = (): string[] => {
const spreadsheet = SpreadsheetApp.getActiveSpreadsheet()
const allSheets = spreadsheet.getSheets()

return allSheets.map((sheet) => sheet.getName())
}
30 changes: 30 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const columnNames: Function = (): string[] => {
const columnNames = [
'ツイート日時',
'ツイートID',
'ユーザー名',
'ユーザーID',
'ツイート本文',
'キャラ1',
'キャラ2',
'キャラ3',
'票数',
'合計',
'要レビュー',
'備考',
'二次チェック済',
]

return columnNames
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const prefixSheetName: Function = (): string => {
return 'G_集計用_'
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const ll: Function = (argument: any): void => {
console.log(argument)
}
5 changes: 0 additions & 5 deletions src/foo.ts

This file was deleted.

19 changes: 19 additions & 0 deletions src/getEachSheetId.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const getEachSheetId: Function = (): void => {
const spreadsheet = SpreadsheetApp.getActiveSpreadsheet()
const allSheets = spreadsheet.getSheets()

const eachSheetId: Record<string, any>[] = []
for (let i = 0; i < allSheets.length; i++) {
eachSheetId[allSheets[i].getName()] = allSheets[i].getSheetId()
}

let eachSheetIdForShownText = ''
for (const [key, value] of Object.entries(eachSheetId)) {
// ★
eachSheetIdForShownText += `${key},${value}\n`
}

console.log(eachSheetIdForShownText)
Browser.msgBox(eachSheetIdForShownText)
}
7 changes: 7 additions & 0 deletions src/onOpen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const onOpen: Function = (): void => {
SpreadsheetApp.getActiveSpreadsheet().addMenu('幻水総選挙', [
{ name: 'シート順ソート', functionName: 'sortSheetsByJapanese' },
{ name: 'シートID取得', functionName: 'getEachSheetId' },
])
}
51 changes: 51 additions & 0 deletions src/sortSheetsByJapanese.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// 50音順にシートをソートする
// cf. https://qiita.com/chanP_yamazaki/items/01c20108e1fdde2e2fef

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const sortSheetsByJapanese = (): void => {
const spreadsheet = SpreadsheetApp.getActiveSpreadsheet()
const allSheetsList = spreadsheet.getSheets()
const currentSheet = spreadsheet.getActiveSheet()
const sortInfo: { sheetList: object; sheetNameList: string[] } = {
sheetList: {},
sheetNameList: [],
}

try {
for (let count = 0; count < allSheetsList.length; count++) {
const sheetName: string = allSheetsList[count].getName()
// FIXME: 型 'string' の式を使用して型 '{}' にインデックスを付けることはできないため、要素は暗黙的に 'any' 型になります。
sortInfo['sheetList'][sheetName] = allSheetsList[count]
sortInfo['sheetNameList'].push(sheetName)
}

sortInfo['sheetNameList'].sort((a: string, b: string) => {
a = a.toString().toLowerCase()
b = b.toString().toLowerCase()

if (a < b) return -1
if (a > b) return 1
return 0
})

let setIndex = 1
for (
let sheetCount = 0;
sheetCount < sortInfo['sheetNameList'].length;
sheetCount++
) {
const sheetName = sortInfo['sheetNameList'][sheetCount]
// FIXME: 型 'string' の式を使用して型 '{}' にインデックスを付けることはできないため、要素は暗黙的に 'any' 型になります。
const activeSheet = sortInfo['sheetList'][sheetName]
activeSheet.activate()

spreadsheet.moveActiveSheet(setIndex)
setIndex++
}

currentSheet.activate()
ll('シートの日本語順でのソートが完了しました')
} catch (e) {
ll(e.lineNumber + ':' + e)
}
}
11 changes: 11 additions & 0 deletions src/tryDropdown.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const tryDropdown: Function = (): void => {
const ss = SpreadsheetApp.getActive()
const sh = ss.getSheetByName('Z_自由シート_01')
const vrg = sh.getRange('A1').clear({ validationsOnly: true })
const dv = SpreadsheetApp.newDataValidation()
.requireValueInList(['foo', 'bar'].sort(), true)
.build()
vrg.setDataValidation(dv)
}
// https://stackoverflow.com/questions/57347606/drop-down-list-from-column-with-comma-separate-data-google-sheets
8 changes: 7 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{
"compilerOptions": {
"lib": ["esnext"],
"experimentalDecorators": true,
"sourceMap": true,
"target": "es5",
"module": "es2015"
"module": "es2015",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"exclude": ["sample/*.ts", "tmp/*.ts", "dist/*.ts"]
}
Loading

0 comments on commit b83fa23

Please sign in to comment.