-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3735037
commit 66594be
Showing
3 changed files
with
103 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#! /usr/bin/env -S bash | ||
# -*- coding: ascii -*- | ||
|
||
LC_ALL=C | ||
POSIXLY_CORRECT=1 | ||
unset -f builtin | ||
unset -v POSIXLY_CORRECT | ||
|
||
# --------------------------------------------------------------------------------------------------------------------- | ||
|
||
get_command_or_fail() { | ||
RESULT="$(/usr/bin/env which "${1}")" | ||
builtin echo "${RESULT:?\'"${1}"\' command not found}" | ||
} | ||
|
||
THE_NPM="$(get_command_or_fail npm)" | ||
|
||
# --------------------------------------------------------------------------------------------------------------------- | ||
|
||
"${THE_NPM}" run prepublishOnly --ignore-scripts --if-present | ||
|
||
THE_TGZ="$("${THE_NPM}" run pack:clean)" | ||
|
||
"${THE_NPM}" publish --ignore-scripts "${THE_TGZ}" | ||
|
||
"${THE_NPM}" run publish --ignore-scripts --if-present | ||
"${THE_NPM}" run postpublish --ignore-scripts --if-present |
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,73 @@ | ||
#! /usr/bin/env -S bash | ||
# -*- coding: ascii -*- | ||
|
||
LC_ALL=C | ||
POSIXLY_CORRECT=1 | ||
unset -f builtin | ||
unset -v POSIXLY_CORRECT | ||
|
||
# --------------------------------------------------------------------------------------------------------------------- | ||
|
||
get_command_or_fail() { | ||
RESULT="$(/usr/bin/env which "${1}")" | ||
builtin echo "${RESULT:?\'"${1}"\' command not found}" | ||
} | ||
|
||
THE_MKTEMP="$(get_command_or_fail mktemp)" | ||
THE_NPM="$(get_command_or_fail npm)" | ||
THE_TAR="$(get_command_or_fail tar)" | ||
THE_NODE="$(get_command_or_fail node)" | ||
THE_GZIP="$(get_command_or_fail gzip)" | ||
|
||
# --------------------------------------------------------------------------------------------------------------------- | ||
|
||
TMP_DIR="$("${THE_MKTEMP}" -d 2> /dev/null || "${THE_MKTEMP}" -d -t 'tmp')" | ||
|
||
if [[ ! "${TMP_DIR}" || ! -d "${TMP_DIR}" ]]; then | ||
builtin echo "Could not create temporary directory" | ||
builtin exit 1 | ||
fi | ||
|
||
builtin trap 'rm -rf "${TMP_DIR}"' EXIT | ||
|
||
# --------------------------------------------------------------------------------------------------------------------- | ||
|
||
THE_DIR="$(builtin pwd)" | ||
|
||
THE_TGZ="$("${THE_NPM}" pack --pack-destination "${TMP_DIR}" --json | "${THE_NODE}" -e "process.stdout.write(JSON.parse(require('fs').readFileSync(0))[0].filename);")" | ||
|
||
builtin pushd "${TMP_DIR}" > /dev/null || exit 1 | ||
|
||
"${THE_TAR}" xzf "${THE_TGZ}" | ||
|
||
"${THE_NODE}" -e " | ||
const fs = require('fs'); | ||
const package = JSON.parse(fs.readFileSync('package/package.json')); | ||
delete package.devDependencies; | ||
delete package.files; | ||
if ('scripts' in package) { | ||
package.scripts = [ | ||
'preinstall', | ||
'install', | ||
'postinstall', | ||
'prepublish', | ||
'preprepare', | ||
'prepare', | ||
'postprepare', | ||
].reduce( | ||
(obj, key) => key in package.scripts ? ({ ...obj, [key]: package.scripts[key] }) : obj, | ||
{}, | ||
); | ||
} | ||
fs.writeFileSync('package/package.json', JSON.stringify(package, null, 2) + '\n'); | ||
" | ||
|
||
"${THE_TAR}" c package | "${THE_GZIP}" -9 > "${THE_DIR}/${THE_TGZ}" | ||
|
||
builtin popd > /dev/null || exit 1 | ||
|
||
builtin echo "${THE_TGZ}" |
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 |
---|---|---|
|
@@ -67,7 +67,9 @@ | |
"test:meta": "jest --runInBand --config=./etc/jest.meta.config.cjs", | ||
"test:regression": "jest --runInBand --config=./etc/jest.regression.config.cjs", | ||
"reset": "pnpm clean && rm -rf node_modules && rm -f pnpm-lock.yaml", | ||
"all": "pnpm reset; pnpm up --latest; pnpm format; pnpm lint; pnpm build; pnpm test; pnpm test:meta; pnpm test:regression; pnpm doc" | ||
"all": "pnpm reset; pnpm up --latest; pnpm format; pnpm lint; pnpm build; pnpm test; pnpm test:meta; pnpm test:regression; pnpm doc", | ||
"pack:clean": "./etc/pack", | ||
"publish:clean": "./etc/publish" | ||
}, | ||
"packageManager": "[email protected]", | ||
"devDependencies": { | ||
|