Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Nx monorepo #2

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
indent_style = tab
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 100

[{package.json,*.yml,*.md}]
indent_size = 2
indent_style = space

[*.md]
trim_trailing_whitespace = false
26 changes: 0 additions & 26 deletions .eslintrc.js

This file was deleted.

48 changes: 48 additions & 0 deletions .git-hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
# Script adapted from https://github.com/kaczor6418/git-hooks-example/blob/master/git-hooks/pre-commit

# Support using VSCode to commit
# This loads nvm.sh and sets the correct PATH before running hook
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

# This take the current active node version you want to verify the hook
export NVM_DIR="$HOME/.nvm"
a=$(nvm current)

export PATH="$NVM_DIR/versions/node/$a/bin:$PATH"

# Define colours for nicer CLI output
RED="\033[1;31m"
GREEN="\033[1;32m"
NO_COLOUR="\033[0m"

echo -e "${GREEN} Executing git hook $0 $@ ${NO_COLOUR}"

commands=("npx nx affected -t lint, check-types --parallel=2" "npx nx affected:test --coverage")
failures=()

# Loop over commands, execute and push failure message if we see one
for cmd in "${commands[@]}"; do
$cmd
exit_code=$?

if [ "$exit_code" -eq 1 ]; then
failures+=("✖ Command ${RED}'${cmd}'${NO_COLOUR} failed with exit code ${exit_code} - see CLI output for errors")
elif [ "$exit_code" -eq 127 ]; then
failures+=("✖ Command ${RED}'${cmd}'${NO_COLOUR} failed with exit code ${exit_code} - check that the script exists in package.json")
elif [ "$exit_code" -ne 0 ]; then
failures+=("✖ Command ${RED}'${cmd}'${NO_COLOUR} failed with unexpected exit code ${exit_code}")
fi
done

# Report overall success or failure
if [ ${#failures[@]} -ne 0 ]; then
echo -e "\n🚩${RED} Couldn't commit changes dues to the following errors: ${NO_COLOUR}"

for report in "${failures[@]}"; do
echo -e $report;
done

exit 1
fi
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'monthly'
open-pull-requests-limit: 10
commit-message:
prefix: 'TCS-3'
groups:
minor-and-patch:
applies-to: version-updates
patterns:
- '*'
update-types:
- 'minor'
- 'patch'
41 changes: 41 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on:
pull_request:
branches:
- '**' # Trigger on all branches

permissions:
actions: read
contents: read

jobs:
code-quality:
name: 🕵️‍♀️ Code Quality Check
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}

- name: Fetch target
run: git fetch origin ${{ github.event.pull_request.base.ref }}

- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install
run: npm ci

- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v4

- name: ⚙️ Run Tests
run: npx nx affected -t lint test --parallel=2

- name: ⚙️ Run Build
run: npx nx affected -t build
58 changes: 41 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,49 @@
# package directories
node_modules
jspm_packages
# See http://help.github.com/ignore-files/ for more about ignoring files.

# Serverless directories
.serverless
# Environment
*.env

# ESBuild directories
# Compiled output
dist
tmp
/out-tsc
coverage
.build

# IDE folders
vscode
.vscode
# Dependencies
node_modules
jspm_packages

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

# Localstack directories
.localstack
# IDE - VSCode
.vscode/*
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

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

# System Files
.DS_Store
Thumbs.db

# Environment Variables
config.json
config.*.json
# Nx cache
.nx/cache
.nx/workspace-data

dist/
vite.config.*.timestamp*
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v22.10.0
13 changes: 13 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Add files here to ignore them from prettier formatting
**/dist
**/coverage

# nx format always picks this up and reformats
# this file even if there's no issues, so we ignore it
tsconfig.base.json

# lock file is autogenerated
pnpm-lock.yaml
package-lock.json

/.nx/cache
28 changes: 28 additions & 0 deletions .verdaccio/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# path to a directory with all packages
storage: ../tmp/local-registry/storage

# a list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/
maxage: 60m

packages:
'**':
# give all users (including non-authenticated users) full access
# because it is a local registry
access: $all
publish: $all
unpublish: $all

# if package is not available locally, proxy requests to npm registry
proxy: npmjs

# log settings
log:
type: stdout
format: pretty
level: warn

publish:
allow_offline: true # set offline to true to allow publish offline
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
47 changes: 0 additions & 47 deletions bitbucket-pipelines.yml

This file was deleted.

Loading