diff --git a/internal-tooling/.gitignore b/internal-tooling/.gitignore deleted file mode 100644 index a14702c409..0000000000 --- a/internal-tooling/.gitignore +++ /dev/null @@ -1,34 +0,0 @@ -# dependencies (bun install) -node_modules - -# output -out -dist -*.tgz - -# code coverage -coverage -*.lcov - -# logs -logs -_.log -report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json - -# dotenv environment variable files -.env -.env.development.local -.env.test.local -.env.production.local -.env.local - -# caches -.eslintcache -.cache -*.tsbuildinfo - -# IntelliJ based IDEs -.idea - -# Finder (MacOS) folder config -.DS_Store diff --git a/internal-tooling/README.md b/internal-tooling/README.md index 22be2684fc..3b44d78ea8 100644 --- a/internal-tooling/README.md +++ b/internal-tooling/README.md @@ -23,3 +23,6 @@ in tsconfig.json for any other workspace package specified by package.json as a dependency, peer-dependency, or dev-dependency. Will also ensure the proper settings for composite etc. are in use. + +For packages that should emit types (any non-test app package) it will +ensure that the declarationDir is added to the files array in package.json. diff --git a/internal-tooling/package.json b/internal-tooling/package.json index fb8cb48ca6..e4e0d85ab7 100644 --- a/internal-tooling/package.json +++ b/internal-tooling/package.json @@ -23,6 +23,9 @@ "@pnpm/find-workspace-packages": "6.0.9", "@pnpm/logger": "1000.0.0" }, + "engines": { + "node": ">= 18.20.7" + }, "volta": { "extends": "../package.json" } diff --git a/internal-tooling/src/-utils.ts b/internal-tooling/src/-utils.ts index f6929e3165..26d851966c 100644 --- a/internal-tooling/src/-utils.ts +++ b/internal-tooling/src/-utils.ts @@ -34,6 +34,17 @@ export async function getPackageJson({ packageDir, packagesDir }: { packageDir: return { file: packageJsonFile, pkg, path: packageJsonPath, nicePath: path.join(packageDir, 'package.json') }; } +export async function runPrettier() { + const root = await getMonorepoRoot(); + const childProcess = Bun.spawn(['bun', 'lint:prettier:fix'], { + env: process.env, + cwd: root, + stdout: 'inherit', + stderr: 'inherit', + }); + await childProcess.exited; +} + type PkgJsonFile = { name: string; version: string; @@ -91,6 +102,11 @@ interface BaseProjectPackage { tsconfigFile: BunFile; pkgPath: string; tsconfigPath: string; + isRoot: boolean; + isPrivate: boolean; + isTooling: boolean; + isConfig: boolean; + isTest: boolean; pkg: PkgJsonFile; save: (editStatus: { pkgEdited: boolean; configEdited: Boolean }) => Promise; } @@ -138,13 +154,14 @@ export async function walkPackages( const dir = await getMonorepoRoot(); const packages = await collectAllPackages(dir); const projects = new Map(); + const TestDir = path.join(dir, 'tests'); for (const [name, project] of packages) { if (config.excludeRoot && name === 'root') continue; if (config.excludePrivate && project.manifest.private) continue; if (config.excludeTooling && name === '@warp-drive/internal-tooling') continue; if (config.excludeConfig && name === '@warp-drive/config') continue; - if (config.excludeTests && project.dir === 'tests') continue; + if (config.excludeTests && project.dir.startsWith(TestDir)) continue; const pkgPath = path.join(project.dir, 'package.json'); const tsconfigPath = path.join(project.dir, 'tsconfig.json'); @@ -162,6 +179,11 @@ export async function walkPackages( pkgPath, hasTsConfig, tsconfigPath, + isRoot: name === 'root', + isPrivate: project.manifest.private ?? false, + isTooling: name === '@warp-drive/internal-tooling', + isConfig: name === '@warp-drive/config', + isTest: project.dir.startsWith(TestDir), pkg, tsconfig, save: async ({ pkgEdited, configEdited }: { pkgEdited: boolean; configEdited: Boolean }) => { diff --git a/internal-tooling/src/sync-references.ts b/internal-tooling/src/sync-references.ts index 2426ed5a41..53a01ac205 100755 --- a/internal-tooling/src/sync-references.ts +++ b/internal-tooling/src/sync-references.ts @@ -3,7 +3,13 @@ import debug from 'debug'; import path from 'path'; import chalk from 'chalk'; -import { walkPackages, type ProjectPackage, type ProjectPackageWithTsConfig, type TsConfigFile } from './-utils'; +import { + runPrettier, + walkPackages, + type ProjectPackage, + type ProjectPackageWithTsConfig, + type TsConfigFile, +} from './-utils'; const log = debug('wd:sync-references'); @@ -195,8 +201,9 @@ async function main() { log( `\n\t${chalk.gray('=').repeat(60)}\n\t\t${chalk.magentaBright('@warp-drive/')}${chalk.greenBright('internal-tooling')} Sync TypeScript References\n\t${chalk.gray('=').repeat(60)}\n\n\t\t${chalk.gray(`Syncing Project References`)}\n\n` ); + let anyFileEdited = false; - walkPackages(async (project: ProjectPackage, projects: Map) => { + await walkPackages(async (project: ProjectPackage, projects: Map) => { log(`\t📦 Syncing ${project.pkg.name}`); let pkgEdited = false; let tsconfigEdited = false; @@ -231,6 +238,17 @@ async function main() { log(`\t\t🔧 Added paths hash to tsconfig.json`); } + if (!project.isTest) { + if (!project.pkg.files?.includes(tsconfig.compilerOptions!.declarationDir!)) { + project.pkg.files ??= []; + project.pkg.files.push(tsconfig.compilerOptions!.declarationDir!); + pkgEdited = true; + log( + `\t\t🔧 Added types output directory "${tsconfig.compilerOptions.declarationDir}" to files in package.json` + ); + } + } + for (const name of referenced) { const relProject = projects.get(name); if (!relProject) { @@ -262,8 +280,13 @@ async function main() { } } - await project.save({ pkgEdited, configEdited: tsconfigEdited }); + if (pkgEdited || tsconfigEdited) { + anyFileEdited = true; + await project.save({ pkgEdited, configEdited: tsconfigEdited }); + } }); + + if (anyFileEdited) await runPrettier(); } main(); diff --git a/packages/codemods/package.json b/packages/codemods/package.json index 20f6ca31d8..d0b8e731ad 100644 --- a/packages/codemods/package.json +++ b/packages/codemods/package.json @@ -28,7 +28,8 @@ "utils", "codemods", "logos", - "LICENSE.md" + "LICENSE.md", + "unstable-preview-types" ], "author": "", "license": "MIT", diff --git a/packages/schema/package.json b/packages/schema/package.json index 2fbe54b86c..f84cf7c71a 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -27,7 +27,8 @@ }, "files": [ "README.md", - "LICENSE.md" + "LICENSE.md", + "unstable-preview-types" ], "bin": { "parse": "./parse", diff --git a/warp-drive-packages/core/README.md b/warp-drive-packages/core/README.md index 64de63adcb..f1dffc7736 100644 --- a/warp-drive-packages/core/README.md +++ b/warp-drive-packages/core/README.md @@ -50,22 +50,6 @@ rich application — letting you ship better experiences more quickly withou
-## Quick Links - -- [Installation](#installation) -- [API Docs](https://api.emberjs.com/ember-data/release) -- [Guides](./guides/index.md) -- [Build Config](./packages/build-config/README.md) -- [Ember Compatibility](#compatibility) -- [The Big List of Versions](#the-big-list-of-versions) -- [Contributing](./CONTRIBUTING.md) -- [Community & Help](https://emberjs.com/community) -- [RFCs](https://github.com/emberjs/rfcs/labels/T-ember-data) -- [Team](https://emberjs.com/team) -- [Blog](https://emberjs.com/blog) - -
- ## Installation ```sh