noderaider / redux-webpack-boilerplate

A genericized boilerplate meant for usage as the basis to any Redux-based React project or library.
http://redux-webpack-boilerplate.js.org
MIT License
8 stars 8 forks source link

Can't follow instructions for repackage usage #2

Open brecke opened 8 years ago

brecke commented 8 years ago

Hey there,

I was just trying out this boilerplate but I can't follow the instructions on the site namely the ones regarding the usage of repackage. Here's what I got:

{ [Error: Error: ENOENT: no such file or directory, open '/Users/miguel/Lab/redux-webpack-boilerplate/traceur'

   { [Error: ENOENT: no such file or directory, open '/Users/miguel/Lab/redux-webpack-boilerplate/traceur']
     errno: -2,
     code: 'ENOENT',
     syscall: 'open',
     path: '/Users/miguel/Lab/redux-webpack-boilerplate/traceur' } } 'you may need to use repackage init [options]'
you may
usage: /usr/local/bin/repackage [init [options]] [options]

I'm definitely a noob in jsland so any help is appreciated. Thanks!

cchamberlain commented 8 years ago

@brecke - Thanks for opening this issue, I'm actively developing on these projects daily and you are the first beta tester. =)

Documentation is weak at the moment since the interfaces may change but I am using both this boilerplate and repackage in production systems and will be improving their documentation. I'll give some inline documentation for its current state here that can serve as the basis for expanded documentation on the next release. Jump to bottom if you don't care about the details.

repackage

For now the best way to use repackage is to install it globally npm i -g repackage. Its primary purpose is to enhance package.json / npm as the primary build system (instead of grunt or gulp). The reason I created it is because out of the box, the npm scripts section is not cross-platform in relation to setting environment variables on script execution (windows requires set NODE_ENV=development&& npm run <script> and linux uses NODE_ENV=development npm run <script>. Repackage fixes these issues by looking in your projects src/package/ directory and compiling any files (js or json) into that section in your project. It merges the compiled output with your current package.json. For the scripts section, it checks to see if the current platform is Windows and if so will replace the linux variant of setting environment variables with the windows variant and the new package.json will get a scripts section that works on the current OS. If you'd like to see the scripts package it is compiling, take a look at the boilerplates src/package/scripts.js

At this time, repackage expects that you have a .repackagerc configuration file in the root of the project. The contents of my file looks like:

.repackagerc

{ "username": "cchamberlain"
, "organization": "cchamberlain"
, "full": "Cole Chamberlain"
, "email": "cole.chamberlain@gmail.com"
}

This file is used to configure package.json settings specific to the library author. I plan to make this file optional / auto-generated and also allow it to be placed in your home directory but I haven't gotten there yet. For now just drop that into the project root (feel free to modify in your fork to match your github info).

Once this file exists you should be able to run repackage then npm run start-hot and see it build.

I'd be grateful for any feedback you could provide as I want to improve this user experience.

TL;DR;

From root of repo in CLI:

brecke commented 8 years ago

I'm still getting the same error running repackage :-/ Does it work for you following those strict instructions? I might be missing something here, probably something really obvious :)

screen shot 2016-04-28 at 15 40 33

cchamberlain commented 8 years ago

It looks like its having some sort of failure in transpiling given the references to traceur (I use babel across the board so the traceur bit stands out as strange). I'll try and get a fix out for this this weekend, in the meantime can you replace the scripts section of your package.json with the following linux formatted version and attempt to run npm run start-hot?

"scripts": {
    "prebuild-package": "rimraf package",
    "build-package": "babel src/package -d package",
    "prebuild-webpack": "rimraf webpack && npm run copy-config-client && npm run copy-config-server && npm run build-package && npm run build-config-client && npm run build-config-server",
    "build-webpack": "babel src/config.client.js -o config.client.js && babel src/config.server.js -o config.server.js && babel src/webpack.config.js -o webpack.config.js && babel src/webpack.static.config.js -o webpack.static.config.js && babel src/webpack -d webpack",
    "prebuild-public": "rimraf public && npm run build-webpack && npm run build-package",
    "build-public": "ncp src/public public && webpack --config webpack.static.config.js --progress --profile --colors",
    "prebuild-app": "npm run build-public",
    "build-app": "webpack --config webpack.config.js --progress --profile --colors",
    "prebuild-bin": "rimraf bin",
    "build-bin": "babel src/bin -d bin",
    "watch-bin": "babel src/bin -d bin --watch",
    "prebuild-lib": "rimraf lib",
    "build-lib": "babel src/lib -d lib",
    "watch-lib": "babel src/lib -d lib --watch",
    "prebuild-test": "rimraf test",
    "build-test": "babel src/test -d test",
    "watch-test": "babel src/test -d test --watch",
    "precopy-config-client": "rimraf config-client.json",
    "copy-config-client": "ncp src/config-client.json config-client.json",
    "precopy-config-server": "rimraf config-server.json",
    "copy-config-server": "ncp src/config-server.json config-server.json",
    "prebuild-config-client": "rimraf config.client.js",
    "build-config-client": "babel src/config.client.js -o config.client.js",
    "prebuild-config-server": "rimraf config.client.js",
    "build-config-server": "babel src/config.client.js -o config.client.js",
    "precopy-app": "rimraf public/vendor",
    "copy-app": "ncp src/app/vendor public/vendor",
    "transform": "transform-package",
    "link-dev": "npm link ../redux-addons ../redux-blueprint ../redux-idle-monitor ../react-redux-idle-monitor ../redux-grid ../redux-grid-view ../redux-middleware ../redux-mux ../save-as",
    "postbuild-app": "npm run copy-app",
    "build-lib-dev": "NODE_ENV=development npm run build-lib",
    "build-lib-prod": "NODE_ENV=production npm run build-lib",
    "build-lib-prod-osx": "NODE_ENV=production npm run build-lib",
    "build-prod": "NODE_ENV=production npm run build-app && npm run build-lib-prod && npm run build-bin",
    "build-dev": "NODE_ENV=development npm run build-app && npm run build-lib-dev && npm run build-bin",
    "build-hot": "NODE_ENV=hot npm run build-app && npm run build-lib-dev && npm run build-bin",
    "start-hot": "NODE_ENV=hot npm run build-hot && node bin/run",
    "start": "NODE_ENV=production npm run build-prod && node bin/run",
    "build": "npm run build-app && npm run build-bin && npm run build-lib",
    "watch": "npm run watch-build",
    "predoc": "rimraf doc",
    "doc": "esdoc -c ./esdoc.json",
    "prerelease": "npm run build",
    "release": "npm version patch && npm publish",
    "postrelease": "npm run release-doc",
    "prerelease-doc": "npm run doc",
    "release-doc": "git subtree push --prefix public origin gh-pages",
    "postrelease-doc": "git commit -am \"doc-release\" && git push --follow-tags",
    "test": "karma start"
  }
brecke commented 8 years ago

Hi,

It works 99%, I'm getting a css loading error

Error: ENOENT: no such file or directory, stat '/Users/miguel/Lab/redux-webpack-boilerplate/public/assets/loading.css'
    at Error (native)
Error: ENOENT: no such file or directory, stat '/Users/miguel/Lab/redux-webpack-boilerplate/public/assets/app.css'
    at Error (native)

But other than that, seems to be working. Will try to figure it out later.

cchamberlain commented 8 years ago

Thinking it must be NODE_ENV related, can you try from command line NODE_ENV=hot npm run start-hot.

Most my testing has been on Windows so thinking that may be where the diff is.