Version: 0.5.4
Last Updated: Unknown
Use this tempalate to generate new lift projects.
| Variable | Data Type | Info |
|---|---|---|
type | string | The name of the Lift folder type |
pkg | string | The name of the package |
description | string | description of command |
1# <%= _.upperFirst(type) %> - <%= _.upperFirst(pkg) %>23Use this tempalate to <%= description %>45## Required67TODO: Update this section89| **Variable** | **Data Type** | **Info** |10| ------------ | ------------- | -------------------------------- |11| `type` | `string` | The name of the Lift folder type |12| `pkg` | `string` | The name of the package |
1# Example scaffold for <%= name %>23## Table45Fields | Value6--- | ---7name | <%= name %>8age | <%= age %>
1/**2 * <%= name %> helper function.3 *4 * @returns {void} undefined response5 */6export const <%= name %> = (): void => {7 console.log(`Ready for <%= name %>`)8}
1Hello! Start your template <%= type %> <%= pkg %> here.
1#!/usr/bin/env node2const path = require('path');3const fs = require('fs');4const dir = __dirname;5const cwd = process.cwd();6const map = JSON.parse(7 fs.readFileSync(path.resolve(dir, './map.json'), 'utf-8'),8);910let filesErr = [];1112const build = ({ dependencies, data, file, output, basedir }) => {13 dependencies.ejs.renderFile(file, data, {}, function (err, str) {14 // str => Rendered HTML string15 if (err) {16 filesErr.push(output);17 throw err;18 }1920 const outputFilePath = `${basedir}/${output}`;21 dependencies.fs.outputFileSync(outputFilePath, str);22 });23};2425module.exports = async function (options) {26 console.log('Bridging <%= type %> <%= pkg %>');27 try {28 const files = await options.dependencies.recursiveReaddir(dir, ['!*.ejs']);29 const basedir = options.data.basedir30 ? path.resolve(cwd, options.data.basedir)31 : cwd;3233 for (const file of files) {34 let filepath = file.replace(dir + '/', '');35 console.log(`\t - Scaffolding: ${filepath}`);36 build({ ...options, file, output: map[filepath], basedir });37 }3839 return options;40 } catch (err) {41 console.error(err);42 }43};
1#!/usr/bin/env node2const path = require('path');3const fs = require('fs');4const dir = __dirname;5const cwd = process.cwd();6const map = JSON.parse(7 fs.readFileSync(path.resolve(dir, './map.json'), 'utf-8'),8);910let filesErr = [];1112const build = ({ dependencies, data, file, output, basedir }) => {13 dependencies.ejs.renderFile(file, data, {}, function (err, str) {14 // str => Rendered HTML string15 if (err) {16 filesErr.push(output);17 throw err;18 }1920 // output should be a mix of the Lift folder21 const outputFilePath = `${basedir}/.lift/${data.type}/${data.pkg}/${output}`;22 dependencies.fs.outputFileSync(outputFilePath, str);23 });24};2526module.exports = async function (options) {27 console.log('Bridging Lift Template - Basic');28 try {29 const files = await options.dependencies.recursiveReaddir(dir, ['!*.ejs']);30 const basedir = options.data.basedir31 ? path.resolve(cwd, options.data.basedir)32 : cwd;3334 for (const file of files) {35 let filepath = file.replace(dir + '/', '');36 console.log(`\t - Scaffolding: ${filepath}`);37 build({ ...options, file, output: map[filepath], basedir });38 }3940 return options;41 } catch (err) {42 console.error(err);43 }44};
1{2 "index.ejs": "index.ts",3 "map.json.ejs": "map.json",4 "entry.ejs": "entry.js",5 "readme.ejs": "README.md"6}
1{2 "entry.ejs": "entry.ts"3}
1# <%= type %> - <%= pkg %>'23Use this tempalate to ...45## Required67TODO: Update this section89| Variable | Data Type | Info |10| -------- | --------- | -------------------------------- |11| type | string | The name of the Lift folder type |12| pkg | string | The name of the package |