Skip to content

Commit

Permalink
Seat 285 (#233)
Browse files Browse the repository at this point in the history
* SEAT-285: Upgrade Build and Dependencies

- chore: Switched to pnpm
- deps: Updated build dependencies
- deps: Declared peer dependencies
- build: Switched from Webpack to tsup
- refactor: Changed package exports structure
- feat: Added ESM and CJS builds
- dev: Added bundle analyzer
- types: Added TypeScript definitions to build

* SEAT-285: moved source to workspace

* SEAT-285: Initialize Monorepo and Enhance Developer Tools

- build: Configured monorepo setup
- deps: Updated linting dependencies
- dev: Added Husky for pre-commit hooks
- chore: Implemented changesets for versioning and changelogs

* SEAT-285: linting/ts fixes

* SEAT-285: repo clean up
chore: package build configs clean up
tests: extracted mock-data into a separate package

* SEAT-285: extracted examples into isolated packages

* SEAT-285: test fixes, started migration to react-testing-library

* SEAT-285: configured CI

* SEAT-285: pre push hook fix

* SEAT-285: fix for trunk branch name

* Update publish.yml

* SEAT-285: fix ci check-ts step

* SEAT-285: fix ci test step

* Update publish.yml

---------

Co-authored-by: Keith River <[email protected]>
Co-authored-by: Matt Coneybeare <[email protected]>
  • Loading branch information
3 people authored Nov 27, 2023
1 parent 4616e37 commit df611b3
Show file tree
Hide file tree
Showing 110 changed files with 13,220 additions and 15,379 deletions.
5 changes: 0 additions & 5 deletions .babelrc

This file was deleted.

8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/fluffy-oranges-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ticketevolution/seatmaps-client": major
---

Updated dependencies, changed build tools and package structure
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

39 changes: 0 additions & 39 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,5 @@
"env": {
"node": true,
"browser": true
},
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"standard",
"standard-react"
],
"plugins": [
"@typescript-eslint",
"react"
],
"settings": {
"react": {
"version": "16.8"
}
},
"globals": {
"fetchMock": "readonly"
},
"rules": {
"no-unused-expressions": [
"error",
{
"allowShortCircuit": true,
"allowTernary": true
}
],
"no-plusplus": "off",
"indent": "off",
"@typescript-eslint/indent": [
"error",
2
],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/member-delimiter-style": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"camelcase": "off"
}
}
19 changes: 19 additions & 0 deletions .github/actions/ci-checks/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "CI checks"
runs:
using: "composite"
steps:
- name: Build
run: pnpm run build
shell: bash

- name: Typecheck
run: pnpm run check-ts
shell: bash

- name: Lint
run: pnpm run lint
shell: bash

- name: Test
run: pnpm run test
shell: bash
17 changes: 17 additions & 0 deletions .github/actions/ci-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "CI setup"
runs:
using: "composite"
steps:
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Use pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Install Dependencies
run: pnpm install --frozen-lockfile
shell: bash
16 changes: 16 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- "**"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/ci-setup
- uses: ./.github/actions/ci-checks
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish
on:
workflow_run:
workflows: ["CI"]
types:
- completed
push:
branches:
- master

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
publish:
if: github.repository == 'ticketevolution/seatmaps-client' && github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.TEVO_GITHUB_TOKEN_GENERATOR_APP_ID }}
private-key: ${{ secrets.TEVO_GITHUB_TOKEN_GENERATOR_PRIVATE_KEY }}

- uses: actions/checkout@v3

- uses: ./.github/actions/ci-setup

- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
publish: pnpm run release
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
NPM_TOKEN: ${{ secrets.TEVO_NPM_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ cors.json
src/parse.js
.eslintcache
.stlelintcache

stats
cjs
esm
umd
.turbo
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm run pre-push-hook
2 changes: 1 addition & 1 deletion .nvm
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.15.0
18.12.1
4 changes: 4 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import("prettier").Config} */
module.exports = {
endOfLine: 'lf',
};
44 changes: 44 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Contributing

Thanks for your interest in @ticketevolution/seatmaps-client. All forms of contribution are
welcome, from issue reports to PRs and documentation / write-ups.

## Development

This repository uses a monorepo structure and consists of multiple packages.

### Tooling

- [PNPM](https://pnpm.io/) to manage packages and dependencies
- [Turborepo](https://turbo.build/) to simplify running scripts in monorepo and configure scripts dependencies.
- [Tsup](https://tsup.egoist.dev/) to bundle packages
- [Testing Library](https://testing-library.com/) for testing components and
hooks
- [Changesets](https://github.com/atlassian/changesets) for changes
documentation, changelog generation, and release management.

### Commands

**`pnpm install`**: installs project dependencies

**`pnpm dev`**: starts dev environment

**`pnpm run-examples`**: starts http servers for usage examples

**`pnpm changeset`**: create a new changeset to describe the changes you are making in the PR. NOTE: do not update package versions manually, changeset will do the correct bump in release PR based on accumulated changes.

**`pnpm build`**: run build for all publishable packages.

**`pnpm test`**: run test for all packages.

## NPM Release

This project uses [Changesets](https://github.com/atlassian/changesets) to manage npm releases.

For new version of the package to be released:

1. PR with changes and a new changeset file should be merged to the master branch.

2. Changeset github action will then open a new PR with all changesets merged into a chengelog and package versions changed.

3. Once PR with updated changelog is merged, changeset github action will publish all changed packages.
34 changes: 12 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,22 @@ RESET_COLOR=\x1b[0m
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

install: ## Install client and server side packages for development
install: ## Install packages for development
@echo "Installing project dependencies..."
npm install
pnpm install

clean: ## Remove temporary files generated by the build and tests
rm -rf ./coverage
rm -rf ./build

clean-all: clean ## Remove all temporary files plus installed dependencies
rm -rf ./node_modules

start: build ## Start the development server
dev: ## Start the development server
@echo "\n\n\nStarting development server...\n\n\n"
npm start
pnpm dev

build: install clean ## Build the project
npm run check
npm run build
lint: ## Lint with eslint
pnpm lint

analyze: ## Run the webpack analyzer
npm analyze
@echo "\nOpen $(MAGENTA_COLOR)http://webpack.github.io/analyse/$(RESET_COLOR) in your browser and upload the stats.json file!"
@echo "$(BLUE_COLOR)(Tip: CMD + double-click the link!)$(RESET_COLOR)\n"
check-ts: ## Check ts types
pnpm check-ts

copy-to-shell: build ## Build seatmaps and drop it into your local Shell instance
docker cp build/. shell_app_1:/usr/src/shell/node_modules/ticket-evolution-seatmaps/build
test: ## Run jest tests
pnpm test

copy-to-core: build ## Build seatmaps and drop it into your local Core instance
cp -r build /Users/Shared/workspace/pos/node_modules/ticket-evolution-seatmaps
build: ## Build the project
pnpm build
Loading

0 comments on commit df611b3

Please sign in to comment.