module.exports = { tags: async (tln) => [], options: async (tln, args) => { args .prefix('TLN_TYPSCRIPT') .option('ssl-cert', { describe: 'Include SSL certificates into docker images', default: false, type: 'boolean' }); }, env: async (tln, env) => {}, dotenvs: async (tln) => [], inherits: async (tln) => [], depends: async (tln) => [], steps: async (tln) => [ { id: 'init', builder: async (tln, script) => script.set([ 'npm i' ]) }, { id: 'build', builder: async (tln, script) => script.set([ 'npm run build' ]) }, { id: 'test', builder: async (tln, script) => script.set([ 'npm run test' ]) }, { id: 'serve', builder: async (tln, script) => script.set([ 'npm run start' ]) }, { id: 'build-docker', builder: async (tln, script) => { let conf = ['envsubst "\\${TLN_COMPONENT_PARAM_HOST}" > ./target/conf.d/default.conf < ./default.conf.template']; if(script.env.TLN_REACT_SSL_CERT) { conf = [ 'envsubst "\\${TLN_COMPONENT_ID} \\${TLN_COMPONENT_PARAM_HOST}" > ./target/conf.d/default.conf < ./default.conf.https.template', 'cp -r ./ssl ./target/' ]; } script.set([ 'rm -rf ./target || true', 'mkdir target', 'mkdir target/conf.d']. concat(conf). concat([ 'docker build \\', ' -t ${TLN_COMPONENT_ID}:${TLN_COMPONENT_VERSION} .' ]) ) } }, { id: 'run-docker', builder: async (tln, script) => { script.set([ 'docker run -d --rm \\', ' -p ${TLN_COMPONENT_PARAM_PORT}:80 \\', ' -p ${TLN_COMPONENT_PARAM_PORTS}:443 \\', ' --name ${TLN_COMPONENT_ID} ${TLN_COMPONENT_ID}:${TLN_COMPONENT_VERSION}' ]) } } ], components: async (tln) => [] }