Skip to content

Commit

Permalink
chore: rename digita-ai to useid (#191)
Browse files Browse the repository at this point in the history
* chore: rename digita-ai to useid

* chore: rename code workspace file WIP

* chore: bump node version in nvmrc

* fix: dependency issues WIP

* chore: remove semcom from dgt-components

* chore: whitespaces

* chore: bump node in CI

* chore: update ci.yml

* build: update CI

* build: update CI

* fix: test errors

* fix: tests

* fix: linting in dgt-utils

* fix: linting

* fix: linting in dgt-components

* fix dgt-components: build errors

* chore: update husky config

---------

Co-authored-by: Stijn Taelemans <[email protected]>
  • Loading branch information
BelgianNoise and lem-onade authored Aug 8, 2023
1 parent 4ef1192 commit e35a7c7
Show file tree
Hide file tree
Showing 134 changed files with 32,354 additions and 35,471 deletions.
40 changes: 22 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ jobs:

- name: Extract tag
id: extract-tag
run: echo "::set-output name=tag::${GITHUB_REF/refs\/tags\//}"
run: echo "tag=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT

- name: Check tag
run: echo ${{ steps.extract-tag.outputs.tag }}

- name: Extract branch
id: extract-branch
run: echo "::set-output name=branch::${GITHUB_REF/refs\/heads\//}"
run: echo "branch=${GITHUB_REF/refs\/heads\//}" >> $GITHUB_OUTPUT

- name: Check branch
run: echo ${{ steps.extract-branch.outputs.branch }}

- uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18
registry-url: https://npm.pkg.github.com

- run: npm run bootstrap
Expand Down Expand Up @@ -87,35 +87,39 @@ jobs:
needs: release
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18
registry-url: https://npm.pkg.github.com/

- name: Install dependencies
run: npm run bootstrap
env:
NODE_AUTH_TOKEN: ${{ secrets.GA_TOKEN }}

- run: npm run build:all

- run: npm publish packages/dgt-components
env:
NODE_AUTH_TOKEN: ${{ secrets.GA_TOKEN }}

- run: npm publish packages/semcom-components

- run: |
cd packages/dgt-theme
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GA_TOKEN }}

- run: npm publish packages/dgt-theme
- run: |
cd packages/dgt-utils-core
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GA_TOKEN }}

- run: npm publish packages/dgt-utils
- run: |
packages/dgt-utils
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GA_TOKEN }}

- run: npm publish packages/dgt-utils-core
- run: |
packages/dgt-components
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GA_TOKEN }}
75 changes: 2 additions & 73 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

. "$(dirname $0)/_/husky.sh"

Expand All @@ -22,75 +22,4 @@ if [[ -z "$STAGED" && -z "$MERGE" ]] ; then
fi

## Lint commit message
echo "[COMMIT-MSG Hook] Linting commit message" && ./node_modules/.bin/commitlint --edit $1

## Check for WIP mention
if (grep -qe "WIP" $1); then

## If WIP, skip tests
echo "[COMMIT-MSG Hook] Found WIP mention => Skipping tests"

else

## If no WIP, run tests
echo "[COMMIT-MSG Hook] No WIP mention found"

if [[ -n "$MERGE" ]] ; then
echo "[COMMIT-MSG Hook] Saved ongoing merge status"
fi

if [[ -n "$STAGED" ]] ; then
echo "[COMMIT-MSG Hook] Stashing working tree"
STASH="pre-commit hook test on $(date '+%F %T')" && git stash push -qukm "$STASH"
fi

echo "[COMMIT-MSG Hook] Running tests"

## Build list of previous WIP changes
LIST=""
NEW=$(git rev-parse HEAD)
while [[ -n "$NEW" ]] ; do
LIST=$(echo "$LIST" ; echo "$NEW")
NEW=$(echo "$NEW" | sed -e 's/^\(.*\)$/\1\^@/g' | xargs git rev-list --no-walk -E --grep="WIP")
done

RELEVANT="$(echo "$LIST" | xargs -L1 git diff-tree --no-commit-id --name-only -r | sort -u ; echo "$STAGED")"

## Install root dependencies if package.json changed
echo "$RELEVANT" | grep -q "^package.json$" && npm i

## Bootstrap packages with changed package.json
PACKAGES=$(echo "$RELEVANT" | grep "package.json$" | grep -v "^package.json$" | xargs cat | grep name
echo "$PACKAGES" | sed 's/.*"name": "\(.*\)".*/--scope "\1"/g') | xargs ./node_modules/.bin/lerna bootstrap --since HEAD

## Run tests related to staged files
echo "$RELEVANT" | xargs ./node_modules/.bin/jest --bail --coverage --silent --passWithNoTests --findRelatedTests

if [[ $? -ne 0 ]] ; then
echo "[COMMIT-MSG Hook] You tried to commit changes without a WIP mention,"
echo "[COMMIT-MSG Hook] but tests related to staged files or yet untested WIP commits are failing."
echo "[COMMIT-MSG Hook] Resolve the remaining issues or commit current changes as WIP."
fi

echo "[COMMIT-MSG Hook] Resetting the stage"

## Reset tracked files & clean untracked files
git reset --hard
git clean -df

if [[ -n "$STAGED" ]] ; then
echo "[COMMIT-MSG Hook] Restoring working tree"
git stash list | grep -q "$STASH" && git stash pop -q --index
fi

if [[ -n "$MERGE" ]] ; then
echo "[COMMIT-MSG Hook] Restoring ongoing merge status"
git update-ref MERGE_HEAD "$MERGE"
if [[ -n "$M_MSG" ]] ; then
echo "$M_MSG" > .git/MERGE_MSG
fi
fi

exit $TESTS

fi
echo "[COMMIT-MSG Hook] Linting commit message" && pnpm commitlint --edit $1
6 changes: 0 additions & 6 deletions .husky/pre-commit

This file was deleted.

8 changes: 4 additions & 4 deletions .husky/pre-push
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
#!/bin/bash

. "$(dirname $0)/_/husky.sh"

REGEX="^(main|next|release(release|feat|fix|test|chore|build|docs)\/[a-zA-Z0-9\-]+)$"
REGEX="^((master|develop|release|(release|feat|fix|docs|test|chore|build|docs)\/|snyk-)[a-zA-Z0-9\.\-]+)$"

REMOTE="$1"
URL="$2"
Expand All @@ -12,7 +12,7 @@ do

BRANCH=$(git rev-parse --abbrev-ref "$L_REF")

if [[ "$R_SHA" = "$(printf "%040d")" ]] ; then
if [ "$R_SHA" = "$(printf "%040d")" ] ; then

# Check branch name convention
if ! (echo "$BRANCH" | grep -qE "$REGEX") ; then
Expand All @@ -24,4 +24,4 @@ do

fi

done
done
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@digita-ai:registry=https://npm.pkg.github.com
@useid:registry=https://npm.pkg.github.com
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
18
Loading

0 comments on commit e35a7c7

Please sign in to comment.