Skip to content

Commit

Permalink
chore(verdaccio): more obvious way of clean working tree before verda…
Browse files Browse the repository at this point in the history
…ccio release (#1356)
  • Loading branch information
timofei-iatsenko authored Jan 25, 2023
1 parent c51f2dd commit 04631c9
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions scripts/verdaccio-release.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { exec: _exec } = require("child_process")
const chalk = require("chalk")
const ora = require("ora")
const os = require("os")

async function releaseInVerdaccio() {
const spinner = ora()
Expand All @@ -27,13 +26,8 @@ async function releaseInVerdaccio() {
spinner.start(
"Dont't mark files as changed to let publish, but not create a git history"
)
if (isWindows()) {
await exec(
`for /f "" %f in ('git ls-files -m') do git update-index --assume-unchanged %f`
)
} else {
await exec("git ls-files -m | xargs git update-index --assume-unchanged")
}
await exec("git commit --all -m \"TEMP: verdaccio release\"")

spinner.succeed()

spinner.start("Publishing packages to local registry")
Expand All @@ -44,15 +38,7 @@ async function releaseInVerdaccio() {
spinner.succeed()

spinner.start("Reverting the changed files from index")
if (isWindows()) {
await exec(
`for /f "tokens=2" %f in ('git ls-files -v ^| findstr /R /C:"^[abcdefghijklmnopqrstuvwxyz]"') do git update-index --no-assume-unchanged %f --"`
)
} else {
await exec(
"git ls-files -v | grep '^[a-z]' | cut -c3- | xargs git update-index --no-assume-unchanged --"
)
}
await exec("git reset --soft HEAD~1")
spinner.succeed()

console.log()
Expand All @@ -63,10 +49,6 @@ async function releaseInVerdaccio() {
)
}

function isWindows() {
return os.platform() === "win32"
}

function exec(cmd, options) {
const _options = {
env: {
Expand Down

1 comment on commit 04631c9

@vercel
Copy link

@vercel vercel bot commented on 04631c9 Jan 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.