diff --git a/package.json b/package.json index 7f1a326099b895..8f91808eaac430 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,8 @@ "code-style": "lage code-style --verbose", "codepen": "cd packages/react && node ../../scripts/executors/local-codepen.js", "copy-notices": "node scripts/generators/copy-notices.js", - "create-component": "plop --plopfile ./scripts/generators/create-component/index.ts --dest . --require @fluentui/scripts-ts-node/register", - "create-package": "plop --plopfile ./scripts/generators/create-package/index.ts --dest . --require @fluentui/scripts-ts-node/register", + "create-component": "yarn nx workspace-generator react-component", + "create-package": "yarn nx workspace-generator react-library", "e2e": "lage e2e --verbose --concurrency=1", "format": "node scripts/executors/format.js", "generate-version-files": "node -r ./scripts/ts-node/register ./scripts/generators/generate-version-files", diff --git a/scripts/generators/create-component/index.ts b/scripts/generators/create-component/index.ts deleted file mode 100644 index 90541504647282..00000000000000 --- a/scripts/generators/create-component/index.ts +++ /dev/null @@ -1,173 +0,0 @@ -// Plop script for templating out a converged React component -//#region Imports -import { execSync } from 'child_process'; -import * as os from 'os'; -import * as path from 'path'; - -import { findGitRoot, getAllPackageInfo, getProjectMetadata, isConvergedPackage } from '@fluentui/scripts-monorepo'; -import { names } from '@nrwl/devkit'; -import chalk from 'chalk'; -import * as fs from 'fs-extra'; -import { Actions } from 'node-plop'; -import { AddManyActionConfig, NodePlopAPI } from 'plop'; - -//#endregion - -//#region Globals -const convergedComponentPackages = Object.entries(getAllPackageInfo()) - .filter( - ([pkgName, info]) => - isConvergedPackage({ packagePathOrJson: info.packageJson }) && - pkgName.startsWith('@fluentui/react-') && - info.packagePath.startsWith('packages') && - !!info.packageJson.dependencies?.['@fluentui/react-utilities'], - ) - .map(([packageName]) => packageName); - -const root = findGitRoot(); - -interface Answers { - packageNpmName: string; - componentName: string; -} - -interface Data extends Answers { - /** Package name without scope */ - packageName: string; - /** Absolute path to package */ - packagePath: string; - /** Absolute path to the component folder */ - componentPath: string; - /** Different strings Dictionary based off the provided `componentName` */ - componentNames: ReturnType; -} -//#endregion - -//#region Module Export -module.exports = (plop: NodePlopAPI) => { - plop.setWelcomeMessage('This utility is a helper to create converged React components'); - - plop.setGenerator('component', { - description: 'New component', - - prompts: [ - { - type: 'list', - name: 'packageNpmName', - message: 'Which package to create the new component in?', - choices: convergedComponentPackages, - validate: (packageName: string) => convergedComponentPackages.includes(packageName), - }, - { - type: 'input', - name: 'componentName', - message: 'New component name (ex: MyComponent):', - validate: (input: string) => - /^[A-Z][a-zA-Z0-9]+$/.test(input) || 'Must enter a PascalCase component name (ex: MyComponent)', - }, - ], - - actions: (answers: Answers): Actions => { - const globOptions: AddManyActionConfig['globOptions'] = { dot: true }; - const packageMetadata = getProjectMetadata(answers.packageNpmName); - if (!packageMetadata.sourceRoot) { - throw new Error(`${answers.packageNpmName} has is missing sourceRoot path in workspace.json`); - } - - const packageName = answers.packageNpmName.replace('@fluentui/', ''); - const componentPath = path.join(packageMetadata.sourceRoot, 'components', answers.componentName); - const componentNames = names(answers.componentName); - const data: Data = { - ...answers, - packageName, - packagePath: packageMetadata.root, - componentPath, - componentNames, - }; - - return [ - () => checkIfComponentAlreadyExists(data), - { - // Copy component templates - type: 'addMany', - destination: data.packagePath, - globOptions, - data, - skipIfExists: true, - templateFiles: ['plop-templates/**/*'], - }, - () => appendToPackageIndex(data), - () => { - console.log(`${chalk.green('✔')} Component files created!`); - - console.log('👷‍♀️ Updating API and running tests...\n'); - - execSync(`yarn nx workspace-generator migrate-converged-pkg --name=${data.packageNpmName}`, { - cwd: root, - stdio: 'inherit', - }); - - execSync(`yarn workspace ${data.packageNpmName} generate-api`, { - cwd: root, - stdio: 'inherit', - }); - - execSync(`yarn workspace ${data.packageNpmName} test -t ${data.componentName}`, { - cwd: root, - stdio: 'inherit', - }); - - execSync(`yarn workspace ${data.packageNpmName} lint --fix`, { - cwd: root, - stdio: 'inherit', - }); - - return 'Component ready!'; - }, - ]; - }, - }); -}; -//#endregion - -//#region Custom Actions - -const checkIfComponentAlreadyExists = (data: Data): string => { - const { componentName, componentPath } = data; - - if (fs.existsSync(componentPath) === true && fs.readdirSync(componentPath).length > 0) { - throw new Error(`The component ${componentName} already exists at ${componentPath}`); - } - return `Component ${componentName} doesn't exist yet.`; -}; - -const appendToPackageIndex = (data: Data): string => { - const { componentName, packageName, packagePath } = data; - - const indexPath = path.join(packagePath, 'src/index.ts'); - const indexContent = cleanCreatePackageTemplate(indexPath); - - const appendLine = `export * from './${componentName}';`; - - // read contents and see if line is exists - if (!indexContent.includes(appendLine)) { - // doesn't exist so append - fs.writeFileSync(indexPath, `${appendLine}${os.EOL}`, { flag: 'a' }); - return `Updated package ${packageName} index.ts to include ${componentName}`; - } - - return `Package ${packageName} index.ts already contains reference to ${componentName}`; - - function cleanCreatePackageTemplate(filePath: string) { - const content = fs.readFileSync(filePath, { encoding: 'utf8' }); - const templateContent = 'export {}'; - - if (content.indexOf(templateContent) !== -1) { - fs.writeFileSync(filePath, ''); - return ''; - } - return content; - } -}; - -//#endregion diff --git a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/index.ts.hbs b/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/index.ts.hbs deleted file mode 100644 index 6153344477e031..00000000000000 --- a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/index.ts.hbs +++ /dev/null @@ -1,5 +0,0 @@ -export * from './{{componentName}}'; -export * from './{{componentName}}.types'; -export * from './render{{componentName}}'; -export * from './use{{componentName}}'; -export * from './use{{componentName}}Styles.styles'; diff --git a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/render{{componentName}}.tsx.hbs b/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/render{{componentName}}.tsx.hbs deleted file mode 100644 index 8dadff5eec6cf0..00000000000000 --- a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/render{{componentName}}.tsx.hbs +++ /dev/null @@ -1,16 +0,0 @@ -/** @jsxRuntime classic */ -/** @jsx createElement */ - -import { createElement } from '@fluentui/react-jsx-runtime'; -import { getSlotsNext } from '@fluentui/react-utilities'; -import type { {{componentName}}State, {{componentName}}Slots } from './{{componentName}}.types'; - -/** - * Render the final JSX of {{componentName}} - */ -export const render{{componentName}}_unstable = (state: {{componentName}}State) => { - const { slots, slotProps } = getSlotsNext<{{componentName}}Slots>(state); - - // TODO Add additional slots in the appropriate place - return ; -}; diff --git a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/use{{componentName}}.ts.hbs b/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/use{{componentName}}.ts.hbs deleted file mode 100644 index 33de6c420dd566..00000000000000 --- a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/use{{componentName}}.ts.hbs +++ /dev/null @@ -1,28 +0,0 @@ -import * as React from 'react'; -import { getNativeElementProps } from '@fluentui/react-utilities'; -import type { {{componentName}}Props, {{componentName}}State } from './{{componentName}}.types'; - -/** - * Create the state required to render {{componentName}}. - * - * The returned state can be modified with hooks such as use{{componentName}}Styles_unstable, - * before being passed to render{{componentName}}_unstable. - * - * @param props - props from this instance of {{componentName}} - * @param ref - reference to root HTMLElement of {{componentName}} - */ -export const use{{componentName}}_unstable = (props: {{componentName}}Props, ref: React.Ref): {{componentName}}State => { - return { - // TODO add appropriate props/defaults - components: { - // TODO add each slot's element type or component - root: 'div', - }, - // TODO add appropriate slots, for example: - // mySlot: resolveShorthand(props.mySlot), - root: getNativeElementProps('div', { - ref, - ...props, - }), - }; -}; diff --git a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/use{{componentName}}Styles.styles.ts.hbs b/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/use{{componentName}}Styles.styles.ts.hbs deleted file mode 100644 index 8f6fd5de3e5970..00000000000000 --- a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/use{{componentName}}Styles.styles.ts.hbs +++ /dev/null @@ -1,34 +0,0 @@ -import { makeStyles, mergeClasses } from '@griffel/react'; -import type { {{componentName}}Slots, {{componentName}}State } from './{{componentName}}.types'; -import type { SlotClassNames } from '@fluentui/react-utilities'; - - -export const {{componentNames.propertyName}}ClassNames:SlotClassNames<{{componentName}}Slots> = { - root: 'fui-{{componentName}}' - // TODO: add class names for all slots on {{componentName}}Slots. - // Should be of the form `: 'fui-{{componentName}}__` -}; - -/** - * Styles for the root slot - */ -const useStyles = makeStyles({ - root: { - // TODO Add default styles for the root element - }, - - // TODO add additional classes for different states and/or slots -}); - -/** - * Apply styling to the {{componentName}} slots based on the state - */ -export const use{{componentName}}Styles_unstable = (state: {{componentName}}State): {{componentName}}State => { - const styles = useStyles(); - state.root.className = mergeClasses({{componentNames.propertyName}}ClassNames.root, styles.root, state.root.className); - - // TODO Add class names to slots, for example: - // state.mySlot.className = mergeClasses(styles.mySlot, state.mySlot.className); - - return state; -}; diff --git a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/{{componentName}}.test.tsx.hbs b/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/{{componentName}}.test.tsx.hbs deleted file mode 100644 index d30d820de3f195..00000000000000 --- a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/{{componentName}}.test.tsx.hbs +++ /dev/null @@ -1,18 +0,0 @@ -import * as React from 'react'; -import { render } from '@testing-library/react'; -import { {{componentName}} } from './{{componentName}}'; -import { isConformant } from '../../testing/isConformant'; - -describe('{{componentName}}', () => { - isConformant({ - Component: {{componentName}}, - displayName: '{{componentName}}', - }); - - // TODO add more tests here, and create visual regression tests in /apps/vr-tests - - it('renders a default state', () => { - const result = render(<{{componentName}}>Default {{componentName}}); - expect(result.container).toMatchSnapshot(); - }); -}); diff --git a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/{{componentName}}.tsx.hbs b/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/{{componentName}}.tsx.hbs deleted file mode 100644 index 0e16ce7edec0e2..00000000000000 --- a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/{{componentName}}.tsx.hbs +++ /dev/null @@ -1,18 +0,0 @@ -import * as React from 'react'; -import { use{{componentName}}_unstable } from './use{{componentName}}'; -import { render{{componentName}}_unstable } from './render{{componentName}}'; -import { use{{componentName}}Styles_unstable } from './use{{componentName}}Styles.styles'; -import type { {{componentName}}Props } from './{{componentName}}.types'; -import type { ForwardRefComponent } from '@fluentui/react-utilities'; - -/** - * {{componentName}} component - TODO: add more docs - */ -export const {{componentName}}: ForwardRefComponent<{{componentName}}Props> = React.forwardRef((props, ref) => { - const state = use{{componentName}}_unstable(props, ref); - - use{{componentName}}Styles_unstable(state); - return render{{componentName}}_unstable(state); -}); - -{{componentName}}.displayName = '{{componentName}}'; diff --git a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/{{componentName}}.types.ts.hbs b/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/{{componentName}}.types.ts.hbs deleted file mode 100644 index ddcb52a451d2d2..00000000000000 --- a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/{{componentName}}.types.ts.hbs +++ /dev/null @@ -1,18 +0,0 @@ -import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities'; - -export type {{componentName}}Slots = { - root: Slot<'div'>; -}; - -/** - * {{componentName}} Props - */ -export type {{componentName}}Props = ComponentProps<{{componentName}}Slots> & {}; - -/** - * State used in rendering {{componentName}} - */ -export type {{componentName}}State = ComponentState<{{componentName}}Slots>; -// TODO: Remove semicolon from previous line, uncomment next line, and provide union of props to pick from {{componentName}}Props. -// & Required> -; diff --git a/scripts/generators/create-component/plop-templates/src/testing/isConformant.ts.hbs b/scripts/generators/create-component/plop-templates/src/testing/isConformant.ts.hbs deleted file mode 100644 index 77f88408cbd839..00000000000000 --- a/scripts/generators/create-component/plop-templates/src/testing/isConformant.ts.hbs +++ /dev/null @@ -1,14 +0,0 @@ -import { isConformant as baseIsConformant } from '@fluentui/react-conformance'; -import type { IsConformantOptions, TestObject } from '@fluentui/react-conformance'; -import griffelTests from '@fluentui/react-conformance-griffel'; - -export function isConformant( - testInfo: Omit, 'componentPath'> & { componentPath?: string }, -) { - const defaultOptions: Partial> = { - componentPath: require.main?.filename.replace('.test', ''), - extraTests: griffelTests as TestObject, - }; - - baseIsConformant(defaultOptions, testInfo); -} diff --git a/scripts/generators/create-component/plop-templates/src/{{componentName}}.ts.hbs b/scripts/generators/create-component/plop-templates/src/{{componentName}}.ts.hbs deleted file mode 100644 index b330aff50827a6..00000000000000 --- a/scripts/generators/create-component/plop-templates/src/{{componentName}}.ts.hbs +++ /dev/null @@ -1 +0,0 @@ -export * from './components/{{componentName}}/index'; diff --git a/scripts/generators/create-component/plop-templates/stories/{{componentName}}/index.stories.tsx.hbs b/scripts/generators/create-component/plop-templates/stories/{{componentName}}/index.stories.tsx.hbs deleted file mode 100644 index fc6f6cf78f8f89..00000000000000 --- a/scripts/generators/create-component/plop-templates/stories/{{componentName}}/index.stories.tsx.hbs +++ /dev/null @@ -1,18 +0,0 @@ -import { {{componentName}} } from '@fluentui/{{packageName}}'; - -import descriptionMd from './{{componentName}}Description.md'; -import bestPracticesMd from './{{componentName}}BestPractices.md'; - -export { Default } from './{{componentName}}Default.stories'; - -export default { - title: 'Preview Components/{{componentName}}', - component: {{componentName}}, - parameters: { - docs: { - description: { - component: [descriptionMd, bestPracticesMd].join('\n'), - } - } - } -}; diff --git a/scripts/generators/create-component/plop-templates/stories/{{componentName}}/{{componentName}}BestPractices.md b/scripts/generators/create-component/plop-templates/stories/{{componentName}}/{{componentName}}BestPractices.md deleted file mode 100644 index 08ff8ddeeb5f86..00000000000000 --- a/scripts/generators/create-component/plop-templates/stories/{{componentName}}/{{componentName}}BestPractices.md +++ /dev/null @@ -1,5 +0,0 @@ -## Best practices - -### Do - -### Don't diff --git a/scripts/generators/create-component/plop-templates/stories/{{componentName}}/{{componentName}}Default.stories.tsx.hbs b/scripts/generators/create-component/plop-templates/stories/{{componentName}}/{{componentName}}Default.stories.tsx.hbs deleted file mode 100644 index b295b24ec08c00..00000000000000 --- a/scripts/generators/create-component/plop-templates/stories/{{componentName}}/{{componentName}}Default.stories.tsx.hbs +++ /dev/null @@ -1,6 +0,0 @@ -import * as React from 'react'; -import { {{componentName}}, {{componentName}}Props } from '@fluentui/{{packageName}}'; - -export const Default = (props: Partial<{{componentName}}Props>) => ( - <{{componentName}} {...props} /> -); diff --git a/scripts/generators/create-component/plop-templates/stories/{{componentName}}/{{componentName}}Description.md b/scripts/generators/create-component/plop-templates/stories/{{componentName}}/{{componentName}}Description.md deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/scripts/generators/create-package/index.ts b/scripts/generators/create-package/index.ts index c3ea0634f9f5fe..782cac0ff8c90b 100644 --- a/scripts/generators/create-package/index.ts +++ b/scripts/generators/create-package/index.ts @@ -5,7 +5,6 @@ import { PackageJson, findGitRoot, flushTreeChanges, getProjectMetadata, tree } import { addProjectConfiguration } from '@nrwl/devkit'; import chalk from 'chalk'; import * as fs from 'fs-extra'; -import * as jju from 'jju'; import _ from 'lodash'; import { Actions } from 'node-plop'; import { AddManyActionConfig, NodePlopAPI } from 'plop'; @@ -24,10 +23,9 @@ const convergedReferencePackages = { interface Answers { /** Package name without scope */ packageName: string; - target: 'react' | 'node'; + target: 'node'; description: string; codeowner: string; - hasTests?: boolean; isConverged?: boolean; } @@ -44,7 +42,7 @@ module.exports = (plop: NodePlopAPI) => { { type: 'list', name: 'target', - choices: ['react', 'node'], + choices: ['node'], default: 'react', message: 'Package target:', }, @@ -53,8 +51,7 @@ module.exports = (plop: NodePlopAPI) => { name: 'description', message: 'Package description:', // no reasonable default for node packages - default: (answers: Partial) => - answers.target === 'react' ? 'React components for building web experiences' : undefined, + default: (answers: Partial) => undefined, validate: (input: string) => !!input || 'Must enter a description', }, { @@ -69,13 +66,6 @@ module.exports = (plop: NodePlopAPI) => { '@microsoft/cxe-prg', ], }, - { - type: 'confirm', - name: 'hasTests', - message: 'Will this package have tests?', - default: true, - when: answers => answers.target === 'node', // react always has tests - }, { type: 'confirm', name: 'isConverged', @@ -84,10 +74,7 @@ module.exports = (plop: NodePlopAPI) => { }, ], actions: (answers: Answers): Actions => { - if (answers.target === 'react') { - answers = { hasTests: true, ...answers }; - } - const { packageName, target, hasTests } = answers; + const { packageName, target } = answers; const destination = answers.isConverged ? `packages/react-components/${packageName}-preview` @@ -120,9 +107,7 @@ module.exports = (plop: NodePlopAPI) => { destination, globOptions, data, - templateFiles: hasTests - ? [`plop-templates-${target}/**/*`] - : [`plop-templates-${target}/**/*`, `!(plop-templates-${target}/jest.config.js)`], + templateFiles: [`plop-templates-${target}/**/*`], }, // update package.json { @@ -130,12 +115,6 @@ module.exports = (plop: NodePlopAPI) => { path: `${destination}/package.json`, transform: packageJsonContents => updatePackageJson(packageJsonContents, answers), }, - // update tsconfig.json - { - type: 'modify', - path: `${destination}/tsconfig.json`, - transform: tsconfigContents => updateTsconfig(tsconfigContents, hasTests), - }, // update nx workspace () => { updateNxProject(answers, { projectName: data.packageNpmName, projectRoot: destination }); @@ -231,9 +210,7 @@ function replaceVersionsFromReference( continue; } for (const depPkg of Object.keys(packageDependencies)) { - if (!answers.hasTests && /\b(jest|enzyme|test(ing)?|react-conformance)\b/.test(depPkg)) { - delete packageDependencies[depPkg]; - } else if (referenceDeps[depType]?.[depPkg]) { + if (referenceDeps[depType]?.[depPkg]) { packageDependencies[depPkg] = referenceDeps[depType]?.[depPkg] as string; } else { // Record the error and wait to throw until later for better logs @@ -262,7 +239,7 @@ function replaceVersionsFromReference( * Returns the updated stringified JSON. */ function updatePackageJson(packageJsonContents: string, answers: Answers) { - const { target, hasTests, isConverged } = answers; + const { target, isConverged } = answers; // Copy dep versions in package.json from actual current version specs. // This is preferable over hardcoding dependency versions to keep things in sync. @@ -271,26 +248,9 @@ function updatePackageJson(packageJsonContents: string, answers: Answers) { const referencePackages = (isConverged ? convergedReferencePackages : v8ReferencePackages)[target]; replaceVersionsFromReference(referencePackages, newPackageJson, answers); - if (!hasTests) { - delete newPackageJson.scripts['start-test']; - delete newPackageJson.scripts.test; - delete newPackageJson.scripts['update-snapshots']; - } - return JSON.stringify(newPackageJson, null, 2); } -function updateTsconfig(tsconfigContents: string, hasTests: boolean | undefined): string { - if (hasTests) { - return tsconfigContents; - } - // Remove jest types if there aren't tests (use jju since tsconfig might have comments) - const tsconfig = jju.parse(tsconfigContents); - const types: string[] = tsconfig.compilerOptions.types; - tsconfig.compilerOptions.types = types.filter(t => t !== 'jest'); - return jju.update(tsconfigContents, tsconfig, { mode: 'cjson', indent: 2 }); -} - function updateNxProject(_answers: Answers, config: { projectName: string; projectRoot: string }) { addProjectConfiguration(tree, config.projectName, { root: config.projectRoot, diff --git a/scripts/generators/create-package/plop-templates-node/package.json.hbs b/scripts/generators/create-package/plop-templates-node/package.json.hbs index 5357290d3e4b4e..f6f49432d624dd 100644 --- a/scripts/generators/create-package/plop-templates-node/package.json.hbs +++ b/scripts/generators/create-package/plop-templates-node/package.json.hbs @@ -21,9 +21,9 @@ "update-snapshots": "just-scripts jest -u" }, "devDependencies": { - "@fluentui/eslint-plugin": "", - "@fluentui/scripts-api-extractor": "", - "@fluentui/scripts-tasks": "" + "@fluentui/eslint-plugin": "*", + "@fluentui/scripts-api-extractor": "*", + "@fluentui/scripts-tasks": "*" }, "dependencies": { "@swc/helpers": "" diff --git a/scripts/generators/create-package/plop-templates-react/.babelrc.json b/scripts/generators/create-package/plop-templates-react/.babelrc.json deleted file mode 100644 index 40e01373083cee..00000000000000 --- a/scripts/generators/create-package/plop-templates-react/.babelrc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "presets": ["@griffel"], - "plugins": ["annotate-pure-calls", "@babel/transform-react-pure-annotations"] -} diff --git a/scripts/generators/create-package/plop-templates-react/.eslintrc.json b/scripts/generators/create-package/plop-templates-react/.eslintrc.json deleted file mode 100644 index ceea884c70dccc..00000000000000 --- a/scripts/generators/create-package/plop-templates-react/.eslintrc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": ["plugin:@fluentui/eslint-plugin/react"], - "root": true -} diff --git a/scripts/generators/create-package/plop-templates-react/README.md b/scripts/generators/create-package/plop-templates-react/README.md deleted file mode 100644 index b8815854d6c766..00000000000000 --- a/scripts/generators/create-package/plop-templates-react/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# {{{packageNpmName}}} - -**{{{friendlyPackageName}}} components for [Fluent UI React](https://react.fluentui.dev/)** - -These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release. diff --git a/scripts/generators/create-package/plop-templates-react/config/api-extractor.json b/scripts/generators/create-package/plop-templates-react/config/api-extractor.json deleted file mode 100644 index dd9d4b04ceb5a0..00000000000000 --- a/scripts/generators/create-package/plop-templates-react/config/api-extractor.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "@fluentui/scripts-api-extractor/api-extractor.common.json" -} diff --git a/scripts/generators/create-package/plop-templates-react/config/tests.js b/scripts/generators/create-package/plop-templates-react/config/tests.js deleted file mode 100644 index 2e211ae9e21420..00000000000000 --- a/scripts/generators/create-package/plop-templates-react/config/tests.js +++ /dev/null @@ -1 +0,0 @@ -/** Jest test setup file. */ diff --git a/scripts/generators/create-package/plop-templates-react/docs/Spec.md.hbs b/scripts/generators/create-package/plop-templates-react/docs/Spec.md.hbs deleted file mode 100644 index f494b468766e93..00000000000000 --- a/scripts/generators/create-package/plop-templates-react/docs/Spec.md.hbs +++ /dev/null @@ -1,63 +0,0 @@ -# {{packageNpmName}} Spec - -## Background - -_Description and use cases of this component_ - -## Prior Art - -_Include background research done for this component_ - -- _Link to Open UI research_ -- _Link to comparison of v7 and v0_ -- _Link to GitHub epic issue for the converged component_ - -## Sample Code - -_Provide some representative example code that uses the proposed API for the component_ - -## Variants - -_Describe visual or functional variants of this control, if applicable. For example, a slider could have a 2D variant._ - -## API - -_List the **Props** and **Slots** proposed for the component. Ideally this would just be a link to the component's `.types.ts` file_ - -## Structure - -- _**Public**_ -- _**Internal**_ -- _**DOM** - how the component will be rendered as HTML elements_ - -## Migration - -_Describe what will need to be done to upgrade from the existing implementations:_ - -- _Migration from v8_ -- _Migration from v0_ - -## Behaviors - -_Explain how the component will behave in use, including:_ - -- _Component States_ -- _Interaction_ - - _Keyboard_ - - _Cursor_ - - _Touch_ - - _Screen readers_ - -## Accessibility - -Base accessibility information is included in the design document. After the spec is filled and review, outcomes from it need to be communicated to design and incorporated in the design document. - -- Decide whether to use **native element** or folow **ARIA** and provide reasons -- Identify the **[ARIA](https://www.w3.org/TR/wai-aria-practices-1.2/) pattern** and, if the component is listed there, follow its specification as possible. -- Identify accessibility **variants**, the `role` ([ARIA roles](https://www.w3.org/TR/wai-aria-1.1/#role_definitions)) of the component, its `slots` and `aria-*` props. -- Describe the **keyboard navigation**: Tab Oder and Arrow Key Navigation. Describe any other keyboard **shortcuts** used -- Specify texts for **state change announcements** - [ARIA live regions - ](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) (number of available items in dropdown, error messages, confirmations, ...) -- Identify UI parts that appear on **hover or focus** and specify keyboard and screen reader interaction with them -- List cases when **focus** needs to be **trapped** in sections of the UI (for dialogs and popups or for hierarchical navigation) -- List cases when **focus** needs to be **moved programatically** (if parts of the UI are appearing/disappearing or other cases) diff --git a/scripts/generators/create-package/plop-templates-react/etc/{{packageName}}.api.md b/scripts/generators/create-package/plop-templates-react/etc/{{packageName}}.api.md deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/scripts/generators/create-package/plop-templates-react/jest.config.js b/scripts/generators/create-package/plop-templates-react/jest.config.js deleted file mode 100644 index da6895b582bc16..00000000000000 --- a/scripts/generators/create-package/plop-templates-react/jest.config.js +++ /dev/null @@ -1,8 +0,0 @@ -const { createV8Config: createConfig } = require('@fluentui/scripts-jest'); - -const config = createConfig({ - setupFiles: ['./config/tests.js'], - snapshotSerializers: ['@griffel/jest-serializer'], -}); - -module.exports = config; diff --git a/scripts/generators/create-package/plop-templates-react/just.config.ts b/scripts/generators/create-package/plop-templates-react/just.config.ts deleted file mode 100644 index b10db31a6aca51..00000000000000 --- a/scripts/generators/create-package/plop-templates-react/just.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { preset } from '@fluentui/scripts-tasks'; - -preset(); diff --git a/scripts/generators/create-package/plop-templates-react/package.json.hbs b/scripts/generators/create-package/plop-templates-react/package.json.hbs deleted file mode 100644 index d4fd386f80fcc5..00000000000000 --- a/scripts/generators/create-package/plop-templates-react/package.json.hbs +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "{{{packageNpmName}}}", - "version": "{{{packageVersion}}}", - "private": true, - "description": "{{{description}}}", - "main": "lib-commonjs/index.js", - "module": "lib/index.js", - "typings": "lib/index.d.ts", - "sideEffects": false, - "repository": { - "type": "git", - "url": "https://github.com/microsoft/fluentui" - }, - "license": "MIT", - "scripts": { - "build": "just-scripts build", - "clean": "just-scripts clean", - "code-style": "just-scripts code-style", - "just": "just-scripts", - "lint": "just-scripts lint", - "start": "just-scripts dev:storybook", - "start-test": "just-scripts jest-watch", - "test": "just-scripts test", - "update-snapshots": "just-scripts jest -u" - }, - "devDependencies": { - "@fluentui/eslint-plugin": "", - "@fluentui/react-conformance": "", - "@fluentui/react-conformance-griffel": "", - "@fluentui/scripts-api-extractor": "", - "@fluentui/scripts-tasks": "" - }, - "dependencies": { - "@fluentui/react-jsx-runtime": "", - "@fluentui/react-theme": "", - "@fluentui/react-utilities": "", - "@griffel/react": "", - "@swc/helpers": "" - }, - "peerDependencies": { - "@types/react": "", - "@types/react-dom": "", - "react": "", - "react-dom": "" - }, - "beachball": { - "disallowedChangeTypes": [ - "major", - "prerelease" - ] - } -} diff --git a/scripts/generators/create-package/plop-templates-react/src/index.ts b/scripts/generators/create-package/plop-templates-react/src/index.ts deleted file mode 100644 index aacbad0068e241..00000000000000 --- a/scripts/generators/create-package/plop-templates-react/src/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// TODO: replace with real exports -export {}; diff --git a/scripts/generators/create-package/plop-templates-react/tsconfig.json b/scripts/generators/create-package/plop-templates-react/tsconfig.json deleted file mode 100644 index 0a88d158924adf..00000000000000 --- a/scripts/generators/create-package/plop-templates-react/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "baseUrl": ".", - "outDir": "dist", - "target": "es5", - "module": "commonjs", - "jsx": "react", - "declaration": true, - "sourceMap": true, - "importHelpers": true, - "noUnusedLocals": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "moduleResolution": "node", - "preserveConstEnums": true, - "lib": ["es5", "dom"], - "skipLibCheck": true, - "typeRoots": ["../../node_modules/@types", "../../typings"], - "types": ["jest", "custom-global"] - }, - "include": ["src"] -} diff --git a/scripts/generators/tsconfig.lib.json b/scripts/generators/tsconfig.lib.json index 96f606df39c1ff..7d62e63759a565 100644 --- a/scripts/generators/tsconfig.lib.json +++ b/scripts/generators/tsconfig.lib.json @@ -6,12 +6,6 @@ "outDir": "../../dist/out-tsc", "types": ["node"] }, - "exclude": [ - "**/*.spec.ts", - "**/*.test.ts", - "**/plop-templates/**", - "**/plop-templates-node/**", - "**/plop-templates-react/**" - ], + "exclude": ["**/*.spec.ts", "**/*.test.ts", "**/plop-templates/**", "**/plop-templates-node/**"], "include": ["./**/*.ts", "./**/*.js"] }