Skip to content

Commit

Permalink
Merge branch 'TryGhost:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
andreascreten authored May 7, 2024
2 parents 8682327 + 3246a8d commit d3b10c1
Show file tree
Hide file tree
Showing 720 changed files with 17,625 additions and 8,176 deletions.
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
layout node
use flake .
4 changes: 2 additions & 2 deletions .github/actions/restore-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ runs:
steps:
- name: Check dependency cache
id: dep-cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ env.DEPENDENCY_CACHE_KEY }}

- name: Check build cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
id: build-cache
with:
path: ${{ env.CACHED_BUILD_PATHS }}
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const COMMAND_TYPESCRIPT = {
env: {}
};

const adminXApps = '@tryghost/admin-x-demo,@tryghost/admin-x-settings';
const adminXApps = '@tryghost/admin-x-demo,@tryghost/admin-x-settings,@tryghost/admin-x-activitypub';

const COMMANDS_ADMINX = [{
name: 'adminXDeps',
Expand All @@ -77,7 +77,7 @@ const COMMANDS_ADMINX = [{
}, {
name: 'adminX',
command: `nx run-many --projects=${adminXApps} --parallel=${adminXApps.length} --targets=dev`,
cwd: path.resolve(__dirname, '../../apps/admin-x-settings'),
cwd: path.resolve(__dirname, '../../apps/admin-x-settings', '../../apps/admin-x-activitypub'),
prefixColor: '#C35831',
env: {}
}];
Expand Down
2 changes: 2 additions & 0 deletions .github/scripts/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
version: '3.8'

name: ghost

services:
mysql:
image: mysql:8.0.35
Expand Down
6 changes: 5 additions & 1 deletion .github/scripts/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ async function runAndStream(command, args, options) {

console.log(chalk.blue(`Running knex-migrator init`));
await runAndStream('yarn', ['knex-migrator', 'init'], {cwd: coreFolder});

if (process.argv.includes('--no-seed')) {
console.log(chalk.yellow(`Skipping seed data`));
console.log(chalk.yellow(`Done`));
return;
}
if (resetData) {
const xxl = process.argv.includes('--xxl');

Expand Down
40 changes: 20 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
echo "BASE_COMMIT=$BASE_COMMIT" >> $GITHUB_ENV
- name: Determine added packages
uses: dorny/paths-filter@v2.11.1
uses: dorny/paths-filter@v2.12.0
id: added
with:
filters: |
Expand Down Expand Up @@ -148,23 +148,23 @@ jobs:
echo "$EOF" >> "$GITHUB_ENV"
- name: Nx cache
uses: actions/cache@v3
uses: actions/cache@v4
id: cache_nx
with:
path: .nxcache
key: nx-Linux-${{ github.ref }}-${{ env.HEAD_COMMIT }}
restore-keys: ${{needs.job_get_metadata.outputs.is_main == 'false' && env.NX_CACHE_RESTORE_KEYS || 'nx-never-restore'}}

- name: Check dependency cache
uses: actions/cache@v3
uses: actions/cache@v4
id: cache_dependencies
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ env.cachekey }}
restore-keys: ${{needs.job_get_metadata.outputs.is_main == 'false' && env.DEPENDENCY_CACHE_RESTORE_KEYS || 'dep-never-restore'}}

- name: Check build cache
uses: actions/cache@v3
uses: actions/cache@v4
id: cache_built_packages
with:
path: ${{ env.CACHED_BUILD_PATHS }}
Expand Down Expand Up @@ -207,7 +207,7 @@ jobs:
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_install_deps.outputs.dependency_cache_key }}

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ghost/**/.eslintcache
key: eslint-cache
Expand Down Expand Up @@ -273,7 +273,7 @@ jobs:
- name: Merge Admin test coverage
run: yarn ember coverage-merge
working-directory: ghost/admin
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: admin-coverage
path: ghost/*/coverage/cobertura-coverage.xml
Expand Down Expand Up @@ -325,7 +325,7 @@ jobs:
- name: Get Playwright version
id: playwright-version
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
- uses: actions/cache@v4
name: Check if Playwright browser is cached
id: playwright-cache
with:
Expand Down Expand Up @@ -356,7 +356,7 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: browser-tests-playwright-report
Expand Down Expand Up @@ -417,7 +417,7 @@ jobs:
if: needs.job_get_metadata.outputs.changed_any_code == 'true'
strategy:
matrix:
node: [ '18.12.1' ]
node: [ '18.12.1', '20.11.1' ]
name: Unit tests (Node ${{ matrix.node }})
steps:
- uses: actions/checkout@v4
Expand All @@ -436,7 +436,7 @@ jobs:

- run: yarn nx affected -t test:unit --base=${{ needs.job_get_metadata.outputs.BASE_COMMIT }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: startsWith(matrix.node, '18')
with:
name: unit-coverage
Expand All @@ -455,7 +455,7 @@ jobs:
if: needs.job_get_metadata.outputs.changed_core == 'true'
strategy:
matrix:
node: [ '18.12.1' ]
node: [ '18.12.1', '20.11.1' ]
env:
- DB: mysql8
NODE_ENV: testing-mysql
Expand Down Expand Up @@ -519,7 +519,7 @@ jobs:
endTime="$(date +%s)"
echo "test_time=$(($endTime-$startTime))" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: startsWith(matrix.node, '18') && contains(matrix.env.DB, 'mysql')
with:
name: e2e-coverage
Expand Down Expand Up @@ -658,7 +658,7 @@ jobs:
- name: Get Playwright version
id: playwright-version
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
- uses: actions/cache@v4
name: Check if Playwright browser is cached
id: playwright-cache
with:
Expand All @@ -675,7 +675,7 @@ jobs:

- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: admin-x-settings-playwright-report
path: apps/admin-x-settings/playwright-report
Expand Down Expand Up @@ -711,7 +711,7 @@ jobs:
- name: Get Playwright version
id: playwright-version
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
- uses: actions/cache@v4
name: Check if Playwright browser is cached
id: playwright-cache
with:
Expand All @@ -728,7 +728,7 @@ jobs:

- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: comments-ui-playwright-report
path: apps/comments-ui/playwright-report
Expand Down Expand Up @@ -764,7 +764,7 @@ jobs:
- name: Get Playwright version
id: playwright-version
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
- uses: actions/cache@v4
name: Check if Playwright browser is cached
id: playwright-cache
with:
Expand All @@ -781,7 +781,7 @@ jobs:

- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: signup-form-playwright-report
path: apps/signup-form/playwright-report
Expand Down Expand Up @@ -879,7 +879,7 @@ jobs:

- name: Restore Admin coverage
if: contains(needs.job_admin-tests.result, 'success')
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: admin-coverage

Expand All @@ -896,7 +896,7 @@ jobs:

- name: Restore E2E coverage
if: contains(needs.job_database-tests.result, 'success')
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: e2e-coverage

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ typings/
# dotenv environment variables file
.env

# direnv
.direnv

# IDE
.idea/*
*.iml
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
<img src="https://img.shields.io/github/contributors/TryGhost/Ghost.svg" alt="Contributors" />
</a>
</p>
<p align="center">
Love open source? <a href="https://careers.ghost.org/devops-engineer">We're hiring</a> DevOps engineers to work on Ghost full-time.
</p>


&nbsp;

Expand Down
1 change: 1 addition & 0 deletions apps/admin-x-activitypub/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tailwind.config.cjs
56 changes: 56 additions & 0 deletions apps/admin-x-activitypub/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/* eslint-env node */
module.exports = {
root: true,
extends: [
'plugin:ghost/ts',
'plugin:react/recommended',
'plugin:react-hooks/recommended'
],
plugins: [
'ghost',
'react-refresh',
'tailwindcss'
],
settings: {
react: {
version: 'detect'
}
},
rules: {
// sort multiple import lines into alphabetical groups
'ghost/sort-imports-es6-autofix/sort-imports-es6': ['error', {
memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple']
}],

// TODO: re-enable this (maybe fixed fast refresh?)
'react-refresh/only-export-components': 'off',

// suppress errors for missing 'import React' in JSX files, as we don't need it
'react/react-in-jsx-scope': 'off',
// ignore prop-types for now
'react/prop-types': 'off',

// TODO: re-enable these if deemed useful
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-empty-function': 'off',

// custom react rules
'react/jsx-sort-props': ['error', {
reservedFirst: true,
callbacksLast: true,
shorthandLast: true,
locale: 'en'
}],
'react/button-has-type': 'error',
'react/no-array-index-key': 'error',
'react/jsx-key': 'off',

'tailwindcss/classnames-order': ['error', {config: 'tailwind.config.cjs'}],
'tailwindcss/enforces-negative-arbitrary-values': ['warn', {config: 'tailwind.config.cjs'}],
'tailwindcss/enforces-shorthand': ['warn', {config: 'tailwind.config.cjs'}],
'tailwindcss/migration-from-tailwind-2': ['warn', {config: 'tailwind.config.cjs'}],
'tailwindcss/no-arbitrary-value': 'off',
'tailwindcss/no-custom-classname': 'off',
'tailwindcss/no-contradicting-classname': ['error', {config: 'tailwind.config.cjs'}]
}
};
3 changes: 3 additions & 0 deletions apps/admin-x-activitypub/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
playwright-report
test-results
13 changes: 13 additions & 0 deletions apps/admin-x-activitypub/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AdminX Standalone</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/standalone.tsx"></script>
</body>
</html>
Loading

0 comments on commit d3b10c1

Please sign in to comment.