Prechádzať zdrojové kódy

feat(create): Pin TypeScript version

Fixes #268. Since TypeScript does not really follow SemVer, minor versions can (and do) break Vendure compilation.
Michael Bromley 5 rokov pred
rodič
commit
a2fba131a6

+ 6 - 0
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';

+ 2 - 2
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())

+ 2 - 0
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 };