sarsamurmu/reboost

log.exportResolvedPaths { local_options }

GHNewbiee opened this issue · 3 comments

A problem which I usually face, and probably other users, too, is the correct declaration of relative paths, especially of those ones which are related to foreign packages/modules config options.

I suggest a new option to be created; the log.exportResolvedPaths one, which records all resolved options paths in a user friendly form such as:

relative_file_path, absolute_file_path, Option.property_name, relative_path_set, ABOSLUTE_PATH_resolved

and exports them either to the terminal or to a file.

local_options would include properties such as:

include, exclude, columnsDisplayed: string[], exportTo: terminal|'path_to_log_file'

Moreover, showResponseTime option would also be moved under the log option as log.showResponseTime.

Additional notes:

  • Instead of an option, it could be a plugin.
  • A maxFilesNo property may be set, to control the files per directory that are exported when regex is used.

Can you describe it more with example configurations?

Note: I have added additional notes in the first message.

Yes, of course. For example:

start({
  rootDir: process.cwd(),
  cacheDir: './.reboost_cache',
  entries: [
    ['./src/index.js', './public/dist/index.js']
  ],
  contentServer: {
    root: './public'
    },
    index: 'index.html'
  },
  resolve: {
    alias: {
      ConfigFiles: './.config_files',
      Public: './public',
      Src: './src'
    },
  },
  sourceMaps: {
    include: /.*/,
    exclude: /node_modules/
  },
  watchOptions: {
    include: /.*/,
    exclude: /\..*|node_modules|.*.json|.*.code-workspace|reboost.js/,
    chokidar: {
      cwd: process.cwd()
      }
    }
  },
  plugins: [
    UsePlugin({
      include: /.(png|jpg|jpeg)$/i,
      exclude: /.*/,
      use: FilePlugin()
    }),
    UsePlugin({
      include: /.*/,
      exclude: /node_modules/,
      use: BabelPlugin()
    }),
    CSSPlugin({
      modules: {
        test: /\.module\./i
      }
    })
  ]
})

When

  log.exportResolvedPaths: {
    include: /.*/,
    exclude: /node_modules/,
    columnsDisplayed: ['relative_file_path', 'absolute_file_path', 'Option.property_name', 'relative_path_set', 'ABOSLUTE_PATH_resolved'],
    exportTo: 'terminal',
    maxFilesNo: 5
  }

then, the following should be given:

relative_file_path absolute_file_path Option.property_name relative_path_set ABOSLUTE_PATH_resolved
./reboost.js /home/... /project/reboot.js rootDir ./ /home/... /project/
"-" "-" cacheDir ./.reboost_cache/ /home/... /project/.reboost_cache/
"-" "-" contentServer.root ./public/ /home/... /project/public/
"-" "-" contentServer.index ./public/index.html /home/... /project/public/index.html
"-" "-" resolve.alias.ConfigFiles ./.config_files/ /home/... /project/.config_files/
"-" "-" resolve.alias.Public ./public/ /home/... /project/public/
"-" "-" resolve.alias.Src ./src/ /home/... /project/src/
"-" "-" sourceMaps.include The first 5 files per directory The first 5 files per directory
"-" "-" sourceMaps.exclude ./node_modules/ /home/... /project/node_modules/
... ... ... ... ...
"-" "-" watchOptions.chokidar.cwd ./ /home/... /project/
... ... ... ... ...

This should also include imports and requires from every single file; for example:
test.js

import { a, b } from './.../tester'
...
relative_file_path absolute_file_path Option.property_name relative_path_set ABOSLUTE_PATH_resolved
./.../test.js /home/... /project/.../test.js a, b ./.../tester.js /home/... /project/.../tester.js

We do not really need it, too! You may keep it as a low priority feature in future when all other high priorities will have been settled down and you'll wonder what else small features can be added to "improve/develop" the project.