Skip to content

Commit

Permalink
Merge pull request #52 from upm-packages/tweak_init
Browse files Browse the repository at this point in the history
Tweak init command
  • Loading branch information
monry authored Mar 18, 2020
2 parents 6d7ad6f + ed148e5 commit 5542b3c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion scripts/lib/variable/version.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

if [ -z "${VERSION}"]; then
if [ -z "${VERSION}" ]; then
registry_url=$(echo ${matched_registry} | jq -r ".url")
package_info_url="${registry_url}/${PACKAGE_ID}"
VERSION=$(curl -s ${package_info_url} | jq -r ".\"dist-tags\".latest")
Expand Down
25 changes: 17 additions & 8 deletions scripts/upm-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ registry_protocol=$(echo ${registry_json} | jq -r '."protocol"')
project_name=${PACKAGE_NAME}
package_domain=$(echo ${registry_json} | jq -r '."domain"')
package_name=$(echo ${PACKAGE_NAME} | tr '[:upper:]' '[:lower:]')
package_name=${package_name//\./-}
display_name=${DISPLAY_NAME}
description=${DESCRIPTION}
unity_version=$(echo ${registry_json} | jq -r '."unity_version"')
Expand All @@ -52,7 +51,8 @@ repository_user=$(echo ${registry_json} | jq -r '."repository"."user"')
if [ -z "${repository_user}" ]; then
repository_user=$(echo ${registry_json} | jq -r '."repository"."organization"')
fi
repository_name=${PACKAGE_NAME//\./-}
repository_name=${PACKAGE_NAME}
directory_name=${PACKAGE_NAME//\./-}
license="UNLICENSED"
license_url=""
if [ "string" = "$(echo ${registry_json} | jq -r '.license|type')" ]; then
Expand All @@ -72,9 +72,9 @@ if [ -z "${publish_registry_protocol}" ]; then
publish_registry_protocol=${registry_protocol}
fi

if [ -d "${repository_name}" ]; then
if [ -d "${directory_name}" ]; then
cat << __VALIDATE_DIRECTORY__
ERROR: Directory '${repository_name}' has already exists
ERROR: Directory '${directory_name}' has already exists
__VALIDATE_DIRECTORY__
exit 1
fi
Expand Down Expand Up @@ -105,9 +105,9 @@ package_json=$(cat << __PACKAGE_JSON__
__PACKAGE_JSON__
)

mkdir -p "${repository_name}/Assets"
mkdir -p "${repository_name}/ProjectSettings"
cd "${repository_name}"
mkdir -p "${directory_name}/Assets"
mkdir -p "${directory_name}/ProjectSettings"
cd "${directory_name}"
echo ${package_json} | jq -M '.' > Assets/package.json
echo "registry=${publish_registry_protocol}://${publish_registry_hostname}" > .npmrc

Expand Down Expand Up @@ -159,7 +159,8 @@ cat > Assets/.npmignore << __NPMIGNORE__
.npmignore
yarn-debug.log*
yarn-error.log*
Tests/
Tests.meta
__NPMIGNORE__

cat > ProjectSettings/ProjectSettings.asset << __PROJECT_SETTINGS__
Expand All @@ -173,6 +174,14 @@ PlayerSettings:
Standalone: ${package_domain}.${package_name}
__PROJECT_SETTINGS__

cat > ProjectSettings/EditorSettings.asset << __EDITOR_SETTINGS__
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!159 &1
EditorSettings:
m_ProjectGenerationRootNamespace: ${PACKAGE_NAME}
__EDITOR_SETTINGS__

mkdir -p .github/workflows/
cat > .github/workflows/publish-upm-package.yml << __GITHUB_ACTIONS__
name: Publish UPM Package
Expand Down

0 comments on commit 5542b3c

Please sign in to comment.