open-wc / custom-elements-manifest

Custom Elements Manifest is a file format that describes custom elements in your project.
https://custom-elements-manifest.open-wc.org/
226 stars 37 forks source link

The outdir in the config half-works #249

Closed Audie80 closed 1 month ago

Audie80 commented 2 months ago

I fill in the "outdir" field in the configuration file "custom-elements-manifest.config.mjs". The json file is generated in the correct folder, but IS ALSO generated in the base folder. I would like the json file to be generated ONLY in the specified folder.

My configuration file :

import { cemInheritancePlugin } from 'custom-elements-manifest-inheritance';
import externalCEM from '../../core/custom-elements.json' assert { type: 'json' };

const options = {
  externalManifests: [externalCEM],
};

export default {
  globs: ['components/**/*.component.js'],
  exclude: [],
  outdir: '.storybook',
  dev: false,
  litelement: false,
  fast: false,
  stencil: false,
  catalyst: false,
  plugins: [cemInheritancePlugin(options)],
};

Command in "package.json" file : "analyze": "cem analyze --config 'custom-elements-manifest.config.mjs'",

2 same files are generated : Capture d’écran de 2024-04-30 11-34-55

thepassle commented 2 months ago

Thats weird, we only write the custom-elements.json here: https://github.com/open-wc/custom-elements-manifest/blob/bf49c387b55c758c57acddfecaa37be960bc74dc/packages/analyzer/cli.js#L83

Could you debug it to see why its getting written twice?

And are you sure it's not just a remnant/leftover from a previous run without using the outdir config option?

thepassle commented 1 month ago

Closing due to no activity, please feel free to reopen if the issue persists

Audie80 commented 1 month ago

Sorry, I didn’t see your answer. I’ll test!

Audie80 commented 1 month ago

Hello ! I tested and I was missing the "outdir" option in the "options" object for the 'custom-elements-manifest-inheritance' plugin. With this writing it works well:

import { cemInheritancePlugin } from 'custom-elements-manifest-inheritance';
import externalCEM from '../../core/custom-elements.json' assert { type: 'json' };

const options = {
  externalManifests: [externalCEM],
  outdir: '.storybook/',
};

export default {
  globs: ['components/**/*.component.js'],
  exclude: [],
  outdir: '.storybook/',
  dev: true,
  litelement: false,
  fast: false,
  stencil: false,
  catalyst: false,
  plugins: [cemInheritancePlugin(options)],
};

Thank you !