Skip to content

Commit

Permalink
chore(v11): update component-list
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-blum committed Sep 13, 2024
1 parent c03195c commit fae71fb
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 42 deletions.
2 changes: 1 addition & 1 deletion packages/component-list/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ and submit a pull request.

> 💡 Thinking about maintenance, it's best to find a way to build this data from
> your component library. See how
> [cloud-cognitive](https://github.com/carbon-design-system/devtools/tree/base/packages/component-list/src/library/cloud-cognitive.js)
> [ibm-products](https://github.com/carbon-design-system/devtools/tree/base/packages/component-list/src/library/ibm-products.js)
> set up their components to scale.
5. Add your new library file to the build file
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import fs from 'fs';
import { carbonPrefix } from '../../../web-extension/src/globals/prefixSelectors.js';
import { _initStats, camelCase } from '../helpers.js';

const carbonPrefix = 'cds';
const _carbonWebComponentsDir =
'../../node_modules/carbon-web-components/es/components';
'../../node_modules/@carbon/web-components/es/components';
const { _stats, success } = new _initStats();
const carbonWebComponents = {
name: 'Carbon web components',
Expand Down
5 changes: 2 additions & 3 deletions packages/component-list/src/libraries/carbon.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as componentList from 'carbon-components-react';
import { carbonPrefix } from '../../../web-extension/src/globals/prefixSelectors.js';
import * as componentList from '@carbon/react';
import { buildReactComponentList } from '../helpers.js';

const prefix = carbonPrefix + '--';
const prefix = 'cds--';

const mockedProps = {
pageSizes: [0],
Expand Down
35 changes: 0 additions & 35 deletions packages/component-list/src/libraries/cloud-cognitive.js

This file was deleted.

31 changes: 31 additions & 0 deletions packages/component-list/src/libraries/ibm-products.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import fs from 'fs';
import { pkg } from '@carbon/ibm-products';
import { _initStats } from '../helpers.js';

const { _stats, success } = new _initStats();
const productsDir = '../../node_modules/@carbon/ibm-products/es/components';
const products = {
name: 'Carbon for IBM Products',
components: {},
_stats,
};
const { getDevtoolsId, devtoolsAttribute } = pkg;

try {
const components = fs.readdirSync(productsDir);

components.forEach((file) => {
if (file === '_Canary' || file === 'index.d.ts') {
return;
}

const identifier = `[${devtoolsAttribute}="${getDevtoolsId(file)}]`;

products.components[identifier] = file;
success();
});
} catch (e) {
console.log(e);
}

export { products };
2 changes: 1 addition & 1 deletion packages/component-list/src/libraries/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from './carbon';
export * from './carbon-web-components';
export * from './ibmdotcom';
export * from './cloud-cognitive';
export * from './ibm-products';
export * from './security';
export * from './cloud-pal';

0 comments on commit fae71fb

Please sign in to comment.