mirror of
https://github.com/LukeHagar/form.git
synced 2025-12-10 04:19:54 +00:00
Fixing failing tasks in ci workflow (#394)
* fixing jest config * fixing eslint errors for react-form * fixing script lints * configuring prettier to ignore built files * updating eslint deps * updating pnpm lockfile * updating dep install step in pr workflow * rm reference to custom validatePackages script * fixing code sandbox failure * attempting to fix frozen locfile issue * fixing install:csb step * removing unnecessary type assignment
This commit is contained in:
12
.github/workflows/pr.yml
vendored
12
.github/workflows/pr.yml
vendored
@@ -22,7 +22,7 @@ jobs:
|
||||
node-version: 16.14.2
|
||||
cache: 'pnpm'
|
||||
- name: Install dependencies
|
||||
run: pnpm --filter "./packages/**" --filter form --prefer-offline install
|
||||
run: pnpm --filter "./packages/**" --filter form --prefer-offline install --no-frozen-lockfile
|
||||
- name: Run Tests
|
||||
uses: nick-fields/retry@v2.8.3
|
||||
with:
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
node-version: 16.14.2
|
||||
cache: 'pnpm'
|
||||
- name: Install dependencies
|
||||
run: pnpm --filter "./packages/**" --filter form --prefer-offline install
|
||||
run: pnpm --filter "./packages/**" --filter form --prefer-offline install --no-frozen-lockfile
|
||||
- run: pnpm run test:eslint --base=${{ github.event.pull_request.base.sha }}
|
||||
typecheck:
|
||||
name: 'Typecheck'
|
||||
@@ -67,7 +67,7 @@ jobs:
|
||||
node-version: 16.14.2
|
||||
cache: 'pnpm'
|
||||
- name: Install dependencies
|
||||
run: pnpm --filter "./packages/**" --filter form --prefer-offline install
|
||||
run: pnpm --filter "./packages/**" --filter form --prefer-offline install --no-frozen-lockfile
|
||||
- run: pnpm run test:types --base=${{ github.event.pull_request.base.sha }}
|
||||
format:
|
||||
name: 'Format'
|
||||
@@ -86,7 +86,7 @@ jobs:
|
||||
node-version: 16.14.2
|
||||
cache: 'pnpm'
|
||||
- name: Install dependencies
|
||||
run: pnpm --filter "./packages/**" --filter form --prefer-offline install
|
||||
run: pnpm --filter "./packages/**" --filter form --prefer-offline install --no-frozen-lockfile
|
||||
- run: pnpm run test:format --base=${{ github.event.pull_request.base.sha }}
|
||||
test-react-17:
|
||||
name: 'Test React 17'
|
||||
@@ -105,7 +105,7 @@ jobs:
|
||||
node-version: 16.14.2
|
||||
cache: 'pnpm'
|
||||
- name: Install dependencies
|
||||
run: pnpm --filter "./packages/**" --filter form --prefer-offline install
|
||||
run: pnpm --filter "./packages/**" --filter form --prefer-offline install --no-frozen-lockfile
|
||||
- name: Run Tests
|
||||
uses: nick-fields/retry@v2.8.3
|
||||
with:
|
||||
@@ -127,7 +127,7 @@ jobs:
|
||||
node-version: 16.14.2
|
||||
cache: 'pnpm'
|
||||
- name: Install dependencies
|
||||
run: pnpm --filter "./packages/**" --filter form --prefer-offline install
|
||||
run: pnpm --filter "./packages/**" --filter form --prefer-offline install --no-frozen-lockfile
|
||||
- run: pnpm run test:build
|
||||
env:
|
||||
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
/packages/svelte-form/.svelte-kit
|
||||
/packages/*/build
|
||||
30
package.json
30
package.json
@@ -6,7 +6,7 @@
|
||||
"nx-reset": "nx reset",
|
||||
"clean": "pnpm --filter \"./packages/**\" run clean",
|
||||
"preinstall": "node -e \"if(process.env.CI == 'true') {console.log('Skipping preinstall...'); process.exit(1)}\" || npx -y only-allow pnpm",
|
||||
"install:csb": "pnpm install --frozen-lockfile",
|
||||
"install:csb": "pnpm --filter \"./packages/**\" --prefer-offline install --no-frozen-lockfile",
|
||||
"test": "pnpm run test:ci",
|
||||
"test:ci": "nx affected --targets=test:lib,test:types,test:eslint,test:format --parallel=5",
|
||||
"test:react:17": "nx affected --target=test:lib --parallel=5",
|
||||
@@ -66,21 +66,21 @@
|
||||
"chalk": "^4.1.2",
|
||||
"concurrently": "^7.1.0",
|
||||
"current-git-branch": "^1.1.0",
|
||||
"eslint": "7.x",
|
||||
"eslint-config-prettier": "^6.11.0",
|
||||
"eslint-config-react-app": "^5.2.1",
|
||||
"eslint-config-standard": "^14.1.1",
|
||||
"eslint-config-standard-react": "^9.2.0",
|
||||
"eslint-import-resolver-typescript": "^2.7.1",
|
||||
"eslint-plugin-flowtype": "5.x",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-jsx-a11y": "6.x",
|
||||
"eslint": "8.34.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-config-react-app": "^7.0.1",
|
||||
"eslint-config-standard": "^17.0.0",
|
||||
"eslint-config-standard-react": "^13.0.0",
|
||||
"eslint-import-resolver-typescript": "^3.5.3",
|
||||
"eslint-plugin-flowtype": "8.0.3",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"eslint-plugin-jsx-a11y": "^6.7.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-prettier": "^3.1.3",
|
||||
"eslint-plugin-promise": "^4.2.1",
|
||||
"eslint-plugin-react": "7.20.0",
|
||||
"eslint-plugin-react-hooks": "^4.3.0",
|
||||
"eslint-plugin-standard": "^4.0.1",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"eslint-plugin-react": "7.32.2",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-standard": "^5.0.0",
|
||||
"git-log-parser": "^1.2.0",
|
||||
"jest": "^27.5.1",
|
||||
"jsonfile": "^6.1.0",
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json",
|
||||
"sourceType": "module"
|
||||
}
|
||||
}
|
||||
13
packages/react-form/.eslintrc.cjs
Normal file
13
packages/react-form/.eslintrc.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
// @ts-check
|
||||
|
||||
/** @type {import('eslint').Linter.Config} */
|
||||
const config = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: './tsconfig.eslint.json',
|
||||
sourceType: 'module',
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = config
|
||||
@@ -1,6 +1,5 @@
|
||||
export default {
|
||||
displayName: 'react-form',
|
||||
preset: '../../jest-preset.js',
|
||||
setupFilesAfterEnv: ['./jest.setup.ts'],
|
||||
testMatch: ['<rootDir>/src/**/*.test.tsx', '<rootDir>/codemods/**/*.test.js'],
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FormApi } from '@tanstack/form-core'
|
||||
import type { FormApi } from '@tanstack/form-core'
|
||||
import * as React from 'react'
|
||||
|
||||
export const formContext = React.createContext<FormApi<any>>(null!)
|
||||
export const formContext = React.createContext<FormApi<any> | null>(null)
|
||||
|
||||
export function useFormContext(customFormApi?: FormApi<any>) {
|
||||
const formApi = React.useContext(formContext)
|
||||
|
||||
7
packages/react-form/tsconfig.eslint.json
Normal file
7
packages/react-form/tsconfig.eslint.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": true
|
||||
},
|
||||
"include": ["**/*.ts", "**/*.tsx", "./.eslintrc.cjs"]
|
||||
}
|
||||
1641
pnpm-lock.yaml
generated
1641
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -17,11 +17,7 @@
|
||||
"dependsOn": ["rollup", "^build:types", "^build"]
|
||||
},
|
||||
"test:build": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"commands": ["bundlewatch", "pnpm run validatePackages"],
|
||||
"parallel": true
|
||||
}
|
||||
"command": "bundlewatch"
|
||||
}
|
||||
},
|
||||
"implicitDependencies": ["@tanstack/form-core", "@tanstack/react-form"]
|
||||
|
||||
@@ -31,7 +31,7 @@ async function run() {
|
||||
// (process.env.PR_NUMBER ? `pr-${process.env.PR_NUMBER}` : currentGitBranch())
|
||||
currentGitBranch()
|
||||
|
||||
const branchConfig: BranchConfig = branchConfigs[branchName]
|
||||
const branchConfig = branchConfigs[branchName]
|
||||
|
||||
if (!branchConfig) {
|
||||
console.log(`No publish config found for branch: ${branchName}`)
|
||||
@@ -136,12 +136,14 @@ async function run() {
|
||||
// Pares the commit messsages, log them, and determine the type of release needed
|
||||
let recommendedReleaseLevel: number = commitsSinceLatestTag.reduce(
|
||||
(releaseLevel, commit) => {
|
||||
if (['fix', 'refactor', 'perf'].includes(commit.parsed.type!)) {
|
||||
if (commit.parsed) {
|
||||
if (['fix', 'refactor', 'perf'].includes(commit.parsed.type || '')) {
|
||||
releaseLevel = Math.max(releaseLevel, 0)
|
||||
}
|
||||
if (['feat'].includes(commit.parsed.type!)) {
|
||||
if (['feat'].includes(commit.parsed.type || '')) {
|
||||
releaseLevel = Math.max(releaseLevel, 1)
|
||||
}
|
||||
}
|
||||
if (commit.body.includes('BREAKING CHANGE')) {
|
||||
releaseLevel = Math.max(releaseLevel, 2)
|
||||
}
|
||||
@@ -173,14 +175,14 @@ async function run() {
|
||||
|
||||
const changedPackages = RELEASE_ALL
|
||||
? packages
|
||||
: changedFiles.reduce((changedPackages, file) => {
|
||||
: changedFiles.reduce((changedPackagesAcc: Package[], file) => {
|
||||
const pkg = packages.find((p) =>
|
||||
file.startsWith(path.join('packages', p.packageDir, p.srcDir)),
|
||||
)
|
||||
if (pkg && !changedPackages.find((d) => d.name === pkg.name)) {
|
||||
changedPackages.push(pkg)
|
||||
if (pkg && !changedPackagesAcc.find((d) => d.name === pkg.name)) {
|
||||
changedPackagesAcc.push(pkg)
|
||||
}
|
||||
return changedPackages
|
||||
return changedPackagesAcc
|
||||
}, [] as Package[])
|
||||
|
||||
// If a package has a dependency that has been updated, we need to update the
|
||||
@@ -244,7 +246,7 @@ async function run() {
|
||||
: await Promise.all(
|
||||
Object.entries(
|
||||
commitsSinceLatestTag.reduce((acc, next) => {
|
||||
const type = next.parsed.type.toLowerCase() ?? 'other'
|
||||
const type = next.parsed?.type?.toLowerCase() ?? 'other'
|
||||
|
||||
return {
|
||||
...acc,
|
||||
@@ -275,7 +277,7 @@ async function run() {
|
||||
|
||||
if (process.env.GH_TOKEN) {
|
||||
const query = `${
|
||||
commit.author.email ?? commit.committer.email
|
||||
commit.author?.email ?? commit.committer.email
|
||||
}`
|
||||
|
||||
const res = await axios.get(
|
||||
@@ -293,19 +295,19 @@ async function run() {
|
||||
username = res.data.items[0]?.login
|
||||
}
|
||||
|
||||
const scope = commit.parsed.scope
|
||||
const scope = commit.parsed?.scope
|
||||
? `${commit.parsed.scope}: `
|
||||
: ''
|
||||
const subject = commit.parsed.subject ?? commit.subject
|
||||
const subject = commit.parsed?.subject ?? commit.subject
|
||||
// const commitUrl = `${remoteURL}/commit/${commit.commit.long}`;
|
||||
|
||||
return `- ${scope}${subject} (${commit.commit.short}) ${
|
||||
username
|
||||
? `by @${username}`
|
||||
: `by ${commit.author.name ?? commit.author.email}`
|
||||
: `by ${commit.author?.name ?? commit.author?.email}`
|
||||
}`
|
||||
}),
|
||||
).then((commits) => [type, commits] as const)
|
||||
).then((commitDescriptions) => [type, commitDescriptions] as const)
|
||||
}),
|
||||
).then((groups) => {
|
||||
return groups
|
||||
@@ -409,7 +411,7 @@ async function run() {
|
||||
}
|
||||
|
||||
console.info('Testing packages...')
|
||||
execSync(`pnpm test:ci ${SKIP_TESTS ? '|| exit 0' : ''}`, {
|
||||
execSync(`pnpm test:ci ${(SKIP_TESTS as boolean) ? '|| exit 0' : ''}`, {
|
||||
encoding: 'utf8',
|
||||
})
|
||||
console.info('')
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
export type Commit = {
|
||||
commit: CommitOrTree
|
||||
tree: CommitOrTree
|
||||
author: AuthorOrCommitter
|
||||
author?: AuthorOrCommitter
|
||||
committer: AuthorOrCommitter
|
||||
subject: string
|
||||
body: string
|
||||
parsed: Parsed
|
||||
parsed?: Parsed
|
||||
}
|
||||
|
||||
export type CommitOrTree = {
|
||||
@@ -14,13 +14,13 @@ export type CommitOrTree = {
|
||||
}
|
||||
|
||||
export type AuthorOrCommitter = {
|
||||
name: string
|
||||
name?: string
|
||||
email: string
|
||||
date: string
|
||||
}
|
||||
|
||||
export type Parsed = {
|
||||
type: string
|
||||
type?: string
|
||||
scope?: string | null
|
||||
subject: string
|
||||
merge?: null
|
||||
|
||||
Reference in New Issue
Block a user