diff --git a/cli-config.yml b/cli-config.yml deleted file mode 100644 index 0214192..0000000 --- a/cli-config.yml +++ /dev/null @@ -1,55 +0,0 @@ -# The container name used for the run container -container-name-run : "node-express-run" -# The container name used for the tools container -container-name-tools : "node-express-tools" - -# The project root on the host for the run container to mount to container-path-run -host-path-run : "." -# The project root on the host for the tools container to mount to container-path-tools -host-path-tools : "." - -# The project root in the run container to mount to host-path-run -container-path-run : "/app" -# The project root in the tools container that will be mounted to host-path-tools -container-path-tools : "/app" - -# The port mappings between the host and the container in the form [host:container] -container-port-map : "3000:3000" -# The port mappings between the host and the container for the debug port in the form [host:container] -container-port-map-debug : "9229:9229" - -# The list of additional mounts between the host and the run container in the form [host_path:container_path] -container-mounts-run: - - "./node_modules_linux": "/app/node_modules" -# The list of additional mounts between the host and the tools container in the form [host_path:container_path] -container-mounts-tools: - - "./node_modules_linux": "/app/node_modules" -# The name for the dockerfile for the run container -dockerfile-run : "Dockerfile" -# The name for the dockerfile for the tools container -dockerfile-tools : "Dockerfile-tools" - -# The name of image to create from dockerfile-run -image-name-run : "node-express-run" -# The name of image to create from dockerfile-tools -image-name-tools : "node-express-tools" - -# The command to build the code and docker image for RUN -build-cmd-run : "npm install" -# The command to execute tests for the code in the tools container -test-cmd : "npm run test" -# The command to build the code and docker image for DEBUG -build-cmd-debug : "npm install" - -# The command to run the code in the run container -run-cmd : "" -# The command to execute debug of the code in the tools container -debug-cmd : "npm run debug" -# The command to stop the code -stop-cmd : "npm stop" - -# The relative path to the helm chart used for Kubernetes deployment -chart-path : "chart/node" - -# The IBM version of this configuration -version : "0.0.3" \ No newline at end of file diff --git a/idt.js b/idt.js deleted file mode 100644 index b22a168..0000000 --- a/idt.js +++ /dev/null @@ -1,89 +0,0 @@ -'use strict' - -/* - * Wrapper for the idt (IBM Developer Tools) command. - * Run with the same arguments as `idt`, e.g. - * `node idt.js build` -> `idt build`. - * If `idt` isn't installed, this will prompt you to install. Or you can run - * `node idt.js install` to automatically install idt and any other - * required dependencies (e.g. docker, git, kubernetes, helm). - * - */ - -const fs = require('fs'); -const process = require('process'); -const cp = require('child_process'); -const request = require('request'); -const path = require('path'); - -const chalk = require('chalk'); - -const node = process.execPath; -// Array of args passed to idt.js. -const args = process.argv.slice(2); -let win = (process.platform === 'win32'); - -// Either install idt or run idt + args. -if (args.includes('install')) { - downloadInstaller(); -} else { - // TODO(gib): Check for idt once this works in scripts: - // const checkCmd = win ? 'where idt' : 'which idt'; - const checkCmd = 'bx plugin show dev'; - let hasIDT = false; - try { - console.log(chalk.blue('Checking for idt')); - cp.execSync(checkCmd); // Don't inherit stdio, we don't want to print the output. - hasIDT = true; // If we didn't have idt, the previous command would have thrown. - } catch (e) { - const prompt = require('prompt-confirm'); - new prompt({ name: 'install', - message: 'IDT not found, do you want to install it? y/N', - default: false - }).ask((answer) => { - if (answer) { - downloadInstaller(() => runIDT(args)); - } else { - console.error(chalk.red(`Not installing idt, so not running: idt ${args.join(' ')}`)); - } - }); - } - if (hasIDT) runIDT(args); -} - -// Run IDT with whatever args we were given. -function runIDT(args) { - const cmd = 'bx dev ' + args.join(' '); - console.log(chalk.blue('Running:'), cmd); - cp.execSync(cmd, {stdio: 'inherit'}); -} - -// Download the IDT installer script and trigger runInstaller(). -function downloadInstaller(cb) { - const url = win ? - 'https://ibm.biz/yeoman-idt-win-install' : - 'http://ibm.biz/yeoman-idt-install'; - - const fileName = url.split('/').pop() - - console.log(chalk.blue('Downloading installer from:'), url); - - const file = fs.createWriteStream(fileName); - - request - .get({url, followAllRedirects: true}) - .on('error', (err) => { console.error(err); }) - .pipe(file) - .on('finish', () => runInstaller(fileName, cb)); -} - -// Run the installer script and trigger optional callback (cb). -function runInstaller(fileName, cb) { - const shell = win ? 'powershell.exe' : 'bash'; - - const filePath = path.resolve(__dirname, fileName); - console.log(`Now running: ${shell} ${filePath}`); - - cp.spawnSync(shell, [filePath], {stdio: 'inherit'}); - typeof cb === 'function' && cb(); -}