Skip to content

Commit

Permalink
Merge pull request #380 from atls/sync/yarn-plugin-commit
Browse files Browse the repository at this point in the history
sync(yarn-plugin-commit): dependencies, command adjustments
  • Loading branch information
Nelfimov authored Aug 20, 2024
2 parents d45e569 + 6c0f12c commit cadeb59
Show file tree
Hide file tree
Showing 9 changed files with 183 additions and 914 deletions.
304 changes: 152 additions & 152 deletions .pnp.cjs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions .yarn/releases/yarn.cjs

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1089,18 +1089,18 @@ __metadata:
dependencies:
"@atls/cli-ui-git-commit-component": "workspace:*"
"@atls/code-commit": "workspace:*"
"@types/react": "npm:^18.3.3"
"@yarnpkg/builder": "npm:4.1.1"
"@yarnpkg/cli": "npm:4.2.2"
"@yarnpkg/core": "npm:4.0.5"
"@types/react": "npm:18.3.3"
"@yarnpkg/builder": "npm:4.1.2"
"@yarnpkg/cli": "npm:4.4.0"
"@yarnpkg/core": "npm:4.1.2"
"@yarnpkg/fslib": "npm:3.1.0"
"@yarnpkg/libui": "npm:3.0.0"
clipanion: "npm:4.0.0-rc.3"
commitizen: "npm:4.3.0"
force-stdin-tty: "npm:0.0.1"
ink: "npm:3.2.0"
lint-staged: "patch:lint-staged@npm%3A13.3.0#~/.yarn/patches/lint-staged-npm-13.3.0-f729900eb4.patch"
react: "npm:^18.3.1"
react: "npm:18.3.1"
word-wrap: "npm:1.2.5"
peerDependencies:
"@yarnpkg/cli": "*"
Expand Down
723 changes: 0 additions & 723 deletions yarn/plugin-commit/bundles/@yarnpkg/plugin-commit.js

This file was deleted.

20 changes: 14 additions & 6 deletions yarn/plugin-commit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
"force-stdin-tty": "0.0.1",
"ink": "3.2.0",
"lint-staged": "patch:lint-staged@npm%3A13.3.0#~/.yarn/patches/lint-staged-npm-13.3.0-f729900eb4.patch",
"react": "^18.3.1",
"react": "18.3.1",
"word-wrap": "1.2.5"
},
"devDependencies": {
"@types/react": "^18.3.3",
"@yarnpkg/builder": "4.1.1",
"@yarnpkg/cli": "4.2.2",
"@yarnpkg/core": "4.0.5",
"@types/react": "18.3.3",
"@yarnpkg/builder": "4.1.2",
"@yarnpkg/cli": "4.4.0",
"@yarnpkg/core": "4.1.2",
"@yarnpkg/fslib": "3.1.0"
},
"peerDependencies": {
Expand All @@ -42,7 +42,15 @@
},
"publishConfig": {
"access": "public",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "dist/index.js",
"typings": "dist/index.d.ts"
"types": "dist/index.d.ts"
}
}
2 changes: 1 addition & 1 deletion yarn/plugin-commit/sources/commit-message-lint.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { read } from '@atls/code-commit'
class CommitMessageLintCommand extends BaseCommand {
static paths = [['commit', 'message', 'lint']]

async execute() {
async execute(): Promise<number> {
const linter = new CommitLinter()

const messages = await read({ edit: true })
Expand Down
15 changes: 7 additions & 8 deletions yarn/plugin-commit/sources/commit-message.command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const RequestCommitMessageSubmit = ({
commit,
useSubmit,
}: {
commit: any
useSubmit: Function
}) => {
commit: CommitProperties
useSubmit: (commit: CommitProperties) => void
}): null => {
const { stdin } = useStdin()

useSubmit(commit)
Expand All @@ -36,7 +36,6 @@ const RequestCommitMessageApp: SubmitInjectedComponent<CommitProperties> = ({ us
const [commit, setCommit] = useState()

if (!commit) {
// @ts-expect-error any
return <RequestCommitMessage onSubmit={setCommit} />
}

Expand All @@ -48,7 +47,7 @@ export class CommitMessageCommand extends BaseCommand {

args: Array<string> = Option.Rest({ required: 0 })

async execute() {
async execute(): Promise<number> {
const [commitMessageFile, source] = this.args

if (source) {
Expand All @@ -62,10 +61,10 @@ export class CommitMessageCommand extends BaseCommand {
const overwroteStdin = forceStdinTty()

const commit: CommitProperties | undefined = await renderForm(
RequestCommitMessageApp,
RequestCommitMessageApp as SubmitInjectedComponent<CommitProperties>,
{},
{
stdin: this.context.stdin,
stdin: process.stdin,
stdout: this.context.stdout,
stderr: this.context.stderr,
}
Expand All @@ -82,7 +81,7 @@ export class CommitMessageCommand extends BaseCommand {
return commit ? 0 : 1
}

private formatCommit(commit: CommitProperties) {
private formatCommit(commit: CommitProperties): string {
const wrapOptions = {
trim: true,
cut: false,
Expand Down
3 changes: 1 addition & 2 deletions yarn/plugin-commit/sources/commit-staged.command.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { BaseCommand } from '@yarnpkg/cli'
import { Option } from 'clipanion'
// @ts-expect-error any
import lintStaged from 'lint-staged'

const config = {
Expand All @@ -15,7 +14,7 @@ export class CommitStagedCommand extends BaseCommand {

args: Array<string> = Option.Rest({ required: 0 })

async execute() {
async execute(): Promise<number> {
try {
const passed = await lintStaged({
config,
Expand Down
14 changes: 0 additions & 14 deletions yarn/plugin-commit/sources/commit.command.ts

This file was deleted.

0 comments on commit cadeb59

Please sign in to comment.