Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

branch-deploy

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

branch-deploy - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

53

index.js

@@ -0,6 +1,53 @@

import chalk from 'chalk'
import inquirer from 'inquirer'
import { exit } from 'process'
import simpleGit from 'simple-git'
console.log('Hello there')
console.log('This is a placeholder package. Real code comming.')
// @TODO: configurable
exit(1)
const remoteName = 'origin'
const branchNamePrefix = 'deploy'
const git = simpleGit()
// @TODO: check current working directory is git repository
const remoteBranches = (await git.branch(['-r'])).all.map((branch) =>
branch.startsWith(`${remoteName}/`)
? branch.substring(remoteName.length + 1)
: branch,
)
const deployBranches = remoteBranches.filter(
(branch) =>
branch === branchNamePrefix || branch.startsWith(`${branchNamePrefix}/`),
)
if (deployBranches.length === 0) {
console.error(
chalk.red(
`Not a single deploy branch found in "${remoteName}" starting with ${branchNamePrefix}.`,
),
)
exit(1)
}
const { targetBranches } = await inquirer.prompt({
type: 'checkbox',
name: 'targetBranches',
message: `Which branch do you want ${chalk.magenta('HEAD')} to push to?`,
choices: deployBranches,
})
if (targetBranches.length === 0) {
console.log(chalk.yellow('No branch selected.'))
exit(0)
}
for (const targetBranch of targetBranches) {
console.log(
`Pushing ${chalk.magenta('HEAD')} to ${chalk.magenta(targetBranch)}…`,
)
await git.push(remoteName, `HEAD:${targetBranch}`)
}
console.log(chalk.green('Done. 🎉'))

5

package.json
{
"name": "branch-deploy",
"version": "0.0.1",
"version": "0.0.2",
"description": "Deploy by pushing a deploy* branch made simplier.",

@@ -33,4 +33,5 @@ "main": "index.js",

"chalk": "^5.2.0",
"inquirer": "^9.1.4"
"inquirer": "^9.1.4",
"simple-git": "^3.16.1"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc