Skip to content

Commit

Permalink
Monorepo setup (datopian#241)
Browse files Browse the repository at this point in the history
Changes:

- adds Nx to the repo,
- configures Nx Cloud distributed caching
- moves templates/default to packages/template
- creates packages/template-e2e package for template's e2e tests
- moves playwright dependency to the root, so that it can be used for other projects in the future
- changes the bash setup script to use the temporary directory, where the template and content fixture are copied and symlinked, so that the setup script doesn't ever touch the original template codebase and we don't need to clean up (i.e. revert symlinks to the original ones) after the tests have run,
- moves lint-staged, husky, changesets and playwright to the root
- adds basic info related to Nx and changesets in README.dev.md
- adds a note about Nx basics in content/notes/Nx.md
- renames the CLI to namespaced @flowershow/cli
- recommended package manager: pnpm
  • Loading branch information
olayway authored Nov 8, 2022
1 parent 0fd94dc commit 5fff379
Show file tree
Hide file tree
Showing 148 changed files with 23,425 additions and 16,880 deletions.
File renamed without changes.
8 changes: 8 additions & 0 deletions .changeset/clean-pots-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@flowershow/template": minor
---

Added:

- Table of Contents Component
- Option in config to enable ToC (all pages or specific folders)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"default": minor
"@flowershow/template": minor
---

Add remark callouts plugin and use it in docs by replacing callout components.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
}
5 changes: 0 additions & 5 deletions .changeset/good-flowers-relate.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'default': patch
"@flowershow/template": patch
---

Fix: imports of components that use 3rd party libraries into MDX files.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"default": minor
"@flowershow/template": minor
---

playwright feature testing added to make sure everything works as expected on changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"default": patch
"@flowershow/template": patch
---

option in config to keep some files/folders unpublished
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
'default': minor
"@flowershow/template": minor
---

Update documentation for:

- how to set Navbar title and logo
- how to disable dark/light theme modes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"default": minor
"@flowershow/template": minor
---

Linting and formatting configuration.
46 changes: 46 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"root": true,
"ignorePatterns": ["node_modules"],
"plugins": ["@nrwl/nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"rules": {
"no-unused-vars": "error",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-empty-function": "off"
}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"env": {
"jest": true
},
"rules": {}
}
]
}
28 changes: 28 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: E2E

on: [push]

jobs:
main:
timeout-minutes: 10
runs-on: ubuntu-latest

strategy:
matrix:
node: [16, 18]

name: Node ${{ matrix.node }} test

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: "recursive"
- uses: nrwl/nx-set-shas@v3
- run: npm ci
- run: sudo apt-get install -y expect
- run: npx playwright install --with-deps
- name: Run tests
env:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
run: npx nx affected --target=e2e --parallel=2
16 changes: 16 additions & 0 deletions .github/workflows/eslint-prettier-workspace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Eslint and prettier

on: [push]

jobs:
main:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: nrwl/nx-set-shas@v3
- run: npm ci
- run: npx nx workspace-lint
- run: npx nx format:check
33 changes: 0 additions & 33 deletions .github/workflows/test-e2e-app.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/test-e2e-cli.yml

This file was deleted.

56 changes: 54 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,54 @@
.obsidian
sandbox/*
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc
.contentlayer
.next
out

# dependencies
node_modules/

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
.obsidian/

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.angular/cache
/.sass-cache
/.eslintcache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db

# Secrets
*.env

# Next.js
.next
/test-results/
/playwright-report/
/playwright/.cache/
12 changes: 6 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "packages/cli/e2e/bats"]
path = packages/cli/e2e/bats
[submodule "packages/cli/src/e2e/bats"]
path = packages/cli/src/e2e/bats
url = https://github.com/bats-core/bats-core.git
[submodule "packages/cli/e2e/test_helper/bats-support"]
path = packages/cli/e2e/test_helper/bats-support
[submodule "packages/cli/src/e2e/test_helper/bats-support"]
path = packages/cli/src/e2e/test_helper/bats-support
url = https://github.com/bats-core/bats-support.git
[submodule "packages/cli/e2e/test_helper/bats-assert"]
path = packages/cli/e2e/test_helper/bats-assert
[submodule "packages/cli/src/e2e/test_helper/bats-assert"]
path = packages/cli/src/e2e/test_helper/bats-assert
url = https://github.com/bats-core/bats-assert.git
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion templates/default/.husky/pre-commit → .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

cd ./templates/default && npx lint-staged
npx lint-staged
File renamed without changes.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auto-install-peers=true
Loading

0 comments on commit 5fff379

Please sign in to comment.