Skip to content
This repository was archived by the owner on Aug 26, 2021. It is now read-only.
This repository was archived by the owner on Aug 26, 2021. It is now read-only.

helper.js add check package.json existence before require #696

@ghost

Description

Bug Report

  • I’ve read and understood the Contributing guidelines and have done my best effort to follow them.
  • I’ve read and agree to the Code of Conduct.
  • I’ve searched for any related issues and avoided creating a duplicate issue.

What happened

Some folders and files like lib, node_modules in package folder are in .gitignore, so when you switch branches these folders stays on place. When you collect folders(e.g. modules) for further usage these "empty" module also gets into result. This provides an error when you try to require package.json from it.

Error: Cannot find module '/var/www/github/design-system-components/packages/file-upload/package.json'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.json (/var/www/github/design-system-components/scripts/helper.js:642:26)
    at Object.init (/var/www/github/design-system-components/scripts/helper.js:625:20)
    at Object.HELPER.init (/var/www/github/design-system-components/scripts/helper.js:1233:19)
    at Object.<anonymous> (/var/www/github/design-system-components/scripts/helper.js:1254:8)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)

What I expected to happen

No error :)

Reproducing

  • Module name: scripts/helper.js

Steps to reproduce:

  1. Checkout new branch
  2. Init, build and commit new component
  3. Switch back
  4. cd into the any existing package folder
  5. run npm run watch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions