Git Product home page Git Product logo

barrel-cli's People

Contributors

bengodfrey avatar montalvomiguelo avatar wturnerharris avatar

Stargazers

 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  avatar  avatar  avatar  avatar  avatar

barrel-cli's Issues

Enable source-maps on Shopify

Hello, I am working on a project that uses brrl-cli and I can't seem to generate a soure-map files. For some reason, my code during development mode works like a charm and during production it throws unexpected errors. I tried including source-maps but they're not there when I check the website on Shopify.

devtools: isProduction ? 'source-map' : 'inline-source-map',

I've tried other type of source-maps but it still fails.

Thanks a lot!

brrl -w doesn't trigger browsersync updates with WordPress projects on Windows

Problem: On a Windows/WordPress setup The brrl -w command doesn't trigger a browsersync update even though it compiles without error in response to file changes. Changes to js and css aren't reflected in the localhost site or proxied lando website as a result.

Background: lib/configure.js checks for '/wp-content/' in the webpack output path to form the public path for the api. On windows that path is backslashed in local configurations which breaks the path being fed to the webpack-dev-middleware initialization in lib/watcher.js. That in turn leads to the output files being compiled in memory at the wrong public path.

Solution: At the checkPublicPath() function in lib/configure.js use Node's path module to check for platform specific path separators then convert all backslashes to forward slashes when forming the public path.

Allow configuring BrowserSync on a per project basis

Context

While working on a Shopify site using the Back in Stock app, I found I needed to work with a URL with no port attached (localhost instead of localhost:3000). This was due to a limitation of the app, which I didn't really have control over.

Solution

Changed the port in watcher.js to 443 (the browser's default https port)

return {
      proxy: {
           ...
          port: 443
      }
}

Then ran start as sudo:

sudo yarn start

This boots up your browser with just localhost, instead of localhost:3000

Caveat

I had to edit the npm package source directly. What would the level of effort be to make this configurable without having to edit the package's source?

Install as documented does not work

Attempting a fresh install with npm i barrel-cli -D on the theme...

npm ERR! code E404
npm ERR! 404 Not Found: barrel-cli@latest

The log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/8.9.2/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'i',
1 verbose cli   'barrel-cli',
1 verbose cli   '-D' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 8a5e40f2850f724d
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 404 https://registry.npmjs.org/barrel-cli 860ms
8 silly fetchPackageMetaData error for barrel-cli@latest 404 Not Found: barrel-cli@latest
9 verbose stack Error: 404 Not Found: barrel-cli@latest
9 verbose stack     at fetch.then.res (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/fetch.js:42:19)
9 verbose stack     at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
9 verbose stack     at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
9 verbose stack     at Promise._settlePromise (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
9 verbose stack     at Promise._settlePromise0 (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
9 verbose stack     at Promise._settlePromises (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18)
9 verbose stack     at Async._drainQueue (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:133:16)
9 verbose stack     at Async._drainQueues (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10)
9 verbose stack     at Immediate.Async.drainQueues (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
9 verbose stack     at runCallback (timers.js:789:20)
9 verbose stack     at tryOnImmediate (timers.js:751:5)
9 verbose stack     at processImmediate [as _immediateCallback] (timers.js:722:5)
10 verbose cwd /Users/westurner/Sites/barrel-kb/wp-content/themes/barrel-base
11 verbose Darwin 16.7.0
12 verbose argv "/usr/local/Cellar/node/8.9.2/bin/node" "/usr/local/bin/npm" "i" "barrel-cli" "-D"
13 verbose node v8.9.2
14 verbose npm  v5.5.1
15 error code E404
16 error 404 Not Found: barrel-cli@latest
17 verbose exit [ 1, true ]

Gulp watch does not trigger for new files

Problem

Currently gulp is not triggering the tasks copy & contact when new files are added to the source directory. They are only being triggered when the files have been changed.

fail-new-files

How to fix (lib/gulp.js)

If the glob string provided to the watch task is an absolute path starting with a / then gulp will not trigger for new files.

We can pass an options argument to the watch tasks and set the cwd property with the directory that will be used to build absolute paths.

watch () {
  gulp.watch(
+   'src/**/*.*',
+   {cwd: config.get('cwd')},
    e => {
      try {
        this.copy(e, true)
      } catch (e) {
        new Err(e)
      }
    }
  )
  gulp.watch(
+   'src/config/**',
+   {cwd: config.get('cwd')},
    e => {
      try {
        this.concat(true)
      } catch (e) {
        new Err(e)
      }
    }
  )
}

Also update the copy method and check if the type of the event was added.

+  if (type === 'changed' || type === 'added') {

Add stylelint to HMR

Barrel WordPress will include stylelint in an upcoming release.

Since adding this to the local webpack.config.js has no effect on HMR, we need to add the following to the webpack.js routine:

const StyleLintPlugin = require('stylelint-webpack-plugin')
...
  preparePlugins () {
...
      ...(this.watching && config.get('hmr') ? [
        new webpack.HotModuleReplacementPlugin()
      ]: []),
      new StyleLintPlugin({
        configFile: path.resolve(config.get('cwd'), '.stylelintrc'),
        files: '(src/css/|modules/)**/*.css',
        syntax: 'scss',
        failOnError: false,
        quiet: false
      }),  
      new webpack.NoEmitOnErrorsPlugin(),
    ]
  }

These are the deps required:

"stylelint": "^9.6.0",
"stylelint-config-standard": "^18.2.0",
"stylelint-webpack-plugin": "^0.10.5",

Add helpful details if commits.txt has dead commit hashes

Issue occurred during Zupa Noma (PayWhirl -> reCharge) project.

$ npm run development

> [email protected] development /Users/user/Sites/zupa-noma
> brrl -d -e development


Proxy target set at https://zupa-noma-dev.myshopify.com
Compiling assets.. This could take a few moments
(node:66249) UnhandledPromiseRejectionWarning: fatal: bad object 8f2357061072669954108fff96842be184800b95

(node:66249) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:66249) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

This is a result of an uncaught exception due to unexpected behavior. The commits.txt contained two commit hashes that were not relevant to the project. This can happen if the file was ported from another project or if the commits were invalidated due to force push. Either way I was able to confirm that the deployment process continued without issue after commenting out L32. Understandably, this should be returning the diff'd files to reduce overhead of pushing all files rather than changed ones. After adding a common commit hash to the commits.txt and removing the others, the deployment command succeeded.

I recommend adding a catch or condition to indicate to the user of the CLI that the commits.txt file is bad or add a process to wipe it out and start again or find a common commit hash that does exist in the file.

-bash: brrl: command not found

Hi,

After running "npm i @barrelny/cli -D", I try to run "brrl -b" and get the error:

-bash: brrl: command not found

Any clues?

Thanks,
Wil

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.