1 | import { resolve as resolvePath } from 'path';
|
2 | import createFile from 'vamtiger-create-file';
|
3 | import webcomponentSnippet from './snippet/webcomponent';
|
4 |
|
5 | const { cwd } = process;
|
6 | const folder = resolvePath(
|
7 | cwd(),
|
8 | 'source'
|
9 | );
|
10 |
|
11 | export default async function({ packagePath }: IParams) {
|
12 | const { name } = require(packagePath);
|
13 | const filePath = resolvePath(
|
14 | folder,
|
15 | `${name}.ts`
|
16 | );
|
17 |
|
18 | await createFile(filePath, webcomponentSnippet);
|
19 | }
|
20 |
|
21 | export interface IParams {
|
22 | packagePath: string;
|
23 | }
|