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

🧹 chore(none): repo maintenance #2577

Merged
merged 1 commit into from
Apr 25, 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
3 changes: 2 additions & 1 deletion config/eslint.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ module.exports = {
`**/*.d.ts`,
`**/*.html`,
`**/*.json`,
`**/.budfiles`,
`**/.storage`,
`**/compiled`,
`**/dist`,
`**/lib`,
`**/node_modules`,
Expand Down
4 changes: 2 additions & 2 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
login: kellymears
avatar: https://avatars.githubusercontent.com/u/397606?v=4
url: https://github.com/kellymears
contributions: 986
contributions: 989
email: [email protected]
- name: QWp6t
login: QWp6t
Expand Down Expand Up @@ -37,7 +37,7 @@
login: dsturm
avatar: https://avatars.githubusercontent.com/u/384815?v=4
url: https://github.com/dsturm
contributions: 3
contributions: 4
- name: Nicolas Lemoine
login: nlemoine
avatar: https://avatars.githubusercontent.com/u/2526939?v=4
Expand Down
5 changes: 0 additions & 5 deletions sources/@repo/constants/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,3 @@
* Absolute path from repo relative path
*/
export declare const path: (...path: Array<string>) => string

/**
* bud repository configuration
*/
export declare const projectConfig: Record<string, any>
29 changes: 2 additions & 27 deletions sources/@repo/constants/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {createRequire} from 'module'
import {join} from 'path'
import {fileURLToPath} from 'url'

Expand All @@ -7,31 +6,7 @@ export const root = (
? fileURLToPath(import.meta.url)
: __dirname
)
.split(`sources/`)
.split(`sources`)
.shift()

export const path = (...path) => path.length ? join(root, ...path) : root

export const ROOT_MANIFEST_PATH = path(`package.json`)
export const STORAGE_PATH = path(`storage`)
export const TS_CONFIG_PATH = path(`config`, `tsconfig.json`)
export const REGISTRY_PROXY = `http://localhost:4873`

export const paths = {
config: path(`config`),
fixtures: path(`storage`, `fixtures`),
root: root,
sources: path(`sources`),
storage: path(`storage`),
tests: path(`tests`),
}

let projectConfig
if (typeof import.meta?.url !== `undefined`) {
const require = createRequire(import.meta.url)
projectConfig = require(`../../../config/monorepo.config.cjs`)
} else {
projectConfig = require(`../../../config/monorepo.config.cjs`)
}

export {projectConfig}
export const path = (...path) => (path.length ? join(root, ...path) : root)
10 changes: 4 additions & 6 deletions sources/@repo/markdown-kit/contributors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,31 @@ import {join} from 'path'

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

import ignoredCommits from './ignored_sha.js'

let {root, sources} = paths

const octokit = new (Octokit.plugin(paginateRest))({
auth: process.env.GITHUB_TOKEN,
})

await yml.write(
join(root, `contributors.yml`),
path(`contributors.yml`),
await getContributorsFromCommits(),
)

await fs.listAsync(join(sources, `@roots`)).then(
await fs.listAsync(path(`sources`, `@roots`)).then(
async signifiers =>
await signifiers
.map(signifier => join(`@roots`, signifier))
.reduce(async (promised, signifier) => {
await promised

const pkgPath = join(sources, signifier)
const pkgPath = path(`sources`, signifier)
const jsonPath = join(pkgPath, `package.json`)
const ymlPath = join(pkgPath, `contributors.yml`)

Expand Down
21 changes: 12 additions & 9 deletions sources/@repo/markdown-kit/readme/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type {GrayMatterFile} from 'gray-matter'

import {path, projectConfig} from '@repo/constants'
import {sep} from 'path'

import {path} from '@repo/constants'
import {Filesystem, json as Json} from '@roots/bud-support/filesystem'
import globby from '@roots/bud-support/globby'
import {Logger} from '@roots/bud-support/logger'
Expand All @@ -9,20 +11,19 @@ import {format} from 'prettier'

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

const fs = new Filesystem()
const logger = new Logger({
logLevel: `info`,
})

type Chunks = Array<string> | Promise<Array<string>>
type File = GrayMatterFile<string>
type ChunkReducer<T> = (chunks: Chunks, obj: T) => Promise<Chunks>
type ForPackage<T> = (signifier: string) => T

const fs = new Filesystem()
const logger = new Logger({logLevel: `info`})

/**
* Returns props for a template
*/
const getProps = async (signifier: string) => {
const {default: projectConfig} = await import(path(`config`, `monorepo.config.cjs`))
const json = await Json.read(path(`sources`, signifier, `package.json`))
return {...json, projectConfig}
}
Expand Down Expand Up @@ -83,7 +84,7 @@ const partials: ForPackage<ChunkReducer<string>> =
const chunks = await promised

const file = matter(
await fs.read(path(`sources/${signifier}/docs/${docsPath}`), `utf8`),
await fs.read(path(`sources`, signifier, `docs`, docsPath), `utf8`),
)

return [
Expand All @@ -103,11 +104,13 @@ const partials: ForPackage<ChunkReducer<string>> =
* - An `extension` package is an optional Bud interface
* - A `library` package is not Bud specific but is used by Bud interfaces
*/
await globby(path(`sources/@roots/*`), {
await globby(path(`sources`, `@roots`, `*`), {
onlyDirectories: true,
}).then(async packages => {
await Promise.all(
packages.map(path => path.split(`sources/`).pop()).map(generateReadme),
packages
.map(path => path.split(`sources${sep}`).pop())
.map(generateReadme),
)
})

Expand Down
30 changes: 15 additions & 15 deletions sources/@repo/yarn-plugin-bud/bundles/@yarnpkg/plugin-bud.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sources/@roots/blade-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/browserslist-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/bud-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/bud-babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/bud-build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/bud-cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/bud-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/bud-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/bud-compress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/bud-criticalcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/bud-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/bud-emotion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/bud-entrypoints/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/bud-esbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/bud-eslint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ You can configure Stylelint in two ways:

### Using an eslint config file

You can configure eslint [using a eslint config file](https://eslint.io/user-guide/configure).
You can configure eslint [using a eslint config file](https://eslint.org/docs/latest/use/configure/configuration-files).

bud.js allows for you to write your eslint config in CommonJS, ESM, TypeScript, JSON or YML. This file should be placed in the root of your project or the project `./config` directory.

Expand Down
5 changes: 5 additions & 0 deletions sources/@roots/bud-eslint/contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@
url: https://github.com/chrillep
contributions: 1
email: [email protected]
- name: Daniel Sturm
login: dsturm
avatar: https://avatars.githubusercontent.com/u/384815?v=4
url: https://github.com/dsturm
contributions: 1
6 changes: 5 additions & 1 deletion sources/@roots/bud-eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"email": "[email protected]",
"name": "Christian Widlund",
"url": "https://github.com/chrillep"
},
{
"name": "Daniel Sturm",
"url": "https://github.com/dsturm"
}
],
"license": "MIT",
Expand Down Expand Up @@ -93,4 +97,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/bud-extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/bud-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/bud-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
2 changes: 1 addition & 1 deletion sources/@roots/bud-imagemin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@
"volta": {
"extends": "../../../package.json"
}
}
}
12 changes: 6 additions & 6 deletions sources/@roots/bud-imagemin/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {join} from 'node:path'

import {paths} from '@repo/constants'
import {path} from '@repo/constants'
import execa from '@roots/bud-support/execa'
import * as fs from 'fs-jetpack'
import {beforeAll, describe, expect, it} from 'vitest'

const testDirectory = join(paths.sources, `@roots`, `bud-imagemin`, `test`)
const testDirectory = path(`sources`, `@roots`, `bud-imagemin`, `test`)

describe(`@roots/bud-imagemin test projects`, () => {
beforeAll(async () => {
Expand Down Expand Up @@ -36,8 +36,8 @@ describe(`@roots/bud-imagemin test projects`, () => {
)

expect(source?.length).toMatchInlineSnapshot(`4995`)
expect(quality50?.length).toMatchInlineSnapshot('undefined')
expect(qualityDefault?.length).toMatchInlineSnapshot('undefined')
expect(quality50?.length).toMatchInlineSnapshot(`undefined`)
expect(qualityDefault?.length).toMatchInlineSnapshot(`undefined`)
})

it(`should generate webp with expected sizes`, async () => {
Expand All @@ -61,7 +61,7 @@ describe(`@roots/bud-imagemin test projects`, () => {
),
`utf8`,
)
expect(quality50?.length).toMatchInlineSnapshot('undefined')
expect(qualityDefault?.length).toMatchInlineSnapshot('undefined')
expect(quality50?.length).toMatchInlineSnapshot(`undefined`)
expect(qualityDefault?.length).toMatchInlineSnapshot(`undefined`)
})
})
Loading
Loading