Coder Social home page Coder Social logo

survivejs / react-component-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
357.0 357.0 68.0 3.33 MB

Boilerplate for React.js components (MIT)

Home Page: https://survivejs.github.io/react-component-boilerplate/

License: MIT License

JavaScript 96.93% CSS 3.07%

react-component-boilerplate's People

Contributors

alebrozzo avatar bebraw avatar binhqd avatar dusnoki avatar no23reason avatar rusinovanton avatar yn5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-component-boilerplate's Issues

Error when running gh-pages

I had this error when running gh-pages inside a newly cloned repo:

screen shot 2017-07-10 at 2 25 18 pm

Please help. Thanks for the package too.

JSX -> JS dist-modules issue

Hi! I really like this project. I'm attempting to use it in an educational workshop tomorrow but I'm stuck.

I'm running I keep running into an issue where my dist-modules are attempting to require .jsx files, but the compiled files in dist-modules has .js extensions resulting in an error.

This is strange to me because the docs compile and run fine, and everything else is great. But when I install the package into another project such as create-react-app it results in the aforementioned errors with JS/JSX

Here are some screenshots

screen shot 2017-05-08 at 11 03 51 am

screen shot 2017-05-08 at 11 00 11 am

And here is a link to my test repo https://github.com/richattack/testjam

This is my first attempt at making an external component library. I've been debugging this issue for weeks not sure what the problem but I believe it to be a webpack or babel related issue.

Thanks!

Rich

running the gh-pages npm command does nothing

This is the output followed by no changes in the gh-pages branch and no directory called gh-pages created

➜  react-selection-popover master ✗ npm run gh-pages

> [email protected] gh-pages /react-selection-popover
> webpack

reading file /react-selection-popover/README.md

.npmignore problem

Why you put post_install.js script in lib folder if .npmignore including those? It make npm install error on postinstall command.

Consider adding storybook

It would be nice to have storybook added to the boilerplate so to check components as being developed. I particularly don't use github pages but I think it only allows for a single repo to be deployed, so anyone with multiple projects would have trouble dealing with it.

I get an error when running command BABEL_ENV=es6

I am a Windows dev (please don't shun me) and running scripts on package.jsn that have the setting BABEL_ENV=xxx causes an error. Also happens with rimraf, which I can overcome with replacing it with del-cli package.

Please consider making the scripts Windows friendly ;)

Drop JSCS

ESLint can replace it altogether. One less dependency.

ES Lint Errors strict mode not permitted

I get these errors when running npm run lint:

~/dev/react-component-boilerplate $ npm run lint

> [email protected] lint /Users/saschwarz/dev/react-component-boilerplate
> eslint . --ext .js --ext .jsx

The react/jsx-quotes rule is deprecated. Please use the jsx-quotes rule instead.

/Users/saschwarz/dev/react-component-boilerplate/demo/index.js
  1:1  error  Strict mode is not permitted  strict

/Users/saschwarz/dev/react-component-boilerplate/lib/deploy_gh_pages.js
  1:1  error  Strict mode is not permitted  strict

/Users/saschwarz/dev/react-component-boilerplate/src/index.js
  1:1  error  Strict mode is not permitted  strict

/Users/saschwarz/dev/react-component-boilerplate/webpack.config.babel.js
  1:1  error  Strict mode is not permitted  strict

✖ 4 problems (4 errors, 0 warnings)

Did you want to update the .eslintrc to specify "strict": 0?

I'm not certain how to resolve: The react/jsx-quotes rule is deprecated. Please use the jsx-quotes rule instead. I couldn't find where that is specified in the branch and jsx-quotes is already specified in the .eslintrc.

Missing class properties transform.

screen shot 2017-07-25 at 08 40 52

Hello, I've tried everything, now I'm here begging for help.

I can't seem to add support for es7 class properties using this boilerplate, I'm using this:

"presets": [
    "react",
    "es2015",
    "stage-0"
  ],
  "plugins": [
    "transform-runtime",
    "transform-class-properties"
  ],

and I've tried every order of those I can imagine. Any ideas?

Update Babel to 7.x

I think it would be beneficial to update Babel to 7.x version - especially for <> tag support (React.Fragment) and keeping dependencies always up to date.

Serverside rendring compatibility

Is it possible to build components with this boilerplate that support server side rending? I see this error when I import my component:

...\dist\manifest.js:152
/******/ ([]);
         ^
ReferenceError: window is not defined

Set up nicer versioning workflow

Now npm version is a bit nasty. You will have to generate dist manually to get it included in a version. It probably would be better to implement a custom script for this purpose and do something like npm run version.

Related to npm/npm#7906.

Figure out how to make this run on Windows

By the way, npm install fails in the boilerplate (for windows)
E:\Repositories of Code\react-component-boilerplate\node_modules\jest-cli\node_modules\jsdom\node_modules\contextify>if not defined npm_config_node_gyp (node "C:\Program
Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (rebuild)
gyp ERR! configure error

Error: spawn catalog.js-start ENOENT

After starting I recieve the following error:

Error: spawn catalog.js-start ENOENT
at exports._errnoException (util.js:1026:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:182:32)
at onErrorNT (internal/child_process.js:348:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:592:11)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: catalog start docs
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

Noticed a couple of issues while trying to use it

  1. it seems to be missing a package (probably due to dependency changes over time). Need to add

    "loader-utils": "^0.2.16",

to your package.json

  1. the GithubCorner icon your code generates requires there to be a 'user' param in the package.json that isn't there by default (figured out through guessing tbh) so might be worth adding a

"user": "survivejs",

to your package.json too

You may need an appropriate loader to handle this file type

Commands npm run dist:modules and npm run dist are successful in my component repo,
When I do a yarn add file:'../path' and add my component to my react project
and run the project it fails during compilation and displays the error You may need an appropriate loader to handle this file type
It's failing to compile JSX in my component file.
screen shot 2017-05-27 at 7 58 32 pm

Adding a component to the Demo application

I imported my component into the Demo.jsx file as import SVGPathPlayer from '../src/svgplayer.jsx';
My component, in turn, imports it's styling via a Sass scss file: import './svgplayer.scss'; and imports a 3rd party lib (snap.svg) which requires a custom loader. I've added the loaders to the appropriate build targets.

I get this traceback when running npm run dist:

> webpack

/Users/saschwarz/dev/react-svgpathplayer/node_modules/babel-core/lib/transformation/file/index.js:671
      throw err;
      ^
SyntaxError: /Users/saschwarz/dev/react-svgpathplayer/src/svgplayer.scss: Unexpected token (1:0)
> 1 | .svg-player {
    | ^
  2 |     border: 1px solid #d3d3d3;
  3 |     .buttons {
  4 |         border-top: 1px solid #d3d3d3;

After some dividing/conquering of the webpack.config.babel.js file I found the problem is caused by:
import App from './demo/App.jsx'; which pulls in Demo.jsx which then brings in my component and the unsupported files.

So for now I've disabled that import, and consequently the demo functionality, and everything now compiles/runs correctly. It would be nice to re-enable the demo feature; but I'm not sure what the best solution would be.

For my purposes using the dist build of the component and manually inserting the script tags for the externals into a plain HTML file to create a demo is probably easier than the custom build step with templated insertion of the extracted bundles. I also like the idea that only one build of the component exists and it is used everywhere so I won't ever have to debug different build permutations; but I'm still new to webpack so that solution is also easiest for me to grok...

Another solution would be to not import App into webpack.config.babel.js and find another way to supply the template with the App component.

The last solution I can think of is to find another way to import my component into the Demo.jsx.

I'd greatly appreciate your input; I'm wondering if I'm not using the demo feature of this boilerplate as you intended.

`npm test` does not work for a fresh checkout

First off, thank you for creating such a useful template project. It is exactly what I was looking for (and had begun to painfully create for myself).

I'm having trouble actually running tests though. Steps to reproduce:

  1. Clone this repo
  2. Run npm i to install dependencies
  3. Open tests/boilerplate_test.js and uncomment the 3rd line (or add any import statement):
import React from 'react';
  1. Run npm test or npm run tdd

The following error occurs:

$ npm run test

> [email protected] test /Users/brianvaughn/Documents/git/react-component-boilerplate
> karma start

Hash: 8344a6c0a9b3c44a5636
Version: webpack 1.12.2
Time: 18ms

ERROR in ./tests/boilerplate_test.js
Module parse failed: /Users/brianvaughn/Documents/git/react-component-boilerplate/tests/boilerplate_test.js Line 3: Unexpected token
You may need an appropriate loader to handle this file type.
| 'use strict';
| 
| import React from 'react';
| // import {
| //   renderIntoDocument,

Can't run `dist` task.

I downloaded this boilerplate and modified a couple thing (removed the renderJSX from the webpack config, render the component directly in the body, etc.). And now I'm trying tp run npm run dist and i get an error.

ERROR in ./demo/App.jsx
Module parse failed: /Users/rparent/Documents/CTSProjects/cem/modules/boilerplate/demo/App.jsx Line 2: Unexpected token
You may need an appropriate loader to handle this file type.
| 
| import React from 'react';
| import Fork from 'react-ghfork';
| import pkgInfo from '../package.json';
 @ ./src/index.js 3:13-39

And this is the content of the App.jsx file.

import React from 'react';
import Fork from 'react-ghfork';
import pkgInfo from '../package.json';

export default class App extends React.Component {
  render() {
    return (
      <div>
        <p>This is some text</p>
      </div>
    );
  }
}

I'm not familiar with webpack and npm scripts yet so this might a really small thing somewhere that I forgot.

I can provide more code if you want.

Thanks 😃

Integrate nwb?

Maintenance-wise it would be a good idea to consume the configuration from a project such as https://github.com/insin/nwb . Now the problem is that it becomes quite painful to manage multiple projects that are based on the boilerplate.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.