Skip to content
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

So many files? #483

Closed
brianstone opened this issue Sep 30, 2016 · 11 comments
Closed

So many files? #483

brianstone opened this issue Sep 30, 2016 · 11 comments

Comments

@brianstone
Copy link
Contributor

"gatsby": "^0.12.6"
node: v4.4.2
macOS Sierra

Just starting Gatsby today and did gatsby new my-test-gatsby-site and was wondering:
Has anyone written a script to remove unwanted files from the install? (i.e. .cjsx, .less, etc.)

If not, I might jump on that.

@KyleAMathews
Copy link
Contributor

Yeah, agree it can be kind of excessive.

With 1.0 and the new "theme" system, one thought is that themes could explicitly provide "example" content that you could a) install without it or b) remove it after installing once you're done playing around with content and you want to add your own content.

@bdougie
Copy link

bdougie commented Oct 2, 2016

The idea of themes is interest, is this sort of like the Hugo does their themes? Is this also being actively developed on a branch?

I would love to take a look and see if there is anything I can assist with.

Update: I found what I was looking for. Going familiarize myself with the Roadmap to 1.0 and read up on the Todos in the project board.

Nice to see the use of GitHub projects in this project, super awesome feature.

@KyleAMathews
Copy link
Contributor

@bdougie themes are probably a post 1.0 feature or will be one of the last features added. They're not necessary to actually build a site — more of an optimization to make it easier for people to adopt Gatsby. But like all optimizations, they should be the last thing you add to ensure all the foundational pieces are really good first.

But yeah, they'll work really similar to theme systems. I really like Jekyll's https://jekyllrb.com/docs/themes/

@brianstone
Copy link
Contributor Author

@KyleAMathews I'm having a bit of trouble with npm link. How do I link the Gatsby project to run locally?

@KyleAMathews
Copy link
Contributor

Have you followed the steps here? https://github.com/gatsbyjs/gatsby/blob/master/CONTRIBUTING.md

@brianstone
Copy link
Contributor Author

@KyleAMathews I got npm link to work, thank you!

@brianstone
Copy link
Contributor Author

"gatsby": "^0.12.14"
node: v6.8.1
macOS Sierra

Hey @KyleAMathews. I thought I had npm link figured out, but unfortunately it's still not working. My goal is to add a flag to the cli that will run a clean version of gatsby pointing to my repo.

I have followed the directions in CONTRIBUTING.md as well and even tried it with a fresh install of my OS and a new user.

I am continuing to get the following error:

Gatsby: Local install exists but failed to load it. Continuing with global install: { Error: /Users/brianstone/code/gatsby/dist/bin/cli.js: Cannot find module
  at PluginPass.Program (/Users/brianstone/code/gatsby/node_modules/babel-plugin-lodash/lib/index.js:97:15)
  at newFn (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/visitors.js:276:21)
  at NodePath._call (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/path/context.js:76:18)
  at NodePath.call (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/path/context.js:48:17)
  at NodePath.visit (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/path/context.js:105:12)
  at TraversalContext.visitQueue (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/context.js:150:16)
  at TraversalContext.visitSingle (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/context.js:108:19)
  at TraversalContext.visit (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/context.js:192:19)
  at Function.traverse.node (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/index.js:114:17)
  at traverse (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/index.js:79:12)
  at File.transform (/Users/brianstone/code/gatsby/node_modules/babel-core/lib/transformation/file/index.js:563:35)
  at /Users/brianstone/code/gatsby/node_modules/babel-core/lib/transformation/pipeline.js:50:19
  at File.wrap (/Users/brianstone/code/gatsby/node_modules/babel-core/lib/transformation/file/index.js:579:16)
  at Pipeline.transform (/Users/brianstone/code/gatsby/node_modules/babel-core/lib/transformation/pipeline.js:47:17)
  at Object.transformFileSync (/Users/brianstone/code/gatsby/node_modules/babel-core/lib/api/node.js:138:10)
  at compile (/Users/brianstone/code/gatsby/node_modules/babel-register/lib/node.js:118:20)
  at loader (/Users/brianstone/code/gatsby/node_modules/babel-register/lib/node.js:144:14)
  at Object.require.extensions.(anonymous function) [as .js] (/Users/brianstone/code/gatsby/node_modules/babel-register/lib/node.js:154:7)
  at Module.load (/Users/brianstone/code/gatsby/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at tryModuleLoad (module.js:446:12)
  at Function.Module._load (module.js:438:3)
  at Module.require (module.js:497:17)
  at require (internal/module.js:20:19)
  at loadGatsby (/Users/brianstone/code/gatsby/bin/gatsby.js:30:3)
  at /Users/brianstone/code/gatsby/bin/gatsby.js:53:7
  at FSReqWrap.oncomplete (fs.js:123:15)
 _babel: true }
/Users/brianstone/code/gatsby/node_modules/babel-core/lib/transformation/file/index.js:605
      throw err;
      ^

Error: /Users/brianstone/code/gatsby/dist/bin/cli.js: Cannot find module
  at PluginPass.Program (/Users/brianstone/code/gatsby/node_modules/babel-plugin-lodash/lib/index.js:97:15)
  at newFn (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/visitors.js:276:21)
  at NodePath._call (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/path/context.js:76:18)
  at NodePath.call (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/path/context.js:48:17)
  at NodePath.visit (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/path/context.js:105:12)
  at TraversalContext.visitQueue (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/context.js:150:16)
  at TraversalContext.visitSingle (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/context.js:108:19)
  at TraversalContext.visit (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/context.js:192:19)
  at Function.traverse.node (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/index.js:114:17)
  at traverse (/Users/brianstone/code/gatsby/node_modules/babel-traverse/lib/index.js:79:12)
  at File.transform (/Users/brianstone/code/gatsby/node_modules/babel-core/lib/transformation/file/index.js:563:35)
  at /Users/brianstone/code/gatsby/node_modules/babel-core/lib/transformation/pipeline.js:50:19
  at File.wrap (/Users/brianstone/code/gatsby/node_modules/babel-core/lib/transformation/file/index.js:579:16)
  at Pipeline.transform (/Users/brianstone/code/gatsby/node_modules/babel-core/lib/transformation/pipeline.js:47:17)
  at Object.transformFileSync (/Users/brianstone/code/gatsby/node_modules/babel-core/lib/api/node.js:138:10)
  at compile (/Users/brianstone/code/gatsby/node_modules/babel-register/lib/node.js:118:20)
  at loader (/Users/brianstone/code/gatsby/node_modules/babel-register/lib/node.js:144:14)
  at Object.require.extensions.(anonymous function) [as .js] (/Users/brianstone/code/gatsby/node_modules/babel-register/lib/node.js:154:7)
  at Module.load (/Users/brianstone/code/gatsby/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at tryModuleLoad (module.js:446:12)
  at Function.Module._load (module.js:438:3)
  at Module.require (module.js:497:17)
  at require (internal/module.js:20:19)
  at loadGatsby (/Users/brianstone/code/gatsby/bin/gatsby.js:30:3)
  at /Users/brianstone/code/gatsby/bin/gatsby.js:44:5
  at LOOP (fs.js:1758:14)
  at _combinedTickCallback (internal/process/next_tick.js:67:7)
  at process._tickCallback (internal/process/next_tick.js:98:9)

I believe that my problem is stemming from a misunderstanding of where my npm packages are located. I was originally linking to usr/local/lib/node_modules/npm/node_modules, but after some looking, it appeared that it was actually pointing to a bin or lib folder located in specific versions of node (brianstone/.nvm/versions/node/v6.8.1/). Here is what my ~/.bash_profile looks like:

[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

if [ -f ~/.git-completion.bash ]; then
     . ~/.git-completion.bash
fi

export NVM_DIR="/Users/brianstone/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

As well, here is what my steps for linking look like:

  1. cd into my fork of gatsby
  2. npm install
  3. npm uninstall -g gatsby && npm link
  4. npm run build
  5. cd into usr/local/lib/node_modules/npm/node_modules
  6. npm link gatsby
  7. cd to a folder to test the cli
  8. npm link gatsby
  9. gatsby new test-fork

    And then it throws the error.

Any ideas to help point me in the right direction?

@KyleAMathews
Copy link
Contributor

I don't have experience with NVM, perhaps that is causing trouble.

Also — you don't need steps 5 & 6.

@bdougie
Copy link

bdougie commented Oct 22, 2016

I think you might be on to something there @KyleAMathews. NVM is a tool to manage multiple versions of node and npm link stores symlink globally to a local repo (as I understand it). NVM might be getting in the way per the first link below, though it seems resolved per the conversation.

nvm-sh/nvm#1118
nvm-sh/nvm#668

@matthewmueller
Copy link

matthewmueller commented Oct 25, 2016

+1, I'd love to see gatsby boiled down to just a pages/ and templates/, where pages are just data and templates are the views. all other configuration goes into the package.json and dependencies.

@brianstone
Copy link
Contributor Author

Hey, going to close this because my original PR was merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants