packages/zent/scripts/new-component.js
function addFiles(name) {
  const packagesDir = path.resolve(__dirname, '../src');
  const assetsDir = path.resolve(__dirname, '../assets');
  const componentDir = `${packagesDir}/${name}`;
  const upperComponentName = getComponentName(name);

  console.log(`Adding new component：${upperComponentName}`);

  if (!fs.existsSync(componentDir)) {
    fs.mkdirSync(componentDir);
  } else {
    console.log(
      `${upperComponentName} already exists, please choose another name.`
    );
    process.exit(2);
  }

  fs.writeFileSync(
    `${componentDir}/index.ts`,
    `import ${upperComponentName} from './${upperComponentName}';\n\nexport * from './${upperComponentName}';\n`
  );

  fs.writeFileSync(
    `${componentDir}/README_en-US.md`,
    `---
title: ${upperComponentName}
path: component/${name}
group: FIXME group name here
---

## ${upperComponentName}

Describe ${upperComponentName}.

### API

| Property     |  Description  | Type     |  Required  |   Default  | Alternative   |
| ------------ | -------------- | -------- | ---------- | ---------- | ------------- |
| className    | Custom class name  | string     |  No        |  |  |`
  );

  fs.writeFileSync(
    `${componentDir}/README_zh-CN.md`,
    `---
title: ${upperComponentName}
subtitle: FIXME 中文名
path: component/${name}
group: FIXME 中文分组名
---

## ${upperComponentName}

简单描述 ${upperComponentName} 组件。

### API

| 参数        |   说明       | 类型     | 是否必须    | 默认值      | 备选值     |
| ------------| ----------- | -------- | ---------- | ---------- | ---------- |
| className   | 额外类名     | string   |  否         |           |            |
`
  );
  fs.writeFileSync(`${componentDir}/${upperComponentName}.tsx`, '');
  fs.writeFileSync(`${assetsDir}/${name}.scss`, '');

  addFilesToIndex(name);
}
function addFiles(name) {
  const packagesDir = path.resolve(__dirname, '../src');
  const assetsDir = path.resolve(__dirname, '../assets');
  const componentDir = `${packagesDir}/${name}`;
  const upperComponentName = getComponentName(name);

  console.log(`Adding new component：${upperComponentName}`);

  if (!fs.existsSync(componentDir)) {
    fs.mkdirSync(componentDir);
  } else {
    console.log(
      `${upperComponentName} already exists, please choose another name.`
    );
    process.exit(2);
  }

  fs.writeFileSync(
    `${componentDir}/index.ts`,
    `import ${upperComponentName} from './${upperComponentName}';\n\nexport * from './${upperComponentName}';\n`
  );

  fs.writeFileSync(
    `${componentDir}/README_en-US.md`,
    `---
title: ${upperComponentName}
path: component/${name}
group: FIXME group name here
---

## ${upperComponentName}

Describe ${upperComponentName}.

### API

| Property     |  Description  | Type     |  Required  |   Default  | Alternative   |
| ------------ | -------------- | -------- | ---------- | ---------- | ------------- |
| className    | Custom class name  | string     |  No        |  |  |`
  );

  fs.writeFileSync(
    `${componentDir}/README_zh-CN.md`,
    `---
title: ${upperComponentName}
subtitle: FIXME 中文名
path: component/${name}
group: FIXME 中文分组名
---

## ${upperComponentName}

简单描述 ${upperComponentName} 组件。

### API

| 参数        |   说明       | 类型     | 是否必须    | 默认值      | 备选值     |
| ------------| ----------- | -------- | ---------- | ---------- | ---------- |
| className   | 额外类名     | string   |  否         |           |            |
`
  );
  fs.writeFileSync(`${componentDir}/${upperComponentName}.tsx`, '');
  fs.writeFileSync(`${assetsDir}/${name}.scss`, '');

  addFilesToIndex(name);
}
创建组件文件夹以及js/css文件