knighkit-cms

0.0.30 • Public • Published

knighkit-cms 是 knighkit 的一键上传插件,也可以单独使用。可将打包好的代码,一键上传到 CMS 系统。

安装

可以使用 npm 进行安装:

	npm install -g knighkit-cms

预先安装好 phantomjs

因为网络问题,安装可能出现phantomjs下载不下来的问题。可以通过自行下载phantomjs,然后设置环境变量的方式解决。

phantomjs 的版本

推荐使用 1.9.8。

执行

创建配置文件

你需要在执行命令的文件夹中创建一个配置文件,名为 configs.js。示例内容如下:

/**
 * @describe: 所有相关配置
 */
(function (window, undefined) {
    var allConfigs = {
        /**
         * 服务器的一些固定配置
         */
        url: {
            /**
             * 服务器根地址
             */
            server: 'http://www.example.com',
            /**
             * 创建文件夹服务
             */
            newDir: '/cgi-bin/xxx?dir=',
            /**
             * 上传文件服务
             */
            upload: '/cgi-bin/xxx_new?dir=',
            /**
             * 上传html文件服务
             */
            htmlfileserver: '/edit/top.htm',
            /**
             * 修改已有旧文件的服务
             */
            htmlfileupdate: '/cgi-bin/xx/save',
            /**
             * 增加新文件的服务
             */
            htmlfileadd: '/cgi-bin/xx/add',
            /**
             * 搜索文件列表的服务
             */
            htmlfilelist: '/cgi-bin/html/search?',
            /**
             * 登陆到cms的地址
             */
            login: 'http://xxx?'
        },
        /**
         * cms频道名称
         */
        channelName: '<儿童频道>',
        /**
         * cms频道id
         */
        channelId: 'children',
        /**
         * 是否覆盖上传
         */
        overwrite: true, //是否覆盖
        /**
         *  静态资源文件过滤
         *  正则表达式
         *  正则匹配对象是整个文件路径,如:'F:\\xxxx\\xxx\\xxx-cms\\xxx\\v001\\a.js'
         */
        staticResourcesFileFilter: [/\.htm/, /\.html/],
        /**
         * 静态资源映射到服务器的规则
         * key 是 本地资源文件夹地址, 请使用绝对路径或者命令行执行位置的相对路径
         * value 是 远程服务器静态资源文件夹地址,第一个字符不能是 /,后果自负
         */
        staticResourcesMapping: {
            'F:\\xxx\\xxx\\xxx\\xxx': 'subProject/subdir/'
        },
        /**
         * 大分类,请创建测试分类,否则测试发布无法使用
         */
        catalog: 'xxxx',
        /**
         * 安全上传模式,会提示你已经存在同名文件,这时候,不能更新文件
         */
        htmlSafeAdd: false,
        /**
         * 此字段由遍历程序自动生成,请勿手动配置,无效
         * { 'filename':'filecode'
         *  }
         */
        __htmls: {},
        /**
         * 此字段由遍历程序自动生成,请勿手动配置,无效
         * { 'serverurl/sharepage/':
            { '.': [ 'F:\\xxxx\\xxx\\xxx\\xxx\\xxx\\xx.js',
                     '... ],
               V01: [ 'F:\\xxx\\xxx\\xxx\\xx.js' ]
            }
        }
         */
        __files: {}
        /* --------end-----------*/
    };

    if (typeof module !== 'undefined' && module.exports !== 'undefined') {
        module.exports = allConfigs;
    } else if (typeof define === 'function') {
        define(function () {
            return  allConfigs;
        });
    }
})(this);

执行命令

kkit -c

执行以上命令时,会自动将配置中指定的文件上传到 cms 系统。

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.30
    2
    • latest

Version History

Package Sidebar

Install

npm i knighkit-cms

Weekly Downloads

44

Version

0.0.30

License

none

Unpacked Size

31.9 kB

Total Files

9

Last publish

Collaborators

  • knightwu