-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: bug in assemble indexes * Add better tests to ensure working correctly * feat: move deps to optional * Only needed if using the parkin CLI, which is not even deployed yet * Add resetPkg script to better handle version when publishing to NPM
- Loading branch information
1 parent
3221a92
commit cca7d38
Showing
9 changed files
with
322 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import path from 'node:path' | ||
import { fileURLToPath } from 'node:url' | ||
import { promisify } from 'util' | ||
import { exec } from 'child_process' | ||
|
||
|
||
const dirname = path.dirname(fileURLToPath(import.meta.url)) | ||
const cmdExec = promisify(exec) | ||
const rootPath = path.join(dirname, `../`) | ||
|
||
|
||
/** | ||
* Executes a command in the docs directory | ||
* @function | ||
* | ||
* @param {string} cmd - Command to be run | ||
* | ||
* @returns {Promise} - resolves to response from cmdExec method | ||
*/ | ||
const runCmd = async cmd => { | ||
return await cmdExec(cmd, { cwd: rootPath }) | ||
} | ||
|
||
/** | ||
* Gets the current package.json version | ||
* Then resets the package.json in git | ||
* Finally updates the package.json back to the version it was before git checkout | ||
*/ | ||
const resetPkg = async () => { | ||
const oldv = process.env.npm_package_version | ||
await runCmd(`git checkout ./package.json`) | ||
await runCmd(`pnpm version ${oldv} --no-git-tag-version --allow-same-version --no-commit-hooks`) | ||
await runCmd(`git add ./package.json`) | ||
|
||
try { | ||
const resp = await runCmd(`git commit -m "Update version to \"${oldv}\""`) | ||
console.log(resp) | ||
} | ||
catch(err){ | ||
if(err.stdout.includes(`not staged`)) return | ||
throw err | ||
} | ||
} | ||
|
||
|
||
resetPkg() |
Oops, something went wrong.