Skip to content

Commit

Permalink
Fix bootstrap missing files in gatsby-cli (gatsbyjs#2658)
Browse files Browse the repository at this point in the history
* Don't install yarn as already installed

* Fix missing files during lerna bootstrap

* Use path.posix.join instead of path.join

File comparisons are being made using === resulting in string comparisons that are platform dependent.
  • Loading branch information
Zalastax authored and KyleAMathews committed Oct 30, 2017
1 parent 8a262a4 commit 0b8a7d5
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
1 change: 0 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ install:
Exit-AppVeyorBuild
}
- ps: Install-Product node $env:nodejs_version $env:platform
- choco install yarn --ignore-dependencies
- refreshenv
- echo we are running on %PLATFORM%
- node --version
Expand Down
1 change: 1 addition & 0 deletions packages/gatsby-cli/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/lib
/*.js
!/bin.js
/reporter
yarn.lock
4 changes: 4 additions & 0 deletions packages/gatsby-cli/bin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node
// This file exists to fix a problem lerna has with symlinks on Windows
// See https://github.com/gatsbyjs/gatsby/pull/2658
require(`lib/index.js`)
4 changes: 2 additions & 2 deletions packages/gatsby-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.1.11",
"author": "Kyle Mathews <[email protected]>",
"bin": {
"gatsby": "lib/index.js"
"gatsby": "bin.js"
},
"dependencies": {
"babel-code-frame": "^6.26.0",
Expand Down Expand Up @@ -32,7 +32,7 @@
"gatsby"
],
"license": "MIT",
"main": "lib/index.js",
"main": "bin.js",
"scripts": {
"build": "babel src --out-dir lib --ignore __tests__",
"watch": "babel -w src --out-dir lib --ignore __tests__",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe(`gatsby-remark-copy-linked-files`, () => {
}
const getFiles = filePath => [
{
absolutePath: path.normalize(filePath),
absolutePath: path.posix.normalize(filePath),
internal: {},
extension: filePath
.split(`.`)
Expand Down
8 changes: 4 additions & 4 deletions packages/gatsby-remark-copy-linked-files/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ module.exports = (
isRelativeUrl(link.url) &&
getNode(markdownNode.parent).internal.type === `File`
) {
const linkPath = path.join(getNode(markdownNode.parent).dir, link.url)
const linkPath = path.posix.join(getNode(markdownNode.parent).dir, link.url)
const linkNode = _.find(files, file => {
if (file && file.absolutePath) {
return file.absolutePath === linkPath
}
return null
})
if (linkNode && linkNode.absolutePath) {
const newPath = path.join(
const newPath = path.posix.join(
process.cwd(),
`public`,
`${linkNode.internal.contentDigest}.${linkNode.extension}`
Expand All @@ -43,7 +43,7 @@ module.exports = (
return
}

const relativePath = path.join(
const relativePath = path.posix.join(
`/${linkNode.internal.contentDigest}.${linkNode.extension}`
)
link.url = `${relativePath}`
Expand Down Expand Up @@ -116,7 +116,7 @@ module.exports = (
return
}

const imagePath = path.join(getNode(markdownNode.parent).dir, image.url)
const imagePath = path.posix.join(getNode(markdownNode.parent).dir, image.url)
const imageNode = _.find(files, file => {
if (file && file.absolutePath) {
return file.absolutePath === imagePath
Expand Down

0 comments on commit 0b8a7d5

Please sign in to comment.