const path = require('path'); const fs = require('fs'); module.exports = { tags: async (tln) => [], options: async (tln, args) => { }, env: async (tln, env) => { env.NODEJS_HOME = env.TLN_COMPONENT_HOME; const suffix = tln.isWindows() ? '' : 'bin'; env.PATH = [path.join(env.TLN_COMPONENT_HOME, suffix), env.PATH].join(path.delimiter); }, dotenvs: async (tln) => [], inherits: async (tln) => [], depends: async (tln) => [], steps: async (tln) => [ { id: 'init', builder: async (tln, script) => { const home = script.env.TLN_COMPONENT_HOME; const packageJson = path.join(home, 'package.json'); if (fs.existsSync(packageJson)) { script.set([ 'npm i' ]); } return true; } }, { id: 'build', builder: async (tln, script) => script.set([ 'npm run build' ]) }, { id: 'test', builder: async (tln, script) => script.set([ 'npm run lint && npm run test' ]) }, // { id: 'serve', builder: async (tln, script) => script.set([ 'npm run serve' ]) }, // { id: 'version', builder: async (tln, script) => { const id = script.env.TLN_COMPONENT_ID; const home = script.env.TLN_COMPONENT_HOME; const {name, version} = tln.unpackId(id); if (version) { script.set([` echo [node] && node -v && echo [npm] && npm -v `]); } }}, // { id: 'install', builder: async (tln, script) => { const id = script.env.TLN_COMPONENT_ID; const home = script.env.TLN_COMPONENT_HOME; const version = id.split('-')[1]; if (version && tln.canInstallComponent(tln, id, home)) { script.set(tln.getDownloadScript(tln, { linux: { name: `node-v${version}-linux-x64.tar.gz`, opts: { src: `node-v${version}-linux-x64`, flt: `*`, dest: `.`, rmv: `node-v${version}-linux-x64` }, url: `https://nodejs.org/dist/v${version}/node-v${version}-linux-x64.tar.gz` }, darwin: { name: `node-v${version}-darwin-x64.tar.gz`, opts: { src: `node-v${version}-darwin-x64`, flt: `*`, dest: '.', rmv: `node-v${version}-darwin-x64` }, url: `https://nodejs.org/dist/v${version}/node-v${version}-darwin-x64.tar.gz` }, win32: { name: `node-v${version}-win-x64.zip`, opts: { src: `node-v${version}-win-x64`, flt: `*`, dest: `.`, rmv: `node-v${version}-win-x64` }, url: `https://nodejs.org/dist/v${version}/node-v${version}-win-x64.zip` } })); } } } ], components: async (tln) => require('./components.js') } /* Ubuntu curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - sudo apt install nodejs -y Centos curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash - sudo yum clean all && sudo yum makecache fast sudo yum install -y gcc-c++ make sudo yum install -y nodejs */