From a2fba131a6e10763eaf2d032fbd556b6bad08af1 Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Mon, 30 Mar 2020 15:17:58 +0200 Subject: [PATCH] feat(create): Pin TypeScript version Fixes #268. Since TypeScript does not really follow SemVer, minor versions can (and do) break Vendure compilation. --- packages/create/src/constants.ts | 6 ++++++ packages/create/src/create-vendure-app.ts | 4 ++-- packages/create/src/helpers.ts | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 packages/create/src/constants.ts diff --git a/packages/create/src/constants.ts b/packages/create/src/constants.ts new file mode 100644 index 0000000000..1d095b2f86 --- /dev/null +++ b/packages/create/src/constants.ts @@ -0,0 +1,6 @@ +export const REQUIRED_NODE_VERSION = '>=8.9.0'; +/** + * The TypeScript version needs to pinned because minor versions often + * introduce breaking changes. + */ +export const TYPESCRIPT_VERSION = '3.7.5'; diff --git a/packages/create/src/create-vendure-app.ts b/packages/create/src/create-vendure-app.ts index 2348e00cf7..a7cf19b2ef 100644 --- a/packages/create/src/create-vendure-app.ts +++ b/packages/create/src/create-vendure-app.ts @@ -8,6 +8,7 @@ import os from 'os'; import path from 'path'; import { Observable } from 'rxjs'; +import { REQUIRED_NODE_VERSION } from './constants'; import { gatherCiUserResponses, gatherUserResponses } from './gather-user-responses'; import { checkDbConnection, @@ -22,7 +23,6 @@ import { CliLogLevel } from './types'; // tslint:disable-next-line:no-var-requires const packageJson = require('../package.json'); -const REQUIRED_NODE_VERSION = '>=8.9.0'; checkNodeVersion(REQUIRED_NODE_VERSION); let projectName: string | undefined; @@ -128,7 +128,7 @@ async function createApp( .then(() => { if (devDependencies.length) { subscriber.next(`Installing ${devDependencies.join(', ')}`); - return installPackages(root, useYarn, devDependencies, true, logLevel); + return installPackages(root, useYarn, devDependencies, true, logLevel, isCi); } }) .then(() => subscriber.complete()) diff --git a/packages/create/src/helpers.ts b/packages/create/src/helpers.ts index cf8ae6d7d9..85069b42dc 100644 --- a/packages/create/src/helpers.ts +++ b/packages/create/src/helpers.ts @@ -6,6 +6,7 @@ import fs from 'fs-extra'; import path from 'path'; import semver from 'semver'; +import { TYPESCRIPT_VERSION } from './constants'; import { CliLogLevel, DbType } from './types'; /** @@ -235,6 +236,7 @@ export function getDependencies( const devDependencies = ['concurrently']; if (usingTs) { devDependencies.push('ts-node'); + dependencies.push(`typescript@${TYPESCRIPT_VERSION}`); } return { dependencies, devDependencies };