Skip to content

Install devDependencies before prepare #1183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2015

Conversation

rosen-vladimirov
Copy link
Contributor

As our hooks (like typescript) are called before executing prepare method, we must be sure we have
all devDependencies installed in order to be able to execute before-prepare hooks.
This is mandatory for projects where typescript is enabled, but you do not have node_modules directory yet.

Steps to reproduce the bug:

  1. tns create app1
  2. cd app1
  3. tns install typescript
  4. rm -rf node_modules
  5. tns build android
    You'll see error:
Error: Cannot find module 'nativescript-dev-typescript/lib/before-prepare.js'

As our hooks (like typescript) are called before executing prepare method, we must be sure we have
all devDependencies installed in order to be able to execute before-prepare hooks.
This is mandatory for projects where typescript is enabled, but you do not have node_modules directory yet.
@rosen-vladimirov rosen-vladimirov self-assigned this Nov 13, 2015
@rosen-vladimirov rosen-vladimirov added this to the 1.5.0 milestone Nov 13, 2015
@teobugslayer
Copy link
Contributor

👍

@ns-bot
Copy link

ns-bot commented Nov 13, 2015

Test PASSed.

let packageJsonContent = this.$fs.readJson(this.getPackageJsonFilePath()).wait();
let devDependencies = _.keys(packageJsonContent.devDependencies);
if(devDependencies.length && (this.$options.force || _.difference(devDependencies, installedDependencies).length)) {
let command = `npm install ${devDependencies.join(" ")}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use npm install --development?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, I want only devDependencies to be installed, while npm i --development is installing everything including devDependencies.

rosen-vladimirov added a commit that referenced this pull request Nov 13, 2015
@rosen-vladimirov rosen-vladimirov merged commit d575480 into release Nov 13, 2015
@rosen-vladimirov rosen-vladimirov deleted the vladimirov/fix-tsc-no-modules branch November 13, 2015 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants