const path = require('path'); module.exports = { tags: async (tln) => [], dotenvs: async (tln) => [], env: async (tln, env) => { env.KNATIVE_HOME = env.TLN_COMPONENT_HOME; env.PATH = [env.TLN_COMPONENT_HOME, env.PATH].join(path.delimiter); }, options: async (tln, args) => [], inherits: async (tln) => [], depends: async (tln) => [], steps: async (tln) => [ { 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 [knative] && kn version `]); } }}, { id: 'install', filter: '', builder: async (tln, script) => { const id = script.env.TLN_COMPONENT_ID; const home = script.env.TLN_COMPONENT_HOME; const {name, version} = tln.unpackId(id); const key = `${name}-v${version}`; if (version && tln.canInstallComponent(tln, id, home)) { script.set(tln.getDownloadScript(tln, { linux: { name: `kn-linux-amd64`, opts: null, url: `https://github.com/knative/client/releases/download/${key}/kn-linux-amd64`, cmd: 'mv kn-linux-amd64 kn && chmod +x ./kn', keep: true }, darwin: { name: `kn-darwin-amd64`, opts: null, url: `https://github.com/knative/client/releases/download/${key}/kn-darwin-amd64`, cmd: 'mv kn-darwin-amd64 kn && chmod +x ./kn', keep: true }, win32: { name: `kn-windows-amd64.exe`, opts: null, url: `https://github.com/knative/client/releases/download/knative-v1.8.1/kn-windows-amd64.exe`, cmd: 'ren kn-windows-amd64.exe kn.exe', keep: true } })); } } } ], components: async (tln) => require('./components.js') }