How to use the licia.last function in licia

To help you get started, we’ve selected a few licia examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github liriliri / licia / lib / pack.js View on Github external
async function genFile(file, pkgName) {
    let modName = last(file.split('/')).slice(0, -3);

    let data = await fs.readFile(file, 'utf8');

    const env = modData[modName].env;
    const isEs5 = contain(env, 'browser') || contain(env, 'miniprogram');
    if (isEs5 && pkgName !== 'licia-src') {
        data = await transBabel(data);
    }
    if (pkgName === 'miniprogram-licia') {
        if (!contain(env, 'miniprogram')) {
            return;
        }
    }

    data = data.replace(/\/\* module[\s\S]*?\*\//m, '');
github liriliri / licia / lib / update.js View on Github external
async function extractInfo() {
    const files = await glob('src/*/*.js', {
        ignore: ['src/*/*.*.js']
    });

    const regDependency = /\s*\b_\(\s*['"]([\w\s$]+)['"]\s*\);?/m;

    for (const file of files) {
        let modName = last(file.split('/')).slice(0, -3);

        const data = await fs.readFile(file, 'utf8');

        let desc = 'No description.';
        let comments = extractBlockCmts(data);

        if (comments.length > 0) {
            desc = trim(comments[0]).split('\n')[0];
        }

        let modInfo = extend(
            {
                description: desc,
                dependencies: extractDependencies(data)
            },
            extractCmts(comments)