1.0.0 • Published 5 years ago

initfiles v1.0.0

Weekly downloads
7
License
ISC
Repository
github
Last release
5 years ago

InitFiles

initfiles is a code generation tool for frontend project。

image

How to use

  1. npm install initfiles -D
  2. Create a template file in your project. You can add the javascript template file in any folder. eg templates/abc.js.

    module.exports = function (arg1, arg2) {
        return [
            {
                name: `src/pages/${arg1}/${arg2}.js`,
                content: '// this is js content'
            },
            {
                name: `src/pages/${arg1}/index.js`,
                type: 'append',
                content: '// this is append content\n'
            }
        ]
    }

    The js template file should return a object array, and the array item schame as below.

    propertynamedescriptionrequireddefaultvalue
    namethe file name, it should be a relative file name and can contains folder path.true
    contentthe file content.true
    typethe file type, 'create' or 'append'. if 'create' then will crate a new file with content, if 'append' then will append the content to the file.false'create'
  3. Then you can run the command ifs -t templates/abc.js value1 value2, in this case, your project root folder then will add two file src/pages/value1/value2.js and src/pages/value1/index.js.

1.0.0

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago