1.0.3 • Published 2 years ago
lila-tasks v1.0.3
lila-tasks
Lila built-in tasks.
install
npm install --save-dev lila-tasksuse
In lila.init.js:
import tasksPlugin from 'lila-tasks';
export default lila => {
tasksPlugin(lila);
...
};built-in tasks
@lila/make: create a file(relative to root)
['@lila/make', {file, content, force}]}]file:type: stringfile to handle.content:type: stringfile content.force:type: booldefault: falsewhether to override if file already existed.
@lila/replace: replace file content(relative to root)
['@lila/replace', {file, replace: [{target, replacement}]}]file:type: stringfile to handle.replace:type: []options to replace.target:type: string|RegExptarget to be replaced.replacement:type: stringstring to replace.
@lila/insert: insert file content(relative to root)
['@lila/insert', {file, start, end}]file:type: stringfile to handle.start:type: stringcontent to prepend.end:type: stringcontent to append.
@lila/convert: convert file extension(relative to root)
['@lila/convert', {file, ext}]file:type: stringfile to handle.ext:type: stringextension name, likephp, jsp.
@lila/backup: backup file(relative to root)
Copy file to a suffixed name, index.html -> index.2000-01-02-03-04-05.html.
['@lila/backup', {file, suffix}]file:type: stringfile to handle.suffix:type: stringdefault: (new Date()).getTime()index.html -> index.${suffix}.html.
@lila/move: move file or directory(relative to root)
['@lila/move', {source, target, force}]source:type: stringsource file or directorytarget:type: stringtarget file or directoryforce:type: booldefault: falsewhether to override if target already existed.
@lila/copy: copy file or directory(relative to root)
['@lila/copy', {source, target, force}]source:type: stringsource file or directorytarget:type: stringtarget file or directoryforce:type: booldefault: falsewhether to override if target already existed.
@lila/del: delete files or directories(relative to root)
['@lila/del', file]
['@lila/del', dir]
['@lila/del', [file1, dir2, dir3, ...]]@lila/del-dev: delete dev directory
'@lila/del-dev'@lila/del-build: delete build directory
'@lila/del-build'@lila/del-tmp: delete tmp directory
'@lila/del-tmp'@lila/sync: sync files to remote server
['@lila/sync', {src, server, remotePath}]src:globs/[globs, options]gulp.srcserver:type: {}server config, see gulp-ssh.remotePath:type: stringremote server path to upload to.cache:type: booleandefault: falsewhether to cache files.cacheFileName:type: stringdefault: cachefile name to record cache.
@lila/sync-save-cache: save files handling record after @lila/sync task
['@lila/sync-save-cache', {cacheFileName}]cacheFileName:type: stringdefault: cachefile name to record cache.
@lila/sync-dir: sync directories to remote server(relative to root)
['@lila/sync-dir', {server, remotePath, dirs}]server:type: {}server config, see gulp-ssh.remotePath:type: stringremote server path to upload to.dirs:type: string/arraydirectories to sync.
@lila/sync-build: sync build directory to remote server(relative to root)
['@lila/sync-build', {server, remotePath, sourceMap}]server:type: {}server config, see gulp-ssh.remotePath:type: stringremote server path to upload to.sourceMap:type: booldefault: truewhether to upload source-map files.
@lila/sync-html: sync html files to remote server(relative to build)
['@lila/sync-html', {server, remotePath, ext}]server:type: {}server config, see gulp-ssh.remotePath:type: stringremote server path to upload to.ext:type: stringdefault: htmlhtml file extension.
@lila/sync-source-map: sync source-map files to remote server(relative to build)
['@lila/sync-source-map', {server, remotePath}]server:type: {}server config, see gulp-ssh.remotePath:type: stringremote server path to upload to.
@lila/clean-cache: remove handled files by last handling, and remain new files, mainly for build directory
'@lila/clean-cache'
// or
['@lila/clean-cache', {dir, cacheFileName}]dir:type: stringdirectory to handle(relative toroot)cacheFileName:type: stringdefault: cachefile name to record cache.
@lila/save-cache: save files handling record, mainly for build directory
'@lila/save-cache'
// or
['@lila/save-cache', {dir, cacheFileName}]dir:type: stringdirectory to handle(relative toroot)cacheFileName:type: stringdefault: cachefile name to record cache.
@lila/shell: execute shell scripts
['@lila/shell', {command, args, options}]command, args, options: see child_process spawn
@lila/ssh-exec: execute commands on remote server
Available version >= v1.0.1
['@lila/ssh-exec', {server, script}]server:type: {}server config, see ssh2 connect.script:type: stringcommands to execute on remote server. Use&&to concat multiple commands.
@lila/remote-exec: execute commands on remote server
Available version >= v1.0.1
['@lila/remote-exec', {server, scripts, log}]server:type: {}server config, see gulp-ssh exec.scripts:type: string/arraycommands to execute on remote server.log:type: stringdefault: remote-exec.loglog file.
@lila/remote-shell: execute shell scripts on remote server
!!!Some commands will hang the connection, causing the connection not to finish. Please use @lila/ssh-exec or @lila/remote-exec instead.
['@lila/remote-shell', {server, scripts, log}]server:type: {}server config, see gulp-ssh shell.scripts:type: string/arrayshell scripts to execute on remote server.log:type: stringdefault: remote-shell.loglog file.