Skip to content

[case]Build copyright

王集鹄 edited this page Aug 5, 2015 · 2 revisions

示例给源文件添加版权信息

../package.json

{
  "name": "jdists",
  "version": "0.9.7",
  "description": "Code block processing tools",
  ...
  "author": {
    "name": "zswang",
    "url": "http://weibo.com/zswang"
  },
  "license": "MIT",
  ...
}

input

/*<jdists encoding="ejs" data="../package.json">*/
/**
 * @file <%- name %> scope
 *
 * <%- description %>
 * @author
     <% (author instanceof Array ? author : [author]).forEach(function (item) { %>
 *   <%- item.name %> (<%- item.url %>)
     <% }); %>
 * @version <%- version %>
     <% var now = new Date() %>
 * @date <%- [
      now.getFullYear(),
      now.getMonth() + 101,
      now.getDate() + 100
    ].join('-').replace(/-1/g, '-') %>
 */
/*</jdists>*/

var colors = require('colors');
var util = require('util');
...

output

/**
 * @file jdists scope
 *
 * Code block processing tools
 * @author
 *   zswang (http://weibo.com/zswang)
 * @version 0.9.7
 * @date 2015-08-03
 */
var colors = require('colors');
var util = require('util');
...