Skip to content

Commit

Permalink
Merge pull request #446 from layer5io/431-single-pkg
Browse files Browse the repository at this point in the history
refactor: change to single package repo
  • Loading branch information
nebula-aac authored Jan 31, 2024
2 parents 2e5995f + f8a4e38 commit eb7b8fd
Show file tree
Hide file tree
Showing 547 changed files with 35,899 additions and 27,587 deletions.
11 changes: 11 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ categories:
- 'kind/chore'
- 'chore'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
version-resolver:
major:
labels:
- "major"
minor:
labels:
- "minor"
patch:
labels:
- "patch"
default: patch
template: |
## What's New
$CHANGES
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@ jobs:
node-version: [16, 18, 20]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Setup and install deps
run: |
yarn install
npm install
- name: Prettier check
run: |
yarn format:check
npm run format:check
- name: Build
run: |
yarn run build-all
npm run build
- name: Test
run: |
npm run test
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: yarn install
run: npm install

- name: Run Lint
run: yarn lint
run: npm run lint
76 changes: 0 additions & 76 deletions .github/workflows/pre-release.yml

This file was deleted.

117 changes: 40 additions & 77 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,82 +1,45 @@
name: Version and Publish to NPM
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

on:
workflow_dispatch:
inputs:
version:
description: 'Specify the version type (path, minor, major)'
required: true
default: 'patch'
name: Publish Node.js Package

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASEDRAFTER_PAT }}
ref: 'master'

- name: Setup Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
scope: "@layer5"
on:
release:
types: [published]
workflow_dispatch:
inputs:
release-version:
required: true

- name: Install deps and build
run: |
yarn
yarn build-all
- name: Initialize the NPM config
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_AUTH: ${{ secrets.GH_TOKEN }}

- name: Initialize Git User
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor}}@users.noreply.github.com"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{secrets.GH_TOKEN}}

- name: Identify changed packages
id: changed-packages
run: |
echo "Changed packages: $(yarn lerna changed --json | jq -r '.[].name')"
- uses: actions/setup-node@v3
with:
node-version: 18
- run: |
npm install
- name: Check if there are changed packages
run: |
echo "Changed packages: ${{ steps.changed-packages.outputs.changed-packages }}"
if: steps.changed-packages.outputs.changed-packages != ''

- name: Version packages
run: |
if [ "${{ github.event.inputs.version }}" != 'none' ]; then
./scripts/version-release.sh "${{ steps.changed-packages.outputs.changed-packages }}"
else
echo "Skipping versioning based on input."
fi
- name: Use git-auto-commit-action
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'chore: publish'
commit_user_name: l5io
commit_user_email: [email protected]
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
commit_options: '--signoff'

- name: Create Git tags
run: ./scripts/create-multiple-git-tag.sh

- name: Publish packages
run: make publish-ci
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_AUTH: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-gpr:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
token: ${{secrets.GH_TOKEN}}
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
scope: "@layer5"
- run: npm publish --verbose
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/storybook-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ jobs:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: yarn install
run: npm install

- name: Build Storybook
run: |
cd apps/design-system
yarn install
yarn build-storybook
npm install
npm build-storybook
- name: Deploy Storybook
uses: peaceiris/actions-gh-pages@v3
Expand Down
9 changes: 0 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,7 @@ dist/**
packages/dist/**
packages/design-system/node_modules/**

.yarn/*
.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

**/storybook-static/**
lerna-debug.log
pub.sh
.eslintcache

Expand Down
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn commitlint --edit ${1}
npx commitlint --edit ${1}
28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.3.cjs

This file was deleted.

13 changes: 0 additions & 13 deletions .yarnrc.yml

This file was deleted.

16 changes: 15 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,21 @@ For example:
- `feat(auth): add user authentication feature`
- `fix(ui): resolve styling issue in the header`

Please ensure that your commits adhere to this format to maintain a clear and organized commit history.
Please ensure that your commits adhere to this format to maintain a clear and organized commit history. This repo also uses `commitizen` and `commitlint` to make sure that you are adhering the rules in writing a commit.

To write a commit message for this repo, each commit should have the following above, which includes the type, an optional scope, and a descriptive message.

- `style`: Since we're using `prettier` and `eslint` to fix formatting and linting styles, you can write your commit message like so:

`style(repo): use prettier and eslint to lint and format`

or `style: format files`.

The above will just write a commit message without a scope.

- `feat`: When using this commit type, we're introducing a new feature into the repo. This feature has never been used, and will require a `minor` version to be used.
- `fix`: When usin this commit type, we're introducing backward compatibility fixes to the existing repo. To help have a clean git commit, it would be better to create new features, and then work on fixing them to make meaningful releases.
- `docs`: This is specific to any of the documentations, like Markdown files.

#### Tests

Expand Down
24 changes: 8 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,28 @@

## Install Sistent dependencies your local machine.
package-setup:
yarn install
npm install

## Build Sistent components and packages on your local machine.
package-build: setup
yarn run build-all
npm run build

package-format-check:
yarn run format:check
npm run format:check

package-format-fix:
yarn run format:write
npm run format:write

.PHONY: version-patch version-minor version-major version-alpha
.PHONY: version-patch version-minor version-major

# Create a patch version of packages
version-patch:
yarn run versionup:patch
npm run versionup:patch

# Create a minor version of packages
version-minor:
yarn run versionup:minor
npm run versionup:minor

# Create a major versio of packages
version-major:
yarn run versionup:major

# Create beta version of the next minor version
# For example: 0.12.0 => 0.13.0-alpha.0
version-alpha:
yarn run version:alpha

publish-ci:
yarn release-latest:ci
npm run versionup:major
Loading

0 comments on commit eb7b8fd

Please sign in to comment.