Skip to content

Build tooling #1807

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

Merged
merged 26 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
165 changes: 15 additions & 150 deletions .github/workflows/nodejs.yml → .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node.js CI
name: Pull Request CI

on:
pull_request:
Expand All @@ -9,80 +9,9 @@ concurrency:
cancel-in-progress: true

jobs:
install:
name: Install node modules
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'

- name: Install
run: yarn install --frozen-lockfile --prefer-offline

outputs:
yarn-cache-dir: ${{ steps.get-yarn-cache-dir.outputs.dir }}

lints:
lint:
name: Check lints
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v2

- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'

- run: yarn install --frozen-lockfile --prefer-offline

- name: prettier
run: yarn check:prettier

- name: eslint
run: yarn check:eslint --format junit -o reports/junit/js-lint-results.xml

types:
name: Check types
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v2

- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'

- run: yarn install --frozen-lockfile --prefer-offline

- uses: actions/cache/restore@v3
name: Restore TS cache
id: ts-cache
with:
path: |
**/dist/**/*.ts
!**/node_modules
key: ${{ runner.os }}-ts-cache-${{ hashFiles('**/tsconfig.js', '**/package.tsconfig.js', '**/src/', '**/scripts/', '!**/node_modules', '!**/dist') }}

- name: types
run: yarn check:ts

deps:
name: Check dependency list
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v2

Expand All @@ -95,16 +24,15 @@ jobs:

- run: yarn install --frozen-lockfile --prefer-offline

- name: deps
run: yarn check:deps
- name: lint
run: yarn lint

- name: package.json versions
run: yarn check:package-json
outputs:
yarn-cache-dir: ${{ steps.get-yarn-cache-dir.outputs.dir }}

build:
name: Build packages
runs-on: ubuntu-latest
needs: [install, lints]
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -132,44 +60,12 @@ jobs:

- name: build
if: ${{ steps.build-cache.outputs.cache-hit != 'true' }}
run: yarn build:packages

build-ts:
name: Build TypeScript
runs-on: ubuntu-latest
needs: [install, lints]
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v3
name: Check for ts cache
id: ts-cache
with:
path: |
**/dist/**/*.ts
!**/node_modules
key: ${{ runner.os }}-ts-cache-${{ hashFiles('**/tsconfig.js', '**/package.tsconfig.js', '**/src/', '**/scripts/', '!**/node_modules', '!**/dist') }}

- name: Use Node.js 16
if: ${{ steps.ts-cache.outputs.cache-hit != 'true' }}
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'

- name: Install
if: ${{ steps.ts-cache.outputs.cache-hit != 'true' }}
run: yarn install --frozen-lockfile --prefer-offline

- name: build-ts
if: ${{ steps.ts-cache.outputs.cache-hit != 'true' }}
run: yarn build:ts
run: yarn build

chromatic:
name: Chromatic
runs-on: ubuntu-latest
needs: [install, build]
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -205,7 +101,7 @@ jobs:
tests:
name: Run tests
runs-on: ubuntu-latest
needs: [install, build]
needs: [build]
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -235,7 +131,7 @@ jobs:
tests-ssr:
name: Run tests with artificial server rendering
runs-on: ubuntu-latest
needs: [install, build]
needs: [build]
steps:
- uses: actions/checkout@v2

Expand All @@ -262,10 +158,10 @@ jobs:
env:
JEST_JUNIT_OUTPUT: 'reports/junit/js-test-ssr-results.xml'

checkBuilds:
name: Verify builds
validate-builds:
name: Validate builds & dependencies
runs-on: ubuntu-latest
needs: [install, build, build-ts]
needs: [build]
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -296,36 +192,5 @@ jobs:
!**/node_modules
key: ${{ runner.os }}-ts-cache-${{ hashFiles('**/tsconfig.js', '**/package.tsconfig.js', '**/src/', '**/scripts/', '!**/node_modules', '!**/dist') }}

- name: check builds
run: yarn check:builds

sizeDiff:
name: Check file size
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v2

- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'

- run: yarn install --frozen-lockfile --prefer-offline

- uses: actions/cache/restore@v3
name: Restore build cache
id: build-cache
with:
path: |
**/dist
!**/node_modules
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/rollup.config.js', '**/babel.config.js', '**/src/', '**/scripts/', '!**/node_modules', '!**/dist') }}

- uses: preactjs/compressed-size-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
clean-script: 'clean:builds && clean:modules'
build-script: 'build:packages'
- name: validate
run: yarn validate
36 changes: 36 additions & 0 deletions .github/workflows/sizeDiff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: File Size

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
sizeDiff:
name: Check file size
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'

- run: yarn install --frozen-lockfile --prefer-offline

- uses: actions/cache/restore@v3
name: Restore build cache
id: build-cache
with:
path: |
**/dist
!**/node_modules
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/rollup.config.js', '**/babel.config.js', '**/src/', '**/scripts/', '!**/node_modules', '!**/dist') }}

- uses: preactjs/compressed-size-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
clean-script: 'clean'
build-script: 'build'
20 changes: 0 additions & 20 deletions .github/workflows/test-dispatch.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ packages/**/stories.js*

# Storybook/Chromatic logs
build-storybook.log

.turbo
2 changes: 1 addition & 1 deletion .npmpackagejsonlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"patterns": ["./packages/code/package.json"],
"rules": {
"prefer-caret-version-dependencies": "warning"
"prefer-caret-version-dependencies": "off"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"lerna": "3.4.3",
"lerna": "7.0.2",
"packages": ["packages/*"],
"version": "independent",
"command": {
Expand Down
31 changes: 14 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,17 @@
"scripts": {
"init": "yarn && yarn build",
"create-package": "node ./scripts/create-package.js",
"pre-build": "node ./scripts/pre-build.js",
"build": "npm-run-all --serial \"build:* {@}\" --",
"build:packages": "npx ts-node ./scripts/build.ts",
"build:ts": "lerna exec -- tsc --build",
"build": "turbo run build tsc",
"build:turbo": "turbo run build tsc",
"build-storybook": "storybook build",
"check": "npm-run-all --parallel check:*",
"check:prettier": "prettier --check \"**/*.{js,ts,tsx,json,md,yml}\"",
"check:eslint": "eslint \"**/*.{js,ts,tsx}\"",
"check:deps": "npx ts-node ./scripts/depcheck.ts",
"check:builds": "npx ts-node ./scripts/check-builds.ts",
"check:ts": "lerna exec -- tsc --build",
"check:package-json": "npmPkgJsonLint ./packages",
"chromatic": "npx chromatic --build-script='build-storybook'",
"build:docs": "npx ts-node ./scripts/parse-tsdocs.ts",
"lint": "npm-run-all --parallel lint:*",
"lint:prettier": "prettier --check \"**/*.{js,ts,tsx,json,md,yml}\"",
"lint:eslint": "eslint \"**/*.{js,ts,tsx}\"",
"chromatic": "npx chromatic",
"clean": "yarn clean:builds && yarn clean:modules",
"clean:builds": "rm -rf packages/*/dist packages/*/tsconfig.tsbuildinfo ./tsconfig.tsbuildinfo packages/**/stories.js",
"clean:modules": "rm -rf node_modules packages/*/node_modules ",
"demo:storybook": "storybook build && ./scripts/demo-storybook.sh",
"docs:tsdoc": "npx ts-node ./scripts/parse-tsdocs.ts",
"docs:proptypes": "npx ts-node ./scripts/proptypes.ts",
"fix": "npm-run-all --parallel fix:*",
"fix:prettier": "prettier --write \"**/*.{js,ts,tsx,json,md,yml}\"",
"fix:eslint": "eslint \"**/*.{js,ts,tsx}\" --fix",
Expand All @@ -37,13 +29,17 @@
"prepublish:ts-downlevel": "rm -rf packages/*/dist/ts3.4 && echo packages/*/dist | NODE_NO_WARNINGS=1 xargs -I{} -n1 -P8 downlevel-dts {} {}/ts3.4",
"publish": "npm-run-all --serial publish:*",
"publish:packages": "yarn changeset publish --public",
"publish:storybook": "storybook build && gh-pages --dist ./storybook-static",
"slackbot": "npx ts-node ./scripts/slackbot",
"start": "storybook dev -p 9001 --no-version-updates",
"test": "npx ts-node ./scripts/test.ts",
"test:local": "yarn test",
"test:ssr": "yarn test --ssr",
"unlink": "./scripts/unlink.sh",
"update:proptypes": "npx ts-node ./scripts/proptypes.ts",
"validate": "npm-run-all --parallel validate:*",
"validate:dependencies": "npx ts-node ./scripts/depcheck.ts",
"validate:builds": "npx ts-node ./scripts/check-builds.ts",
"validate:package-json": "npmPkgJsonLint ./packages",
"watch": "yarn build -- -- --watch"
},
"devDependencies": {
Expand Down Expand Up @@ -144,7 +140,7 @@
"jest-axe": "^4.1.0",
"jest-canvas-mock": "^2.5.1",
"jest-junit": "^10.0.0",
"lerna": "3.20.2",
"lerna": "^7.0.2",
"meow": "^6.1.0",
"node-fetch": "2",
"npm-package-json-lint": "^6.3.0",
Expand All @@ -164,6 +160,7 @@
"storybook-addon-performance": "^0.17.1",
"stream-browserify": "^3.0.0",
"ts-node": "^8.8.2",
"turbo": "^1.10.3",
"typescript": "^4.1.0",
"url-loader": "4.1.0"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/a11y/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
}
},
"scripts": {
"build": "../../node_modules/.bin/rollup --config ../../rollup.config.js"
"build": "../../node_modules/.bin/rollup --config ../../rollup.config.js",
"tsc": "tsc --build tsconfig.json"
},
"license": "Apache-2.0",
"publishConfig": {
Expand Down
Loading