diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dd5fd2dc6..62821fc3bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## Version 2.0.0 + +Release date: Thu Mar 21 2024 + +--- + ## Version 2.0.0-next.18 Release date: Thu Mar 21 2024 diff --git a/docs/pages/changelog.mdx b/docs/pages/changelog.mdx index 9dd5fd2dc6..62821fc3bf 100644 --- a/docs/pages/changelog.mdx +++ b/docs/pages/changelog.mdx @@ -1,3 +1,9 @@ +## Version 2.0.0 + +Release date: Thu Mar 21 2024 + +--- + ## Version 2.0.0-next.18 Release date: Thu Mar 21 2024 diff --git a/package.json b/package.json index ca0b0fd48f..5a5ffda9d4 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "prettier:check": "prettier --check '**/*.{ts,tsx,css,md,mdx,sol}'", "release:check": "changeset status --verbose --since=origin/main", "release:publish": "pnpm install && pnpm build && changeset publish", - "release:version": "changeset version && pnpm install --lockfile-only", + "release:version": "changeset version && pnpm install --lockfile-only && pnpm run changelog:generate", "sort-package-json": "npx sort-package-json package.json 'packages/*/package.json' 'templates/*/package.json' 'templates/*/packages/*/package.json' 'examples/*/package.json' 'examples/*/packages/*/package.json' 'e2e/*/package.json' 'e2e/*/packages/*/package.json' 'docs/package.json'", "test": "pnpm run --recursive --filter=!@latticexyz/services test", "test:ci": "pnpm run --recursive --parallel --filter=!@latticexyz/services test:ci", @@ -39,6 +39,7 @@ "devDependencies": { "@arktype/attest": "0.6.4", "@changesets/cli": "^2.26.1", + "@types/glob": "^7.2.0", "@types/node": "^18.15.11", "@typescript-eslint/eslint-plugin": "7.1.1", "@typescript-eslint/parser": "7.1.1", @@ -46,6 +47,7 @@ "chalk": "^5.2.0", "eslint": "8.57.0", "execa": "^7.0.0", + "glob": "^8.0.3", "husky": ">=6", "lint-staged": ">=10", "prettier": "3.2.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9e2c5c67d5..f0d75816be 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: '@changesets/cli': specifier: ^2.26.1 version: 2.26.1 + '@types/glob': + specifier: ^7.2.0 + version: 7.2.0 '@types/node': specifier: ^18.15.11 version: 18.15.11 @@ -35,6 +38,9 @@ importers: execa: specifier: ^7.0.0 version: 7.0.0 + glob: + specifier: ^8.0.3 + version: 8.0.3 husky: specifier: '>=6' version: 6.0.0 @@ -430,8 +436,6 @@ importers: specifier: 0.34.6 version: 0.34.6(jsdom@22.1.0) - packages/ecs-browser: {} - packages/faucet: dependencies: '@fastify/compress': @@ -524,12 +528,6 @@ importers: specifier: 0.34.6 version: 0.34.6(jsdom@22.1.0) - packages/network: {} - - packages/noise: {} - - packages/phaserx: {} - packages/protocol-parser: dependencies: '@latticexyz/common': @@ -713,8 +711,6 @@ importers: specifier: ^6.7.0 version: 6.7.0(postcss@8.4.23)(typescript@5.4.2) - packages/solecs: {} - packages/solhint-config-mud: devDependencies: tsup: @@ -734,10 +730,6 @@ importers: specifier: ^6.7.0 version: 6.7.0(postcss@8.4.23)(typescript@5.4.2) - packages/std-client: {} - - packages/std-contracts: {} - packages/store: dependencies: '@arktype/util': @@ -805,8 +797,6 @@ importers: specifier: 0.34.6 version: 0.34.6(jsdom@22.1.0) - packages/store-cache: {} - packages/store-indexer: dependencies: '@koa/cors': diff --git a/scripts/changelog.ts b/scripts/changelog.ts index 42e4c61049..ab3569a64a 100644 --- a/scripts/changelog.ts +++ b/scripts/changelog.ts @@ -6,6 +6,7 @@ import { execa } from "execa"; import { readFileSync, writeFileSync } from "node:fs"; import path from "path"; +import glob from "glob"; //--------- CONSTANTS @@ -13,7 +14,7 @@ const REPO_URL = process.env.REPO_URL ?? "https://github.com/latticexyz/mud"; const CHANGELOG_PATH = process.env.CHANGELOG_PATH ?? "CHANGELOG.md"; const CHANGELOG_DOCS_PATH = process.env.CHANGELOG_DOCS_PATH ?? "docs/pages/changelog.mdx"; const VERSION_PATH = process.env.VERSION_PATH ?? path.join(process.cwd(), "packages/world/package.json"); -const INCLUDE_CHANGESETS = (process.env.INCLUDE_CHANGESETS as "diff" | "all") ?? "diff"; // "diff" to only include new changesets, "all" to use all changesets in pre.json +const INCLUDE_CHANGESETS = (process.env.INCLUDE_CHANGESETS as "diff" | "all") ?? "diff"; // "diff" to only include new changesets, "all" to use all changesets enum ChangeType { PATCH, @@ -95,24 +96,24 @@ async function getVersion() { } async function getChanges(include: "diff" | "all") { - const changesetsToInclude: string[] = []; + let changesetsToInclude: string[] = []; if (include === "diff") { // Get the diff of the current branch to main - const changesetDiff = (await execa("git", ["diff", "main", ".changeset/pre.json"])).stdout; - - // Get the list of changesets - const addedLinesRegex = /\+\s+"(?!.*:)([^"]+)"/g; - changesetsToInclude.push(...[...changesetDiff.matchAll(addedLinesRegex)].map((match) => match[1])); + // --diff-filter=d excludes deleted files from diff (changesets deletes these files after release) + changesetsToInclude = (await execa("git", ["diff", "--name-only", "--diff-filter=d", "main", ".changeset"])).stdout + .trim() + .split(/\s+/) + .map((filename) => filename.trim()) + .filter((filename) => /.md$/.test(filename)); } else if (include === "all") { - // Load all current changesets from the .changeset/pre.json file - changesetsToInclude.push(...(await import(path.join(process.cwd(), ".changeset/pre.json"))).default.changesets); + // Load all current changesets from the .changeset dir + changesetsToInclude = glob.sync(".changeset/*.md"); } // Load the contents of each changeset and metadata from git const changesetContents = await Promise.all( - changesetsToInclude.map(async (addedChangeset) => { - const changesetPath = `.changeset/${addedChangeset}.md`; + changesetsToInclude.map(async (changesetPath) => { const changeset = readFileSync(changesetPath).toString(); const gitLog = (await execa("git", ["log", changesetPath])).stdout; return { ...parseChangeset(changeset), ...parseGitLog(gitLog) };