Skip to content

Commit

Permalink
fix(create-app): xdev renames + node versions
Browse files Browse the repository at this point in the history
  • Loading branch information
wmertens committed Mar 4, 2024
1 parent 404e0e6 commit 11aed89
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
7 changes: 5 additions & 2 deletions packages/create-qwik/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
"yargs": "17.7.2"
},
"engines": {
"node": ">=16.8.0 <18.0.0 || >=18.11",
"npm": ">=6.0.0"
"node": "^18.17.0 || ^20.3.0 || >=21.0.0",
"npm": ">=10.0.0",
"pnpm": ">=8.0.0",
"yarn": ">=3.0.0"
},
"engines-annotation": "Mostly required by sharp which needs a Node-API v9 compatible runtime",
"files": [
"create-qwik.cjs",
"index.cjs",
Expand Down
14 changes: 11 additions & 3 deletions packages/qwik/src/cli/utils/install-deps.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { bgRed, cyan, red } from 'kleur/colors';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { log } from '@clack/prompts';
import type { IntegrationData } from '../types';
Expand All @@ -15,11 +14,19 @@ export function runInPkg(pkgManager: string, args: string[], cwd: string) {
return runCommand(cmd, args, cwd);
}

/**
* This does an initial install of the base dependencies in the background while the install is
* running. Afterwards the actual dependencies get added and the package manager re-run
*/
export function backgroundInstallDeps(pkgManager: string, baseApp: IntegrationData) {
const { tmpInstallDir } = setupTmpInstall(baseApp);

const { install, abort } = installDeps(pkgManager, tmpInstallDir);

install.finally(() => {
fs.rmdirSync(tmpInstallDir, { recursive: true });
});

const complete = async (outDir: string) => {
let success = false;

Expand Down Expand Up @@ -84,11 +91,12 @@ export function backgroundInstallDeps(pkgManager: string, baseApp: IntegrationDa

function setupTmpInstall(baseApp: IntegrationData) {
const tmpId =
'create-qwik-' +
'.create-qwik-' +
Math.round(Math.random() * Number.MAX_SAFE_INTEGER)
.toString(36)
.toLowerCase();
const tmpInstallDir = path.join(os.tmpdir(), tmpId);
// Keep in same mountpoint so renames can move quickly
const tmpInstallDir = path.join(baseApp.dir, tmpId);

try {
fs.mkdirSync(tmpInstallDir);
Expand Down
7 changes: 6 additions & 1 deletion starters/apps/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@
"trustedDependencies": [
"sharp"
],
"trustedDependencies-annotation": "Needed for bun to allow running install scripts",
"engines": {
"node": ">=16.8.0 <18.0.0 || >=18.11"
"node": "^18.17.0 || ^20.3.0 || >=21.0.0",
"npm": ">=10.0.0",
"pnpm": ">=8.0.0",
"yarn": ">=3.0.0"
},
"engines-annotation": "Mostly required by sharp which needs a Node-API v9 compatible runtime",
"private": true,
"type": "module"
}

0 comments on commit 11aed89

Please sign in to comment.