From c36b974a0442010b3e4e859821b9739861ac2b6c Mon Sep 17 00:00:00 2001 From: Andrew Lisowski Date: Sat, 13 Mar 2021 12:32:34 -0800 Subject: [PATCH 1/2] Write auto configuration in TypeScript --- auto.config.ts | 63 ++++++++++++++ docs/pages/docs/configuration/autorc.mdx | 54 +++++++++++- package.json | 57 ------------- packages/cli/package.json | 2 + packages/cli/src/index.ts | 1 + packages/core/package.json | 1 + packages/core/src/auto-args.ts | 104 ++++++----------------- packages/core/src/auto.ts | 2 + packages/core/src/config.ts | 26 +++++- packages/core/src/types.ts | 29 ++++++- yarn.lock | 30 +++++-- 11 files changed, 218 insertions(+), 151 deletions(-) create mode 100644 auto.config.ts create mode 100644 packages/cli/src/index.ts diff --git a/auto.config.ts b/auto.config.ts new file mode 100644 index 000000000..0a3c909bd --- /dev/null +++ b/auto.config.ts @@ -0,0 +1,63 @@ +import { AutoRc } from "./packages/core"; + +import { INpmConfig } from "./plugins/npm"; +import { IBrewPluginOptions } from "./plugins/brew"; +import { IGhPagesPluginOptions } from "./plugins/gh-pages"; +import { IAllContributorsPluginOptions } from "./plugins/all-contributors"; + +/** Auto configuration */ +export default function rc(): AutoRc { + return { + plugins: [ + [ + "upload-assets", + [ + "./packages/cli/binary/auto-linux.gz", + "./packages/cli/binary/auto-macos.gz", + "./packages/cli/binary/auto-win.exe.gz", + ], + ], + [ + "npm", + { + exact: true, + canaryScope: "@auto-canary", + } as INpmConfig, + ], + "released", + "first-time-contributor", + "pr-body-labels", + "./scripts/auto-update-curl-version.js", + [ + "all-contributors", + { + types: { + plugin: "**/plugin/**/*", + code: ["**/src/**/*", "**/package.json", "**/tsconfig.json"], + }, + } as IAllContributorsPluginOptions, + ], + [ + "brew", + { + executable: "./packages/cli/binary/auto-macos.gz", + name: "auto", + } as IBrewPluginOptions, + ], + [ + "gh-pages", + { + buildCommand: "yarn docs:build", + dir: "docs/out", + } as IGhPagesPluginOptions, + ], + ], + labels: [ + { + name: "blog-post", + changelogTitle: "📚 Blog Post", + releaseType: "none", + }, + ], + }; +} diff --git a/docs/pages/docs/configuration/autorc.mdx b/docs/pages/docs/configuration/autorc.mdx index 1a4715b56..6c63ea605 100644 --- a/docs/pages/docs/configuration/autorc.mdx +++ b/docs/pages/docs/configuration/autorc.mdx @@ -8,10 +8,11 @@ import { DefaultLabelRenderer } from "../../../components/defaultLabelsRenderer" This means you can define this file a variety of ways. `cosmiconfig` will start at the root of your project and start to search up the directory tree for the following: -- a package.json property -- a JSON or YAML, extension-less "rc file" -- an "rc file" with the extensions `.json`, `.yaml`, `.yml`, or `.js` -- a `.config.js` CommonJS module +- an `auto` package.json property +- a JSON or YAML, extension-less rc file ".autorc" +- an "rc file" with the extensions `.json`, `.yaml`, `.yml`, `.ts` or `.js` +- a `auto.config.js` or `auto.config.js` CommonJS module +- a `auto.config.ts` TypeScript module ## Initialization @@ -21,6 +22,51 @@ To interactively create an `.autorc` use the `init` command. You can configure m auto init ``` +## TypeScript Configuration + +You can write your `auto` configuration in a TypeScript file for easier validation + +**auto.config.ts:** + +```ts +import { AutoRc } from "auto"; + +import { INpmConfig } from "@auto-it/core"; +import { IAllContributorsPluginOptions } from "@auto-it/all-contributors"; + +/** Auto configuration */ +export default function rc(): AutoRc { + return { + plugins: [ + "released", + [ + "npm", + { + exact: true, + canaryScope: "@auto-canary", + } as INpmConfig, + ], + [ + "all-contributors", + { + types: { + plugin: "**/plugin/**/*", + code: ["**/src/**/*", "**/package.json", "**/tsconfig.json"], + }, + } as IAllContributorsPluginOptions, + ], + ], + labels: [ + { + name: "blog-post", + changelogTitle: "📚 Blog Post", + releaseType: "none", + }, + ], + }; +} +``` + ## Options The following are all of the top level configuration options for `auto`. diff --git a/package.json b/package.json index e0e6e4ef6..c998ece0a 100644 --- a/package.json +++ b/package.json @@ -134,62 +134,5 @@ "isolatedModules": true } } - }, - "auto": { - "plugins": [ - [ - "upload-assets", - [ - "./packages/cli/binary/auto-linux.gz", - "./packages/cli/binary/auto-macos.gz", - "./packages/cli/binary/auto-win.exe.gz" - ] - ], - [ - "npm", - { - "exact": true, - "canaryScope": "@auto-canary" - } - ], - "released", - "first-time-contributor", - "pr-body-labels", - "./scripts/auto-update-curl-version.js", - [ - "all-contributors", - { - "types": { - "plugin": "**/plugin/**/*", - "code": [ - "**/src/**/*", - "**/package.json", - "**/tsconfig.json" - ] - } - } - ], - [ - "brew", - { - "executable": "./packages/cli/binary/auto-macos.gz", - "name": "auto" - } - ], - [ - "gh-pages", - { - "buildCommand": "yarn docs:build", - "dir": "docs/out" - } - ] - ], - "labels": [ - { - "name": "blog-post", - "changelogTitle": "📚 Blog Post", - "releaseType": "none" - } - ] } } diff --git a/packages/cli/package.json b/packages/cli/package.json index 50c9ffa4a..d4b8bd426 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,8 @@ { "name": "auto", "bin": "dist/bin/auto.js", + "main": "dist/bin/index.js", + "types": "dist/bin/index.d.ts", "description": "CLI tools to help facilitate semantic versioning based on GitHub PR labels", "version": "10.19.0", "license": "MIT", diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts new file mode 100644 index 000000000..856b7e596 --- /dev/null +++ b/packages/cli/src/index.ts @@ -0,0 +1 @@ +export { AutoRc } from "@auto-it/core"; diff --git a/packages/core/package.json b/packages/core/package.json index a10df0cab..26f6fc5e7 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -38,6 +38,7 @@ }, "dependencies": { "@auto-it/bot-list": "link:../../packages/bot-list", + "@endemolshinegroup/cosmiconfig-typescript-loader": "^3.0.2", "@octokit/plugin-enterprise-compatibility": "^1.2.2", "@octokit/plugin-retry": "^3.0.1", "@octokit/plugin-throttling": "^3.2.0", diff --git a/packages/core/src/auto-args.ts b/packages/core/src/auto-args.ts index f8e187412..e2aa6d195 100644 --- a/packages/core/src/auto-args.ts +++ b/packages/core/src/auto-args.ts @@ -4,33 +4,28 @@ import { GithubInformation, LogOptions, ReleaseCalculationOptions, + AutoRc, } from "./types"; -export interface ICreateLabelsOptions { - /** Do not actually do anything */ - dryRun?: boolean; -} +export type ICreateLabelsOptions = DryRunOption; export interface ILabelOptions { /** PR to get the labels for */ pr?: number; - /** Label to check for */ exists?: string; } -export interface IPRCheckOptions { +export interface IPRCheckOptions extends DryRunOption { /** PR to check the label for */ pr?: number; /** URL to attach to the checkmark */ url?: string; /** The context the check should be attached to */ context?: string; - /** Do not actually do anything */ - dryRun?: boolean; } -export interface IPRStatusOptions { +export interface IPRStatusOptions extends DryRunOption { /** The commit to attach a check to */ sha?: string; /** The pr to attach a check to */ @@ -43,8 +38,6 @@ export interface IPRStatusOptions { description: string; /** The context the check should be attached to */ context: string; - /** Do not actually do anything */ - dryRun?: boolean; } export type IVersionOptions = ReleaseCalculationOptions & { @@ -57,39 +50,23 @@ export interface QuietOption { quiet?: boolean; } -interface NoVersionPrefix { - /** Whether to prefix the version with a "v" */ - noVersionPrefix?: boolean; -} +type NoVersionPrefix = Pick; export interface DryRunOption { /** Do not actually do anything */ dryRun?: boolean; } -interface ChangelogMessage { - /** The commit message to commit the changelog changes with */ - message?: string; -} - interface ChangelogTitle { /** Override the title use in the addition to the CHANGELOG.md. */ title?: string; } -interface Prerelease { - /** Create a prerelease */ - prerelease?: boolean; -} - -interface BaseBranch { - /** The branch to treat as the base */ - baseBranch?: string; -} +type BaseBranch = Pick; export type IChangelogOptions = BaseBranch & ChangelogTitle & - ChangelogMessage & + NonNullable & QuietOption & DryRunOption & NoVersionPrefix & @@ -103,7 +80,7 @@ export type IChangelogOptions = BaseBranch & }; export type IReleaseOptions = BaseBranch & - Prerelease & + NonNullable & DryRunOption & NoVersionPrefix & Partial & @@ -116,78 +93,49 @@ export type IReleaseOptions = BaseBranch & useVersion?: string; }; -export type ICommentOptions = DryRunOption & { - /** The message to use when commenting */ - message?: string; - /** THe PR to comment on */ - pr?: number; - /** The context the message should be attached to. Use to post multiple comments to a PR */ - context?: string; - /** Delete the previous comment */ - delete?: boolean; - /** Instead of deleting/adding a new comment. Just edit the old one */ - edit?: boolean; -}; +export type ICommentOptions = DryRunOption & + NonNullable & { + /** The message to use when commenting */ + message?: string; + /** THe PR to comment on */ + pr?: number; + /** The context the message should be attached to. Use to post multiple comments to a PR */ + context?: string; + }; export type IPRBodyOptions = Omit; export type ILatestOptions = BaseBranch & DryRunOption & Partial & - Prerelease & + NonNullable & NoVersionPrefix & ChangelogTitle & - ChangelogMessage & QuietOption & - ReleaseCalculationOptions & { - /** Skip creating the changelog */ - noChangelog?: boolean; - }; - -export type IShipItOptions = ILatestOptions & { - /** - * Make auto publish prerelease versions when merging to baseBranch. - * Only PRs merged with "release" label will generate a "latest" release. - * Only use this flag if you do not want to maintain a prerelease branch, - * and instead only want to use baseBranch. - */ - onlyGraduateWithReleaseLabel?: boolean; -}; + ReleaseCalculationOptions; -interface ForceOption { - /** Always deploy even if marked as skip release */ - force?: boolean; -} +export type IShipItOptions = ILatestOptions & NonNullable; export type ICanaryOptions = QuietOption & - ForceOption & { - /** Do not actually do anything */ - dryRun?: boolean; + NonNullable & + DryRunOption & { /** THe PR to attach the canary to */ pr?: number; /** The build to attach the canary to */ build?: number; - /** The message used when attaching the canary version to a PR */ - message?: string | "false"; }; export type INextOptions = QuietOption & - ForceOption & { - /** Do not actually do anything */ - dryRun?: boolean; - /** The message used when attaching the prerelease version to a PR */ - message?: string; - }; + NonNullable & + DryRunOption; export interface IInfoOptions { /** List some of the available plugins */ listPlugins?: boolean; } -export type GlobalOptions = { - /** Plugins to initialize "auto" with */ - plugins?: string[]; -} & Partial & +export type GlobalOptions = Pick & + Partial & LogOptions; export type ApiOptions = GlobalOptions & diff --git a/packages/core/src/auto.ts b/packages/core/src/auto.ts index f4d9aebb5..de31c5af1 100644 --- a/packages/core/src/auto.ts +++ b/packages/core/src/auto.ts @@ -2260,3 +2260,5 @@ export { LernaPackage, } from "./utils/get-lerna-packages"; export { default as inFolder } from "./utils/in-folder"; + +export { AutoRc } from "./types"; diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts index 084b8368a..fc3ac8dd5 100644 --- a/packages/core/src/config.ts +++ b/packages/core/src/config.ts @@ -2,6 +2,7 @@ import { cosmiconfig } from "cosmiconfig"; import merge from "deepmerge"; import fetch from "node-fetch"; import * as path from "path"; +import TypeScriptLoader from "@endemolshinegroup/cosmiconfig-typescript-loader"; import { getVersionMap } from "./release"; import { ILogger } from "./utils/logger"; @@ -66,7 +67,26 @@ export default class Config { * load the extends property, load the plugins and start the git remote interface. */ async loadConfig() { - const explorer = cosmiconfig("auto"); + const name = "auto"; + const explorer = cosmiconfig(name, { + searchPlaces: [ + "package.json", + `.${name}rc`, + `.${name}rc.json`, + `.${name}rc.yaml`, + `.${name}rc.yml`, + `.${name}rc.ts`, + `.${name}rc.js`, + `.${name}rc.cjs`, + `${name}.config.js`, + `${name}.config.cjs`, + `${name}.config.ts`, + `${name}.config.js`, + ], + loaders: { + ".ts": TypeScriptLoader, + }, + }); const result = await explorer.search(); let rawConfig: ConfigObject = {}; @@ -75,6 +95,10 @@ export default class Config { rawConfig = result.config; } + if (typeof rawConfig === "function") { + rawConfig = await rawConfig(); + } + if (rawConfig.extends) { rawConfig = merge( rawConfig, diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index bdb283aaa..a6e28cfa0 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -1,6 +1,6 @@ import * as t from "io-ts"; -import { labelDefinition } from "./semver"; +import { ILabelDefinition, labelDefinition } from "./semver"; const author = t.partial({ /** The name and email of the author to make commits with */ @@ -71,38 +71,58 @@ export const globalOptions = t.partial({ versionBranches: t.union([t.boolean, t.string]), /** Options to pass to "auto comment" */ comment: t.partial({ + /** Delete the previous comment */ delete: t.boolean, + /** Instead of deleting/adding a new comment. Just edit the old one */ edit: t.boolean, }), /** Options to pass to "auto changelog" */ changelog: t.partial({ + /** The commit message to commit the changelog changes with */ message: t.string, }), /** Options to pass to "auto release" */ release: t.partial({ + /** Create a prerelease */ prerelease: t.boolean, }), /** Options to pass to "auto shipit" */ shipit: t.partial({ + /** Create a prerelease */ prerelease: t.boolean, + /** Skip creating the changelog */ noChangelog: t.boolean, + /** The commit message to commit the changelog changes with */ message: t.string, + /** + * Make auto publish prerelease versions when merging to baseBranch. + * Only PRs merged with "release" label will generate a "latest" release. + * Only use this flag if you do not want to maintain a prerelease branch, + * and instead only want to use baseBranch. + */ onlyGraduateWithReleaseLabel: t.boolean, }), /** Options to pass to "auto latest" */ latest: t.partial({ + /** Create a prerelease */ prerelease: t.boolean, + /** Skip creating the changelog */ noChangelog: t.boolean, + /** The commit message to commit the changelog changes with */ message: t.string, }), /** Options to pass to "auto canary" */ canary: t.partial({ + /** Always deploy even if marked as skip release */ force: t.boolean, + /** The message used when attaching the canary version to a PR */ message: t.union([t.literal(false), t.string]), }), /** Options to pass to "auto next" */ next: t.partial({ + /** Always deploy even if marked as skip release */ force: t.boolean, + /** The message used when attaching the prerelease version to a PR */ message: t.string, }), }); @@ -120,7 +140,12 @@ export const autoRc = t.intersection([ ]), ]); -export type AutoRc = t.TypeOf; +export type AutoRc = t.TypeOf & { + // Seems to be a bug with io-ts and label jsDoc isn't getting through + // so we explicitly set it + /** Labels that power auto */ + labels?: ILabelDefinition[]; +}; export const loadedAutoRc = t.intersection([ autoRc, diff --git a/yarn.lock b/yarn.lock index 3089041ba..451491669 100644 --- a/yarn.lock +++ b/yarn.lock @@ -64,12 +64,13 @@ integrity sha512-TYiuOxy5Pf9ORn94X/ujl7PY9opIh+l6NzRAV8EBLpIv3IC9gmEoev4wmmyP7Q33J0/nGjqxAaZcq/n2SZrYaQ== "@auto-it/bot-list@link:packages/bot-list": - version "10.18.8" + version "10.19.0" "@auto-it/core@link:packages/core": - version "10.18.8" + version "10.19.0" dependencies: "@auto-it/bot-list" "link:packages/bot-list" + "@endemolshinegroup/cosmiconfig-typescript-loader" "^3.0.2" "@octokit/plugin-enterprise-compatibility" "^1.2.2" "@octokit/plugin-retry" "^3.0.1" "@octokit/plugin-throttling" "^3.2.0" @@ -101,13 +102,14 @@ tapable "^2.0.0-beta.2" terminal-link "^2.1.1" tinycolor2 "^1.4.1" + ts-node "^9.1.1" tslib "2.1.0" type-fest "^0.21.1" typescript-memoize "^1.0.0-alpha.3" url-join "^4.0.0" "@auto-it/npm@link:plugins/npm": - version "10.18.8" + version "10.19.0" dependencies: "@auto-it/core" "link:packages/core" "@auto-it/package-json-utils" "link:packages/package-json-utils" @@ -124,13 +126,13 @@ user-home "^2.0.0" "@auto-it/package-json-utils@link:packages/package-json-utils": - version "10.18.8" + version "10.19.0" dependencies: parse-author "^2.0.0" parse-github-url "1.0.2" "@auto-it/released@link:plugins/released": - version "10.18.8" + version "10.19.0" dependencies: "@auto-it/bot-list" "link:packages/bot-list" "@auto-it/core" "link:packages/core" @@ -1385,6 +1387,16 @@ resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.7.4.tgz#19bf0f5af19149111c40d98bb0cf82119f5d9eeb" integrity sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw== +"@endemolshinegroup/cosmiconfig-typescript-loader@^3.0.2": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@endemolshinegroup/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-3.0.2.tgz#eea4635828dde372838b0909693ebd9aafeec22d" + integrity sha512-QRVtqJuS1mcT56oHpVegkKBlgtWjXw/gHNWO3eL9oyB5Sc7HBoc2OLG/nYpVfT/Jejvo3NUrD0Udk7XgoyDKkA== + dependencies: + lodash.get "^4" + make-error "^1" + ts-node "^9" + tslib "^2" + "@eslint/eslintrc@^0.2.2": version "0.2.2" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.2.2.tgz#d01fc791e2fc33e88a29d6f3dc7e93d0cd784b76" @@ -10117,7 +10129,7 @@ lodash.clonedeep@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= -lodash.get@^4.4.2: +lodash.get@^4, lodash.get@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= @@ -10299,7 +10311,7 @@ make-error@1.x: resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== -make-error@^1.1.1: +make-error@^1, make-error@^1.1.1: version "1.3.6" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== @@ -15260,7 +15272,7 @@ ts-jest@^26.1.3: semver "7.x" yargs-parser "20.x" -ts-node@^9.1.1: +ts-node@^9, ts-node@^9.1.1: version "9.1.1" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-9.1.1.tgz#51a9a450a3e959401bda5f004a72d54b936d376d" integrity sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg== @@ -15292,7 +15304,7 @@ tslib@1.10.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== -tslib@2.1.0, tslib@^2.0.0, tslib@^2.0.3: +tslib@2.1.0, tslib@^2, tslib@^2.0.0, tslib@^2.0.3: version "2.1.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a" integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A== From 47ea37fe0444010da4a22563168a711f4e9d218b Mon Sep 17 00:00:00 2001 From: Andrew Lisowski Date: Sat, 13 Mar 2021 12:54:58 -0800 Subject: [PATCH 2/2] using "as" doesn't verify as much as you'd want --- auto.config.ts | 56 +++++++++++------------- docs/pages/docs/configuration/autorc.mdx | 30 ++++++------- 2 files changed, 40 insertions(+), 46 deletions(-) diff --git a/auto.config.ts b/auto.config.ts index 0a3c909bd..3c9150559 100644 --- a/auto.config.ts +++ b/auto.config.ts @@ -5,6 +5,28 @@ import { IBrewPluginOptions } from "./plugins/brew"; import { IGhPagesPluginOptions } from "./plugins/gh-pages"; import { IAllContributorsPluginOptions } from "./plugins/all-contributors"; +const npmOptions: INpmConfig = { + exact: true, + canaryScope: "@auto-canary", +}; + +const allContributorsOptions: IAllContributorsPluginOptions = { + types: { + plugin: "**/plugin/**/*", + code: ["**/src/**/*", "**/package.json", "**/tsconfig.json"], + }, +}; + +const brewOptions: IBrewPluginOptions = { + executable: "./packages/cli/binary/auto-macos.gz", + name: "auto", +}; + +const ghPagesOptions: IGhPagesPluginOptions = { + buildCommand: "yarn docs:build", + dir: "docs/out", +}; + /** Auto configuration */ export default function rc(): AutoRc { return { @@ -17,40 +39,14 @@ export default function rc(): AutoRc { "./packages/cli/binary/auto-win.exe.gz", ], ], - [ - "npm", - { - exact: true, - canaryScope: "@auto-canary", - } as INpmConfig, - ], + ["npm", npmOptions], "released", "first-time-contributor", "pr-body-labels", "./scripts/auto-update-curl-version.js", - [ - "all-contributors", - { - types: { - plugin: "**/plugin/**/*", - code: ["**/src/**/*", "**/package.json", "**/tsconfig.json"], - }, - } as IAllContributorsPluginOptions, - ], - [ - "brew", - { - executable: "./packages/cli/binary/auto-macos.gz", - name: "auto", - } as IBrewPluginOptions, - ], - [ - "gh-pages", - { - buildCommand: "yarn docs:build", - dir: "docs/out", - } as IGhPagesPluginOptions, - ], + ["all-contributors", allContributorsOptions], + ["brew", brewOptions], + ["gh-pages", ghPagesOptions], ], labels: [ { diff --git a/docs/pages/docs/configuration/autorc.mdx b/docs/pages/docs/configuration/autorc.mdx index 6c63ea605..0d8eaeba5 100644 --- a/docs/pages/docs/configuration/autorc.mdx +++ b/docs/pages/docs/configuration/autorc.mdx @@ -34,27 +34,25 @@ import { AutoRc } from "auto"; import { INpmConfig } from "@auto-it/core"; import { IAllContributorsPluginOptions } from "@auto-it/all-contributors"; +const npmOptions: INpmConfig = { + exact: true, + canaryScope: "@auto-canary", +}; + +const allContributorsOptions: IAllContributorsPluginOptions = { + types: { + plugin: "**/plugin/**/*", + code: ["**/src/**/*", "**/package.json", "**/tsconfig.json"], + }, +}; + /** Auto configuration */ export default function rc(): AutoRc { return { plugins: [ "released", - [ - "npm", - { - exact: true, - canaryScope: "@auto-canary", - } as INpmConfig, - ], - [ - "all-contributors", - { - types: { - plugin: "**/plugin/**/*", - code: ["**/src/**/*", "**/package.json", "**/tsconfig.json"], - }, - } as IAllContributorsPluginOptions, - ], + ["npm", npmOptions], + ["all-contributors", allContributorsOptions], ], labels: [ {