diff --git a/.github/scripts/dev.js b/.github/scripts/dev.js index e022c50b55c..5ff1f1bcbd5 100644 --- a/.github/scripts/dev.js +++ b/.github/scripts/dev.js @@ -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')) { diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f42641eaafa..eb0620a7200 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: @@ -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: @@ -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" @@ -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" @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: diff --git a/apps/admin-x-design-system/.eslintrc.cjs b/apps/admin-x-design-system/.eslintrc.cjs new file mode 100644 index 00000000000..27d400ede58 --- /dev/null +++ b/apps/admin-x-design-system/.eslintrc.cjs @@ -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'}] + } +}; diff --git a/apps/admin-x-design-system/.gitignore b/apps/admin-x-design-system/.gitignore new file mode 100644 index 00000000000..62ac7b71aa7 --- /dev/null +++ b/apps/admin-x-design-system/.gitignore @@ -0,0 +1,2 @@ +es +types diff --git a/apps/admin-x-settings/src/admin-x-ds/assets/fonts/Inter.ttf b/apps/admin-x-design-system/.storybook/Inter.ttf similarity index 100% rename from apps/admin-x-settings/src/admin-x-ds/assets/fonts/Inter.ttf rename to apps/admin-x-design-system/.storybook/Inter.ttf diff --git a/apps/admin-x-settings/.storybook/adminx-theme.tsx b/apps/admin-x-design-system/.storybook/adminx-theme.tsx similarity index 100% rename from apps/admin-x-settings/.storybook/adminx-theme.tsx rename to apps/admin-x-design-system/.storybook/adminx-theme.tsx diff --git a/apps/admin-x-settings/.storybook/main.tsx b/apps/admin-x-design-system/.storybook/main.tsx similarity index 59% rename from apps/admin-x-settings/.storybook/main.tsx rename to apps/admin-x-design-system/.storybook/main.tsx index c80dfe7b948..53b7664ef08 100644 --- a/apps/admin-x-settings/.storybook/main.tsx +++ b/apps/admin-x-design-system/.storybook/main.tsx @@ -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: [ @@ -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; diff --git a/apps/admin-x-settings/.storybook/manager.tsx b/apps/admin-x-design-system/.storybook/manager.tsx similarity index 100% rename from apps/admin-x-settings/.storybook/manager.tsx rename to apps/admin-x-design-system/.storybook/manager.tsx diff --git a/apps/admin-x-settings/.storybook/preview.tsx b/apps/admin-x-design-system/.storybook/preview.tsx similarity index 76% rename from apps/admin-x-settings/.storybook/preview.tsx rename to apps/admin-x-design-system/.storybook/preview.tsx index 268a8befcda..6f1dfede995 100644 --- a/apps/admin-x-settings/.storybook/preview.tsx +++ b/apps/admin-x-design-system/.storybook/preview.tsx @@ -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: { @@ -33,12 +31,12 @@ const preview: Preview = { let {scheme} = context.globals; return ( -
Here you can find our design guidelines, component documentation, and resources for building apps in Ghost Admin.
-