Skip to content

Instantly share code, notes, and snippets.

@chnirt
Last active January 10, 2023 10:10
Show Gist options
  • Save chnirt/1445f38cb8df53c00fc15a84ef163cc2 to your computer and use it in GitHub Desktop.
Save chnirt/1445f38cb8df53c00fc15a84ef163cc2 to your computer and use it in GitHub Desktop.
Encrypt and decrypt app

Hello world

Quick Overview

npx https://gist.github.com/chnirt/1445f38cb8df53c00fc15a84ef163cc2

if you've previously installed chnirt-build-app globally via npx https://gist.github.com/chnirt/1445f38cb8df53c00fc15a84ef163cc2, we recommend you uninstall the package using npm uninstall -g chnirt-build-app or yarn global remove chnirt-build-app to ensure that npx always uses the latest version. NOTE: remember to clear cache using npx clear-npx-cache

See more

https://remarkablemark.org/blog/2020/06/04/npx-gist/ https://stackoverflow.com/questions/49717855/create-nodejs-cli-select-options-menu

#!/usr/bin/env node
import inquirer from 'inquirer'
import { execSync } from 'child_process'
console.log('Hi, welcome to Node Build App by Chnirt')
const questions = [
{
type: 'list',
name: 'developmentTarget',
message: 'What develop target do you need?',
choices: ['Development', 'Staging', 'Production'],
},
{
type: 'password',
name: 'encryptedKey',
message: 'What\'s your encrypted key?',
},
{
type: 'list',
name: 'buildType',
message: 'What build type do you need?',
choices: ['installRelease', 'assembleRelease', 'bundleRelease', 'installDebug', 'assembleDebug'],
},
]
inquirer.prompt(questions).then((answers) => {
console.log('Creating assets')
var cmd = `
chmod +x ./.build-scripts/config.sh &&
DEPLOYMENT_TARGET=${answers['developmentTarget']} ENCRYPTED_KEY=${answers['encryptedKey']} ./.build-scripts/config.sh &&
cd android &&
./gradlew ${answers['buildType']} &&
cd ../
`
var options = {
stdio: 'inherit',
encoding: 'utf8'
}
execSync(cmd, options)
console.log('Done')
console.log('Happy cheating')
});
{
"dependencies": {
"inquirer": "^9.0.0"
},
"name": "chnirt-build-app",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"type": "module",
"description": "",
"bin": "./index.js"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment