Skip to content

Commit

Permalink
chore: fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
bradzacher committed Mar 15, 2023
1 parent cf893b7 commit 154811b
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 43 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.js
@@ -1,5 +1,5 @@
// @ts-check
/** @type {import('@typescript-eslint/utils').TSESLint.Linter.Config} */
/** @type {import('./packages/utils/src/ts-eslint/Linter').Linter.Config} */
module.exports = {
root: true,
plugins: [
Expand Down Expand Up @@ -410,9 +410,9 @@ module.exports = {
},
},
{
files: ['./packages/website-eslint/src/mock/**/*.js'],
files: ['./packages/website-eslint/src/mock/**/*.js', '*.d.ts'],
rules: {
// mocks have to mirror their original
// mocks and declaration files have to mirror their original package
'import/no-default-export': 'off',
},
},
Expand Down
18 changes: 14 additions & 4 deletions .github/actions/prepare-build/action.yml
Expand Up @@ -10,13 +10,23 @@ runs:
id: build-cache
with:
path: '**/dist/**'
key: ${{ runner.os }}-build-${{ github.ref }}
key: ${{ runner.os }}-build-${{ github.ref }}-${{ github.run_id }}
# We don't want to share builds across runs even for the same branch
# because each commit can have different build artifacts and we don't
# want to accidentally share artifacts and poison the build output
restore-keys: |
${{ runner.os }}-build-
${{ runner.os }}-build-${{ github.ref }}-${{ github.run_id }}
# If the cache was hit, then we still run the types build because we generate source files
- name: Build AST Spec
if: steps['build-cache'].outputs.cache-hit == 'true'
shell: bash
run: |
SKIP_AST_SPEC_REBUILD=true npx nx run types:build
# if the cache was hit - this will run in <1s
- name: Build
if: steps['build-cache'].outputs.cache-hit != 'true'
shell: bash
# Website will be built by the Netlify GitHub App
run: |
npx nx run-many --target=build --parallel --exclude website
npx nx run-many --target=build --parallel --exclude=website --exclude=website-eslint --exclude=ast-spec --exclude=types
21 changes: 20 additions & 1 deletion .github/workflows/ci.yml
Expand Up @@ -177,6 +177,25 @@ jobs:
# Sadly 1 day is the minimum
retention-days: 1

website_build:
name: Build Website
needs: [install, build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install
uses: ./.github/actions/prepare-install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
- name: Build Base
uses: ./.github/actions/prepare-build

- name: Build Website
shell: bash
run: |
npx nx run-many --target=build --projects=website-eslint,website
## TODO - re-enable once we fix them
# https://github.com/typescript-eslint/typescript-eslint/issues/6508
# website_tests:
Expand All @@ -187,7 +206,7 @@ jobs:
# # We technically do not need to wait for build within the pipeline any more because the build we care about is happening within Netlify, however,
# # it is highly likely that if the CI one fails, the Netlify one will as well, so in order to not waste unncessary Github Actions minutes/resources,
# # we do still keep this requirement here.
# needs: [build]
# needs: [website_build]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
Expand Down
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -23,7 +23,7 @@
"url": "https://github.com/typescript-eslint/typescript-eslint/issues"
},
"scripts": {
"build": "nx run-many --target=build --parallel --exclude website",
"build": "nx run-many --target=build --parallel --exclude website --exclude website-eslint",
"check-clean-workspace-after-install": "git diff --quiet --exit-code",
"check-configs": "nx run-many --target=check-configs --parallel",
"check-docs": "nx run-many --target=check-docs --parallel",
Expand All @@ -44,8 +44,9 @@
"postinstall": "nx run repo-tools:postinstall-script",
"pre-commit": "yarn lint-staged",
"start": "nx run website:start",
"test": "nx run-many --target=test --parallel --exclude integration-tests",
"test": "nx run-many --target=test --parallel --exclude integration-tests --exclude website --exclude website-eslint",
"test-integration": "nx run integration-tests:test",
"test-website": "nx run-many --target=test --projects=website,website-eslint",
"typecheck": "nx run-many --target=typecheck --parallel"
},
"engines": {
Expand Down
6 changes: 3 additions & 3 deletions packages/types/package.json
Expand Up @@ -35,7 +35,7 @@
"estree"
],
"scripts": {
"prebuild": "tsx ./tools/copy-ast-spec.ts",
"copy-ast-spec": "tsx ./tools/copy-ast-spec.ts",
"build": "tsc -b tsconfig.build.json",
"postbuild": "downlevel-dts dist _ts4.2/dist --to=4.2",
"clean": "tsc -b tsconfig.build.json --clean",
Expand All @@ -47,7 +47,7 @@
},
"nx": {
"targets": {
"prebuild": {
"copy-ast-spec": {
"dependsOn": [
{
"target": "build",
Expand All @@ -65,7 +65,7 @@
"projects": "dependencies"
},
{
"target": "prebuild",
"target": "copy-ast-spec",
"projects": "self"
}
]
Expand Down
6 changes: 4 additions & 2 deletions packages/types/tools/copy-ast-spec.ts
Expand Up @@ -67,8 +67,10 @@ async function copyFile(
}

async function main(): Promise<void> {
// ensure the package is built
await execAsync('yarn', ['build'], { cwd: AST_SPEC_PATH });
if (process.env.SKIP_AST_SPEC_REBUILD) {
// ensure the package is built
await execAsync('yarn', ['build'], { cwd: AST_SPEC_PATH });
}

await Promise.all([
copyFile('dist', 'ast-spec.ts', code =>
Expand Down
2 changes: 1 addition & 1 deletion packages/website/package.json
Expand Up @@ -47,11 +47,11 @@
"@axe-core/playwright": "^4.4.5",
"@docusaurus/module-type-aliases": "~2.2.0",
"@playwright/test": "^1.27.1",
"@types/esquery": "^1.0.2",
"@types/react": "^18.0.9",
"@types/react-helmet": "^6.1.5",
"@types/react-router-dom": "^5.3.3",
"@typescript-eslint/eslint-plugin": "5.55.0",
"@typescript-eslint/types": "5.55.0",
"copy-webpack-plugin": "^11.0.0",
"cross-fetch": "*",
"globby": "^11.1.0",
Expand Down
20 changes: 0 additions & 20 deletions patches/@types+esquery+1.0.2.patch

This file was deleted.

7 changes: 0 additions & 7 deletions yarn.lock
Expand Up @@ -3460,13 +3460,6 @@
version "0.0.0"
uid ""

"@types/esquery@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@types/esquery/-/esquery-1.0.2.tgz#ccab4b6bd1aec356d5daa5b3abc55eac703c332d"
integrity sha512-qeAoHiWfqF4ST6An3DM2r1743bWL7B5hW4oNR9tWkdOjFUR1aK2j0jnYvW6h30VGDeXQ+1bWOYTej4JVo/5+PA==
dependencies:
"@types/estree" "*"

"@types/estree@*":
version "0.0.0"
uid ""
Expand Down

0 comments on commit 154811b

Please sign in to comment.