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

🧪 test: cli flags #2348

Merged
merged 11 commits into from
Jul 4, 2023
Merged
3 changes: 0 additions & 3 deletions config/constraints.pro

This file was deleted.

27 changes: 27 additions & 0 deletions config/eslint.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,33 @@ module.exports = {
[`n/shebang`]: OFF,
[`no-console`]: ERROR,
[`no-extra-semi`]: OFF,
[`perfectionist/sort-imports`]: [
ERROR,
{
[`read-tsconfig`]: false,
'custom-groups': {
type: {
[`node`]: [`node:*`],
},
value: {
[`node`]: [`node:*`],
},
},
groups: [
[`type`],
[`node`, `builtin`],
`external`,
`internal-type`,
`internal`,
[`parent-type`, `sibling-type`, `index-type`],
[`parent`, `sibling`, `index`],
`object`,
`unknown`,
],
order: `asc`,
type: `alphabetical`,
},
],
[`react-hooks/exhaustive-deps`]: WARN,
[`react-hooks/rules-of-hooks`]: ERROR,
[`react/prop-types`]: OFF,
Expand Down
3 changes: 2 additions & 1 deletion config/vitest.e2e.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {env} from 'process'
import {env} from 'node:process'

import GithubActionsReporter from 'vitest-github-actions-reporter'
import {defineConfig} from 'vitest/config'

Expand Down
1 change: 1 addition & 0 deletions config/vitest.integration.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {env} from 'node:process'

import GithubActionsReporter from 'vitest-github-actions-reporter'
import {defineConfig} from 'vitest/config'

Expand Down
1 change: 1 addition & 0 deletions config/vitest.unit.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {env} from 'process'

import GithubActionsReporter from 'vitest-github-actions-reporter'
import {defineConfig} from 'vitest/config'

Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
"syncpack": "10.6.1",
"ts-node": "10.9.1",
"tslib": "2.6.0",
"typescript": "5.1.5",
"typescript": "5.1.6",
"verdaccio": "5.25.0",
"vitest": "0.32.2",
"vitest-github-actions-reporter": "0.10.0",
"webpack": "5.88.0"
"webpack": "5.88.1"
},
"workspaces": {
"packages": [
Expand All @@ -62,7 +62,6 @@
"sources/@roots/*/src/__fixtures__/*",
"sources/create-bud-app",
"sources/deprecated/bud-terser",
"examples/vue-legacy",
"tests/util/project",
"tests/reproductions/*"
]
Expand Down
4 changes: 2 additions & 2 deletions sources/@repo/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"netlify-cli": "15.7.0",
"raw-loader": "4.0.2",
"ts-node": "10.9.1",
"typescript": "5.1.5",
"typescript": "5.1.6",
"url-loader": "4.1.1",
"webpack": "5.88.0"
"webpack": "5.88.1"
},
"dependencies": {
"@docusaurus/theme-classic": "2.4.1",
Expand Down
15 changes: 7 additions & 8 deletions sources/@repo/markdown-kit/contributors/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/* eslint-disable n/no-process-env */
import {join} from 'node:path'

import {Octokit} from '@octokit/core'
import {paginateRest} from '@octokit/plugin-paginate-rest'
import {paths} from '@repo/constants'
import {json, yml} from '@roots/bud-support/filesystem'
import isUndefined from '@roots/bud-support/lodash/isUndefined'
import sortBy from '@roots/bud-support/lodash/sortBy'
import fs from 'fs-jetpack'
import {join} from 'path'

import ignoredCommits from './ignored_sha.js'

Expand Down Expand Up @@ -45,9 +44,9 @@ await fs.listAsync(join(sources, `@roots`)).then(

await json.write(jsonPath, {
...pkgJson,
contributors: contributors.map(({name, email, url}) => ({
name,
contributors: contributors.map(({email, name, url}) => ({
email,
name,
url,
})),
})
Expand All @@ -64,9 +63,9 @@ async function getContributorsFromCommits(path) {
`GET /repos/{owner}/{repo}/commits{?sha,path,author,tag,since,until,per_page,page}`,
{
owner: `roots`,
repo: `bud`,
path,
per_page: 100,
repo: `bud`,
},
response => {
response?.data
Expand All @@ -82,12 +81,12 @@ async function getContributorsFromCommits(path) {
.map(({author, commit}) => {
contributors[author.login] = {
...(contributors[author.login] ?? {}),
name: commit.author.name,
login: author.login,
avatar: author.avatar_url,
url: author.html_url,
contributions:
(contributors[author.login]?.contributions ?? 0) + 1,
login: author.login,
name: commit.author.name,
url: author.html_url,
}

if (
Expand Down
2 changes: 1 addition & 1 deletion sources/@repo/markdown-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"prettier": "2.8.8",
"strip-ansi": "7.1.0",
"tslib": "2.6.0",
"typescript": "5.1.5"
"typescript": "5.1.6"
},
"scripts": {
"build": "yarn tsc -b"
Expand Down
7 changes: 4 additions & 3 deletions sources/@repo/markdown-kit/readme/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import {path, projectConfig} from '@repo/constants'
import {Filesystem, json as Json} from '@roots/bud-support/filesystem'
import globby from '@roots/bud-support/globby'

import {templates} from './renderer/index.js'

import {path, projectConfig} from '@repo/constants'
import type {GrayMatterFile} from 'gray-matter'
import matter from 'gray-matter'
import {format} from 'prettier'

import {templates} from './renderer/index.js'

const fs = new Filesystem()

type Chunks = Array<string> | Promise<Array<string>>
Expand Down
3 changes: 2 additions & 1 deletion sources/@repo/markdown-kit/readme/renderer/handlebars.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type {TemplateDelegate} from 'handlebars'

import {path} from '@repo/constants'
import fs from 'fs-jetpack'
import {globby} from 'globby'
import type {TemplateDelegate} from 'handlebars'
import Handlebars from 'handlebars'

let handlebars = Handlebars
Expand Down
9 changes: 5 additions & 4 deletions sources/@repo/markdown-kit/readme/renderer/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import type {TemplateDelegate} from './handlebars.js'

import {Handlebars, handlebars} from './handlebars.js'

import {path} from '@repo/constants'
import fs from 'fs-jetpack'
import {globby} from 'globby'
import {format} from 'prettier'

import type {TemplateDelegate} from './handlebars.js'
import {Handlebars, handlebars} from './handlebars.js'

const sources = await globby(
path(`sources/@repo/markdown-kit/readme/templates/*.md`),
)
Expand All @@ -23,4 +24,4 @@ const templates: {
}
}, Promise.resolve({}))

export {format, Handlebars, sources, templates, handlebars}
export {Handlebars, format, handlebars, sources, templates}
12 changes: 6 additions & 6 deletions sources/@repo/markdown-kit/releases/data.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import {Octokit} from 'octokit'

interface ghRelease {
published_at: string
tag_name: string
author: {
html_url: string
avatar_url: string
html_url: string
login: string
}
body: string
published_at: string
tag_name: string
}

interface release extends ghRelease {
intro: string
major: number
minor: number
patch: number
semver: string
intro: string
tags: string
}

Expand Down Expand Up @@ -59,13 +59,13 @@ const parse = (release: ghRelease): release => {

return {
...release,
body: release.body.split(`\n`).slice(1).join(`\n`).trim(),
intro: release.body.split(`\n`).shift().trim().trim(),
major: parseVersion(major),
minor: parseVersion(minor),
patch: parseVersion(patch),
semver,
tags: `[release, ${major}, ${major}.${minor}]`,
intro: release.body.split(`\n`).shift().trim().trim(),
body: release.body.split(`\n`).slice(1).join(`\n`).trim(),
}
}

Expand Down
3 changes: 1 addition & 2 deletions sources/@repo/markdown-kit/releases/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {Filesystem} from '@roots/bud-support/filesystem'

import type {release} from './data.js'
import {releases} from './data.js'
import {type release, releases} from './data.js'
import {body, path} from './release.js'

const fs = new Filesystem()
Expand Down
4 changes: 2 additions & 2 deletions sources/@repo/markdown-kit/releases/release.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {join} from 'node:path/posix'

import {paths} from '@repo/constants'
import {join} from 'path'

import type {release} from './data.js'

import {releases} from './data.js'

const getNewerVersions = (current: release): Array<release> =>
Expand Down
2 changes: 1 addition & 1 deletion sources/@repo/test-kit/integration-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {path} from '@repo/constants'
import {bind} from '@roots/bud-support/decorators'
import {execa} from 'execa'
import fs from 'fs-jetpack'
import {join} from 'node:path'
import {join} from 'path'

interface Options {
buildCommand?: [string, Array<string>?]
Expand Down
24 changes: 8 additions & 16 deletions sources/@repo/yarn-plugin-bud/bundles/@yarnpkg/plugin-bud.js

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions sources/@repo/yarn-plugin-bud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@
"private": true,
"packageManager": "yarn@3.2.4",
"main": "./sources/index.ts",
"engines": {
"node": "18.12.1"
},
"devDependencies": {
"@types/lodash": "4.14.195",
"@types/node": "18.16.18",
"@types/semver": "7.5.0",
"@yarnpkg/builder": "4.0.0-rc.46"
"@yarnpkg/builder": "4.0.0-rc.46",
"typescript": "5.1.6"
},
"dependencies": {
"@repo/constants": "workspace:*",
"@yarnpkg/cli": "4.0.0-rc.46",
"@yarnpkg/core": "4.0.0-rc.46",
"@yarnpkg/shell": "4.0.0-rc.46",
"@yarnpkg/cli": "4.0.0-rc.48",
"@yarnpkg/core": "4.0.0-rc.48",
"@yarnpkg/shell": "4.0.0-rc.48",
"clipanion": "3.2.1",
"fs-jetpack": "5.1.0",
"globby": "13.2.0",
"lodash": "4.17.21",
"ora": "6.3.1",
"semver": "7.5.3",
"tslib": "2.6.0",
"typescript": "5.1.5"
"tslib": "2.6.0"
},
"scripts": {
"build": "builder build plugin"
},
"volta": {
"node": "18.12.1",
"npm": "8.19.2",
"yarn": "1.22.19"
"extends": "../../../package.json"
}
}
5 changes: 2 additions & 3 deletions sources/@repo/yarn-plugin-bud/sources/command/_docusaurus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ export class Docusaurus extends Command {
`docusaurus`,
...(this.passthrough ?? []),
])
.catch(error => {
throw error
})
.then(this.throwIfError)
.catch(this.catch)
}
}
36 changes: 36 additions & 0 deletions sources/@repo/yarn-plugin-bud/sources/command/_eslint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import {path} from '@repo/constants'
import {CommandClass, Option} from 'clipanion'

import {Command} from './base.command'

/**
* Eslint command class
*/
export class Eslint extends Command {
public static paths: CommandClass['paths'] = [[`@bud`, `eslint`]]

public static usage: CommandClass['usage'] = {
category: `@bud`,
description: `Eslint passthrough`,
examples: [[`eslint usage info`, `yarn @bud eslint --help`]],
}

public passthrough = Option.Proxy({name: `pm2 options`})

public async execute() {
await this.cli
.run([
`eslint`,
path(`examples/**/*.{ts,tsx,js,jsx}`),
path(`sources/**/src/**/*.{ts,tsx,js,jsx}`),
path(`tests/**/*.{ts,tsx,js,jsx}`),
path(`config/**/*.{ts,tsx,js,jsx}`),
`--config`,
path(`config/eslint.config.cjs`),
`--no-error-on-unmatched-pattern`,
...this.passthrough,
])
.then(this.throwIfError)
.catch(this.catch)
}
}
5 changes: 2 additions & 3 deletions sources/@repo/yarn-plugin-bud/sources/command/_netlify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ export class Netlify extends Command {
`netlify`,
...(this.passthrough ?? []),
])
.catch(error => {
throw error
})
.then(this.throwIfError)
.catch(this.catch)
}
}
Loading