Skip to content
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

fix: remaining create branch cleanups #1746

Merged
merged 5 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"overrides": [{ "files": ".nvmrc", "options": { "parser": "yaml" } }],
"plugins": [
"prettier-plugin-curly",
"prettier-plugin-sh",
"prettier-plugin-packagejson"
"prettier-plugin-packagejson",
"prettier-plugin-sh"
],
"useTabs": true
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"main": "./lib/index.js",
"bin": "./bin/index.js",
"files": [
"LICENSE.md",
"README.md",
"bin/index.js",
"lib/",
"package.json",
"LICENSE.md",
"README.md"
"package.json"
],
"scripts": {
"build": "tsup",
Expand All @@ -42,6 +42,7 @@
},
"dependencies": {
"@clack/prompts": "^0.8.2",
"@prettier/sync": "^0.5.2",
"all-contributors-for-repository": "^0.3.0",
"chalk": "^5.3.0",
"execa": "^9.5.1",
Expand All @@ -67,7 +68,6 @@
"@octokit/request-error": "6.1.5",
"@release-it/conventional-changelog": "9.0.3",
"@types/eslint-plugin-markdown": "2.0.2",
"@types/eslint__js": "8.42.3",
"@types/git-url-parse": "9.0.3",
"@types/js-yaml": "4.0.9",
"@types/node": "22.10.1",
Expand Down
28 changes: 18 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { z } from "zod";
import { StatusCode } from "./codes.js";

export interface AllContributorContributor {
avatar_url: string;
contributions: string[];
login: string;
}
Expand Down Expand Up @@ -37,9 +38,11 @@ export interface PartialPackageData {
description?: string;
devDependencies?: Record<string, string>;
email?: string;
engine?: { node?: string };
name?: string;
repository?: string | { type: string; url: string };
scripts?: Record<string, string>;
version?: string;
}

/**
Expand Down
8 changes: 6 additions & 2 deletions src/steps/addOwnerAsAllContributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { Octokit } from "octokit";

import { getGitHubUserAsAllContributor } from "../shared/getGitHubUserAsAllContributor.js";
import { readFileAsJson } from "../shared/readFileAsJson.js";
import { AllContributorsData, Options } from "../shared/types.js";
import {
AllContributorContributor,
AllContributorsData,
Options,
} from "../shared/types.js";
import { formatJson } from "./writing/creation/formatters/formatJson.js";

export async function addOwnerAsAllContributor(
Expand Down Expand Up @@ -38,7 +42,7 @@ export async function addOwnerAsAllContributor(
contributors.push({
contributions: ["tool"],
login: user,
});
} as AllContributorContributor);
}

await fs.writeFile(
Expand Down
6 changes: 3 additions & 3 deletions src/steps/finalizeDependencies.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("finalize", () => {
expect(mockExecaCommand.mock.calls).toMatchInlineSnapshot(`
[
[
"pnpm add @eslint-community/eslint-plugin-eslint-comments@latest @eslint/js@latest @release-it/conventional-changelog@latest @types/eslint-plugin-markdown@latest @types/eslint__js@latest @types/node@latest @vitest/coverage-v8@latest @vitest/eslint-plugin@latest all-contributors-cli@latest console-fail-test@latest cspell@latest eslint@latest eslint-plugin-jsdoc@latest eslint-plugin-jsonc@latest eslint-plugin-markdown@latest eslint-plugin-n@latest eslint-plugin-package-json@latest eslint-plugin-perfectionist@latest eslint-plugin-regexp@latest eslint-plugin-yml@latest husky@latest jsonc-eslint-parser@latest knip@latest lint-staged@latest markdownlint@latest markdownlint-cli@latest prettier@latest prettier-plugin-curly@latest prettier-plugin-packagejson@latest prettier-plugin-sh@latest release-it@latest sentences-per-line@latest tsup@latest typescript@latest typescript-eslint@latest vitest@latest -D",
"pnpm add @eslint-community/eslint-plugin-eslint-comments@latest @eslint/js@latest @release-it/conventional-changelog@latest @types/eslint-plugin-markdown@latest @types/node@latest @vitest/coverage-v8@latest @vitest/eslint-plugin@latest all-contributors-cli@latest console-fail-test@latest cspell@latest eslint@latest eslint-plugin-jsdoc@latest eslint-plugin-jsonc@latest eslint-plugin-markdown@latest eslint-plugin-n@latest eslint-plugin-package-json@latest eslint-plugin-perfectionist@latest eslint-plugin-regexp@latest eslint-plugin-yml@latest husky@latest knip@latest lint-staged@latest markdownlint@latest markdownlint-cli@latest prettier@latest prettier-plugin-curly@latest prettier-plugin-packagejson@latest prettier-plugin-sh@latest release-it@latest sentences-per-line@latest tsup@latest typescript@latest typescript-eslint@latest vitest@latest -D",
],
[
"npx all-contributors-cli generate",
Expand All @@ -59,7 +59,7 @@ describe("finalize", () => {
expect(mockExecaCommand.mock.calls).toMatchInlineSnapshot(`
[
[
"pnpm add @eslint-community/eslint-plugin-eslint-comments@latest @eslint/js@latest @release-it/conventional-changelog@latest @types/eslint-plugin-markdown@latest @types/eslint__js@latest @types/node@latest @vitest/coverage-v8@latest @vitest/eslint-plugin@latest all-contributors-cli@latest console-fail-test@latest cspell@latest eslint@latest eslint-plugin-jsdoc@latest eslint-plugin-jsonc@latest eslint-plugin-markdown@latest eslint-plugin-n@latest eslint-plugin-package-json@latest eslint-plugin-perfectionist@latest eslint-plugin-regexp@latest eslint-plugin-yml@latest husky@latest jsonc-eslint-parser@latest knip@latest lint-staged@latest markdownlint@latest markdownlint-cli@latest prettier@latest prettier-plugin-curly@latest prettier-plugin-packagejson@latest prettier-plugin-sh@latest release-it@latest sentences-per-line@latest tsup@latest typescript@latest typescript-eslint@latest vitest@latest -D --offline",
"pnpm add @eslint-community/eslint-plugin-eslint-comments@latest @eslint/js@latest @release-it/conventional-changelog@latest @types/eslint-plugin-markdown@latest @types/node@latest @vitest/coverage-v8@latest @vitest/eslint-plugin@latest all-contributors-cli@latest console-fail-test@latest cspell@latest eslint@latest eslint-plugin-jsdoc@latest eslint-plugin-jsonc@latest eslint-plugin-markdown@latest eslint-plugin-n@latest eslint-plugin-package-json@latest eslint-plugin-perfectionist@latest eslint-plugin-regexp@latest eslint-plugin-yml@latest husky@latest knip@latest lint-staged@latest markdownlint@latest markdownlint-cli@latest prettier@latest prettier-plugin-curly@latest prettier-plugin-packagejson@latest prettier-plugin-sh@latest release-it@latest sentences-per-line@latest tsup@latest typescript@latest typescript-eslint@latest vitest@latest -D --offline",
],
[
"npx all-contributors-cli generate",
Expand Down Expand Up @@ -92,7 +92,7 @@ describe("finalize", () => {
expect(mockExecaCommand.mock.calls).toMatchInlineSnapshot(`
[
[
"pnpm add @eslint-community/eslint-plugin-eslint-comments@latest @eslint/js@latest @types/eslint__js@latest @types/node@latest eslint@latest eslint-plugin-jsdoc@latest eslint-plugin-n@latest eslint-plugin-regexp@latest husky@latest lint-staged@latest prettier@latest prettier-plugin-curly@latest prettier-plugin-packagejson@latest prettier-plugin-sh@latest tsup@latest typescript@latest typescript-eslint@latest -D",
"pnpm add @eslint-community/eslint-plugin-eslint-comments@latest @eslint/js@latest @types/node@latest eslint@latest eslint-plugin-jsdoc@latest eslint-plugin-n@latest eslint-plugin-regexp@latest husky@latest lint-staged@latest prettier@latest prettier-plugin-curly@latest prettier-plugin-packagejson@latest prettier-plugin-sh@latest tsup@latest typescript@latest typescript-eslint@latest -D",
],
[
"pnpm dedupe --offline",
Expand Down
4 changes: 0 additions & 4 deletions src/steps/finalizeDependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Options } from "../shared/types.js";
export async function finalizeDependencies(options: Options) {
const devDependencies = [
"@eslint/js",
"@types/eslint__js",
"@types/node",
"eslint",
"eslint-plugin-n",
Expand All @@ -25,9 +24,6 @@ export async function finalizeDependencies(options: Options) {
: ["@eslint-community/eslint-plugin-eslint-comments"]),
...(options.excludeLintJSDoc ? [] : ["eslint-plugin-jsdoc"]),
...(options.excludeLintJson ? [] : ["eslint-plugin-jsonc"]),
...(options.excludeLintJson && options.excludeLintPackageJson
? []
: ["jsonc-eslint-parser"]),
...(options.excludeLintKnip ? [] : ["knip"]),
...(options.excludeLintMd
? []
Expand Down
1 change: 1 addition & 0 deletions src/steps/uninstallPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export async function uninstallPackages(offline: boolean | undefined) {
await removeDependencies(
[
"@clack/prompts",
"@prettier/sync",
"all-contributors-for-repository",
"chalk",
"execa",
Expand Down
12 changes: 7 additions & 5 deletions src/steps/writing/creation/createDotGitignore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { Options } from "../../../shared/types.js";
import { formatIgnoreFile } from "./formatters/formatIgnoreFile.js";

export function createDotGitignore(options: Pick<Options, "excludeTests">) {
return formatIgnoreFile([
...(options.excludeTests ? [] : ["/coverage"]),
"/lib",
"/node_modules",
]);
return formatIgnoreFile(
[
...(options.excludeTests ? [] : ["/coverage"]),
"/lib",
"/node_modules",
].sort(),
);
}
Loading
Loading