Parcourir la source

Add publish config

Specify publish configs.
master
TheoryOfNekomata il y a 2 ans
Parent
révision
b30aac3589
2 fichiers modifiés avec 41 ajouts et 0 suppressions
  1. +19
    -0
      package.json
  2. +22
    -0
      publish.sh

+ 19
- 0
package.json Voir le fichier

@@ -4,6 +4,25 @@
"types": "dist/types/index.d.ts",
"main": "dist/cjs/production/index.js",
"module": "dist/esm/production/index.js",
"publishing": {
"github": {
"repository": "https://github.com/TheoryOfNekomata/uuid-buffer.git",
"publishConfig": {
"registry": "https://npm.pkg.github.com"
}
},
"master": {
"repository": "https://code.modal.sh/TheoryOfNekomata/uuid-buffer.git",
"publishConfig": {
"registry": "https://js.pack.modal.sh"
}
},
"npm": {
"publishConfig": {
"registry": "https://registry.npmjs.com"
}
}
},
"exports": {
".": {
"development": {


+ 22
- 0
publish.sh Voir le fichier

@@ -0,0 +1,22 @@
defaultBranch=master

for branch in $(cat package.json | jq .publishing | jq -r keys[]) ; do
echo "Selected configuration: $branch"

rawRepository=$(cat package.json | jq -r .publishing.$branch.repository)
repository=$(cat package.json | jq -r .publishing.$branch.repository)
defaultRepository=$(cat package.json | jq -r .publishing.$defaultBranch.repository)

if [ $repository = $defaultRepository ]; then
echo "Changing to default repository: $repository"
echo "$( jq --arg repository "$repository" '.repository = $repository' package.json )" > package.json
elif [ $rawRepository != 'null' ]; then
echo "Changing to mirror repository: $repository"
echo "$( jq --arg repository "$repository" '.repository = $repository' package.json )" > package.json
fi

registry=$(cat package.json | jq -r .publishing.$branch.publishConfig.registry)
echo "Publishing to package repository: $registry"
npm publish --registry=$registry --access public
git reset --hard
done

Chargement…
Annuler
Enregistrer