diff --git a/package.json b/package.json index d2829ff0c1..209089be65 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,6 @@ "build:prod:npm": "BABEL_ENV=production OUTPUT=dist LANGUAGE=en-US REACT=true yarn build:prod:dist", "build:prod:storybook": "LANGUAGE=en-US REACT=true BROWSERSLIST_ENV=production BABEL_ENV=development NODE_ENV=development storybook build -c .storybook -o styleguide/storybook", "build:sync": "LANGUAGE=en-US BABEL_ENV=development NODE_ENV=development RSYNC=true webpack --config scripts/webpack.config.js --mode development", - "build:assets": "./scripts/asset-import/cli.js", "chromatic": "chromatic", "clean": "rm -rf dist es i18n/json i18n/*.js reports styleguide", "copy:flow": "flow-copy-source --ignore \"**/__tests__/**\" --ignore \"**/__mocks__/**\" --ignore \"**/*.ts\" ./src ./es && copyfiles './src/**/*.js.flow' es --up 1", @@ -154,9 +153,6 @@ "@storybook/react-webpack5": "^8.2.4", "@storybook/test": "^8.2.4", "@storybook/theming": "^8.2.4", - "@svgr/core": "^5.0.1", - "@svgr/plugin-prettier": "^5.0.1", - "@svgr/plugin-svgo": "^5.1.0", "@testing-library/jest-dom": "^6.4.6", "@testing-library/react": "^16.0.0", "@types/classnames": "^2.2.9", @@ -190,17 +186,14 @@ "babel-plugin-rewire": "^1.0.0", "babel-plugin-styled-components": "^1.10.7", "babel-preset-react-app": "^9.1.0", - "camelcase": "^5.3.1", "chromatic": "^10.6.1", "circular-dependency-plugin": "^5.2.2", "classnames": "^2.2.6", "color": "^3.1.2", - "colors": "^1.4.0", "conventional-changelog": "^3.1.18", "conventional-changelog-cli": "^2.0.31", "conventional-github-releaser": "^3.1.3", "copyfiles": "^2.2.0", - "cosmiconfig": "^6.0.0", "css-loader": "^7.1.2", "css-minimizer-webpack-plugin": "^7.0.0", "cssnano": "^4.1.10", @@ -246,7 +239,6 @@ "msw": "^2.1.5", "msw-storybook-addon": "^2.0.2", "npm-run-all": "^4.1.5", - "ora": "^4.0.3", "pikaday": "^1.8.0", "postcss": "^8.4.31", "postcss-loader": "^8.1.1", @@ -276,14 +268,12 @@ "react-tether": "^1.0.5", "react-textarea-autosize": "^8.5.3", "regenerator-runtime": "^0.14.1", - "rimraf": "^3.0.1", "sanitize-html": "^1.21.1", "sass": "^1.34.1", "sass-lint": "^1.13.1", "sass-loader": "^8.0.2", "scroll-into-view-if-needed": "^2.2.20", "semantic-release": "^16.0.2", - "simple-git": "^3.16.0", "sinon": "^2.3.7", "source-map-loader": "^0.2.4", "start-server-and-test": "^1.10.8", @@ -298,15 +288,13 @@ "tabbable": "^1.1.3", "ts-loader": "^6.2.1", "typescript": "5.2.2", - "uniqid": "^5.2.0", "uuid": "^8.3.2", "wait-on": "^3.3.0", "webpack": "^5.92.0", "webpack-bundle-analyzer": "^4.10.2", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4", - "worker-farm": "^1.7.0", - "yargs": "^15.1.0" + "worker-farm": "^1.7.0" }, "peerDependencies": { "@box/blueprint-web": "^7.3.1", diff --git a/scripts/asset-import/cli.js b/scripts/asset-import/cli.js deleted file mode 100755 index b7c1398942..0000000000 --- a/scripts/asset-import/cli.js +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env node - -const colors = require('colors/safe'); -const yargs = require('yargs'); -const pick = require('lodash/pick'); -const { importer, defaultConfig } = require('.'); - -const { argv } = yargs - .usage('Automatically import assets from Design Team for commit\n\n$0 [options]') - .option('repository', { - alias: 'r', - description: 'The asset repository to use', - demandOption: true, - }) - .option('branch', { - alias: 'b', - description: 'The branch or tag to use', - }) - .option('asset-path', { - alias: 'a', - description: 'Path under root repo directory, from which to take assets', - }) - .option('working-dir', { - alias: 'w', - description: 'Temporary working directory for assets', - }) - .option('destination-dir', { - alias: 'd', - description: 'Relative destination of exported assets', - }) - .option('verbose', { - description: 'Print more details on config and runtime output', - }) - .default(defaultConfig) - .help('h') - .alias('h', 'help'); - -(async function cli() { - try { - await importer(pick(argv, ['repository', 'branch', 'workingDir', 'destinationDir', 'verbose', 'assetPath'])); - } catch (e) { - // eslint-disable-next-line - console.log(colors.red('There was an unexpected error when processing assets\n'), e); - process.exit(1); - } -})(); diff --git a/scripts/asset-import/index.js b/scripts/asset-import/index.js deleted file mode 100644 index c1a2cea83a..0000000000 --- a/scripts/asset-import/index.js +++ /dev/null @@ -1,4 +0,0 @@ -const importer = require('./src/import'); -const defaultConfig = require('./src/defaultConfig'); - -module.exports = { importer, defaultConfig }; diff --git a/scripts/asset-import/src/amenders/addAutoGeneratedMessage.js b/scripts/asset-import/src/amenders/addAutoGeneratedMessage.js deleted file mode 100644 index ac8adaebd6..0000000000 --- a/scripts/asset-import/src/amenders/addAutoGeneratedMessage.js +++ /dev/null @@ -1,19 +0,0 @@ -// include a block comment letting developers know that these icons shouldn't -// be edited, and where to ask for changes or updates -module.exports = function addAutoGeneratedMessage(file) { - const updatedFile = file.replace( - 'const __add_documentation = true;', - ` -/** - * This is an auto-generated component and should not be edited - * manually in contributor pull requests. - * - * If you have problems with this component: - * - https://github.com/box/box-ui-elements/issues/new?template=Bug_report.md - * - * If there are missing features in this component: - * - https://github.com/box/box-ui-elements/issues/new?template=Feature_request.md - */`, - ); - return updatedFile; -}; diff --git a/scripts/asset-import/src/amenders/addFlowSupport.js b/scripts/asset-import/src/amenders/addFlowSupport.js deleted file mode 100644 index 679cde321a..0000000000 --- a/scripts/asset-import/src/amenders/addFlowSupport.js +++ /dev/null @@ -1,19 +0,0 @@ -const path = require('path'); -const times = require('lodash/times'); - -// Add flow support comment to top of file, along with type and usage -// Account for import path used in box-ui-elements so that the import is relative -module.exports = function addFlow(file, options) { - // If we import all icons into trees under src/, we - // can use the number of directories to get the relative path - // of the AccessibleSVG import in BUIE - const directoryCount = path.dirname(options.fileNameAndPath).split('/').length - 1; - const typedFile = file - .replace( - 'const __add_types = true;', - `import type { Icon } from '${times(directoryCount, () => '../').join('')}icons/flowTypes';`, - ) - .replace('props =>', '(props: Icon) =>') - .replace("import React from 'react'", "import * as React from 'react'"); - return `// @flow\n${typedFile}`; -}; diff --git a/scripts/asset-import/src/amenders/addTypes.js b/scripts/asset-import/src/amenders/addTypes.js deleted file mode 100644 index 00801a1ae0..0000000000 --- a/scripts/asset-import/src/amenders/addTypes.js +++ /dev/null @@ -1,18 +0,0 @@ -// @TODO(FIX-TS-MIGRATION-HACK) -const deprecatedVersion = require('./addFlowSupport'); - -// Add typescript support comment to top of file, along with type and usage -// Account for import path used in box-ui-elements so that the import is relative -module.exports = function addTypes(file, options) { - // @TODO(FIX-TS-MIGRATION-HACK) - if (options.useFlow) { - return deprecatedVersion(file, options); - } - // If we import all icons into trees under src/, we - // can use the number of directories to get the relative path - // of the AccessibleSVG import in BUIE - return file - .replace('const __add_types = true;\n', '') - .replace('props =>', '(props: SVGProps) =>') - .replace("import React from 'react'", "import * as React from 'react'"); -}; diff --git a/scripts/asset-import/src/amenders/applyViewbox.js b/scripts/asset-import/src/amenders/applyViewbox.js deleted file mode 100644 index 67a2b499b4..0000000000 --- a/scripts/asset-import/src/amenders/applyViewbox.js +++ /dev/null @@ -1,10 +0,0 @@ -// this amender will apply any viewbox values to the asset (if available) -// TODO: we should check for this value on import, as this likely means it wasn't a proper icon import -module.exports = function applyViewbox(file, options) { - if (options.viewBox) { - return file - .replace('width="1em"', `width={${options.viewBox.width}}`) - .replace('height="1em"', `height={${options.viewBox.height}}`); - } - return file; -}; diff --git a/scripts/asset-import/src/amenders/createStory.js b/scripts/asset-import/src/amenders/createStory.js deleted file mode 100644 index 3d61174f50..0000000000 --- a/scripts/asset-import/src/amenders/createStory.js +++ /dev/null @@ -1,42 +0,0 @@ -const fs = require('fs'); -const camelCase = require('camelcase'); -const { getComponentPathsFromFile, getComponentNameFromFile } = require('../util'); - -/** - * Create a .stories.js file for each parsed asset. Use the file content - * and file path to make a new file that uses a template for the content - * then writes the new file adjacent to the React component. - */ - -module.exports = function createStory(file, options) { - const relativePath = getComponentPathsFromFile(options.fileNameAndPath); - const finalFileName = getComponentNameFromFile(options.fileNameAndPath); - - // Create the storybook title - const storybookTitleParts = relativePath.split('/').slice(1); - const storybookTitle = `${storybookTitleParts.join('|')}|${finalFileName}`; - - fs.writeFileSync( - `${options.destinationPath}${relativePath.toLowerCase()}/${finalFileName}.stories.tsx`, - `import * as React from 'react'; - -import ${finalFileName} from './${finalFileName}'; - -export const ${camelCase(finalFileName)} = () => <${finalFileName} />; - -export default { - title: '${storybookTitle}', - component: ${finalFileName}, - parameters: { - notes: "\`import ${finalFileName} from 'box-ui-elements/es${getComponentPathsFromFile( - options.fileNameAndPath, - ).toLowerCase()}/${finalFileName.split('.svg')[0]}';\`", - }, -}; -`, - 'utf8', - ); - - // remember to return file so that any amenders added after this one continue to work - return file; -}; diff --git a/scripts/asset-import/src/amenders/deprecatedUseAccessibleSvg.js b/scripts/asset-import/src/amenders/deprecatedUseAccessibleSvg.js deleted file mode 100644 index 91f84dba18..0000000000 --- a/scripts/asset-import/src/amenders/deprecatedUseAccessibleSvg.js +++ /dev/null @@ -1,27 +0,0 @@ -const path = require('path'); -const times = require('lodash/times'); - -const bdlColors = require('../bdlColors'); - -const reColorValues = new RegExp(Object.values(bdlColors).join('|'), 'g'); - -// Handle swapping tags for regular svg with accessible one -// Account for import path used in box-ui-elements so that the import is relative -module.exports = function useAccessibleSvg(file, options) { - // If we import all icons into trees under src/, we - // can use the number of directories to get the relative path - // of the AccessibleSVG import in BUIE - const directoryCount = path.dirname(options.fileNameAndPath).split('/').length - 1; - const relativePath = times(directoryCount, () => '../').join(''); - const accessibleSvgImport = `import AccessibleSVG from '${relativePath}icons/accessible-svg';`; - - // Identify whether there were color swaps in the file. If so, add the color import. - const colorImport = file.match(reColorValues) ? `import * as vars from '${relativePath}styles/variables';\n` : ''; - - const accessibleSvgFile = file - .replace(' '../').join(''); - const accessibleSvgImport = `import AccessibleSVG, { SVGProps } from '${relativePath}components/accessible-svg/AccessibleSVG';`; - - // Identify whether there were color swaps in the file. If so, add the color import. - const colorImport = file.match(reColorValues) ? `import * as vars from '${relativePath}styles/variables';\n` : ''; - - const accessibleSvgFile = file - .replace(' { - const newKeyName = bdlColors[key]; - if (typeof newKeyName === 'string') { - bdlColorExport[newKeyName.toUpperCase()] = `{vars.${camelCase(key)}}`; - } -}); - -module.exports = bdlColorExport; diff --git a/scripts/asset-import/src/defaultConfig.js b/scripts/asset-import/src/defaultConfig.js deleted file mode 100644 index f76017a2ba..0000000000 --- a/scripts/asset-import/src/defaultConfig.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - assetPath: './_Deprecated', - branch: 'master', - workingDir: '/tmp', - destinationDir: 'src', -}; diff --git a/scripts/asset-import/src/import.js b/scripts/asset-import/src/import.js deleted file mode 100644 index 240d5e4fdb..0000000000 --- a/scripts/asset-import/src/import.js +++ /dev/null @@ -1,125 +0,0 @@ -/* eslint-disable import/no-unresolved, no-shadow, import/no-extraneous-dependencies, no-console */ -const SimpleGit = require('simple-git/promise'); -const path = require('path'); -const colors = require('colors/safe'); -const ora = require('ora'); -const rimraf = require('rimraf'); -const cosmiconfig = require('cosmiconfig'); -const uniqid = require('uniqid'); - -const util = require('./util'); -const defaultConfig = require('./defaultConfig'); -const convertToReact = require('./parsers/convertToReact'); -const disableAlphaSort = require('./amenders/disableAlphaSort'); -const addTypes = require('./amenders/addTypes'); -const useAccessibleSvg = require('./amenders/useAccessibleSvg'); -const applyViewbox = require('./amenders/applyViewbox'); -const addAutoGeneratedMessage = require('./amenders/addAutoGeneratedMessage'); -const createStory = require('./amenders/createStory'); - -// create an instance of ora for individual file parsing later -const progress = ora(); - -/** - * Run all configured parsers - * @param {string} file SVG contents - * @param {object} options options used by any possible parser (SVGR, etc.) - * @return {string} parsed file content - */ -function parse(file, options) { - // Add any additional entries below in the order they should run - return [convertToReact].reduce((finalFile, currentFunc) => { - return currentFunc(finalFile, options); - }, file); -} - -/** - * Amend the produced files in ways that cannot be handled in parse phase - * @param {string} file SVG contents - * @param {object} options options used by any possible amender - * @return {string} amended file content - */ -function amend(file, options) { - // Add any additional entries below in the order they should run - return [useAccessibleSvg, disableAlphaSort, addTypes, applyViewbox, addAutoGeneratedMessage, createStory].reduce( - (finalFile, currentFunc) => { - return currentFunc(finalFile, options); - }, - file, - ); -} - -/** - * handler function for calling amend and parse. Also logs progress while running - * @param {string} fileContent the actual content of the icon file - * @param {object} options options used by any possible parser - * - fileNameAndPath - the full path and name of the file in the working directory - * - sourcePath - the temporary directory where unconverted assets live - * - destinationPath - the target (relative) directory where assets will be placed - */ -function parser(fileContent, options) { - progress.text = colors.cyan(`Parsing ${options.fileNameAndPath}`); - progress.render(); - - const parsed = parse(fileContent, options); - - progress.text = colors.cyan(`Amending ${options.fileNameAndPath}`); - progress.render(); - - return amend(parsed, options); -} - -module.exports = async cliOptions => { - progress.start(colors.cyan('Load configuration. . .')); - - // prefer the CLI options to any found config, then use defaults as last resort - const settings = cosmiconfig.cosmiconfig('asset-import'); - const emptyConfig = { config: {} }; - const result = await settings.search().catch(() => null); - const config = { ...defaultConfig, ...(result || emptyConfig).config, ...cliOptions }; - - if (result && result.filepath) { - progress.succeed(colors.cyan(`Using config ${result.filepath}`)); - } else { - progress.info(colors.cyan('No config file used')); - } - - if (config.verbose) { - // print out config details - progress.info(colors.brightCyan('Using configuration:')); - progress.info(colors.brightCyan(config)); - } - - const git = new SimpleGit(config.workingDir); - const sourcePath = `${config.workingDir}/${uniqid('design-assets-')}`; - const assetPath = path.join(sourcePath, config.assetPath); - - rimraf(sourcePath, async () => { - try { - if (git) { - progress.start(colors.cyan(`Clone ${config.repository}`)); - await git.clone(config.repository, sourcePath); - await git.cwd(sourcePath); - progress.succeed(); - - progress.start(colors.cyan(`Checkout ${config.branch} to ${sourcePath}`)); - await git.checkout(config.branch); - progress.succeed(); - - progress.start(colors.cyan(`Parse contents of ${assetPath}. . .`)); - util.parseContentsOf(assetPath, assetPath, config.destinationDir, parser); - progress.succeed(colors.cyan('Parsing completed successfully.')); - - progress.start('Cleaning up. . .'); - rimraf(sourcePath, () => { - progress.succeed(colors.cyan('Done.')); - process.exit(0); - }); - } - } catch (e) { - // There was an error in one of the awaits, probably due to missing arguments - progress.fail(`There was an error processing the assets: ${e}`); - process.exit(2); - } - }); -}; diff --git a/scripts/asset-import/src/parsers/convertToReact.js b/scripts/asset-import/src/parsers/convertToReact.js deleted file mode 100644 index 94a3a5f5a6..0000000000 --- a/scripts/asset-import/src/parsers/convertToReact.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This parser will convert an SVG to - * a react component using SVGR - * - * https://github.com/smooth-code/svgr - */ - -/* eslint-disable import/no-unresolved, no-shadow, import/no-extraneous-dependencies, no-console */ -const svgr = require('@svgr/core').default; -const bdlColors = require('../bdlColors'); -const util = require('../util'); - -// Available options: (https://www.smooth-code.com/open-source/svgr/docs/options/) -module.exports = function svgrParser(svgContent, options) { - return svgr.sync( - svgContent, - { - icon: true, - plugins: ['@svgr/plugin-svgo', '@svgr/plugin-jsx', '@svgr/plugin-prettier'], - replaceAttrValues: bdlColors, - template: function defaultTemplate({ template }, opts, { imports, componentName, props, jsx, exports }) { - return template.ast`${imports} -const __add_svg_imports = true; -const __add_types = true; - -const __add_documentation = true; - -const ${componentName} = (${props}) => ${jsx} -${exports} -`; - }, - }, - { - componentName: util.getComponentNameFromFile(options.fileNameAndPath), - }, - ); -}; diff --git a/scripts/asset-import/src/util.js b/scripts/asset-import/src/util.js deleted file mode 100644 index dd4535ff65..0000000000 --- a/scripts/asset-import/src/util.js +++ /dev/null @@ -1,147 +0,0 @@ -/* eslint-disable import/no-unresolved, no-shadow, import/no-extraneous-dependencies, no-console */ -const fs = require('fs'); -const path = require('path'); -const rimraf = require('rimraf'); -const identity = require('lodash/identity'); -const camelCase = require('camelcase'); - -const viewBoxRegExp = /viewBox="(\d+) (\d+) (\d+) (\d+)"/; - -/** - * Given a directory, return the list of folders in that directory, using the full path. - * Filter out any hidden (dot) directories - * @param {string} directory Full path to directory - * @return {Array} list of directory - */ -function getDirectoriesFor(directory) { - return fs - .readdirSync(directory) - .filter(item => item.indexOf('.') !== 0) - .map(file => path.join(directory, file)) - .filter(path => fs.statSync(path).isDirectory()); -} - -/** - * Given a directory, return the list of files in that directory, using the full path - * Filter only to SVGs - * @param {string} directory Full path to directory - * @return {Array} list of files - */ -function getFilesFor(directory) { - return fs - .readdirSync(directory) - .filter(item => item.indexOf('.svg') > 0) - .map(file => path.join(directory, file)) - .filter(path => !fs.statSync(path).isDirectory()); -} - -/** - * Convert full filename and path into just the file name (used for component name) - * @param {string} filename name used for both path and filename with extension - * @return {string} name of file, stripped of extension and any path information - */ -function getComponentNameFromFile(filename) { - return camelCase(path.parse(filename).name, { pascalCase: true }); -} - -/** - * Given a file name and path, retrieve the directory tree - * @param {string} filename named used for both path and filename with extension - * @return {string} paths to file, without the filename and trailing extension - */ -function getComponentPathsFromFile(filename) { - return path.parse(filename).dir; -} - -/** - * Parse a given SVG document, and return the viewbox values in an object format - * @param {string} file the contents of the SVG document in string form - * @return {?object} object representing the SVG values for viewbox - * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/viewBox - */ -function getViewBoxFromSvg(file) { - const matches = file.match(viewBoxRegExp); - if (matches) { - return { - minX: matches[1], - minY: matches[2], - width: matches[3], - height: matches[4], - }; - } - - return undefined; -} - -/** - * Init. method for driving the conversion process. Writes to the formatted target name - * e.g., source_path/to/some/svg-ICON-file.svg => destination_path/to/some/SvgIconFile.js - * @param {string} directory the current directory to parse - * @param {string} sourcePath the origin directory path (not including the paths in the design repository) - * @param {string} destinationPath the relative destination path to copy to (from config) - * @param {Function} onParseFile what to do when a file (and its content) is reached. by default, pass thru - * @return {void} - */ -function parseContentsOf(directory, sourcePath, destinationPath, onParseFile = identity) { - getFilesFor(directory).forEach(file => { - const targetFileName = file.split(sourcePath)[1]; - const fileContent = fs.readFileSync(file, 'utf8'); - const viewBox = getViewBoxFromSvg(fileContent); - const fileName = getComponentNameFromFile(file); - const options = { - fileName, - fileNameAndPath: targetFileName, - sourcePath, - destinationPath, - viewBox, - }; - - // add useful optional data to the parse file call, like the path and file name - let convertedFile = onParseFile(fileContent, options); - fs.writeFileSync( - `${destinationPath}${getComponentPathsFromFile(targetFileName)}/${fileName}.tsx`, - convertedFile, - 'utf8', - ); - - // @TODO(FIX-TS-MIGRATION-HACK) - convertedFile = onParseFile(fileContent, { - ...options, - useFlow: true, - }); - // @TODO(FIX-TS-MIGRATION-HACK) - fs.writeFileSync( - `${destinationPath}${getComponentPathsFromFile(targetFileName)}/${fileName}.js.flow`, - convertedFile, - 'utf8', - ); - }); - - getDirectoriesFor(directory).forEach(nestedFolder => { - const fullDestPath = `${destinationPath}${nestedFolder.split(sourcePath)[1]}`.toLowerCase(); - - // Ignore any platform directories since web only uses the other parts of the tree - // TODO: consider using some config IFF this may be used by other platform teams - if (fullDestPath.indexOf('platform') > 0) { - return; - } - - try { - rimraf.sync(fullDestPath); - fs.mkdirSync(fullDestPath); - } catch (e) { - if (e.code !== 'EEXIST') { - throw e; - } - } - parseContentsOf(nestedFolder, sourcePath, destinationPath, onParseFile); - }); -} - -module.exports = { - getFilesFor, - getDirectoriesFor, - getComponentNameFromFile, - getComponentPathsFromFile, - parseContentsOf, -}; diff --git a/scripts/utils/bdlClassnameManager b/scripts/utils/bdlClassnameManager deleted file mode 100755 index 2cf76ea713..0000000000 --- a/scripts/utils/bdlClassnameManager +++ /dev/null @@ -1,296 +0,0 @@ -#!/usr/bin/env node - -const fs = require('fs'); -const colors = require('colors/safe'); -const { promisify } = require('util'); -const invert = require('lodash/invert'); -const trimStart = require('lodash/trimStart'); - -const readFile = promisify(fs.readFile); -const writeFile = promisify(fs.writeFile); - -/* - The BDL classname manager is a tool to help identify and correct the usage of classnames - names across box-ui-elements and other projects. - - USAGE - - How to use this tool in "box-ui-elements": - (1) find . -name "*.scss" -exec ../scripts/utils/bdlClassnameManager swap {} \; - (2) find . -name "*.scss" -exec ../scripts/utils/bdlClassnameManager extend {} \; - (3) find . -not -name "*test.js" -and -name "*.js" -exec ../scripts/utils/bdlClassnameManager append {} \; - (4) find . -not -name "*test.tsx" -and -name "*.tsx" -exec ../scripts/utils/bdlClassnameManager append {} \; - - How to use this tool in other projects that have "box-ui-elements" as a dependency: - (1) find . -name "*.scss" -exec ../scripts/utils/bdlClassnameManager swap {} \; - (2) find . -not -name "*test.js" -and -name "*.js" -exec ../scripts/utils/bdlClassnameManager swap {} \; - - Please note that this tool will not catch all cases, so reviewing changes may be required. -*/ - -const conversionMap = { - // 'btn': 'bdl-Button', - 'btn-group': 'bdl-ButtonGroup', - // 'btn-plain': 'bdl-Button--plain', - // 'btn-primary': 'bdl-Button--primary', - 'is-disabled': 'bdl-is-disabled', - label: 'bdl-Label', - pill: 'bdl-Pill', - 'pill-cloud-button': 'bdl-PillCloud-button', - 'pill-cloud-container': 'bdl-PillCloud', - 'pill-error': 'bdl-Pill--error', - 'pill-selector-hidden-input': 'bdl-PillSelector-input--hidden', - 'pill-selector-input': 'bdl-PillSelector-input', - 'pill-selector-input-wrapper': 'bdl-PillSelector', - 'pill-selector-suggestions-enabled': 'bdl-PillSelector--suggestionsEnabled', - 'pill-selector-wrapper': 'bdl-PillSelectorDropdown', - 'pill-text': 'bdl-Pill-text', - 'pill-warning': 'bdl-Pill-warning', - 'pills-list': 'bdl-PillsList', - 'select-button': 'bdl-SelectButton', - toggle: 'bdl-Toggle', - tooltip: 'bdl-Tooltip', -}; -const scssPrefix = '.'; -const jsPrefixes = ["'", '"', '`']; -const jsExtensions = new Set(['js', 'tsx']); - -function lengthSorter(a, b) { - return a.length > b.length ? -1 : 1; -} - -function findAndReplaceSCSS(toReplace, match, replaceWith) { - return toReplace.replace(new RegExp(`\\${match}(?!-)`, 'g'), replaceWith); -} - -function findAndReplaceJS(toReplace, match, replaceWith) { - return toReplace.replace(new RegExp(`(? 0) { - await writeFile(fileName, fileContentsToParse); - console.log( - colors.cyan(`Replaced ${matches.length} classname value${matches.length !== 1 ? 's' : ''} in:\t`), - fileName, - ); - } else if (isVerbose) { - console.warn(colors.yellow('No changes needed to file:\t'), fileName); - } - } catch (error) { - console.error(colors.red('Cannot write updated file to disk\n'), error); - process.exit(1); - } -} - -async function processFileContents({ fileContentsToParse, fileName, isVerbose, sourceNameRegex }, handleMatch) { - const matches = [...new Set(fileContentsToParse.match(sourceNameRegex))]; - - if (isVerbose) { - printVerboseOperationMessage(fileName, matches); - } - - // sort prevents root classnames ('btn') from preemptively changing longer classnames ('btn-primary') - fileContentsToParse = matches.sort(lengthSorter).reduce(handleMatch, fileContentsToParse); - await handleWriteFile(fileContentsToParse, fileName, isVerbose, matches); -} - -async function swap({ currentConversionMap, fileType, ...operationParams }) { - processFileContents(operationParams, (fileContents, match) => { - if (fileType === 'scss') { - fileContents = findAndReplaceSCSS( - fileContents, - match, - `${scssPrefix}${currentConversionMap[trimStart(match, scssPrefix)]}`, - ); - } else if (jsExtensions.has(fileType)) { - const quotationMark = match[0]; - if (jsPrefixes.includes(quotationMark)) { - fileContents = findAndReplaceJS( - fileContents, - match, - `${quotationMark}${currentConversionMap[trimStart(match, quotationMark)]}`, - ); - } else if (operationParams.isVerbose) { - console.warn( - colors.yellow('Incorrect match for JS/TSX files. Skipping', operationParams.fileName, '...'), - ); - } - } - return fileContents; - }); -} - -async function append({ currentConversionMap, fileType, ...operationParams }) { - processFileContents(operationParams, (fileContents, match) => { - if (fileType === 'scss') { - fileContents = findAndReplaceSCSS( - fileContents, - match, - `${match}, ${scssPrefix}${currentConversionMap[trimStart(match, scssPrefix)]}`, - ); - } else if (jsExtensions.has(fileType)) { - const quotationMark = match[0]; - if (jsPrefixes.includes(quotationMark)) { - fileContents = findAndReplaceJS( - fileContents, - match, - `${match} ${currentConversionMap[trimStart(match, quotationMark)]}`, - ); - } else if (operationParams.isVerbose) { - console.warn( - colors.yellow('Incorrect match for JS/TSX files. Skipping', operationParams.fileName, '...'), - ); - } - } - return fileContents; - }); -} - -async function extend({ currentConversionMap, fileType, ...operationParams }) { - processFileContents(operationParams, (fileContents, match, index) => { - if (fileType === 'scss') { - const matchReplace = match.replace('.', ''); - if (index === 0) { - fileContents = fileContents.concat( - '\n\n/*\n* Section below is for bdl-namespace backwards compatibility.\n* Do not add changes below this line.\n*/', - ); - } - fileContents = fileContents.concat( - `\n${scssPrefix}${currentConversionMap[matchReplace]} {\n @extend ${match};\n}\n`, - ); - } else { - console.error( - colors.yellow('Unrecognized file type for extend operation. Skipping', operationParams.fileName, '...'), - ); - process.exit(0); - } - return fileContents; - }); -} - -async function main() { - // argv 0 and 1 are the node instance and the script name respectively. - // argv 2 is the operation: check, swap, append, extend - const operation = process.argv[2]; - - // argv 3 is the file (and extension) - const fileName = process.argv[3]; - - if (!fileName) { - console.error(colors.red('Missing parameter:'), colors.white('fileName')); - process.exit(1); - } - if (!Object.keys(conversionMap).length) { - console.error(colors.red('Missing values in: '), colors.white('conversionMap')); - process.exit(1); - } - const fileType = fileName.split('.').pop(); - const isVerbose = process.argv[4] === '--verbose'; - const isExtend = operation === 'extend'; - const currentConversionMap = isExtend ? invert(conversionMap) : conversionMap; - - let sourceNameRegex; - if (fileType === 'scss') { - const converter = entry => `\\${scssPrefix}${entry}(?!-)`; - sourceNameRegex = new RegExp( - Object.keys(currentConversionMap) - .map(converter) - // Sorting enables finding matches for longer classnames before their root counterparts - // E.g. compare results for /\.btn|\.btn-primary/g to /\.btn-primary|\.btn/g - .sort(lengthSorter) - .join('|'), - 'g', - ); - } else if (jsExtensions.has(fileType)) { - // The majority of .js classnames are surrounded by quotation marks - // Restrict to those prefixes to avoid overrwriting variable names - const converter = entry => jsPrefixes.map(prefix => `${prefix}${entry}`).join('|'); - sourceNameRegex = new RegExp( - Object.keys(currentConversionMap) - .map(converter) - .join('|'), - 'g', - ); - } else { - console.error(colors.yellow('Unrecognized file type for this tool. Skipping', fileName, '...')); - process.exit(0); - } - - try { - const fileContentsToParse = await readFile(fileName, { encoding: 'utf8' }); - const operationParams = { - currentConversionMap, - fileContentsToParse, - fileName, - fileType, - isVerbose, - sourceNameRegex, - }; - - switch (operation) { - case 'check': { - // determine if the file is using one of the legacy variable names - const foundMatch = sourceNameRegex.test(fileContentsToParse); - if (foundMatch) { - // Exit with an error code: we should not find bad names - if (isVerbose) { - console.error(colors.red('Bad BDL class name found in', fileName)); - } - process.exit(1); - } - - break; - } - case 'append': { - append(operationParams); - break; - } - case 'extend': { - extend(operationParams); - break; - } - case 'swap': { - swap(operationParams); - break; - } - default: - console.error(colors.red('Unrecognized operation:'), colors.white(operation)); - console.error( - colors.red( - 'use "swap" to replace names, "append" to add new classes, "extend" to add @extend property, or "check" to verify if a file contains deprecated values', - ), - ); - process.exit(1); - break; - } - } catch (error) { - console.error( - colors.red('Cannot read file, because it does not exist or the wrong path is specified\n'), - error, - ); - process.exit(1); - } -} - -if (process.argv.length < 3) { - printHelp(); -} else { - main(); -} diff --git a/scripts/utils/bdlColorManager b/scripts/utils/bdlColorManager deleted file mode 100755 index adeabe39ab..0000000000 --- a/scripts/utils/bdlColorManager +++ /dev/null @@ -1,176 +0,0 @@ -#!/usr/bin/env node - -/* eslint-disable */ -const fs = require('fs'); -const colors = require('colors/safe'); -const { promisify } = require('util'); -const camelCase = require('lodash/camelCase'); -const kebabCase = require('lodash/kebabCase'); -const identity = require('lodash/identity'); -const readFile = promisify(fs.readFile); -const writeFile = promisify(fs.writeFile); - -/* - The BDL color manager is a tool to help identify and correct the usage of color - variable names across box-ui-elements, and other projects. -*/ - -const conversionMap = { - 'box-blue': 'bdl-box-blue', - 'koray-ing': 'bdl-dark-blue', - 'picton-blue': 'bdl-light-blue', - 'baby-blue': 'bdl-box-blue-50', - 'blue-purple': 'bdl-purple-rain', - 'hover-blue': 'bdl-light-blue', - 'dusty-plum': 'bdl-purple-rain', - 'sad-sunjin': 'bdl-grimace', - 'pale-mint': 'bdl-green-light-10', - 'thats-mint': 'bdl-green-light', - 'shady-acres': 'bdl-green-light', - 'wild-rice': 'bdl-yellorange-50', - 'early-dawn': 'bdl-yellorange-10', - 'lemon-meringue': 'bdl-yellow', - 'dehydrated': 'bdl-yellorange', - 'kumera': 'bdl-yellorange', - 'mad-max': 'bdl-yellorange', - 'ayers-rock': 'bdl-yellorange', - 'amaranth': 'bdl-watermelon-red', - 'lavender-blush': 'bdl-watermelon-red-10', - 'carissma': 'bdl-watermelon-red-50', - 'great-balls-of-fire': 'bdl-watermelon-red', - 'king-crimson': 'bdl-watermelon-red', - 'bfive': 'bdl-gray-30', - 'dtwo': 'bdl-gray-20', - 'efive': 'bdl-gray-10', - 'ffive': 'bdl-gray-05', - 'fivef': 'bdl-gray-05', - 'fnine': 'bdl-gray-02', - 'seesee': 'bdl-gray-20', - 'see-see': 'bdl-gray-20', - 'haze': 'bdl-gray-02', - 'off-white': 'bdl-gray-10', - 'sf-fog': 'bdl-gray-30', - 'karl-fog': 'bdl-gray-02', - 'silver-chalice': 'bdl-gray-40', - 'storms-a-comin': 'bdl-gray-62', - 'blue-steel': 'bdl-gray', - 'better-black': 'bdl-gray-80', - 'downtown-grey': 'bdl-gray-50', - 'twos': 'bdl-gray', - 'threes': 'bdl-gray', - 'fours': 'bdl-gray-80', - 'sevens': 'bdl-gray-62', - 'eights': 'bdl-gray-50', // can cause false positives with words like "heights" - 'nines': 'bdl-gray-50', - 'eees': 'bdl-gray-10', - 'tendemob-grey': 'bdl-gray-62', - 'sunset-grey': 'bdl-gray-80', - 'seventy-sixers': 'bdl-gray-62', - 'approx-mischka-grey': 'bdl-gray-40', - 'lightest-charcoal': 'bdl-gray-30', - 'purple-rain': 'bdl-purple-rain', - 'bdl-neutral-01': 'bdl-gray', - 'bdl-neutral-02': 'bdl-gray-62', - 'bdl-neutral-03': 'bdl-gray-50', - 'bdl-neutral-04': 'bdl-gray-10', - 'bdl-neutral-05': 'bdl-gray-05', - 'bdl-neutral-06': 'bdl-gray-02', -}; - -function printHelp() { - console.log(`Usage: ${process.argv[1].split('/').pop()} operation fileName [--verbose]`); - console.log('\nSupported operations:'); - console.log('\tcheck\t\tcheck to see if a file contains deprecated values (returns error if it does)'); - console.log('\tswap\t\treplace known-deprecated variable names in a JS or SCSS file'); - console.log('\nExample:\n\n'); - console.log(`\tfind src -name '*.scss' -exec ./scripts/utils/bdlColorManager swap {} \;`); -} - -async function main() { - // argv 0 and 1 are the node instance and the script name respectively. - // argv 2 is the operation: check, swap, ... - const operation = process.argv[2]; - - // argv 3 is the file (and extension) - const fileName = process.argv[3]; - - if (!fileName) { - console.error(colors.red('Missing parameter:'), colors.white('fileName')); - process.exit(1); - } - const fileType = fileName.split('.').pop(); - const verboseMode = process.argv[4] === '--verbose'; - - const toRegExp = fileType === 'js' ? identity : entity => `\\\$${entity}(?!-)`; - const caseConverter = fileType === 'js' ? camelCase : kebabCase; - const toTargetLanguage = fileType === 'js' ? camelCase : entity => `$${kebabCase(entity)}`; - - const reBadName = new RegExp(Object.keys(conversionMap).map(entry => toRegExp(caseConverter(entry))).join('|'), 'g'); - - try { - const fileToParse = await readFile(fileName, { encoding: 'utf8' }); - - switch (operation) { - case 'check': - // determine if the file is using one of the legacy variable names - const foundMatch = reBadName.test(fileToParse); - if (foundMatch) { - // Exit with an error code: we should not find bad names - if (verboseMode) { - console.error(colors.red('Bad BDL color name found in', fileName)); - } - process.exit(1); - } - - break; - case 'swap': - // find, then swap in the proper new name - const matches = [...new Set(fileToParse.match(reBadName))]; - let replacementFile = fileToParse; - - if (verboseMode) { - const replacements = matches.map(entry => caseConverter(conversionMap[kebabCase(entry)])); - console.log(colors.cyan('File name:'), colors.white(fileName)); - console.log(colors.cyan('Found:'), matches); - console.log(colors.cyan('Replace with:'), replacements); - } - - matches.forEach(match => { - if (fileType === 'js' || fileType === 'scss') { - replacementFile = replacementFile.replace(new RegExp(toRegExp(caseConverter(match)), 'g'), toTargetLanguage(conversionMap[kebabCase(match)])); - } else { - console.error(colors.yellow('Unrecognized file type for conversion. skipping', fileName, '...')); - process.exit(0); - } - }); - - try { - if (matches.length > 0) { - await writeFile(fileName, replacementFile); - console.log (colors.cyan(`Replaced ${matches.length} color value${matches.length !== 1 ? 's': ''} in:\t`), fileName); - } else if (verboseMode) { - console.warn(colors.yellow('No changes needed to file:\t'), fileName); - } - } catch (error) { - console.error(colors.red('Cannot write updated file to disk\n'), error); - process.exit(1); - } - - break; - default: - console.error(colors.red('Unrecognized operation:'), colors.white(operation)); - console.error(colors.red('use "swap" to replace names, or "check" to verify if a file contains deprecated values')); - process.exit(1); - break; - } - } catch (error) { - console.error(colors.red('Cannot read file, because it does not exist or the wrong path is specified\n'), error); - process.exit(1); - } -} - -if (process.argv.length < 3) { - printHelp(); -} else { - main(); -} diff --git a/yarn.lock b/yarn.lock index c29256b335..9a67320ded 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1470,7 +1470,7 @@ debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.12.6", "@babel/types@^7.18.9", "@babel/types@^7.2.0", "@babel/types@^7.20.7", "@babel/types@^7.21.5", "@babel/types@^7.24.0", "@babel/types@^7.24.7", "@babel/types@^7.24.8", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.9.0": +"@babel/types@^7.0.0", "@babel/types@^7.18.9", "@babel/types@^7.2.0", "@babel/types@^7.20.7", "@babel/types@^7.21.5", "@babel/types@^7.24.0", "@babel/types@^7.24.7", "@babel/types@^7.24.8", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.9.0": version "7.24.8" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.8.tgz#d51ffa9043b17d36622efa44e861a49e69e130a8" integrity sha512-SkSBEHwwJRU52QEVZBmMBnE5Ux2/6WU1grdYyOhpbCNxbmJrDuDCphBzKZSO3taf0zztp+qkWlymE5tVL5l0TA== @@ -2740,18 +2740,6 @@ resolved "https://registry.yarnpkg.com/@juggle/resize-observer/-/resize-observer-3.4.0.tgz#08d6c5e20cf7e4cc02fd181c4b0c225cd31dbb60" integrity sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA== -"@kwsites/file-exists@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@kwsites/file-exists/-/file-exists-1.1.1.tgz#ad1efcac13e1987d8dbaf235ef3be5b0d96faa99" - integrity sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw== - dependencies: - debug "^4.1.1" - -"@kwsites/promise-deferred@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz#8ace5259254426ccef57f3175bc64ed7095ed919" - integrity sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw== - "@leichtgewicht/ip-codec@^2.0.1": version "2.0.5" resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz#4fc56c15c580b9adb7dc3c333a134e540b44bfb1" @@ -5558,103 +5546,6 @@ "@types/express" "^4.7.0" file-system-cache "2.3.0" -"@svgr/babel-plugin-add-jsx-attribute@^5.4.0": - version "5.4.0" - resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-5.4.0.tgz#81ef61947bb268eb9d50523446f9c638fb355906" - integrity sha512-ZFf2gs/8/6B8PnSofI0inYXr2SDNTDScPXhN7k5EqD4aZ3gi6u+rbmZHVB8IM3wDyx8ntKACZbtXSm7oZGRqVg== - -"@svgr/babel-plugin-remove-jsx-attribute@^5.4.0": - version "5.4.0" - resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-remove-jsx-attribute/-/babel-plugin-remove-jsx-attribute-5.4.0.tgz#6b2c770c95c874654fd5e1d5ef475b78a0a962ef" - integrity sha512-yaS4o2PgUtwLFGTKbsiAy6D0o3ugcUhWK0Z45umJ66EPWunAz9fuFw2gJuje6wqQvQWOTJvIahUwndOXb7QCPg== - -"@svgr/babel-plugin-remove-jsx-empty-expression@^5.0.1": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-remove-jsx-empty-expression/-/babel-plugin-remove-jsx-empty-expression-5.0.1.tgz#25621a8915ed7ad70da6cea3d0a6dbc2ea933efd" - integrity sha512-LA72+88A11ND/yFIMzyuLRSMJ+tRKeYKeQ+mR3DcAZ5I4h5CPWN9AHyUzJbWSYp/u2u0xhmgOe0+E41+GjEueA== - -"@svgr/babel-plugin-replace-jsx-attribute-value@^5.0.1": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-replace-jsx-attribute-value/-/babel-plugin-replace-jsx-attribute-value-5.0.1.tgz#0b221fc57f9fcd10e91fe219e2cd0dd03145a897" - integrity sha512-PoiE6ZD2Eiy5mK+fjHqwGOS+IXX0wq/YDtNyIgOrc6ejFnxN4b13pRpiIPbtPwHEc+NT2KCjteAcq33/F1Y9KQ== - -"@svgr/babel-plugin-svg-dynamic-title@^5.4.0": - version "5.4.0" - resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-svg-dynamic-title/-/babel-plugin-svg-dynamic-title-5.4.0.tgz#139b546dd0c3186b6e5db4fefc26cb0baea729d7" - integrity sha512-zSOZH8PdZOpuG1ZVx/cLVePB2ibo3WPpqo7gFIjLV9a0QsuQAzJiwwqmuEdTaW2pegyBE17Uu15mOgOcgabQZg== - -"@svgr/babel-plugin-svg-em-dimensions@^5.4.0": - version "5.4.0" - resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-svg-em-dimensions/-/babel-plugin-svg-em-dimensions-5.4.0.tgz#6543f69526632a133ce5cabab965deeaea2234a0" - integrity sha512-cPzDbDA5oT/sPXDCUYoVXEmm3VIoAWAPT6mSPTJNbQaBNUuEKVKyGH93oDY4e42PYHRW67N5alJx/eEol20abw== - -"@svgr/babel-plugin-transform-react-native-svg@^5.4.0": - version "5.4.0" - resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-transform-react-native-svg/-/babel-plugin-transform-react-native-svg-5.4.0.tgz#00bf9a7a73f1cad3948cdab1f8dfb774750f8c80" - integrity sha512-3eYP/SaopZ41GHwXma7Rmxcv9uRslRDTY1estspeB1w1ueZWd/tPlMfEOoccYpEMZU3jD4OU7YitnXcF5hLW2Q== - -"@svgr/babel-plugin-transform-svg-component@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-transform-svg-component/-/babel-plugin-transform-svg-component-5.5.0.tgz#583a5e2a193e214da2f3afeb0b9e8d3250126b4a" - integrity sha512-q4jSH1UUvbrsOtlo/tKcgSeiCHRSBdXoIoqX1pgcKK/aU3JD27wmMKwGtpB8qRYUYoyXvfGxUVKchLuR5pB3rQ== - -"@svgr/babel-preset@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@svgr/babel-preset/-/babel-preset-5.5.0.tgz#8af54f3e0a8add7b1e2b0fcd5a882c55393df327" - integrity sha512-4FiXBjvQ+z2j7yASeGPEi8VD/5rrGQk4Xrq3EdJmoZgz/tpqChpo5hgXDvmEauwtvOc52q8ghhZK4Oy7qph4ig== - dependencies: - "@svgr/babel-plugin-add-jsx-attribute" "^5.4.0" - "@svgr/babel-plugin-remove-jsx-attribute" "^5.4.0" - "@svgr/babel-plugin-remove-jsx-empty-expression" "^5.0.1" - "@svgr/babel-plugin-replace-jsx-attribute-value" "^5.0.1" - "@svgr/babel-plugin-svg-dynamic-title" "^5.4.0" - "@svgr/babel-plugin-svg-em-dimensions" "^5.4.0" - "@svgr/babel-plugin-transform-react-native-svg" "^5.4.0" - "@svgr/babel-plugin-transform-svg-component" "^5.5.0" - -"@svgr/core@^5.0.1": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@svgr/core/-/core-5.5.0.tgz#82e826b8715d71083120fe8f2492ec7d7874a579" - integrity sha512-q52VOcsJPvV3jO1wkPtzTuKlvX7Y3xIcWRpCMtBF3MrteZJtBfQw/+u0B1BHy5ColpQc1/YVTrPEtSYIMNZlrQ== - dependencies: - "@svgr/plugin-jsx" "^5.5.0" - camelcase "^6.2.0" - cosmiconfig "^7.0.0" - -"@svgr/hast-util-to-babel-ast@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@svgr/hast-util-to-babel-ast/-/hast-util-to-babel-ast-5.5.0.tgz#5ee52a9c2533f73e63f8f22b779f93cd432a5461" - integrity sha512-cAaR/CAiZRB8GP32N+1jocovUtvlj0+e65TB50/6Lcime+EA49m/8l+P2ko+XPJ4dw3xaPS3jOL4F2X4KWxoeQ== - dependencies: - "@babel/types" "^7.12.6" - -"@svgr/plugin-jsx@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@svgr/plugin-jsx/-/plugin-jsx-5.5.0.tgz#1aa8cd798a1db7173ac043466d7b52236b369000" - integrity sha512-V/wVh33j12hGh05IDg8GpIUXbjAPnTdPTKuP4VNLggnwaHMPNQNae2pRnyTAILWCQdz5GyMqtO488g7CKM8CBA== - dependencies: - "@babel/core" "^7.12.3" - "@svgr/babel-preset" "^5.5.0" - "@svgr/hast-util-to-babel-ast" "^5.5.0" - svg-parser "^2.0.2" - -"@svgr/plugin-prettier@^5.0.1": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@svgr/plugin-prettier/-/plugin-prettier-5.5.0.tgz#6c5cc8100f0c895f356d24d523f6ea5165b75366" - integrity sha512-mVc+u+eKUmy8sW5UnFpes9NqVtizJfnhasF8Srbi3XdxVTWyU5lmhWlQAgHLhcrsZKowQ0b7xBa4qWHI5Ew/VQ== - dependencies: - deepmerge "^4.2.2" - prettier "^2.1.2" - -"@svgr/plugin-svgo@^5.1.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@svgr/plugin-svgo/-/plugin-svgo-5.5.0.tgz#02da55d85320549324e201c7b2e53bf431fcc246" - integrity sha512-r5swKk46GuQl4RrVejVwpeeJaydoxkdwkM1mBKOgJLBUJPGaLci6ylg/IjhrRsREKDkr4kbMWdgOtbXEh0fyLQ== - dependencies: - cosmiconfig "^7.0.0" - deepmerge "^4.2.2" - svgo "^1.2.2" - "@swc/helpers@^0.5.0": version "0.5.12" resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.5.12.tgz#37aaca95284019eb5d2207101249435659709f4b" @@ -8901,7 +8792,7 @@ colors@1.0.3: resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b" integrity sha512-pFGrxThWcWQ2MsAz6RtgeWe4NK2kUE1WfsrvvlctdII745EW9I0yflqhe7++M5LEc7bV2c/9/5zc8sFcpL0Drw== -colors@^1.1.2, colors@^1.3.2, colors@^1.4.0: +colors@^1.1.2, colors@^1.3.2: version "1.4.0" resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== @@ -18194,7 +18085,7 @@ optionator@^0.9.3: type-check "^0.4.0" word-wrap "^1.2.5" -ora@^4.0.2, ora@^4.0.3: +ora@^4.0.2: version "4.1.1" resolved "https://registry.yarnpkg.com/ora/-/ora-4.1.1.tgz#566cc0348a15c36f5f0e979612842e02ba9dddbc" integrity sha512-sjYP8QyVWBpBZWD6Vr1M/KwknSw6kJOz41tvGMlwWeClHBtYKTbHMki1PsLZnxKpXMPbTKv9b3pjQu3REib96A== @@ -19610,7 +19501,7 @@ prettier@^1.18.2, prettier@^1.7.0: resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== -prettier@^2.1.2, prettier@^2.5.1, prettier@^2.8.0: +prettier@^2.5.1, prettier@^2.8.0: version "2.8.8" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== @@ -21379,7 +21270,7 @@ rimraf@2.6.3, rimraf@~2.6.2: dependencies: glob "^7.1.3" -rimraf@^3.0.0, rimraf@^3.0.1, rimraf@^3.0.2: +rimraf@^3.0.0, rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== @@ -21920,15 +21811,6 @@ signale@^1.2.1: figures "^2.0.0" pkg-conf "^2.1.0" -simple-git@^3.16.0: - version "3.16.0" - resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-3.16.0.tgz#421773e24680f5716999cc4a1d60127b4b6a9dec" - integrity sha512-zuWYsOLEhbJRWVxpjdiXl6eyAyGo/KzVW+KFhhw9MqEEJttcq+32jTWSGyxTdf9e/YCohxRE+9xpWFj9FdiJNw== - dependencies: - "@kwsites/file-exists" "^1.1.1" - "@kwsites/promise-deferred" "^1.1.1" - debug "^4.3.4" - simple-swizzle@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" @@ -23035,17 +22917,12 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -svg-parser@^2.0.2: - version "2.0.4" - resolved "https://registry.yarnpkg.com/svg-parser/-/svg-parser-2.0.4.tgz#fdc2e29e13951736140b76cb122c8ee6630eb6b5" - integrity sha512-e4hG1hRwoOdRb37cIMSgzNsxyzKfayW6VOflrwvR+/bzrkyxY/31WkbgnQpgtrNp1SdpJvpUAGTa/ZoiPNDuRQ== - svg-tags@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/svg-tags/-/svg-tags-1.0.0.tgz#58f71cee3bd519b59d4b2a843b6c7de64ac04764" integrity sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA== -svgo@^1.0.0, svgo@^1.2.2: +svgo@^1.0.0: version "1.3.2" resolved "https://registry.yarnpkg.com/svgo/-/svgo-1.3.2.tgz#b6dc511c063346c9e415b81e43401145b96d4167" integrity sha512-yhy/sQYxR5BkC98CY7o31VGsg014AKLEPxdfhora76l36hD9Rdy5NZA/Ocn6yayNPgSamYdtX2rFJdcv07AYVw== @@ -23901,11 +23778,6 @@ uniq@^1.0.1: resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" integrity sha512-Gw+zz50YNKPDKXs+9d+aKAjVwpjNwqzvNpLigIruT4HA9lMZNdMqs9x07kKHB/L9WRzqp4+DlTU5s4wG2esdoA== -uniqid@^5.2.0: - version "5.4.0" - resolved "https://registry.yarnpkg.com/uniqid/-/uniqid-5.4.0.tgz#4e17bfcab66dfe33563411ae0c801f46ef964e66" - integrity sha512-38JRbJ4Fj94VmnC7G/J/5n5SC7Ab46OM5iNtSstB/ko3l1b5g7ALt4qzHFgGciFkyiRNtDXtLNb+VsxtMSE77A== - uniqs@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/uniqs/-/uniqs-2.0.0.tgz#ffede4b36b25290696e6e165d4a59edb998e6b02" @@ -25199,7 +25071,7 @@ yargs@^14.2.3: y18n "^4.0.0" yargs-parser "^15.0.1" -yargs@^15.0.1, yargs@^15.1.0: +yargs@^15.0.1: version "15.4.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==