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
Zabriskije committed Nov 13, 2023
2 parents 2552906 + 79cbf34 commit dd254bf
Show file tree
Hide file tree
Showing 921 changed files with 8,255 additions and 37,935 deletions.
16 changes: 11 additions & 5 deletions .github/scripts/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,26 @@ const COMMAND_TYPESCRIPT = {
env: {}
};

const COMMAND_ADMINX = {
const COMMANDS_ADMINX = [{
name: 'adminXDS',
command: 'nx watch --projects=apps/admin-x-design-system -- nx run \\$NX_PROJECT_NAME:build --skip-nx-cache',
cwd: path.resolve(__dirname, '../..'),
prefixColor: '#C35831',
env: {}
}, {
name: 'adminX',
command: 'yarn dev',
command: 'yarn nx build && yarn dev',
cwd: path.resolve(__dirname, '../../apps/admin-x-settings'),
prefixColor: '#C35831',
env: {}
};
}];

if (DASH_DASH_ARGS.includes('ghost')) {
commands = [COMMAND_GHOST, COMMAND_TYPESCRIPT];
} else if (DASH_DASH_ARGS.includes('admin')) {
commands = [COMMAND_ADMIN, COMMAND_ADMINX];
commands = [COMMAND_ADMIN, ...COMMANDS_ADMINX];
} else {
commands = [COMMAND_GHOST, COMMAND_TYPESCRIPT, COMMAND_ADMIN, COMMAND_ADMINX];
commands = [COMMAND_GHOST, COMMAND_TYPESCRIPT, COMMAND_ADMIN, ...COMMANDS_ADMINX];
}

if (DASH_DASH_ARGS.includes('portal') || DASH_DASH_ARGS.includes('all')) {
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ jobs:
key: ${{ env.HEAD_COMMIT }}

- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
Expand All @@ -192,7 +192,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 100
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
Expand Down Expand Up @@ -228,7 +228,7 @@ jobs:
|| needs.job_get_metadata.outputs.changed_core == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "18.12.1"

Expand All @@ -252,7 +252,7 @@ jobs:
COVERAGE: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "18.12.1"

Expand Down Expand Up @@ -294,7 +294,7 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
Expand Down Expand Up @@ -371,7 +371,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 100
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
Expand Down Expand Up @@ -418,7 +418,7 @@ jobs:
name: Database tests (Node ${{ matrix.node }}, ${{ matrix.env.DB }})
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
Expand Down Expand Up @@ -539,7 +539,7 @@ jobs:
name: Regression tests (Node ${{ matrix.node }}, ${{ matrix.env.DB }})
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
Expand Down Expand Up @@ -590,7 +590,7 @@ jobs:
CI: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
Expand Down Expand Up @@ -643,7 +643,7 @@ jobs:
CI: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
Expand Down Expand Up @@ -696,7 +696,7 @@ jobs:
CI: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
Expand Down Expand Up @@ -750,7 +750,7 @@ jobs:
with:
fetch-depth: 0
submodules: true
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
Expand Down Expand Up @@ -779,7 +779,7 @@ jobs:
echo "V4_DIR=$DIR" >> $GITHUB_ENV
ghost install v4 --local -d $DIR
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
Expand Down
41 changes: 41 additions & 0 deletions apps/admin-x-design-system/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module.exports = {
extends: [
'plugin:ghost/ts',
'plugin:react/recommended',
'plugin:react-hooks/recommended'
],
plugins: [
'ghost',
'react-refresh',
'tailwindcss'
],
settings: {
react: {
version: 'detect'
}
},
rules: {
// 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',

'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'}]
}
};
2 changes: 2 additions & 0 deletions apps/admin-x-design-system/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
es
types
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {resolve} from "path";
import type { StorybookConfig } from "@storybook/react-vite";

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
Expand All @@ -17,14 +17,11 @@ const config: StorybookConfig = {
docs: {
autodocs: "tag",
},
// staticDirs: ['../public/fonts'],
async viteFinal(config, options) {
config.resolve.alias = {
crypto: require.resolve('rollup-plugin-node-builtins'),
// @TODO: Remove this when @tryghost/nql is updated
mingo: resolve(__dirname, '../../../node_modules/mingo/dist/mingo.js')
async viteFinal(config, options) {
config.resolve!.alias = {
crypto: require.resolve('rollup-plugin-node-builtins')
}
return config;
},
}
};
export default config;
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import React from 'react';

import '../src/styles/demo.css';
import '../styles.css';
import './storybook.css';

import type { Preview } from "@storybook/react";
import '../src/admin-x-ds/providers/DesignSystemProvider';
import DesignSystemProvider from '../src/admin-x-ds/providers/DesignSystemProvider';
import DesignSystemProvider from '../src/providers/DesignSystemProvider';
import adminxTheme from './adminx-theme';
import { themes } from '@storybook/theming';

import '../src/admin-x-ds/assets/styles/storybook.css';

const preview: Preview = {
parameters: {
Expand All @@ -33,12 +31,12 @@ const preview: Preview = {
let {scheme} = context.globals;

return (
<div className={`admin-x-settings ${scheme === 'dark' ? 'dark' : ''}`} style={{
<div className={`admin-x-design-system admin-x-base ${scheme === 'dark' ? 'dark' : ''}`} style={{
padding: '24px',
background: (scheme === 'dark' ? '#131416' : '')
}}>
{/* 👇 Decorators in Storybook also accept a function. Replace <Story/> with Story() to enable it */}
<DesignSystemProvider>
<DesignSystemProvider fetchKoenigLexical={async () => {}}>
<Story />
</DesignSystemProvider>
</div>);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
/*
* We load Inter in Ember admin, so loading it explicitly here makes the final rendering
* in Storybook match the final rendering when embedded in Ember
*/
@font-face {
font-family: "Inter";
src: url("./Inter.ttf") format("truetype-variations");
font-weight: 100 900;
}

:root {
font-size: 62.5%;
line-height: 1.5;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;

text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}

html, body, #root {
width: 100%;
height: 100%;
margin: 0;
letter-spacing: unset;
}

.sbdocs-wrapper {
padding: 3vmin !important;
}
Expand Down Expand Up @@ -211,4 +240,4 @@
display: grid;
grid-template-columns: auto 240px;
gap: 32px;
}
}
23 changes: 23 additions & 0 deletions apps/admin-x-design-system/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Admin X Design

Components, design guidelines and documentation for building apps in Ghost Admin


## Usage


## Develop

This is a monorepo package.

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.



## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests

75 changes: 75 additions & 0 deletions apps/admin-x-design-system/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"name": "@tryghost/admin-x-design-system",
"type": "module",
"version": "0.0.0",
"repository": "https://github.com/TryGhost/Ghost/tree/main/packages/admin-x-design-system",
"author": "Ghost Foundation",
"private": true,
"main": "es/index.js",
"types": "types/index.d.ts",
"sideEffects": false,
"scripts": {
"build": "vite build && tsc -p tsconfig.declaration.json",
"prepare": "yarn build",
"test": "yarn test:types",
"test:types": "tsc --noEmit",
"lint:code": "eslint --ext .js,.ts,.cjs,.tsx src/ --cache",
"lint": "yarn lint:code && yarn lint:test",
"lint:test": "eslint -c test/.eslintrc.cjs --ext .js,.ts,.cjs,.tsx test/ --cache",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"files": [
"es",
"types",
"tailwind.cjs",
"tailwind.config.cjs"
],
"devDependencies": {
"@codemirror/lang-html": "^6.4.5",
"@storybook/addon-essentials": "7.4.0",
"@storybook/addon-interactions": "7.4.0",
"@storybook/addon-links": "7.4.0",
"@storybook/addon-styling": "1.3.7",
"@storybook/blocks": "7.4.0",
"@storybook/react": "7.4.0",
"@storybook/react-vite": "7.4.0",
"@storybook/testing-library": "0.2.2",
"@vitejs/plugin-react": "4.1.1",
"c8": "8.0.1",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-refresh": "0.4.3",
"eslint-plugin-tailwindcss": "3.13.0",
"mocha": "10.2.0",
"rollup-plugin-node-builtins": "2.1.2",
"sinon": "17.0.0",
"ts-node": "10.9.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"storybook": "7.4.0",
"typescript": "5.2.2",
"vite": "4.5.0",
"vite-plugin-svgr": "3.3.0"
},
"dependencies": {
"@dnd-kit/core": "6.0.8",
"@dnd-kit/sortable": "7.0.2",
"@ebay/nice-modal-react": "1.2.13",
"@sentry/react": "7.78.0",
"@tailwindcss/forms": "0.5.6",
"@tailwindcss/line-clamp": "0.4.4",
"@uiw/react-codemirror": "^4.21.9",
"autoprefixer": "10.4.16",
"clsx": "2.0.0",
"postcss": "8.4.31",
"postcss-import": "15.1.0",
"react-colorful": "^5.1.2",
"react-hot-toast": "2.4.1",
"react-select": "5.8.0",
"tailwindcss": "3.3.5"
},
"peerDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
}
Loading

0 comments on commit dd254bf

Please sign in to comment.