Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/semantic-release/r…
Browse files Browse the repository at this point in the history
…elease-notes-generator-13.0.0
  • Loading branch information
achingbrain authored May 10, 2024
2 parents 15069d8 + 9f10341 commit 8dadb06
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 177 deletions.
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
## [42.2.11](https://github.com/ipfs/aegir/compare/v42.2.10...v42.2.11) (2024-05-01)


### Bug Fixes

* revert [#1512](https://github.com/ipfs/aegir/issues/1512) ([eea2bd1](https://github.com/ipfs/aegir/commit/eea2bd14bf9d22a03ae34d81982d89021a2930a3))

## [42.2.10](https://github.com/ipfs/aegir/compare/v42.2.9...v42.2.10) (2024-05-01)


### Bug Fixes

* do not escape GitHub alerts in readmes ([#1512](https://github.com/ipfs/aegir/issues/1512)) ([3b58126](https://github.com/ipfs/aegir/commit/3b5812649fb6faa3bb78d7e15f078fbc80e8555f))

## [42.2.9](https://github.com/ipfs/aegir/compare/v42.2.8...v42.2.9) (2024-04-26)


### Bug Fixes

* use sync glob ([#1510](https://github.com/ipfs/aegir/issues/1510)) ([1b85876](https://github.com/ipfs/aegir/commit/1b85876332ca1c20d9446bd5af7657a1e11ae68c))

## [42.2.8](https://github.com/ipfs/aegir/compare/v42.2.7...v42.2.8) (2024-04-25)


### Bug Fixes

* update web root ([6a694ec](https://github.com/ipfs/aegir/commit/6a694eca72e70d7363479377a5654f1d24685073))

## [42.2.7](https://github.com/ipfs/aegir/compare/v42.2.6...v42.2.7) (2024-04-25)


### Bug Fixes

* use ES2023.Array ([#1509](https://github.com/ipfs/aegir/issues/1509)) ([18dde31](https://github.com/ipfs/aegir/commit/18dde3196d18b9b90f612021054dc2cd1a3cde11))

## [42.2.6](https://github.com/ipfs/aegir/compare/v42.2.5...v42.2.6) (2024-04-25)


### Bug Fixes

* use absolute links in generated readme ([#1508](https://github.com/ipfs/aegir/issues/1508)) ([8974445](https://github.com/ipfs/aegir/commit/89744455d79a19fee84fc07f458e918bae92d827))
* use fast-glob for resolving projects ([#1494](https://github.com/ipfs/aegir/issues/1494)) ([c45c922](https://github.com/ipfs/aegir/commit/c45c9225296a9ee5636ec83671516168bcf92041))

## [42.2.5](https://github.com/ipfs/aegir/compare/v42.2.4...v42.2.5) (2024-02-27)


Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aegir",
"version": "42.2.5",
"version": "42.2.11",
"description": "JavaScript project management",
"license": "Apache-2.0 OR MIT",
"homepage": "https://github.com/ipfs/aegir#readme",
Expand Down Expand Up @@ -226,10 +226,10 @@
"@electron/get": "^3.0.0",
"@polka/send-type": "^0.5.2",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/commit-analyzer": "^11.1.0",
"@semantic-release/commit-analyzer": "^12.0.0",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^9.0.3",
"@semantic-release/npm": "^11.0.2",
"@semantic-release/github": "^10.0.3",
"@semantic-release/npm": "^12.0.0",
"@semantic-release/release-notes-generator": "^13.0.0",
"@types/chai": "^4.2.16",
"@types/chai-as-promised": "^7.1.3",
Expand Down Expand Up @@ -283,7 +283,7 @@
"micromark-extension-gfm-strikethrough": "^2.0.0",
"micromark-extension-gfm-table": "^2.0.0",
"micromark-extension-gfm-task-list-item": "^2.0.1",
"minimatch": "^9.0.0",
"fast-glob": "^3.3.2",
"mocha": "^10.0.0",
"npm-package-json-lint": "^7.0.0",
"nyc": "^15.1.0",
Expand Down
5 changes: 3 additions & 2 deletions src/check-project/check-monorepo-readme.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ import {
/**
* @param {string} projectDir
* @param {string} repoUrl
* @param {string} webRoot
* @param {string} defaultBranch
* @param {string[]} projectDirs
* @param {string} ciFile
*/
export async function checkMonorepoReadme (projectDir, repoUrl, defaultBranch, projectDirs, ciFile) {
export async function checkMonorepoReadme (projectDir, repoUrl, webRoot, defaultBranch, projectDirs, ciFile) {
const repoParts = repoUrl.split('/')
const repoName = repoParts.pop()
const repoOwner = repoParts.pop()
Expand Down Expand Up @@ -146,7 +147,7 @@ export async function checkMonorepoReadme (projectDir, repoUrl, defaultBranch, p
other.push(child)
})

const license = parseMarkdown(LICENSE(pkg, repoOwner, repoName, defaultBranch))
const license = parseMarkdown(LICENSE(pkg, repoOwner, repoName, webRoot, defaultBranch))

/** @type {import('mdast').Root} */
let apiDocs = {
Expand Down
5 changes: 3 additions & 2 deletions src/check-project/check-readme.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import {
/**
* @param {string} projectDir
* @param {string} repoUrl
* @param {string} webRoot
* @param {string} defaultBranch
* @param {string} ciFile
* @param {any} [rootManifest]
*/
export async function checkReadme (projectDir, repoUrl, defaultBranch, ciFile, rootManifest) {
export async function checkReadme (projectDir, repoUrl, webRoot, defaultBranch, ciFile, rootManifest) {
const repoParts = repoUrl.split('/')
const repoName = repoParts.pop()
const repoOwner = repoParts.pop()
Expand Down Expand Up @@ -162,7 +163,7 @@ export async function checkReadme (projectDir, repoUrl, defaultBranch, ciFile, r
apiDocs = parseMarkdown(APIDOCS(pkg, rootManifest))
}

const license = parseMarkdown(LICENSE(pkg, repoOwner, repoName, defaultBranch))
const license = parseMarkdown(LICENSE(pkg, repoOwner, repoName, webRoot, defaultBranch))

readme.children = [
...header,
Expand Down
51 changes: 25 additions & 26 deletions src/check-project/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import prompt from 'prompt'
import semver from 'semver'
import yargsParser from 'yargs-parser'
import {
getSubprojectDirectories,
isMonorepoProject,
glob,
usesReleasePlease
} from '../utils.js'
import { checkBuildFiles } from './check-build-files.js'
Expand Down Expand Up @@ -113,33 +113,29 @@ async function processMonorepo (projectDir, manifest, branchName, repoUrl, ciFil
}

const projectDirs = []
const webRoot = `${repoUrl}/tree/${branchName}`

for (const workspace of workspaces) {
for await (const subProjectDir of glob('.', workspace, {
cwd: projectDir,
absolute: true
})) {
const stat = await fs.stat(subProjectDir)
for (const subProjectDir of await getSubprojectDirectories(projectDir, workspaces)) {
const stat = await fs.stat(subProjectDir)

if (!stat.isDirectory()) {
continue
}
if (!stat.isDirectory()) {
continue
}

const manfest = path.join(subProjectDir, 'package.json')
const manfest = path.join(subProjectDir, 'package.json')

if (!fs.existsSync(manfest)) {
continue
}
if (!fs.existsSync(manfest)) {
continue
}

const pkg = fs.readJSONSync(manfest)
const homePage = `${repoUrl}/tree/${branchName}${subProjectDir.substring(projectDir.length)}`
const pkg = fs.readJSONSync(manfest)
const homePage = `${webRoot}/${subProjectDir.includes(projectDir) ? subProjectDir.substring(projectDir.length) : subProjectDir}`

console.info('Found monorepo project', pkg.name)
console.info('Found monorepo project', pkg.name)

await processModule(subProjectDir, pkg, branchName, repoUrl, homePage, ciFile, manifest)
await processModule(subProjectDir, pkg, branchName, repoUrl, homePage, ciFile, manifest)

projectDirs.push(subProjectDir)
}
projectDirs.push(subProjectDir)
}

await alignMonorepoProjectDependencies(projectDirs)
Expand All @@ -154,7 +150,7 @@ async function processMonorepo (projectDir, manifest, branchName, repoUrl, ciFil
}))
await checkLicenseFiles(projectDir)
await checkBuildFiles(projectDir, branchName, repoUrl)
await checkMonorepoReadme(projectDir, repoUrl, branchName, projectDirs, ciFile)
await checkMonorepoReadme(projectDir, repoUrl, webRoot, branchName, projectDirs, ciFile)
await checkMonorepoFiles(projectDir)
}

Expand Down Expand Up @@ -386,17 +382,20 @@ async function processModule (projectDir, manifest, branchName, repoUrl, homePag
const { projectType } = await prompt.get({
properties: {
projectType: {
description: 'Project type: typescript | typedESM | typedCJS | untypedESM | untypedCJS',
description: 'Project type: typescript | typedESM | typedCJS | untypedESM | untypedCJS | skip',
required: true,
conform: (value) => {
return ['typescript', 'typedESM', 'typedCJS', 'untypedESM', 'untypedCJS'].includes(value)
return ['typescript', 'typedESM', 'typedCJS', 'untypedESM', 'untypedCJS', 'skip'].includes(value)
},
default: 'typescript'
default: 'skip'
}
}
})

if (projectType === 'typescript') {
if (projectType === 'skip') {
console.info('Skipping', manifest.name)
return
} else if (projectType === 'typescript') {
typescript = true
} else if (projectType === 'typedESM') {
typedESM = true
Expand Down Expand Up @@ -447,7 +446,7 @@ async function processModule (projectDir, manifest, branchName, repoUrl, homePag
}

await checkLicenseFiles(projectDir)
await checkReadme(projectDir, repoUrl, branchName, ciFile, rootManifest)
await checkReadme(projectDir, repoUrl, homePage, branchName, ciFile, rootManifest)
await checkTypedocFiles(projectDir, typescript)
}

Expand Down
19 changes: 10 additions & 9 deletions src/check-project/readme/license.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* @type {Record<string, (repoOwner: string, repoName: string, defaultBranch: string) => string>}
* @type {Record<string, (repoOwner: string, repoName: string, repoUrl: string, defaultBranch: string) => string>}
*/
const licenses = {
ipfs: (repoOwner, repoName, defaultBranch) => `
ipfs: (repoOwner, repoName, webRoot, defaultBranch) => `
# License
Licensed under either of
* Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / http://www.apache.org/licenses/LICENSE-2.0)
* MIT ([LICENSE-MIT](LICENSE-MIT) / http://opensource.org/licenses/MIT)
* Apache 2.0, ([LICENSE-APACHE](${webRoot.replace('/tree/', '/blob/')}/LICENSE-APACHE) / http://www.apache.org/licenses/LICENSE-2.0)
* MIT ([LICENSE-MIT](${webRoot.replace('/tree/', '/blob/')}/LICENSE-MIT) / http://opensource.org/licenses/MIT)
# Contribute
Expand All @@ -22,13 +22,13 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)
`,
default: (repoOwner, repoName, defaultBranch) => `
default: (repoOwner, repoName, webRoot, defaultBranch) => `
# License
Licensed under either of
* Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / http://www.apache.org/licenses/LICENSE-2.0)
* MIT ([LICENSE-MIT](LICENSE-MIT) / http://opensource.org/licenses/MIT)
* Apache 2.0, ([LICENSE-APACHE](${webRoot.replace('/tree/', '/blob/')}/LICENSE-APACHE) / http://www.apache.org/licenses/LICENSE-2.0)
* MIT ([LICENSE-MIT](${webRoot.replace('/tree/', '/blob/')}/LICENSE-MIT) / http://opensource.org/licenses/MIT)
# Contribution
Expand All @@ -40,8 +40,9 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
* @param {*} pkg
* @param {string} repoOwner
* @param {string} repoName
* @param {string} webRoot
* @param {string} defaultBranch
*/
export const LICENSE = (pkg, repoOwner, repoName, defaultBranch) => {
return (licenses[repoOwner] ?? licenses.default)(repoOwner, repoName, defaultBranch)
export const LICENSE = (pkg, repoOwner, repoName, webRoot, defaultBranch) => {
return (licenses[repoOwner] ?? licenses.default)(repoOwner, repoName, webRoot, defaultBranch)
}
2 changes: 1 addition & 1 deletion src/config/tsconfig.aegir.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"checkJs": true,
"target": "ES2022",
"module": "ES2022",
"lib": ["ES2022", "DOM", "DOM.Iterable", "WebWorker"],
"lib": ["ES2023", "ES2023.Array", "DOM", "DOM.Iterable", "WebWorker"],
"noEmit": false,
"noEmitOnError": true,
"emitDeclarationOnly": false,
Expand Down
21 changes: 8 additions & 13 deletions src/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { execa } from 'execa'
import fs from 'fs-extra'
import Listr from 'listr'
import { calculateSiblingVersion } from './check-project/utils.js'
import { isMonorepoProject, isMonorepoRoot, hasDocs, glob } from './utils.js'
import { isMonorepoProject, isMonorepoRoot, hasDocs, getSubprojectDirectories } from './utils.js'

/**
* @typedef {import("./types").GlobalOptions} GlobalOptions
Expand Down Expand Up @@ -151,18 +151,13 @@ async function calculateSiblingVersions (rootDir, workspaces) {
/** @type {Record<string, string>} */
const siblingVersions = {}

for (const workspace of workspaces) {
for await (const subProjectDir of glob(rootDir, workspace, {
cwd: rootDir,
absolute: true
})) {
const pkg = JSON.parse(fs.readFileSync(path.join(subProjectDir, 'package.json'), {
encoding: 'utf-8'
}))

siblingVersions[pkg.name] = calculateSiblingVersion(pkg.version)
packageDirs.push(subProjectDir)
}
for (const subProjectDir of await getSubprojectDirectories(rootDir, workspaces)) {
const pkg = JSON.parse(fs.readFileSync(path.join(subProjectDir, 'package.json'), {
encoding: 'utf-8'
}))

siblingVersions[pkg.name] = calculateSiblingVersion(pkg.version)
packageDirs.push(subProjectDir)
}

return {
Expand Down
9 changes: 3 additions & 6 deletions src/test-dependant/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import os from 'os'
import path from 'path'
import fs from 'fs-extra'
import {
exec,
glob
exec, getSubprojectDirectories
} from '../utils.js'

/**
Expand Down Expand Up @@ -197,10 +196,8 @@ const testMonoRepo = async (targetDir, deps, scriptName) => {
}

// test each package that depends on passed deps
for (const pattern of config.workspaces) {
for await (const match of glob(targetDir, pattern)) {
await testModule(path.join(targetDir, match), deps, scriptName)
}
for (const match of await getSubprojectDirectories(targetDir, config.workspaces)) {
await testModule(path.join(targetDir, match), deps, scriptName)
}
}

Expand Down
Loading

0 comments on commit 8dadb06

Please sign in to comment.