carbon-design-system / carbon-components-vue

Vue implementation of the Carbon Design System
http://vue.carbondesignsystem.com
Apache License 2.0
597 stars 176 forks source link

chore: create script to add named exports of a components to index.js #1580

Closed OlkaB closed 2 months ago

OlkaB commented 3 months ago

Contributes to #1578

 What did you do?

Added prebuild script to auto add named exports of components

 Why did you do it?

This was option available in Vue2 and change from it large repo requires additional piece of work, so prefer to restore it at source

How have you tested it?

run build script then generated local tgz package and tested in Vue3 repo

Were docs updated if needed?

OlkaB commented 2 months ago

@davidnixon thank you for a review.

  1. I'm not sure where should I place the code you've provided

    const indexDir = path.dirname(INDEX_FILE_PATH);
    return './' + path.relative(indexDir, systemPath);

    the only place, which provides systemPath variable is convertToImportPathRelativeToIndex method. Is this a place which you meant (so match should use the code returned by what you wrote)? Sorry for asking, but I do not know how GH pipelines works or how to check it, as locally it works for me (which seems not to be helpful in this case😌).

    1. addressed - underscored components are now not included
    2. I've moved script to ci-check as you've suggested

    btw. this is what I receive in ./src/index.js when running locally

image

davidnixon commented 2 months ago

Sorry yeah I just replaced the contents of convertToImportPathRelativeToIndex with

function convertToImportPathRelativeToIndex(systemPath) {
   const indexDir = path.dirname(INDEX_FILE_PATH);
   return './' + path.relative(indexDir, systemPath);
}

That works for me locally. I think I see the issue. You are on a windows box I think? So this regex const UNNECESSARY_SYSTEM_PATH_CHUNK_REGEX = /.*\\src\\(.*)/; works if I flip to \ to \/. If the path.relative I think that's a clear look to the function.

OlkaB commented 2 months ago

Indeed - I'm working on Windows machine. Thank you very much for the help and explanation. I've made a changes as suggested.