From 47fcd1b0e701df91708286e187899cf01928d0c7 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Thu, 9 Jan 2025 10:59:15 -0500 Subject: [PATCH] npm: success --- scripts/test-package-manager.mjs | 41 ++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/scripts/test-package-manager.mjs b/scripts/test-package-manager.mjs index 321c5dd7d1..ae8615dc07 100644 --- a/scripts/test-package-manager.mjs +++ b/scripts/test-package-manager.mjs @@ -86,7 +86,15 @@ async function fixManifest(projectDir) { return tars.find((name) => name.startsWith(hyphenated)); } - // TODO: + for (let [depName, version] of Object.entries(json.devDependencies)) { + if (!version.includes('workspace')) { + continue; + } + + let local = tarByPrefix(depName.replace('@', '').replace('/', '-')); + + json.devDependencies[depName] = local; + } writeFileSync(manifestPath, JSON.stringify(json, null, 2)); } @@ -98,6 +106,9 @@ async function fixTSConfig(projectDir) { delete json.references; + json.glint = { + environment: [], + }; json.compilerOptions.paths = { 'vite-basic-compat/*': ['./app/*'], 'vite-basic-compat/tests/*': ['./tess/*'], @@ -119,6 +130,7 @@ async function install(packageManager, cwd) { } async function typecheck(packageManager, cwd) { + banner('typecheck'); switch (packageManager) { case 'npm': return await $({ preferLocal: true, shell: true, cwd, stdio: 'inherit' })`npm exec glint`; @@ -129,13 +141,25 @@ async function typecheck(packageManager, cwd) { } } async function build(packageManager, cwd) { + banner('build'); return await $({ preferLocal: true, shell: true, cwd, stdio: 'inherit' })`${packageManager} run build`; } async function test(packageManager, cwd) { + banner('test'); return await $({ preferLocal: true, shell: true, cwd, stdio: 'inherit' })`${packageManager} run test:vite`; } +function banner(text) { + console.info(` +-------------------------------- + + ${text} + +-------------------------------- + `); +} + async function main() { const [, , packageManager] = process.argv; @@ -156,9 +180,18 @@ async function main() { await fixManifest(projectDir); await fixTSConfig(projectDir); await install(packageManager, projectDir); - await typecheck(packageManager, projectDir); - await build(packageManager, projectDir); - await test(packageManager, projectDir); + let typesResult = await typecheck(packageManager, projectDir); + let buildResult = await build(packageManager, projectDir); + let testResult = await test(packageManager, projectDir); + + console.info(` + Using: ${packageManager}; + In: ${projectDir} + + types: ${typesResult.exitCode === 0 ? 'Success' : 'Failure'} + build: ${buildResult.exitCode === 0 ? 'Success' : 'Failure'} + test: ${testResult.exitCode === 0 ? 'Success' : 'Failure'} + `); } await main();