benawad / destiny

Prettier for File Structures
MIT License
3.53k stars 81 forks source link

Relative paths not working with React app #118

Closed sumanthratna closed 4 years ago

sumanthratna commented 4 years ago

I ran npm i destiny --save-dev, then npx destiny ./src --debug and this is what I got:

DEBUG: +0ms config used:
  {
    help: false,
    include: [ './src' ],
    version: false,
    write: false,
    avoidSingleFile: false,
    debug: true
  } 

DEBUG: +28ms glob matches for ".../src/**/*.*":
  [
    '.../src/App.js',
    '.../src/App.test.js',
    '.../src/fonts/avenir/AvenirNext-Bold.eot',
    '.../src/fonts/avenir/AvenirNext-Bold.ttf',
    '.../src/fonts/avenir/AvenirNext-Bold.woff',
    '.../src/fonts/avenir/AvenirNext-BoldItalic.eot',
    '.../src/fonts/avenir/AvenirNext-BoldItalic.ttf',
    '.../src/fonts/avenir/AvenirNext-BoldItalic.woff',
    '.../src/fonts/avenir/AvenirNext-DemiBold.eot',
    '.../src/fonts/avenir/AvenirNext-DemiBold.ttf',
    '.../src/fonts/avenir/AvenirNext-DemiBold.woff',
    '.../src/fonts/avenir/AvenirNext-DemiBoldItalic.eot',
    '.../src/fonts/avenir/AvenirNext-DemiBoldItalic.ttf',
    '.../src/fonts/avenir/AvenirNext-DemiBoldItalic.woff',
    '.../src/fonts/avenir/AvenirNext-Heavy.eot',
    '.../src/fonts/avenir/AvenirNext-Heavy.ttf',
    '.../src/fonts/avenir/AvenirNext-Heavy.woff',
    '.../src/fonts/avenir/AvenirNext-HeavyItalic.eot',
    '.../src/fonts/avenir/AvenirNext-HeavyItalic.ttf',
    '.../src/fonts/avenir/AvenirNext-HeavyItalic.woff',
    '.../src/fonts/avenir/AvenirNext-Italic.eot',
    '.../src/fonts/avenir/AvenirNext-Italic.ttf',
    '.../src/fonts/avenir/AvenirNext-Italic.woff',
    '.../src/fonts/avenir/AvenirNext-Medium.eot',
    '.../src/fonts/avenir/AvenirNext-Medium.ttf',
    '.../src/fonts/avenir/AvenirNext-Medium.woff',
    '.../src/fonts/avenir/AvenirNext-MediumItalic.eot',
    '.../src/fonts/avenir/AvenirNext-MediumItalic.ttf',
    '.../src/fonts/avenir/AvenirNext-MediumItalic.woff',
    '.../src/fonts/avenir/AvenirNext-Regular.eot',
    '.../src/fonts/avenir/AvenirNext-Regular.ttf',
    '.../src/fonts/avenir/AvenirNext-Regular.woff',
    '.../src/fonts/avenir/AvenirNext-UltraLight.eot',
    '.../src/fonts/avenir/AvenirNext-UltraLight.ttf',
    '.../src/fonts/avenir/AvenirNext-UltraLight.woff',
    '.../src/fonts/avenir/AvenirNext-UltraLightItalic.eot',
    '.../src/fonts/avenir/AvenirNext-UltraLightItalic.ttf',
    '.../src/fonts/avenir/AvenirNext-UltraLightItalic.woff',
    '.../src/fonts/icons/icons.eot',
    '.../src/fonts/icons/icons.svg',
    '.../src/fonts/icons/icons.ttf',
    '.../src/fonts/icons/icons.woff',
    '.../src/fonts/icons/pe-icon-social.eot',
    '.../src/fonts/icons/pe-icon-social.svg',
    '.../src/fonts/icons/pe-icon-social.ttf',
    '.../src/fonts/icons/pe-icon-social.woff',
    '.../src/fonts/roboto/Roboto-Bold.eot',
    '.../src/fonts/roboto/Roboto-Bold.ttf',
    '.../src/fonts/roboto/Roboto-Bold.woff',
    '.../src/fonts/roboto/Roboto-Bold.woff2',
    '.../src/fonts/roboto/Roboto-Light.eot',
    '.../src/fonts/roboto/Roboto-Light.ttf',
    '.../src/fonts/roboto/Roboto-Light.woff',
    '.../src/fonts/roboto/Roboto-Light.woff2',
    '.../src/fonts/roboto/Roboto-Medium.eot',
    '.../src/fonts/roboto/Roboto-Medium.ttf',
    '.../src/fonts/roboto/Roboto-Medium.woff',
    '.../src/fonts/roboto/Roboto-Medium.woff2',
    '.../src/fonts/roboto/Roboto-Regular.eot',
    '.../src/fonts/roboto/Roboto-Regular.ttf',
    '.../src/fonts/roboto/Roboto-Regular.woff',
    '.../src/fonts/roboto/Roboto-Regular.woff2',
    '.../src/fonts/roboto/Roboto-Thin.eot',
    '.../src/fonts/roboto/Roboto-Thin.ttf',
    '.../src/fonts/roboto/Roboto-Thin.woff',
    '.../src/fonts/roboto/Roboto-Thin.woff2',
    '.../src/Footer/index.css',
    '.../src/Footer/index.jsx',
    '.../src/Footer/SocialLinks/index.css',
    '.../src/Footer/SocialLinks/index.jsx',
    '.../src/HistoryPage/Content/DevpostCard/index.css',
    '.../src/HistoryPage/Content/DevpostCard/index.jsx',
    '.../src/HistoryPage/Content/index.css',
    '.../src/HistoryPage/Content/index.jsx',
    '.../src/HistoryPage/index.jsx',
    '.../src/images/bigweblogo.png',
    '.../src/images/bkg.png',
    '.../src/images/logo-black.png',
    '.../src/images/logo.png',
    '.../src/images/sponsors/normal/alertfive.png',
    '.../src/images/sponsors/normal/aws.png',
    '.../src/images/sponsors/normal/citadelsecurities.png',
    '.../src/images/sponsors/normal/cloudwave.png',
    '.../src/images/sponsors/normal/collinsaerospace.png',
    '.../src/images/sponsors/normal/cvent.png',
    '.../src/images/sponsors/normal/digitalocean.png',
    '.../src/images/sponsors/normal/ensco.png',
    '.../src/images/sponsors/normal/hawkeye.png',
    '.../src/images/sponsors/normal/mlh.png',
    '.../src/images/sponsors/normal/phone2action.png',
    '.../src/images/sponsors/normal/primamedicine.png',
    '.../src/images/sponsors/normal/razorx2.png',
    '.../src/images/sponsors/normal/spontit.png',
    '.../src/images/sponsors/normal/stackoverflow.png',
    '.../src/images/sponsors/normal/stickermule.png',
    '.../src/images/sponsors/normal/thinkfun.png',
    '.../src/images/sponsors/normal/tjpartnershipfund.png',
    '.../src/images/sponsors/normal/ultrapress.png',
    '.../src/images/sponsors/normal/verizonmedia.png',
    '.../src/images/sponsors/normal/wolfram.png',
    ... 78 more items
  ] 

DEBUG: +2ms restructured map:
  {
    './src': [
      '.../src/App.js',
      '.../src/App.test.js',
      '.../src/fonts/avenir/AvenirNext-Bold.eot',
      '.../src/fonts/avenir/AvenirNext-Bold.ttf',
      '.../src/fonts/avenir/AvenirNext-Bold.woff',
      '.../src/fonts/avenir/AvenirNext-BoldItalic.eot',
      '.../src/fonts/avenir/AvenirNext-BoldItalic.ttf',
      '.../src/fonts/avenir/AvenirNext-BoldItalic.woff',
      '.../src/fonts/avenir/AvenirNext-DemiBold.eot',
      '.../src/fonts/avenir/AvenirNext-DemiBold.ttf',
      '.../src/fonts/avenir/AvenirNext-DemiBold.woff',
      '.../src/fonts/avenir/AvenirNext-DemiBoldItalic.eot',
      '.../src/fonts/avenir/AvenirNext-DemiBoldItalic.ttf',
      '.../src/fonts/avenir/AvenirNext-DemiBoldItalic.woff',
      '.../src/fonts/avenir/AvenirNext-Heavy.eot',
      '.../src/fonts/avenir/AvenirNext-Heavy.ttf',
      '.../src/fonts/avenir/AvenirNext-Heavy.woff',
      '.../src/fonts/avenir/AvenirNext-HeavyItalic.eot',
      '.../src/fonts/avenir/AvenirNext-HeavyItalic.ttf',
      '.../src/fonts/avenir/AvenirNext-HeavyItalic.woff',
      '.../src/fonts/avenir/AvenirNext-Italic.eot',
      '.../src/fonts/avenir/AvenirNext-Italic.ttf',
      '.../src/fonts/avenir/AvenirNext-Italic.woff',
      '.../src/fonts/avenir/AvenirNext-Medium.eot',
      '.../src/fonts/avenir/AvenirNext-Medium.ttf',
      '.../src/fonts/avenir/AvenirNext-Medium.woff',
      '.../src/fonts/avenir/AvenirNext-MediumItalic.eot',
      '.../src/fonts/avenir/AvenirNext-MediumItalic.ttf',
      '.../src/fonts/avenir/AvenirNext-MediumItalic.woff',
      '.../src/fonts/avenir/AvenirNext-Regular.eot',
      '.../src/fonts/avenir/AvenirNext-Regular.ttf',
      '.../src/fonts/avenir/AvenirNext-Regular.woff',
      '.../src/fonts/avenir/AvenirNext-UltraLight.eot',
      '.../src/fonts/avenir/AvenirNext-UltraLight.ttf',
      '.../src/fonts/avenir/AvenirNext-UltraLight.woff',
      '.../src/fonts/avenir/AvenirNext-UltraLightItalic.eot',
      '.../src/fonts/avenir/AvenirNext-UltraLightItalic.ttf',
      '.../src/fonts/avenir/AvenirNext-UltraLightItalic.woff',
      '.../src/fonts/icons/icons.eot',
      '.../src/fonts/icons/icons.svg',
      '.../src/fonts/icons/icons.ttf',
      '.../src/fonts/icons/icons.woff',
      '.../src/fonts/icons/pe-icon-social.eot',
      '.../src/fonts/icons/pe-icon-social.svg',
      '.../src/fonts/icons/pe-icon-social.ttf',
      '.../src/fonts/icons/pe-icon-social.woff',
      '.../src/fonts/roboto/Roboto-Bold.eot',
      '.../src/fonts/roboto/Roboto-Bold.ttf',
      '.../src/fonts/roboto/Roboto-Bold.woff',
      '.../src/fonts/roboto/Roboto-Bold.woff2',
      '.../src/fonts/roboto/Roboto-Light.eot',
      '.../src/fonts/roboto/Roboto-Light.ttf',
      '.../src/fonts/roboto/Roboto-Light.woff',
      '.../src/fonts/roboto/Roboto-Light.woff2',
      '.../src/fonts/roboto/Roboto-Medium.eot',
      '.../src/fonts/roboto/Roboto-Medium.ttf',
      '.../src/fonts/roboto/Roboto-Medium.woff',
      '.../src/fonts/roboto/Roboto-Medium.woff2',
      '.../src/fonts/roboto/Roboto-Regular.eot',
      '.../src/fonts/roboto/Roboto-Regular.ttf',
      '.../src/fonts/roboto/Roboto-Regular.woff',
      '.../src/fonts/roboto/Roboto-Regular.woff2',
      '.../src/fonts/roboto/Roboto-Thin.eot',
      '.../src/fonts/roboto/Roboto-Thin.ttf',
      '.../src/fonts/roboto/Roboto-Thin.woff',
      '.../src/fonts/roboto/Roboto-Thin.woff2',
      '.../src/Footer/index.css',
      '.../src/Footer/index.jsx',
      '.../src/Footer/SocialLinks/index.css',
      '.../src/Footer/SocialLinks/index.jsx',
      '.../src/HistoryPage/Content/DevpostCard/index.css',
      '.../src/HistoryPage/Content/DevpostCard/index.jsx',
      '.../src/HistoryPage/Content/index.css',
      '.../src/HistoryPage/Content/index.jsx',
      '.../src/HistoryPage/index.jsx',
      '.../src/images/bigweblogo.png',
      '.../src/images/bkg.png',
      '.../src/images/logo-black.png',
      '.../src/images/logo.png',
      '.../src/images/sponsors/normal/alertfive.png',
      '.../src/images/sponsors/normal/aws.png',
      '.../src/images/sponsors/normal/citadelsecurities.png',
      '.../src/images/sponsors/normal/cloudwave.png',
      '.../src/images/sponsors/normal/collinsaerospace.png',
      '.../src/images/sponsors/normal/cvent.png',
      '.../src/images/sponsors/normal/digitalocean.png',
      '.../src/images/sponsors/normal/ensco.png',
      '.../src/images/sponsors/normal/hawkeye.png',
      '.../src/images/sponsors/normal/mlh.png',
      '.../src/images/sponsors/normal/phone2action.png',
      '.../src/images/sponsors/normal/primamedicine.png',
      '.../src/images/sponsors/normal/razorx2.png',
      '.../src/images/sponsors/normal/spontit.png',
      '.../src/images/sponsors/normal/stackoverflow.png',
      '.../src/images/sponsors/normal/stickermule.png',
      '.../src/images/sponsors/normal/thinkfun.png',
      '.../src/images/sponsors/normal/tjpartnershipfund.png',
      '.../src/images/sponsors/normal/ultrapress.png',
      '.../src/images/sponsors/normal/verizonmedia.png',
      '.../src/images/sponsors/normal/wolfram.png',
      ... 78 more items
    ]
  } 

INFO: Generating tree for: ./src
ERROR: Cannot find import ../../../images/sponsors/normal/
If you think this is a bug, you can report it: https://github.com/benawad/destiny/issues
DEBUG: +345ms exiting

for the repo https://github.com/hacktj/2020.

Relevant code: https://github.com/HackTJ/2020/blob/de27266d2dbe63df445cfbe7c03bc4f276da453c/src/MainPage/Sponsors/Logo/index.jsx#L33-L46.

<>
  <img
    id={"img-normal-" + sponsorID}
    className={`sponsor-image normal ${showTooltip ? "show" : "hide"}`}
    src={require("../../../images/sponsors/normal/" + logo)}
    alt={name}
  />
  <img
    id={"img-tint-" + sponsorID}
    className={`sponsor-image tint ${showTooltip ? "hide" : "show"}`}
    src={require("../../../images/sponsors/tint/" + logo)}
    alt={name}
  />
</>

Could be related to https://github.com/benawad/destiny/issues/115.

AnatoleLucet commented 4 years ago

Destiny is unable to resolve computed import path (e.g. require("../../img" + imgName)) by now. We are planning to add support for this kind of imports. See #123 for more info.