1.1.3 • Published 3 years ago

yuki-auto-create-template v1.1.3

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

yuki-auto-create-template

$ One-click automatic generation of template files(一键自动化生成文件模板 )

install

$ npm install yuki-auto-create-template -D

OR

$ yarn add yuki-auto-create-template -D

running

// package.json

"scripts": { "createTemplate": "yuki-auto-create-template" }

npm run createTemplate || yarn createTemplate

Example:

Created autoCreateTemplate.config.js in the project root directory(在项目根目录创建autoCreateTemplate.config.js) 
// autoCreateTemplate.config.js   

const TemplateFun = className =>
    `import React, {useEffect} from 'react';
const ${className} = () => {
    useEffect(() => {

    }, [])
    return (
        <React.Fragment>
        ${className}
        </React.Fragment>
    )
}
export default ${className}
`;

module.exports = {
    path: './pages/bb',
    template: [
        {
            folder: 'Home',
            file: {
                name: 'demo.jsx',
                template: config.Index('Demo')
            },
            files: [
                {
                    name: 'index.jsx',
                    template: 'console.log(index.jsx)'
                },
                {
                    name: 'App.jsx',
                    template: TemplateFun('App')
                },
                {
                    name: 'Head.js',
                    template: TemplateFun('Head')
                },
                {
                    name: 'List.jsx',
                    template: TemplateFun('List')
                }
            ],
            dirs: [
                {
                    folder: 'localizations',
                    file: {
                        name: 'demo1.jsx',
                        template: config.Index('Demo1')
                    },
                    files: [
                        {
                            name: 'zh-CN.json',
                            template: '{}'
                        }
                    ],
                    dirs: [
                        {
                            folder: 'aaa',
                            files: [
                                {
                                    name: 'aaa.js',
                                    template: 'console.log(123123)'
                                }
                            ],
                            dirs: [
                                {
                                    folder: 'bbb',
                                    files: [
                                        {
                                            name: 'bbb.js',
                                            template: 'console.log(55)'
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        {
            folder: 'Home111',
            file: {
                name: 'demo2.jsx',
                template: config.Index('Demo2')
            },
            files: [
                {
                    name: 'index.jsx',
                    template: TemplateFun('Index')
                },
                {
                    name: 'App.jsx',
                    template: TemplateFun('App')
                },
                {
                    name: 'Home.js',
                    template: TemplateFun('Home')
                },
                {
                    name: 'List.jsx',
                    template: TemplateFun('List')
                }
            ],
            dirs: [
                {
                    folder: 'localizations',
                    files: [
                        {
                            name: 'zh-CN.json',
                            template: '{}'
                        }
                    ],
                    dirs: [
                        {
                            folder: 'aaa',
                            files: [
                                {
                                    name: 'aaa.js',
                                    template: 'console.log(123123)'
                                }
                            ],
                            dirs: [
                                {
                                    folder: 'bbb',
                                    files: [
                                        {
                                            name: 'bbb.js',
                                            template: 'console.log(55)'
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ]
};
1.1.3

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago