1.2.1 • Published 3 years ago
iclo v1.2.1
Installation
npm i iclo --save-dev
Configuration
The config filename is iclo.config.js
, and iclo.config.cjs
for packages with "type":"module"
Basic configuration:
module.exports = {
from: 'git',
to: ['prettier', 'npm'],
};
With absolute paths:
module.exports = {
from: {
path: '.gitignore',
absolute: true,
},
to: {
paths: ['.prettierignore', '.npmignore'],
absolute: true,
},
};
With prepending and appending to files:
module.exports = {
from: 'git',
to: ['prettier', 'npm'],
prepend: ['# before first line', 'my-file-1', '\n'],
append: ['\n', '# after last line', 'my-file-2'],
};
With multiple configs:
module.exports = [
{
from: 'git',
to: ['prettier', 'npm'],
},
{
from: 'git',
to: ['prettier', 'npm'],
},
];
Usage
CLI
npx iclo [from] [to] [options]
Example
npx iclo .gitignore -f prettier npm -c ./my-config.js
Options:
Name | Shorthand | Description |
---|---|---|
--from-absolute | -f | Treat the from path as absolute. |
--to-absolute | -t | Treat the to paths as absolute. |
--config-file | -c | Specify a custom config file path. |
--version | -v | Print the current version to the console. |
API
const iclo = require('iclo');
(async () => {
await iclo({
from: 'git',
to: ['prettier', 'npm'],
});
})();