stealjs / steal

Gets JavaScript
https://stealjs.com
MIT License
1.36k stars 522 forks source link

npm-crawl fails to find a package when using github dependency shorthand #1504

Open nlundquist opened 5 years ago

nlundquist commented 5 years ago

Reproducible: Always

When using an NPM compatible shorthand for a GitHub hosted dependency ie:

"dependencies": {
  ...
  "can-legacy-view-helpers": "canjs/can-legacy-view-helpers#can-5-compat",
}

rather than:

"dependencies": {
  ...
  "can-legacy-view-helpers": "git+https://git@github.com:canjs/can-legacy-view-helpers#can-5-compat"",
}

Though the application works fine in dev mode, a Steal build fails with the following:

build - buildResult TypeError: Cannot read property 'steal' of undefined at Object.config (VM1439 npm-utils.js:564) at Object.getDependencyMap (VM1441 npm-crawl.js:242) at Object.loadPlugins (VM1441 npm-crawl.js:181) at VM1441 npm-crawl.js:107

Environment:

Software Version
Steal version 2.2.2
Steal-tools version 2.2.2
node -v 10.16.0
npm -v 6.9.0
Operating system MacOS 10.14.5

Note: This same failure occurs when using a valid Git URL (rather than shorthand) of the form git+ssh://git@github.com:canjs/can-ejs#can-5-compat". Steal only appears to play nice with Git URLs that are prefixed with git+https://.

m-mujica commented 4 years ago

@nlundquist do you have a repo where I can replicate this issue?

I just tried with:

{
  "name": "steal-crawl-issue",
  "version": "1.0.0",
  "main": "main.js",
  "dependencies": {
    "can": "canjs/canjs#master"
  },
  "devDependencies": {
    "steal": "^2.2.2",
    "steal-tools": "^2.2.2"
  }
}

and

{
  "name": "steal-crawl-issue",
  "version": "1.0.0",
  "main": "main.js",
  "dependencies": {
    "can": "^5.0.0",
    "can-legacy-view-helpers": "canjs/can-legacy-view-helpers#can-5-compat"
  },
  "devDependencies": {
    "steal": "2.2.2",
    "steal-tools": "2.2.2"
  }
}

both apps build without errors (I'm importing the module using the shorthand in my code).