Skip to content

Commit

Permalink
Merge pull request #1309 from kufu/astro
Browse files Browse the repository at this point in the history
Gatsby -> Astro 移行
  • Loading branch information
arrow2nd authored Nov 15, 2024
2 parents a655629 + 4877896 commit f6a6db0
Show file tree
Hide file tree
Showing 1,850 changed files with 23,270 additions and 26,929 deletions.
13 changes: 3 additions & 10 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
# コピーしてファイル名を.envにして各値を指定してください

## Algoliaの設定(指定しなくてもビルドはできますが、検索は動作しません。)
GATSBY_ALGOLIA_APP_ID=1Passwordを参照してください
PUBLIC_ALGOLIA_APP_ID=1Passwordを参照してください
ALGOLIA_ADMIN_API_KEY=1Passwordを参照してください
GATSBY_ALGOLIA_SEARCH_API_KEY=1Passwordを参照してください
GATSBY_ALGOLIA_INDEX_NAME=content

## Airtableの設定(指定しない場合はモックデータでビルドします)
AIRTABLE_BASE_ID=1Passwordを参照してください
AIRTABLE_PERSONAL_ACCESS_TOKEN=1Passwordを参照してください

## smarthr-uiのデータ取得設定(指定しない場合は全バージョンを取得しますが、キャッシュがない状態でのビルド時間は長くなります)
SHR_UI_MAX_VERSIONS=10 #10などの数値を指定してください
PUBLIC_ALGOLIA_SEARCH_API_KEY=1Passwordを参照してください
PUBLIC_ALGOLIA_INDEX_NAME=content
16 changes: 0 additions & 16 deletions .eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- `lint.yml`

mainブランチに対するPRの作成時に、`yarn lint`を実行します。ESLint/Stylelint/textlintです。
mainブランチに対するPRの作成時に、`pnpm lint`を実行します。ESLint/textlintです。

## 毎週のコンテンツチェック

Expand All @@ -21,7 +21,7 @@ Netlifyのビルドを手動でトリガーするワークフローです。

### deploy-to-netlify.yml

ビルド後の`public`ディレクトリをNetlifyにデプロイします。
ビルド後の`dist`ディレクトリをNetlifyにデプロイします。

### netlify-clear-cache-deploy.yml

Expand Down
23 changes: 18 additions & 5 deletions .github/workflows/deploy-to-netlify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@ on:
workflow_dispatch:

jobs:
build:
build-prod:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'

- name: Create .env file
run: |
Expand All @@ -23,12 +31,17 @@ jobs:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-engines
run: pnpm install --frozen-lockfile

- run: yarn clean
- run: yarn build
- name: Build
run: pnpm build

- run: npx netlify-cli deploy --prod --dir=./public
- name: Deploy
run: |
npx netlify-cli deploy --prod --dir=./dist
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

- name: Update Algolia
run: pnpm tsx ./scripts/update-algoliasearch.ts
22 changes: 18 additions & 4 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,38 @@ on:
jobs:
check:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./scripts/content-checker

steps:
- uses: actions/checkout@v4

# Setup pnpm
- uses: pnpm/action-setup@v4
with:
version: 9

# Setup Node.js
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'

# Install npm packages
# Install packages
- name: Install dependencies
run: yarn --frozen-lockfile --cwd scripts/content-checker
run: pnpm install --frozen-lockfile

# リンクチェックの実行
- id: linkCheck
name: Execute link checker
# リンクエラーが見つかるとスクリプトはexit(1)で終了するが、このactionは中止しない。
# linkChecker.tsを実行し、`console.log()`と`console.error()`の内容をファイルに出力する
run: |
cd scripts/content-checker && npx ts-node linkChecker.ts 1>../../output.txt 2>../../errors.txt || true
echo errors=`cat ../../errors.txt` >> $GITHUB_OUTPUT
pnpm tsx linkChecker.ts 1>./output.txt 2>./errors.txt || true
echo errors=`cat ./errors.txt` >> $GITHUB_OUTPUT
- name: Output log to summary
# 実行結果をActionsのサマリーに出力
run: |
Expand All @@ -37,6 +50,7 @@ jobs:
while read output; do
echo "$output" >> $GITHUB_STEP_SUMMARY
done <output.txt
- name: Output errors to summary
# 前のstepでエラーがあった場合はエラーも出力
if: steps.linkCheck.outputs.errors != ''
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,20 @@ jobs:
steps:
- uses: actions/checkout@v4

# Setup pnpm
- uses: pnpm/action-setup@v4
with:
version: 9

# Setup Node.js
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'

# Run scripts
- name: Install dependencies
run: yarn
run: pnpm install --frozen-lockfile
- name: linting
run: yarn lint
run: pnpm lint
23 changes: 20 additions & 3 deletions .github/workflows/storybook-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,37 @@ jobs:
steps:
- uses: actions/checkout@v4

# Setup pnpm
- uses: pnpm/action-setup@v4
with:
version: 9

# Setup Node.js
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'

# Install npm packages
# Install packages
- name: Install dependencies
run: yarn --frozen-lockfile --cwd scripts/content-checker
run: |
pnpm install --frozen-lockfile
cd ./scripts/content-checker && pnpm install --frozen-lockfile
- name: Fetch Storybook Data
run: pnpm update:ui-data

# リンクチェックの実行
- id: storybookCheck
name: Execute Storybook checker
working-directory: ./scripts/content-checker
# エラーが見つかるとスクリプトはexit(1)で終了するが、このactionは中止しない。
# storybookUrlChecker.tsを実行し、`console.log()`と`console.error()`の内容をファイルに出力する
run: |
cd scripts/content-checker && npx ts-node storybookUrlChecker.ts 1>../../output.txt 2>../../errors.txt || true
pnpm tsx ./storybookUrlChecker.ts 1>../../output.txt 2>../../errors.txt || true
echo errors=`cat ../../errors.txt` >> $GITHUB_OUTPUT
- name: Output log to summary
# 実行結果をActionsのサマリーに出力
run: |
Expand All @@ -37,6 +53,7 @@ jobs:
while read output; do
echo "$output" >> $GITHUB_STEP_SUMMARY
done <output.txt
- name: Output errors to summary
# 前のstepでエラーがあった場合はエラーも出力
if: steps.storybookCheck.outputs.errors != ''
Expand Down
85 changes: 17 additions & 68 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,78 +1,27 @@
# Storybook static build files
storybook-static/
# build output
dist/

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript
# generated types
.astro/

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
# dependencies
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# dotenv environment variable files
# environment variables
.env
.env.production

# gatsby files
.cache/
public

# Mac files
# macOS-specific files
.DS_Store

# Yarn
yarn-error.log
.pnp/
.pnp.js
# Yarn Integrity file
.yarn-integrity

# Local Netlify folder
.netlify
# jetbrains setting folder
.idea/

# Gatsby GraphQL Typegen generated code (https://www.gatsbyjs.com/docs/how-to/local-development/graphql-typegen/#tips)
src/gatsby-types.d.ts
# ページ生成用のデータの一時キャッシュ
src/cache/
5 changes: 3 additions & 2 deletions .husky/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- textlint-disable -->
# gitのフックとして実行する処理

## フックの管理
Expand All @@ -11,8 +12,8 @@

以下のディレクトリ内のファイル(画像ファイルを想定)に変化があった場合に、zipファイルを作り直します。

- `/content/articles/basics/illustration/images`
- `/content/articles/basics/icons/images`
- `/src/content/articles/basics/illustration/images`
- `/src/content/articles/basics/icons/images`

また、同行するreadmeファイル(`/scripts/downloads/readme.txt`)に変更があった場合も作り直します。zipを作成するスクリプトは`/scripts/zipImages.ts`です。

Expand Down
13 changes: 5 additions & 8 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# 画像・アイコンまたはreadme.txtに変更がった場合はzipファイルを作り直し、コミットに含める
files_diff=`git diff --cached --name-only`
readme_file=`echo "$files_diff" | sed -n '/scripts\/downloads\/readme\.txt/p'`
img_files=`echo "$files_diff" | sed -n '/content\/articles\/basics\/illustration\/images\//p'`
icon_files=`echo "$files_diff" | sed -n '/content\/articles\/basics\/icons\/images\//p'`
img_files=`echo "$files_diff" | sed -n '/src\/content\/articles\/basics\/illustration\/images\//p'`
icon_files=`echo "$files_diff" | sed -n '/src\/content\/articles\/basics\/icons\/images\//p'`

if [ -n "$img_files" ] || [ -n "$icon_files" ] || [ -n "$readme_file" ]; then
yarn export:zip-images
git add 'static/downloads/*'
pnpm export:zip-images
git add 'public/downloads/*'
fi

yarn lint-staged
pnpm lint-staged
1 change: 1 addition & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
astro check
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.17.1
22.9.0
5 changes: 4 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## Ignore files
*.md
*.mdx
public/
dist/
pnpm-lock.yaml

6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

14 changes: 14 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* @see https://prettier.io/docs/en/configuration.html
* @type {import("prettier").Config}
*/
const config = {
// eslint-disable-next-line @typescript-eslint/no-require-imports
...require('prettier-config-smarthr'),
singleQuote: true,
trailingComma: 'all',
semi: true,
plugins: ['prettier-plugin-astro'],
};

module.exports = config;
Loading

0 comments on commit f6a6db0

Please sign in to comment.