From 4b027b137b502732156b4e3a333f17ff01fdc9ed Mon Sep 17 00:00:00 2001 From: NGPixel Date: Fri, 21 Jul 2017 17:31:21 -0400 Subject: [PATCH] refactor: use yarn during npm install process --- CHANGELOG.md | 3 +++ npm/install.js | 17 ++++++++++++++++- tsconfig.json | 5 ++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e9d31d5..1ac5f540 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). - **Security**: Optional Two-Factor Authentication (2FA) protection ## [v1.0.0-beta.14] - Unreleased +### Changed +- **Misc**: Switch to Yarn for npm dependencies installation + ### Fixed - **Misc**: JS/CSS is now loading properly in Safari (macOS/iOS) - **Misc**: Process termination handling diff --git a/npm/install.js b/npm/install.js index 2c4de41a..19df66f0 100644 --- a/npm/install.js +++ b/npm/install.js @@ -138,12 +138,24 @@ const tasks = { } }) }, + /** + * Install Yarn + */ + installYarn() { + ora.text = 'Installing Yarn...' + return exec.stdout('npm', ['install', '-g', 'yarn'], { + cwd: installDir + }).then(results => { + ora.text = 'Yarn installed successfully.' + return true + }) + }, /** * Install npm dependencies */ installDependencies() { ora.text = 'Installing Wiki.js npm dependencies...' - return exec.stdout('npm', ['install', '--only=production', '--no-optional'], { + return exec.stdout('yarn', ['install', '--production', '--ignore-optional'], { cwd: installDir }).then(results => { ora.text = 'Wiki.js npm dependencies installed successfully.' @@ -247,6 +259,9 @@ Promise.join( }).then(() => { isContainerBased && console.info('>> Creating config file...') return tasks.ensureConfigFile() +}).then(() => { + isContainerBased && console.info('>> Installing Yarn...') + return tasks.installYarn() }).then(() => { isContainerBased && console.info('>> Installing dependencies...') return tasks.installDependencies() diff --git a/tsconfig.json b/tsconfig.json index 68aba21a..dc25199f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,5 +11,8 @@ "strictNullChecks": true, "suppressImplicitAnyIndexErrors": true, "target": "es5" - } + }, + "exclude": [ + "node_modules" + ] }