@furrymink/cli 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,4 @@
1
1
  app.gateway(){
2
- echo "app.create"
3
2
  local ARGS=("$@")
4
3
 
5
4
  local _DEVICE=$(
@@ -7,9 +7,19 @@ __furrymink.install.android(){
7
7
  npx cap add android
8
8
  }
9
9
 
10
- furrymink.create.mobile.wrapped(){
11
- console.header "Create Wrapped Mobile App"
10
+ __furrymink.create-dotenv(){
11
+ local INSTALL_DIR="$1"
12
+
13
+ console.header "Updating local files"
14
+ console.log "Creating .env"
15
+ cat > "${INSTALL_DIR}/.env.development" << EOF
16
+ # AUTO GENERATED. DO NOT EDIT THIS FILE
17
+ PORT="${BROWSER_PORT}"
18
+ DEFAULT_PORT="${BROWSER_PORT_DEFAULT}"
19
+ EOF
20
+ }
12
21
 
22
+ __furrymink.install(){
13
23
  local ARGS=("$@")
14
24
  local _BASE_REPO_URL="furrymink"
15
25
 
@@ -28,10 +38,6 @@ furrymink.create.mobile.wrapped(){
28
38
  local _DEV_BOWSER_PORT=$(get.broswer-port "3000")
29
39
  local _TYPE=$(get.type)
30
40
 
31
- local _PLATFORM=""
32
-
33
- npx cap init "${_APP_NAME}" "${PACKAGE_ID}" --web-dir "www/dist"
34
-
35
41
  local _TARGET_PLATFORM=$(
36
42
  input.select "Select OS" \
37
43
  --prefill "1" \
@@ -51,8 +57,101 @@ furrymink.create.mobile.wrapped(){
51
57
  ;;
52
58
  *)
53
59
  console.error "Invalid choice" >&2
54
- install-capacitor
60
+ __furrymink.install
55
61
  ;;
56
62
  esac
57
63
 
64
+ __furrymink.update-files
65
+ __furrymink.update-gradle
66
+ __furrymink.update-template \
67
+ $_APP_NAME
68
+ __furrymink.update-npm \
69
+ $_APP_NAME \
70
+ $_VERSION \
71
+ $_TYPE \
72
+ $_REPO_URL \
73
+ $_BUGS_URL \
74
+ $_HOMEPAGE_URL \
75
+ $_LICENSE
76
+
77
+
78
+ npx cap sync
79
+
80
+ git.repo.change \
81
+ $_REPO_URL \
82
+ "main"
83
+
84
+ }
85
+
86
+
87
+
88
+ __furrymink.update-npm(){
89
+ # cd install fir
90
+ local APP_NAME="$1"
91
+ local VERSION="$2"
92
+ local TYPE="$3"
93
+ local REPO_URL="$4"
94
+ local BUGS_URL="$5"
95
+ local HOMEPAGE_URL="$6"
96
+ local LICENSE="$7"
97
+
98
+ npm pkg set name="${APP_NAME}"
99
+ npm pkg set type="${TYPE}"
100
+ npm pkg set main="index.mjs"
101
+ npm pkg set repository.url="${REPO_URL}"
102
+ npm pkg set bugs.url="${BUGS_URL}"
103
+ npm pkg set homepage="${HOMEPAGE_URL}"
104
+ npm pkg set scripts.build="./scripts/build.sh"
105
+ npm pkg set scripts.launch:web="./scripts/launch-web.sh"
106
+ npm pkg set scripts.launch:android="./scripts/launch-android.sh"
107
+ npm pkg set scripts.launch:ios="./scripts/launch-ios.sh"
108
+ npm pkg set scripts.git:push="./scripts/git-push.sh"
109
+ npm pkg set scripts.git:commit="./scripts/git-commit.sh"
110
+ npm pkg set scripts.open:studio:push="npx cap open android"
111
+
112
+ if [[ -z "${LICENSE//[[:space:]]/}" ]]; then
113
+ npm pkg delete license
114
+ else
115
+ npm pkg set license="${LICENSE}"
116
+ fi
117
+
118
+ }
119
+
120
+ __furrymink.update-files(){
121
+ echo "__furrymink.update-files"
122
+ # cd install fir
123
+ # RENAME DOTENV > .env
124
+ }
125
+
126
+ __furrymink.update-template(){
127
+ echo "__furrymink.update-template"
128
+ local APP_NAME="$1"
129
+ # cd install fir
130
+ # sed -i "s/{{APP_NAME}}/$APP_NAME/" "${INSTALL_DIR}/www/src/index.html"
131
+ # sed -i "s/{{VERSION}}/$VERSION/" "${INSTALL_DIR}/www/src/index.html"
132
+ }
133
+
134
+ __furrymink.update-gradle(){
135
+ echo "__furrymink.update-gradle"
136
+ # cd install fir
137
+
138
+ # sed -i 's#^distributionUrl=.*#distributionUrl=https\\://services.gradle.org/distributions/gradle-9.1.0-bin.zip#' "${INSTALL_DIR}/android/gradle/wrapper/gradle-wrapper.properties"
139
+ # sed -i "s/proguard-android\.txt/proguard-android-optimize.txt/g" "${INSTALL_DIR}/android/app/build.gradle"
140
+ # sed -i "s/com.android.tools.build:gradle:8.13.0/com.android.tools.build:gradle:9.0.1/g" "${INSTALL_DIR}/android/build.gradle"
141
+
142
+ }
143
+
144
+ app.create.mobile.wrapped(){
145
+ echo "6.1"
146
+ console.header "Create Wrapped Mobile App"
147
+
148
+ cd "${INSTALL_DIR}"
149
+
150
+ npm exec --yes --package=/home/hushmonkey/furrymink/gitlab/furrymink/furry-installers/boilerplates/capacitorjs -- create-plugin
151
+
152
+ #npm init @furry-boilerplates/capacitorjs
153
+
154
+ __furrymink.install
155
+
156
+
58
157
  }
@@ -7,6 +7,7 @@ app.gateway(){
7
7
 
8
8
  case $COMMAND in
9
9
  "create" | "c" )
10
+ echo "7777777"
10
11
  app.create "${ARGS[@]}";;
11
12
  *)
12
13
  console.error "Invalid create command";;
@@ -6,11 +6,9 @@ cli.gateway(){
6
6
 
7
7
  case $COMMAND in
8
8
  git)
9
- console.echo "GIT"
10
9
  git.gateway "${ARGS[@]}";;
11
10
  # include.scripts "git/entry.sh" "$@";;
12
11
  npm)
13
- console.echo "NPM"
14
12
  npm.gateway "${ARGS[@]}";;
15
13
  # include.scripts "npm/entry.sh" "$@";;
16
14
  create)
@@ -18,7 +16,6 @@ cli.gateway(){
18
16
  # include.scripts "plugin/entry.sh" "$@";;
19
17
  *)
20
18
  console.error "Unknown command '${COMMAND}'";;
21
-
22
19
  esac
23
20
 
24
21
  }
@@ -1,9 +1,2 @@
1
1
  include.scripts \
2
- "modules/includes.sh" \
3
- "git/includes.sh" \
4
- "npm/includes.sh" \
5
- "create/includes.sh" \
6
- "app/includes.sh" \
7
- "plugin/includes.sh" \
8
- "cli/gateway.sh" \
9
- "cli/entry-point.sh"
2
+ "cli/gateway.sh"
@@ -0,0 +1,9 @@
1
+ copy.from-package-to-install(){
2
+ local FROM_REL="$1"
3
+ local TO_REL="$2"
4
+
5
+ local FROM_ABS="${PACKAGE_PATH}/${FROM_REL}"
6
+ local TO_ABS="${INSTALL_DIR}/${TO_REL}"
7
+
8
+ cp -rf "$FROM_ABS" "$TO_ABS"
9
+ }
@@ -0,0 +1,2 @@
1
+ include.scripts \
2
+ "files/copy.from-package-to-install.sh"
@@ -0,0 +1,19 @@
1
+
2
+ ############################
3
+ ### USER INPUT: CREATE INSTALL DIRECTORY
4
+ ############################
5
+ create.install-directory(){
6
+ local DEFAULT=$1
7
+ local USER_DIR=$2
8
+ local APP_DIR=$(
9
+ input.text "Install directory" \
10
+ --prefill "${DEFAULT}" \
11
+ --required
12
+ )
13
+
14
+ local INSTALL_DIR="${USER_DIR}/${APP_DIR}"
15
+
16
+ mkdir -p "${INSTALL_DIR}"
17
+
18
+ echo "${INSTALL_DIR}"
19
+ }
@@ -0,0 +1,27 @@
1
+
2
+
3
+ ############################
4
+ ### USER INPUT: APP NAME
5
+ ############################
6
+ get.app-name(){
7
+ local DEFAULT=$1
8
+ local ANSWER=$(
9
+ input.text "App name" \
10
+ --prefill "${DEFAULT}" \
11
+ --required
12
+ )
13
+
14
+ if [[ $(is.scoped $ANSWER) == "true" ]]; then
15
+ console.error "App name cannot be scoped"
16
+ get.app-name
17
+ exit 1
18
+ fi
19
+
20
+ if [[ $ANSWER == *"/"* ]]; then
21
+ console.error "App name cannot contain slashes"
22
+ get.app-name
23
+ exit 1
24
+ fi
25
+
26
+ echo $ANSWER
27
+ }
@@ -0,0 +1,14 @@
1
+
2
+ ############################
3
+ ### USER INPUT: AUTHOR
4
+ ############################
5
+ get.author(){
6
+ local DEFAULT=$1
7
+ local ANSWER=$(
8
+ input.text "Author" \
9
+ --prefill "${DEFAULT}" \
10
+ --required
11
+ )
12
+
13
+ echo $ANSWER
14
+ }
@@ -0,0 +1,15 @@
1
+
2
+
3
+ ############################
4
+ ### USER INPUT: BROWSER PORT
5
+ ############################
6
+ get.broswer-port(){
7
+ local DEFAULT=$1
8
+ local ANSWER=$(
9
+ input.text "Browser port" \
10
+ --prefill "${DEFAULT}" \
11
+ --required
12
+ )
13
+
14
+ echo $ANSWER
15
+ }
@@ -0,0 +1,22 @@
1
+
2
+ ############################
3
+ ### USER INPUT: Bugs URL
4
+ ############################
5
+ get.bugs-url(){
6
+ local BASE_URL=$1
7
+ local BUGS_URL="https://gitlab.com/${BASE_URL}/BUGS.md"
8
+
9
+ local ANSWER=$(
10
+ input.text "BUGS URL" \
11
+ --prefill "${BUGS_URL}" \
12
+ --required
13
+ )
14
+
15
+ if [[ $ANSWER == *"@"* ]]; then
16
+ console.error "Invalid Bugs URL"
17
+ get.bugs-url
18
+ exit 1
19
+ fi
20
+
21
+ echo "${ANSWER}"
22
+ }
@@ -0,0 +1,12 @@
1
+
2
+ ############################
3
+ ### DEFAULT PACKAGE ID
4
+ ############################
5
+ default-package-id(){
6
+ local BASE_URL="$1"
7
+ local APP_NAME="$2"
8
+
9
+ local PACKAGE_ID="com.${BASE_URL}.${APP_NAME}"
10
+
11
+ echo $(normalise.package-id $PACKAGE_ID)
12
+ }
@@ -0,0 +1,15 @@
1
+
2
+
3
+ ############################
4
+ ### USER INPUT: DESCRIPTION
5
+ ############################
6
+ get.description(){
7
+ local DEFAULT=$1
8
+ local ANSWER=$(
9
+ input.text "Description" \
10
+ --prefill "${DEFAULT}" \
11
+ --required
12
+ )
13
+
14
+ echo $ANSWER
15
+ }
@@ -0,0 +1,27 @@
1
+
2
+
3
+ ############################
4
+ ### USER INPUT: APP NAME
5
+ ############################
6
+ get.directory(){
7
+ local DEFAULT=$1
8
+ local ANSWER=$(
9
+ input.text "Directory" \
10
+ --prefill "${DEFAULT}" \
11
+ --required
12
+ )
13
+
14
+ if [[ $(is.scoped $ANSWER) == "true" ]]; then
15
+ console.error "App name cannot be scoped"
16
+ get.app-name
17
+ exit 1
18
+ fi
19
+
20
+ if [[ $ANSWER == *"/"* ]]; then
21
+ console.error "App name cannot contain slashes"
22
+ get.app-name
23
+ exit 1
24
+ fi
25
+
26
+ echo $ANSWER
27
+ }
@@ -0,0 +1,16 @@
1
+
2
+ ############################
3
+ ### USER INPUT: Homepage URL
4
+ ############################
5
+ get.home-page-url(){
6
+ local BASE_URL=$1
7
+ local HOMEPAGE_URL="https://gitlab.com/${BASE_URL}"
8
+
9
+ local ANSWER=$(
10
+ input.text "Homepage URL" \
11
+ --prefill "${HOMEPAGE_URL}" \
12
+ --required
13
+ )
14
+
15
+ echo "${ANSWER}"
16
+ }
@@ -0,0 +1,14 @@
1
+
2
+
3
+ ############################
4
+ ### USER INPUT: LICENSE
5
+ ############################
6
+ get.license(){
7
+ local DEFAULT=$1
8
+ local ANSWER=$(
9
+ input.text "License" \
10
+ --prefill "${DEFAULT}" \
11
+ )
12
+
13
+ echo $ANSWER
14
+ }
@@ -0,0 +1,16 @@
1
+
2
+ ############################
3
+ ### USER INPUT: PACKAGE ID
4
+ ############################
5
+ get.package-id(){
6
+ local BASE_REPO_URL=$1
7
+ local APP_NAME=$2
8
+ local DEFAULT=$(default-package-id "$BASE_REPO_URL" "$APP_NAME")
9
+
10
+ local ANSWER=$(
11
+ input.text "Package ID" \
12
+ --prefill "${DEFAULT}" \
13
+ --required
14
+ )
15
+ echo $ANSWER
16
+ }
@@ -0,0 +1,23 @@
1
+
2
+
3
+ ############################
4
+ ### USER INPUT: README Url
5
+ ############################
6
+ get.read-me-url(){
7
+ local BASE_URL=$1
8
+ local READ_ME_URL="https://gitlab.com/${BASE_URL}/README.md"
9
+
10
+ local ANSWER=$(
11
+ input.text "README URL" \
12
+ --prefill "${READ_ME_URL}" \
13
+ --required
14
+ )
15
+
16
+ if [[ $ANSWER == *"@"* ]]; then
17
+ console.error "Invalid Readme URL"
18
+ get.read-me-url
19
+ exit 1
20
+ fi
21
+
22
+ echo "$ANSWER"
23
+ }
@@ -0,0 +1,16 @@
1
+
2
+ ############################
3
+ ### USER INPUT: REPO URL
4
+ ############################
5
+ get.repo-url(){
6
+ local BASE_URL=$1
7
+ local REPO_URL="git@gitlab.com:${BASE_URL}.git"
8
+
9
+ local ANSWER=$(
10
+ input.text "Repo URL" \
11
+ --prefill "${REPO_URL}" \
12
+ --required
13
+ )
14
+
15
+ echo "${ANSWER}"
16
+ }
@@ -0,0 +1,13 @@
1
+ #! /bin/bash
2
+ ############################
3
+ ### USER INPUT: JS TYPE
4
+ ############################
5
+ get.type(){
6
+ local TYPE=$(
7
+ input.select "JS type" \
8
+ --prefill "1" \
9
+ --options "module|commonjs"
10
+ )
11
+
12
+ echo $TYPE
13
+ }
@@ -0,0 +1,16 @@
1
+ include.scripts \
2
+ "forms/create-install-directory.sh" \
3
+ "forms/get.app-name.sh" \
4
+ "forms/get.author.sh" \
5
+ "forms/get.browser-port.sh" \
6
+ "forms/get.bugs-url.sh" \
7
+ "forms/get.default-package-id.sh" \
8
+ "forms/get.description.sh" \
9
+ "forms/get.directory.sh" \
10
+ "forms/get.homepage-url.sh" \
11
+ "forms/get.license.sh" \
12
+ "forms/get.package-id.sh" \
13
+ "forms/get.read-me-url.sh" \
14
+ "forms/get.repo-url.sh" \
15
+ "forms/get.type.sh" \
16
+ "forms/normalise.package-id.sh"
@@ -0,0 +1,13 @@
1
+
2
+
3
+ ############################
4
+ ### NORMALISE STRING
5
+ ############################
6
+ normalise.package-id(){
7
+ local PACKAGE_ID=$1
8
+ PACKAGE_ID="${PACKAGE_ID//@/}"
9
+ PACKAGE_ID="${PACKAGE_ID//\//.}"
10
+ PACKAGE_ID="${PACKAGE_ID//\-/}"
11
+
12
+ echo "$PACKAGE_ID"
13
+ }
package/bin/furrymink CHANGED
@@ -2,6 +2,8 @@
2
2
  BIN_PATH="$(cd -- "$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")" && pwd)"
3
3
  CLI_PATH="$(realpath "$BIN_PATH/..")"
4
4
  MODULES_PATH="${BIN_PATH}/modules"
5
+ INSTALL_DIR="$PWD"
6
+ PACKAGE_PATH="$(realpath "$BIN_PATH/..")"
5
7
 
6
8
  include.scripts(){
7
9
  local SCRIPTS=("$@")
@@ -12,6 +14,6 @@ include.scripts(){
12
14
  done
13
15
  }
14
16
 
15
- include.scripts "cli/includes.sh"
17
+ include.scripts "includes.sh"
16
18
 
17
- cli.entry-point "$@"
19
+ cli.gateway "$@"
@@ -0,0 +1,8 @@
1
+ git.repo.change(){
2
+ local REPO="$1"
3
+ local BRANCH="$2"
4
+
5
+ git remote add origin "$REPO"
6
+ git branch -M "$BRANCH"
7
+ git push -uf origin "$BRANCH"
8
+ }
@@ -0,0 +1,8 @@
1
+ git.repo.change(){
2
+ local REPO="$1"
3
+ local BRANCH="$2"
4
+
5
+ git remote set-url origin "$REPO".
6
+ git branch -M "$BRANCH"
7
+ git push -uf origin "$BRANCH"
8
+ }
@@ -0,0 +1,10 @@
1
+ include.scripts \
2
+ "files/includes.sh" \
3
+ "modules/includes.sh" \
4
+ "git/includes.sh" \
5
+ "npm/includes.sh" \
6
+ "create/includes.sh" \
7
+ "app/includes.sh" \
8
+ "plugin/includes.sh" \
9
+ "cli/includes.sh" \
10
+ "forms/includes.sh"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@furrymink/cli",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "To make it easy for you to get started with GitLab, here's a list of recommended next steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,5 +0,0 @@
1
-
2
-
3
- cli.entry-point(){
4
- cli.gateway "$@"
5
- }