Skip to content

Commit

Permalink
fix(repl): version detection (QwikDev#6790)
Browse files Browse the repository at this point in the history
  • Loading branch information
wmertens authored Aug 14, 2024
1 parent 6f498cb commit 22920f2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@
]
}
},
"simple-git-hooks": {
"pre-commit": "pnpm pretty-quick --staged"
},
"contributors": [
{
"name": "Miško Hevery",
Expand Down Expand Up @@ -228,13 +225,13 @@
"lint.prettier": "prettier --cache --check .",
"lint.rust": "make lint",
"lint.syncpack": "syncpack list-mismatches",
"prepare": "simple-git-hooks",
"preinstall": "npx only-allow pnpm",
"prepare": "simple-git-hooks",
"prettier.fix": "prettier --cache --write .",
"qwik-save-artifacts": "tsm ./scripts/qwik-save-artifacts.ts",
"release": "changeset publish",
"release.prepare": "pnpm build --prepare-release",
"release.pkg-pr-new": "pnpm dlx pkg-pr-new@^0.0.9 publish --compact --pnpm ./packages/qwik ./packages/qwik-city ./packages/eslint-plugin-qwik ./packages/create-qwik",
"release.prepare": "pnpm build --prepare-release",
"serve": "tsm --inspect --conditions=development starters/dev-server.ts 3300",
"serve.debug": "tsm --inspect-brk --conditions=development starters/dev-server.ts 3300",
"start": "concurrently \"npm:build.watch\" \"npm:tsc.watch\" -n build,tsc -c green,cyan",
Expand All @@ -256,5 +253,8 @@
"update.qwik.builds": "tsm scripts/update-qwik-builds.ts packages/docs && tsm scripts/update-qwik-builds.ts packages/insights; pnpm install",
"vitest": "vitest"
},
"simple-git-hooks": {
"pre-commit": "pnpm pretty-quick --staged"
},
"type": "module"
}
4 changes: 2 additions & 2 deletions packages/docs/src/repl/repl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ export const receiveMessageFromReplServer = (
const getDependencies = (input: ReplAppInput) => {
const out = { ...bundled };
if (input.version !== 'bundled') {
const isDev = input.version.includes('dev');
const v = input.version.split('-')[0].split('.').map(Number);
const prefix = v[0] >= 1 && v[1] >= 7 && v[2] >= (isDev ? 1 : 2) ? '/dist/' : '/';
const prefix =
v[0] > 1 || (v[0] == 1 && (v[1] > 7 || (v[1] == 7 && v[2] >= 2))) ? '/dist/' : '/';
out[QWIK_PKG_NAME] = {
version: input.version,
};
Expand Down
3 changes: 2 additions & 1 deletion packages/docs/src/repl/worker/app-bundle-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export const appBundleClient = async (
buildMode: options.buildMode,
debug: options.debug,
srcInputs: getInputs(options),
entryStrategy: options.entryStrategy,
// Older versions don't support `segment`
entryStrategy: options.entryStrategy === 'segment' ? 'hook' : options.entryStrategy,
manifestOutput: (m) => {
result.manifest = m;
},
Expand Down
3 changes: 1 addition & 2 deletions packages/docs/src/repl/worker/repl-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ let cache: Cache;
export const depResponse = async (pkgName: string, pkgPath: string) => {
if (pkgName === QWIK_PKG_NAME && !pkgPath.startsWith('/bindings')) {
const version = options.deps[pkgName].version;
const isDev = version.includes('dev');
const v = version.split('-')[0].split('.').map(Number);
if (v[0] >= 1 && v[1] >= 7 && v[2] >= (isDev ? 1 : 2)) {
if (v[0] > 1 || (v[0] == 1 && (v[1] > 7 || (v[1] == 7 && v[2] >= 2)))) {
pkgPath = `/dist${pkgPath}`;
}
}
Expand Down

0 comments on commit 22920f2

Please sign in to comment.