Skip to content

Commit

Permalink
Merge pull request #1894 from kubosho/monorepo
Browse files Browse the repository at this point in the history
Restructure repository into a monorepo
  • Loading branch information
kubosho authored Nov 10, 2024
2 parents b087411 + 837070e commit ae18203
Show file tree
Hide file tree
Showing 169 changed files with 6,796 additions and 5,671 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:

jobs:
check:
defaults:
run:
working-directory: client

runs-on: ubuntu-latest

steps:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/e2e_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ on:

jobs:
test:
defaults:
run:
working-directory: client

env:
PLAYWRIGHT_VERSION: null

runs-on: ubuntu-latest

timeout-minutes: 60

steps:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:

jobs:
lint:
defaults:
run:
working-directory: client

runs-on: ubuntu-latest

steps:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:

jobs:
release:
defaults:
run:
working-directory: client

runs-on: ubuntu-latest

steps:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ env:

jobs:
test:
defaults:
run:
working-directory: client

runs-on: ubuntu-latest

steps:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/upload_og_image_to_s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Upload og:image to S3
on:
push:
branches: [main]
paths:
- client/public/assets/images/og/**

env:
AWS_BUCKET_NAME: ${{ secrets.AWS_BUCKET_NAME }}
Expand All @@ -13,6 +15,10 @@ permissions:

jobs:
upload:
defaults:
run:
working-directory: client

runs-on: ubuntu-latest

steps:
Expand Down
1 change: 1 addition & 0 deletions client/.node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.15.1
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion astro.config.ts → client/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import sitemap from '@astrojs/sitemap';
import type { AstroIntegration } from 'astro';
import { defineConfig } from 'astro/config';

import { SITE_URL } from './constants/site_data';
import { SITE_URL } from '../constants/site_data';

function getAdapter(): AstroIntegration {
if (process.env.USE_NODE_ADAPTER) {
Expand Down
4 changes: 2 additions & 2 deletions e2e/entries_[id].test.ts → client/e2e/entries_[id].test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect, test } from '@playwright/test';

import { pathList } from '../constants/path_list';
import { LOCAL_SITE_URL, OG_IMAGE_PATH } from '../constants/site_data';
import { pathList } from '../../constants/path_list';
import { LOCAL_SITE_URL, OG_IMAGE_PATH } from '../../constants/site_data';

test.describe('Entry page', () => {
test('Should be can to access the entry page', async ({ page }) => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/feed.test.ts → client/e2e/feed.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, test } from '@playwright/test';

import { LOCAL_SITE_URL } from '../constants/site_data';
import { LOCAL_SITE_URL } from '../../constants/site_data';

test.describe('Feed', () => {
test('Should be can access to feed', async ({ page }) => {
Expand Down
4 changes: 2 additions & 2 deletions e2e/policy.test.ts → client/e2e/policy.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect, test } from '@playwright/test';

import { pathList } from '../constants/path_list';
import { LOCAL_SITE_HOSTNAME, LOCAL_SITE_URL } from '../constants/site_data';
import { pathList } from '../../constants/path_list';
import { LOCAL_SITE_HOSTNAME, LOCAL_SITE_URL } from '../../constants/site_data';

function toSeconds(milliSeconds: number): number {
return Math.trunc(milliSeconds / 1000);
Expand Down
2 changes: 1 addition & 1 deletion e2e/sitemap.xml.test.ts → client/e2e/sitemap.xml.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, test } from '@playwright/test';

import { LOCAL_SITE_URL } from '../constants/site_data';
import { LOCAL_SITE_URL } from '../../constants/site_data';

test.describe('Sitemap', () => {
test('Should be can access to sitemap file', async ({ page }) => {
Expand Down
File renamed without changes.
56 changes: 56 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "@kubosho/blog-client",
"version": "9.8.1",
"license": "MIT",
"private": true,
"scripts": {
"dev": "astro dev",
"build": "astro build",
"build:node": "USE_NODE_ADAPTER=true astro build",
"build:ogimage": "tsx ./tools/og_image/generate_og_image.ts",
"preview": "astro preview",
"preview:node": "USE_NODE_ADAPTER=true astro preview",
"test": "vitest run",
"test:e2e": "npx playwright test",
"lint:style": "stylelint **/*.css",
"lint:script": "eslint .",
"lint:markup": "markuplint **/*.astro",
"format": "prettier --write .",
"check:format": "npm run format && git diff --exit-code",
"check:ts": "tsc --project tsconfig.json --noEmit"
},
"dependencies": {
"@astrojs/cloudflare": "^11.2.0",
"@astrojs/sitemap": "^3.2.1",
"astro": "^4.16.9",
"dayjs": "^1.11.13",
"escape-html": "^1.0.3",
"prismjs": "^1.29.0",
"remark-breaks": "^4.0.0",
"remark-gfm": "^4.0.0",
"remark-html": "^16.0.1",
"remark-parse": "^11.0.0",
"remark-stringify": "^11.0.0",
"rosetta": "^1.1.0",
"strip-markdown": "^6.0.0",
"unified": "^11.0.5"
},
"devDependencies": {
"@astrojs/node": "^8.3.4",
"@kubosho/configs": "^4.0.0",
"@markuplint/astro-parser": "^4.6.12",
"@playwright/test": "^1.48.2",
"@types/escape-html": "^1.0.2",
"@types/node": "^22.8.7",
"@types/prismjs": "^1.26.5",
"eslint-plugin-astro": "^1.3.0",
"fishery": "^2.2.2",
"front-matter": "^4.0.2",
"jsdom": "^25.0.1",
"prettier": "^3.3.3",
"prettier-plugin-astro": "^0.14.1",
"sharp": "^0.33.5",
"typescript": "^5.6.3",
"vitest": "^2.1.4"
}
}
2 changes: 1 addition & 1 deletion playwright.config.ts → client/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineConfig, devices } from '@playwright/test';

import { LOCAL_SITE_URL } from './constants/site_data';
import { LOCAL_SITE_URL } from '../constants/site_data';

/**
* See https://playwright.dev/docs/test-configuration.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
import { pathList } from '../../../constants/path_list';
import { pathList } from '../../../../constants/path_list';
import { formatIsoString, formatYYMDString } from '../entry/date';
import type { TinyCollectionEntry } from '../entry/tiny_collection_entry';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import { pathList } from '../../../constants/path_list';
import { ASSETS_URL, FAVICON_URL } from '../../../constants/site_data';
import { pathList } from '../../../../constants/path_list';
import { ASSETS_URL, FAVICON_URL } from '../../../../constants/site_data';
import { retrieveTranslation } from '../locales/i18n';
interface Props {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
import { pathList } from '../../../constants/path_list';
import { pathList } from '../../../../constants/path_list';
import { addWbr } from '../shared_logic/add_wbr';
interface Props {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
import { FALLBACK_OG_IMAGE_URL, TWITTER_ACCOUNT_ID } from '../../../constants/site_data';
import { FALLBACK_OG_IMAGE_URL, TWITTER_ACCOUNT_ID } from '../../../../constants/site_data';
import { retrieveTranslation } from '../locales/i18n';
interface Props {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'node:path';

import { describe, expect, test } from 'vitest';

import { SITE_URL } from '../../../../constants/site_data';
import { SITE_URL } from '../../../../../constants/site_data';
import { generateFeed } from '../feed_generator';

describe('generateFeed()', async () => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import escapeHTML from 'escape-html';

import { pathList } from '../../../constants/path_list';
import { AUTHOR, BASE_LANGUAGE, SITE_HOSTNAME, SITE_URL } from '../../../constants/site_data';
import { pathList } from '../../../../constants/path_list';
import { AUTHOR, BASE_LANGUAGE, SITE_HOSTNAME, SITE_URL } from '../../../../constants/site_data';
import { formatIsoString, formatYYMMDDString } from '../entry/date';
import { convertMarkdownToHtml } from '../entry/entry_converter';
import type { TinyCollectionEntry } from '../entry/tiny_collection_entry';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IS_PRODUCTION_ENV } from '../../../constants/environment';
import { IS_PRODUCTION_ENV } from '../../../../constants/environment';

export const PRODUCTION_GTM_ID = 'GTM-WQNTM9W';
export const DEVELOPMENT_GTM_ID = 'GTM-5FH7ZXN';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
import './BaseShell.css';
import { pathList } from '../../../constants/path_list';
import { AUTHOR, SITE_URL } from '../../../constants/site_data';
import { pathList } from '../../../../constants/path_list';
import { AUTHOR, SITE_URL } from '../../../../constants/site_data';
import ExternalResourceLink from '../../app/components/ExternalResourceLink.astro';
import Logo from '../../app/components/Logo.astro';
import OpenGraphProtocol from '../../app/components/OpenGraphProtocol.astro';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import { pathList } from '../../../constants/path_list';
import { OG_IMAGE_PATH, SITE_URL } from '../../../constants/site_data';
import { pathList } from '../../../../constants/path_list';
import { OG_IMAGE_PATH, SITE_URL } from '../../../../constants/site_data';
import OpenGraphProtocol from '../../app/components/OpenGraphProtocol.astro';
import { SlotNames } from '../_shared/slot_names';
import BaseShell from './BaseShell.astro';
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
import { getCollection } from 'astro:content';
import { pathList } from '../../../constants/path_list';
import { pathList } from '../../../../constants/path_list';
import EntryList from '../../app/components/EntryList.astro';
import { addExcerptToEntries } from '../../app/entry/add_excerpt_to_entries';
import { getSortedEntries } from '../../app/entry/get_sorted_entries';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/entries.astro → client/src/pages/entries.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
import { getCollection } from 'astro:content';
import { pathList } from '../../constants/path_list';
import { pathList } from '../../../constants/path_list';
import EntryList from '../app/components/EntryList.astro';
import { addExcerptToEntries } from '../app/entry/add_excerpt_to_entries';
import { getSortedEntries } from '../app/entry/get_sorted_entries';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import '../_shared/entry_contents.css';
import { getCollection } from 'astro:content';
import { pathList } from '../../../constants/path_list';
import { pathList } from '../../../../constants/path_list';
import { formatIsoString, formatYYMDString } from '../../app/entry/date';
import { retrieveTranslation } from '../../app/locales/i18n';
import { createBlogPostingStructuredData } from '../../app/structured_data/blog_posting_structured_data';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// eslint-disable-next-line import/no-unresolved
import { getCollection } from 'astro:content';

import { SITE_URL } from '../../../constants/site_data';
import { SITE_URL } from '../../../../constants/site_data';
import { addExcerptToEntries } from '../../app/entry/add_excerpt_to_entries';
import { formatIsoString } from '../../app/entry/date';
import { getSortedEntries } from '../../app/entry/get_sorted_entries';
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/pages/index.astro → client/src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
import { getCollection } from 'astro:content';
import { pathList } from '../../constants/path_list';
import { pathList } from '../../../constants/path_list';
import EntryList from '../app/components/EntryList.astro';
import Logo from '../app/components/Logo.astro';
import { addExcerptToEntries } from '../app/entry/add_excerpt_to_entries';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
import '../_shared/entry_contents.css';
import { pathList } from '../../../constants/path_list';
import { pathList } from '../../../../constants/path_list';
import { retrieveTranslation } from '../../app/locales/i18n';
import BaseShell from '../_layouts/BaseShell.astro';
import AnalyticsOptoutSwitch from './_components/AnalyticsOptoutSwitch.astro';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
import { getCollection } from 'astro:content';
import { pathList } from '../../../constants/path_list';
import { pathList } from '../../../../constants/path_list';
import EntryList from '../../app/components/EntryList.astro';
import { addExcerptToEntries } from '../../app/entry/add_excerpt_to_entries';
import { getSortedEntries } from '../../app/entry/get_sorted_entries';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export async function generateOgImage({ pageTitle, siteTitle }: Params): Promise
}

async function main(): Promise<void> {
const entriesPath = path.resolve(__dirname, '../../src/content/entries');
const entriesPath = path.resolve(__dirname, '../../../client/src/content/entries');
const entriesDirents = await fs.readdir(entriesPath, { withFileTypes: true });

const ogImagesPath = path.resolve(__dirname, '../../public/assets/images/og');
Expand Down
File renamed without changes.
File renamed without changes
3 changes: 3 additions & 0 deletions client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["../tsconfig.json", "astro/tsconfigs/strictest"]
}
File renamed without changes.
Loading

0 comments on commit ae18203

Please sign in to comment.