@fnet/cli 1.13.0 → 1.14.1

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.
Files changed (109) hide show
  1. package/dist/fbin/index.js +1 -1
  2. package/dist/fnet/index.4gymwzqb.js +1 -0
  3. package/dist/fnet/index.5r21wfyc.js +1 -0
  4. package/dist/fnet/index.js +9 -9
  5. package/dist/fnet/index.kanz1359.js +2 -0
  6. package/dist/fnet/index.kjw4nv5z.js +1 -0
  7. package/dist/fnet/index.n7q2w82x.js +1 -0
  8. package/dist/{fnode/index.c8qd1bz3.js → fnet/index.pj3wr582.js} +1 -1
  9. package/dist/fnet/index.r3cben5x.js +1 -0
  10. package/dist/fnet/index.sbphkm7x.js +1 -0
  11. package/dist/{fnode/index.e6g5y0zg.js → fnet/index.wmeh7jrw.js} +1 -1
  12. package/dist/fnet/index.xym49mp3.js +1 -0
  13. package/dist/fnet/index.ydv6st7k.js +1 -0
  14. package/dist/fnode/index.05n3mvs9.js +2 -0
  15. package/dist/fnode/index.22v7wtt0.js +2 -0
  16. package/dist/fnode/{index.dtp0a202.js → index.3ay4fp2s.js} +1 -1
  17. package/dist/fnode/index.6g3j97vm.js +1 -0
  18. package/dist/fnode/{index.q61zqpb9.js → index.782edcjp.js} +1 -1
  19. package/dist/fnode/index.7cqahb2f.js +1 -0
  20. package/dist/fnode/index.fy1xwqp2.js +1 -0
  21. package/dist/fnode/index.js +2 -2
  22. package/dist/fnode/index.kswhzt5n.js +1 -0
  23. package/dist/fnode/{index.1k1sj9qs.js → index.q9ghzdn2.js} +3 -3
  24. package/dist/fnode/index.r4xke6yy.js +1 -0
  25. package/dist/fnode/index.w4cz5r8m.js +1 -0
  26. package/dist/fnode/index.wd23pxn8.js +1 -0
  27. package/dist/fnode/index.xvyybysy.js +1 -0
  28. package/dist/fnode/index.z9232w6h.js +1 -0
  29. package/dist/frun/index.js +1 -1
  30. package/dist/fservice/index.js +1 -1
  31. package/package.json +5 -9
  32. package/readme.md +240 -191
  33. package/scripts/postinstall.js +19 -4
  34. package/template/deploy/to-docker/aws/Dockerfile.njk +114 -0
  35. package/template/deploy/to-docker/aws/build.sh.njk +127 -0
  36. package/template/deploy/to-docker/docker/Dockerfile.njk +67 -0
  37. package/template/deploy/to-docker/docker/build.sh.njk +48 -0
  38. package/template/deploy/to-docker/gcloud/Dockerfile.njk +69 -0
  39. package/template/deploy/to-docker/gcloud/build.sh.njk +39 -0
  40. package/template/deploy/to-docker/podman/Dockerfile.njk +69 -0
  41. package/template/deploy/to-docker/podman/build.sh.njk +44 -0
  42. package/template/deploy/to-electron/mac/entitlements.plist.njk +18 -0
  43. package/template/deploy/to-electron/main.js.njk +37 -0
  44. package/template/deploy/to-electron/package.json.njk +36 -0
  45. package/template/deploy/to-electron/src/index.html.njk +23 -0
  46. package/template/deploy/to-ios-app/fnet/index.html.njk +23 -0
  47. package/template/deploy/to-ios-app/fnet-ios-app/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
  48. package/template/deploy/to-ios-app/fnet-ios-app/Assets.xcassets/AppIcon.appiconset/Contents.json +112 -0
  49. package/template/deploy/to-ios-app/fnet-ios-app/Assets.xcassets/Contents.json +6 -0
  50. package/template/deploy/to-ios-app/fnet-ios-app/Assets.xcassets/launch-images.imageset/Contents.json +23 -0
  51. package/template/deploy/to-ios-app/fnet-ios-app/ContentView.swift +32 -0
  52. package/template/deploy/to-ios-app/fnet-ios-app/Info.plist +10 -0
  53. package/template/deploy/to-ios-app/fnet-ios-app/LaunchScreen.storyboard +26 -0
  54. package/template/deploy/to-ios-app/fnet-ios-app/Preview Content/Preview Assets.xcassets/Contents.json +6 -0
  55. package/template/deploy/to-ios-app/fnet-ios-app/WebView.swift +42 -0
  56. package/template/deploy/to-ios-app/fnet-ios-app/fnet_ios_appApp.swift +17 -0
  57. package/template/deploy/to-ios-app/fnet-ios-app.xcodeproj/project.pbxproj.njk +417 -0
  58. package/template/deploy/to-ios-app/fnet-ios-app.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  59. package/template/deploy/to-ios-app/fnet-ios-app.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  60. package/template/deploy/to-ios-app/fnet-ios-app.xcodeproj/xcshareddata/xcschemes/fnet-ios-app.xcscheme +77 -0
  61. package/template/deploy/to-macos-app/fnet/index.html.njk +23 -0
  62. package/template/deploy/to-macos-app/fnet-macos-app/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
  63. package/template/deploy/to-macos-app/fnet-macos-app/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
  64. package/template/deploy/to-macos-app/fnet-macos-app/Assets.xcassets/Contents.json +6 -0
  65. package/template/deploy/to-macos-app/fnet-macos-app/ContentView.swift +13 -0
  66. package/template/deploy/to-macos-app/fnet-macos-app/Preview Content/Preview Assets.xcassets/Contents.json +6 -0
  67. package/template/deploy/to-macos-app/fnet-macos-app/WebView.swift +30 -0
  68. package/template/deploy/to-macos-app/fnet-macos-app/fnet_macos_app.entitlements +16 -0
  69. package/template/deploy/to-macos-app/fnet-macos-app/fnet_macos_appApp.swift +17 -0
  70. package/template/deploy/to-macos-app/fnet-macos-app.xcodeproj/project.pbxproj.njk +396 -0
  71. package/template/deploy/to-macos-app/fnet-macos-app.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  72. package/template/deploy/to-macos-app/fnet-macos-app.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  73. package/template/deploy/to-nextjs/app/layout.tsx.njk +13 -0
  74. package/template/deploy/to-nextjs/app/page.tsx.njk +28 -0
  75. package/template/deploy/to-nextjs/next-env.d.ts +5 -0
  76. package/template/deploy/to-nextjs/package.json.njk +20 -0
  77. package/template/deploy/to-nextjs/tsconfig.json +34 -0
  78. package/template/deploy/to-pyip/package/__init__.py.njk +4 -0
  79. package/template/deploy/to-pyip/package/cli/__init__.py.njk +3 -0
  80. package/template/deploy/to-pyip/package/cli/index.py.njk +24 -0
  81. package/template/deploy/to-pyip/package/lib/__init__.py.njk +3 -0
  82. package/template/deploy/to-pyip/pyproject.toml +3 -0
  83. package/template/deploy/to-pyip/setup.py.njk +32 -0
  84. package/template/deploy/to-rust/Cargo.toml.njk +16 -0
  85. package/template/deploy/to-rust/src/main.rs.njk +112 -0
  86. package/template/deploy/to-webos/appinfo.json.njk +14 -0
  87. package/template/deploy/to-webos/index.html.njk +39 -0
  88. package/template/deploy/to-webos/webOSTVjs-1.2.10/LICENSE-2.0.txt +202 -0
  89. package/template/deploy/to-webos/webOSTVjs-1.2.10/webOSTV-dev.js +1 -0
  90. package/template/deploy/to-webos/webOSTVjs-1.2.10/webOSTV.js +1 -0
  91. package/dist/fnet/index.06vbpwcx.js +0 -1
  92. package/dist/fnet/index.26r88tdp.js +0 -1
  93. package/dist/fnet/index.2g93a9kt.js +0 -1
  94. package/dist/fnet/index.61jdafta.js +0 -1
  95. package/dist/fnet/index.80hh5mtp.js +0 -1
  96. package/dist/fnet/index.a2mbqyxe.js +0 -1
  97. package/dist/fnet/index.gywx3fae.js +0 -1
  98. package/dist/fnet/index.gza1frda.js +0 -1
  99. package/dist/fnet/index.r2gf0b3s.js +0 -1
  100. package/dist/fnet/index.rfysmk2b.js +0 -2
  101. package/dist/fnode/index.5f1kfz9t.js +0 -1
  102. package/dist/fnode/index.7ev6y63q.js +0 -1
  103. package/dist/fnode/index.a4q2w1yd.js +0 -1
  104. package/dist/fnode/index.btj5x5s4.js +0 -1
  105. package/dist/fnode/index.n1598ffs.js +0 -1
  106. package/dist/fnode/index.ng6w9cac.js +0 -1
  107. package/dist/fnode/index.r8s8r2n7.js +0 -2
  108. package/dist/fnode/index.xc08sjp4.js +0 -1
  109. package/dist/fnode/index.zb59076q.js +0 -1
@@ -0,0 +1,114 @@
1
+ FROM {{ params.image_base }}
2
+
3
+ {# BUN INSTALL #}
4
+ RUN npm install -g bun
5
+
6
+ {% if config.env %}
7
+ # Add ARG and ENV for config.env
8
+ {% for key, value in config.env %}
9
+ ARG {{ key }}
10
+ ENV {{ key }}=${{ key }}
11
+ {% endfor %}
12
+ {% endif %}
13
+
14
+ {% if params.env %}
15
+ # Add ARG and ENV for params.env
16
+ {% for key, value in params.env %}
17
+ ARG {{ key }}
18
+ ENV {{ key }}=${{ key }}
19
+ {% endfor %}
20
+ {% endif %}
21
+
22
+
23
+ {% if config.args %}
24
+ # Add ARG for config.args (build-time only)
25
+ {% for key, value in config.args %}
26
+ ARG {{ key }}
27
+ {% endfor %}
28
+ {% endif %}
29
+
30
+ {% if params.args %}
31
+ # Add ARG for params.args (build-time only)
32
+ {% for key, value in params.args %}
33
+ ARG {{ key }}
34
+ {% endfor %}
35
+ {% endif %}
36
+
37
+ USER root
38
+
39
+ WORKDIR /app
40
+
41
+ {% if config.files %}
42
+ # Handle files from config.files
43
+ {% for file in config.files %}
44
+ {% if file.srcfile %}
45
+ # Copy file from {{ file.srcfile }} to {{ file.path }}
46
+ COPY {{ file.srcfile }} {{ file.path }}
47
+ {% elif file.content %}
48
+ # Create file {{ file.path }} from raw content
49
+ RUN mkdir -p $(dirname {{ file.path }}) && echo '{{ file.content | replace("\n", "\\n") | replace("'", "'\\''") }}' > {{ file.path }}
50
+ {% elif file.base64 %}
51
+ # Create file {{ file.path }} from base64 content
52
+ RUN mkdir -p $(dirname {{ file.path }}) && echo '{{ file.base64 }}' | base64 -d > {{ file.path }}
53
+ {% endif %}
54
+ {% endfor %}
55
+ {% endif %}
56
+
57
+ {% if params.files %}
58
+ # Handle files from params.files
59
+ {% for file in params.files %}
60
+ {% if file.srcfile %}
61
+ # Copy file from {{ file.srcfile }} to {{ file.path }}
62
+ COPY {{ file.srcfile }} {{ file.path }}
63
+ {% elif file.content %}
64
+ # Create file {{ file.path }} from raw content
65
+ RUN mkdir -p $(dirname {{ file.path }}) && echo '{{ file.content | replace("\n", "\\n") | replace("'", "'\\''") }}' > {{ file.path }}
66
+ {% elif file.base64 %}
67
+ # Create file {{ file.path }} from base64 content
68
+ RUN mkdir -p $(dirname {{ file.path }}) && echo '{{ file.base64 }}' | base64 -d > {{ file.path }}
69
+ {% endif %}
70
+ {% endfor %}
71
+ {% endif %}
72
+
73
+
74
+ COPY package.json ./
75
+ COPY package-lock.json ./ 2>/dev/null || true
76
+ COPY bun.lock ./ 2>/dev/null || true
77
+
78
+ COPY dist ./dist
79
+
80
+ ENV NODE_ENV=production
81
+
82
+ {% if config.scripts.start %}
83
+ {% for script in config.scripts.start %}
84
+ {{ script }}
85
+ {% endfor %}
86
+ {% endif %}
87
+
88
+ {% if params.scripts.start %}
89
+ {% for script in params.scripts.start %}
90
+ {{ script }}
91
+ {% endfor %}
92
+ {% endif %}
93
+
94
+ {% if params.dev ===true %}
95
+ RUN npm install --force
96
+ {% else %}
97
+ RUN npm install --omit=dev --force
98
+ {% endif %}
99
+
100
+ {% if config.scripts.end %}
101
+ {% for script in config.scripts.end %}
102
+ {{ script }}
103
+ {% endfor %}
104
+ {% endif %}
105
+
106
+ {% if params.scripts.end %}
107
+ {% for script in params.scripts.end %}
108
+ {{ script }}
109
+ {% endfor %}
110
+ {% endif %}
111
+
112
+ EXPOSE 8080
113
+
114
+ CMD ["npm", "run", "cli" ]
@@ -0,0 +1,127 @@
1
+ #!/bin/bash
2
+ set -e # Exit immediately if any command fails
3
+
4
+ # 1. AWS credentials from environment variables
5
+ if [[ -n "${AWS_ACCESS_KEY_ID}" && -n "${AWS_SECRET_ACCESS_KEY}" ]]; then
6
+ echo "Using AWS credentials from environment variables."
7
+ else
8
+ # 2. AWS credentials from params.aws in the template
9
+ {% if params.aws.access_key and params.aws.secret_access_key %}
10
+ export AWS_ACCESS_KEY_ID="{{ params.aws.access_key }}"
11
+ export AWS_SECRET_ACCESS_KEY="{{ params.aws.secret_access_key }}"
12
+
13
+ {% if params.aws.session_token %}
14
+ export AWS_SESSION_TOKEN="{{ params.aws.session_token }}"
15
+ {% endif %}
16
+
17
+ echo "Using AWS credentials from params.aws in template."
18
+
19
+ {% else %}
20
+ # 3. Use AWS_PROFILE if defined, otherwise default to the profile set in AWS CLI
21
+ {% if params.aws.profile %}
22
+ export AWS_PROFILE="{{ params.aws.profile }}"
23
+ echo "Using AWS profile: ${AWS_PROFILE}"
24
+ {% else %}
25
+ echo "Using default AWS profile."
26
+ {% endif %}
27
+
28
+ {% endif %}
29
+ fi
30
+
31
+ # Set AWS region: Check params.region first, then params.aws.region, and finally use a default value
32
+ AWS_REGION="{{ params.region | default(params.aws.region | default('eu-west-1')) }}"
33
+
34
+ # Dynamically get AWS account ID using the credentials
35
+ AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query 'Account' --output text 2> /dev/null)
36
+ if [ $? -ne 0 ]; then
37
+ echo "Error: AWS credentials or token are expired or invalid. Please renew your session or re-authenticate."
38
+ exit 1
39
+ fi
40
+
41
+ # Check if AWS_ACCOUNT_ID is empty
42
+ if [ -z "${AWS_ACCOUNT_ID}" ]; then
43
+ echo "Error: Failed to retrieve AWS account ID. Please check your AWS credentials."
44
+ exit 1
45
+ fi
46
+
47
+ # Image name in ECR format
48
+ IMAGE_NAME="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/{{ params.image_name }}"
49
+
50
+ # Generate image tag, typically using the version or a timestamp
51
+ IMAGE_TAG="{{ params.version }}"
52
+
53
+ # Build arguments
54
+ BUILD_ARGS=""
55
+
56
+ {% if config.env %}
57
+ # Add build arguments from config.env
58
+ {% for key, value in config.env %}
59
+ BUILD_ARGS="$BUILD_ARGS --build-arg {{ key }}='{{ value }}'"
60
+ {% endfor %}
61
+ {% endif %}
62
+
63
+ {% if params.env %}
64
+ # Add build arguments from params.env
65
+ {% for key, value in params.env %}
66
+ BUILD_ARGS="$BUILD_ARGS --build-arg {{ key }}='{{ value }}'"
67
+ {% endfor %}
68
+ {% endif %}
69
+
70
+ {% if config.args %}
71
+ # Add build arguments from config.args
72
+ {% for key, value in config.args %}
73
+ BUILD_ARGS="$BUILD_ARGS --build-arg {{ key }}='{{ value }}'"
74
+ {% endfor %}
75
+ {% endif %}
76
+
77
+ {% if params.args %}
78
+ # Add build arguments from params.args
79
+ {% for key, value in params.args %}
80
+ BUILD_ARGS="$BUILD_ARGS --build-arg {{ key }}='{{ value }}'"
81
+ {% endfor %}
82
+ {% endif %}
83
+
84
+ # Builder name
85
+ BUILDER_NAME="multi-arch-builder"
86
+
87
+ # Check if the builder already exists
88
+ if ! docker buildx inspect $BUILDER_NAME > /dev/null 2>&1; then
89
+ # Create a new Docker Buildx builder instance if it does not exist
90
+ docker buildx create --name $BUILDER_NAME --use
91
+ else
92
+ # Use the existing builder
93
+ docker buildx use $BUILDER_NAME
94
+ fi
95
+
96
+ # Start up the builder instance
97
+ docker buildx inspect --bootstrap
98
+
99
+ # Authenticate Docker to ECR using the AWS profile or credentials
100
+ aws ecr get-login-password --region ${AWS_REGION} | docker login --username AWS --password-stdin ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com
101
+ if [ $? -ne 0 ]; then
102
+ echo "Error: Failed to login to AWS ECR. Please check your credentials."
103
+ exit 1
104
+ fi
105
+
106
+ # Ensure the repository exists in ECR, create it if not
107
+ aws ecr describe-repositories --repository-names "{{ params.image_name }}" --region ${AWS_REGION} > /dev/null 2>&1 || \
108
+ aws ecr create-repository --repository-name "{{ params.image_name }}" --region ${AWS_REGION}
109
+ if [ $? -ne 0 ]; then
110
+ echo "Error: Failed to create or describe the repository. Please check your permissions."
111
+ exit 1
112
+ fi
113
+
114
+ # Build and push the image for multiple platforms
115
+ {% if params.push == true %}
116
+ docker buildx build --platform linux/arm64,linux/amd64 $BUILD_ARGS -t ${IMAGE_NAME}:latest -t ${IMAGE_NAME}:${IMAGE_TAG} --push .
117
+ if [ $? -ne 0 ]; then
118
+ echo "Error: Docker push failed."
119
+ exit 1
120
+ fi
121
+ {% else %}
122
+ docker buildx build --platform linux/arm64,linux/amd64 $BUILD_ARGS -t ${IMAGE_NAME}:latest -t ${IMAGE_NAME}:${IMAGE_TAG} .
123
+ if [ $? -ne 0 ]; then
124
+ echo "Error: Docker build failed."
125
+ exit 1
126
+ fi
127
+ {% endif %}
@@ -0,0 +1,67 @@
1
+ FROM {{ params.image_base }}
2
+
3
+ {# BUN INSTALL #}
4
+ RUN npm install -g bun
5
+
6
+ {% if config.env %}
7
+ # Add ARG and ENV for config.env
8
+ {% for key, value in config.env %}
9
+ ARG {{ key }}
10
+ ENV {{ key }}=${{ key }}
11
+ {% endfor %}
12
+ {% endif %}
13
+
14
+ {% if config.args %}
15
+ # Add ARG for config.args (build-time only)
16
+ {% for key, value in config.args %}
17
+ ARG {{ key }}
18
+ {% endfor %}
19
+ {% endif %}
20
+
21
+ USER root
22
+
23
+ WORKDIR /app
24
+
25
+ {% if config.files %}
26
+ # Handle files from config.files
27
+ {% for file in config.files %}
28
+ {% if file.srcfile %}
29
+ # Copy file from {{ file.srcfile }} to {{ file.path }}
30
+ COPY {{ file.srcfile }} {{ file.path }}
31
+ {% elif file.content %}
32
+ # Create file {{ file.path }} from raw content
33
+ RUN mkdir -p $(dirname {{ file.path }}) && echo '{{ file.content | replace("\n", "\\n") | replace("'", "'\\''") }}' > {{ file.path }}
34
+ {% elif file.base64 %}
35
+ # Create file {{ file.path }} from base64 content
36
+ RUN mkdir -p $(dirname {{ file.path }}) && echo '{{ file.base64 }}' | base64 -d > {{ file.path }}
37
+ {% endif %}
38
+ {% endfor %}
39
+ {% endif %}
40
+
41
+ COPY package.json ./
42
+
43
+ COPY dist ./dist
44
+
45
+ ENV NODE_ENV=production
46
+
47
+ {% if config.scripts.start %}
48
+ {% for script in config.scripts.start %}
49
+ {{ script }}
50
+ {% endfor %}
51
+ {% endif %}
52
+
53
+ {% if params.dev ===true %}
54
+ RUN npm install --force
55
+ {% else %}
56
+ RUN npm install --omit=dev --force
57
+ {% endif %}
58
+
59
+ {% if config.scripts.end %}
60
+ {% for script in config.scripts.end %}
61
+ {{ script }}
62
+ {% endfor %}
63
+ {% endif %}
64
+
65
+ EXPOSE 8080
66
+
67
+ CMD ["npm", "run", "cli" ]
@@ -0,0 +1,48 @@
1
+ #!/bin/bash
2
+ set -e # Exit immediately if any command fails
3
+
4
+ # Image name
5
+ IMAGE_NAME="{{ params.image_name }}"
6
+
7
+ # Generate image tag with current date and time
8
+ {# IMAGE_TAG=$(date "+%Y%m%d.%H%M") #}
9
+ IMAGE_TAG="{{ params.version }}"
10
+
11
+ # Builder name
12
+ BUILDER_NAME="multi-arch-builder"
13
+
14
+ # Check if the builder already exists
15
+ if ! docker buildx inspect $BUILDER_NAME > /dev/null 2>&1; then
16
+ # Create a new Docker Buildx builder instance if it does not exist
17
+ docker buildx create --name $BUILDER_NAME --use
18
+ else
19
+ # Use the existing builder
20
+ docker buildx use $BUILDER_NAME
21
+ fi
22
+
23
+ # Start up the builder instance
24
+ docker buildx inspect --bootstrap
25
+
26
+ # Build arguments
27
+ BUILD_ARGS=""
28
+
29
+ # Add build arguments from config.env
30
+ {% if config.env %}
31
+ {% for key, value in config.env %}
32
+ BUILD_ARGS="$BUILD_ARGS --build-arg {{ key }}='{{ value }}'"
33
+ {% endfor %}
34
+ {% endif %}
35
+
36
+ # Add build arguments from config.args
37
+ {% if config.args %}
38
+ {% for key, value in config.args %}
39
+ BUILD_ARGS="$BUILD_ARGS --build-arg {{ key }}='{{ value }}'"
40
+ {% endfor %}
41
+ {% endif %}
42
+
43
+ # Build and push the image for multiple platforms
44
+ {% if params.push == true %}
45
+ docker buildx build --platform linux/arm64,linux/amd64 $BUILD_ARGS -t ${IMAGE_NAME}:latest -t ${IMAGE_NAME}:${IMAGE_TAG} --push .
46
+ {% else %}
47
+ docker buildx build --platform linux/arm64,linux/amd64 $BUILD_ARGS -t ${IMAGE_NAME}:latest -t ${IMAGE_NAME}:${IMAGE_TAG} --load .
48
+ {% endif %}
@@ -0,0 +1,69 @@
1
+ FROM {{ params.image_base }}
2
+
3
+ {# BUN INSTALL #}
4
+ RUN npm install -g bun
5
+
6
+ {% if config.env %}
7
+ # Add ARG and ENV for config.env
8
+ {% for key, value in config.env %}
9
+ ARG {{ key }}
10
+ ENV {{ key }}=${{ key }}
11
+ {% endfor %}
12
+ {% endif %}
13
+
14
+ {% if config.args %}
15
+ # Add ARG for config.args (build-time only)
16
+ {% for key, value in config.args %}
17
+ ARG {{ key }}
18
+ {% endfor %}
19
+ {% endif %}
20
+
21
+ USER root
22
+
23
+ WORKDIR /app
24
+
25
+ {% if config.files %}
26
+ # Handle files from config.files
27
+ {% for file in config.files %}
28
+ {% if file.srcfile %}
29
+ # Copy file from {{ file.srcfile }} to {{ file.path }}
30
+ COPY {{ file.srcfile }} {{ file.path }}
31
+ {% elif file.content %}
32
+ # Create file {{ file.path }} from raw content
33
+ RUN mkdir -p $(dirname {{ file.path }}) && echo '{{ file.content | replace("\n", "\\n") | replace("'", "'\\''") }}' > {{ file.path }}
34
+ {% elif file.base64 %}
35
+ # Create file {{ file.path }} from base64 content
36
+ RUN mkdir -p $(dirname {{ file.path }}) && echo '{{ file.base64 }}' | base64 -d > {{ file.path }}
37
+ {% endif %}
38
+ {% endfor %}
39
+ {% endif %}
40
+
41
+ COPY package.json ./
42
+ COPY package-lock.json ./ 2>/dev/null || true
43
+ COPY bun.lock ./ 2>/dev/null || true
44
+
45
+ COPY dist ./dist
46
+
47
+ ENV NODE_ENV=production
48
+
49
+ {% if config.scripts.start %}
50
+ {% for script in config.scripts.start %}
51
+ {{ script }}
52
+ {% endfor %}
53
+ {% endif %}
54
+
55
+ {% if params.dev ===true %}
56
+ RUN npm install --force
57
+ {% else %}
58
+ RUN npm install --omit=dev --force
59
+ {% endif %}
60
+
61
+ {% if config.scripts.end %}
62
+ {% for script in config.scripts.end %}
63
+ {{ script }}
64
+ {% endfor %}
65
+ {% endif %}
66
+
67
+ EXPOSE 8080
68
+
69
+ CMD ["npm", "run", "cli" ]
@@ -0,0 +1,39 @@
1
+ #!/bin/bash
2
+ set -e # Exit immediately if any command fails
3
+
4
+ # Set Google Cloud project
5
+ gcloud config set project "{{ config.gcloud.project_id }}"
6
+
7
+ # Set Google Cloud compute zone (optional, if relevant)
8
+ {% if config.gcloud.compute_zone %}
9
+ gcloud config set compute/zone "{{ config.gcloud.compute_zone }}"
10
+ {% else %}
11
+ echo "No compute zone specified, using the default."
12
+ {% endif %}
13
+
14
+ # Image name in GCR format
15
+ IMAGE_NAME="gcr.io/{{ config.gcloud.project_id }}/{{ params.image_name }}"
16
+
17
+ # Generate image tag, typically using the version or a timestamp
18
+ IMAGE_TAG="{{ params.version }}"
19
+
20
+ # Build arguments
21
+ BUILD_ARGS=""
22
+
23
+ # Add build arguments from config.env
24
+ {% if config.env %}
25
+ {% for key, value in config.env %}
26
+ BUILD_ARGS="$BUILD_ARGS --build-arg {{ key }}='{{ value }}'"
27
+ {% endfor %}
28
+ {% endif %}
29
+
30
+ # Add build arguments from config.args
31
+ {% if config.args %}
32
+ {% for key, value in config.args %}
33
+ BUILD_ARGS="$BUILD_ARGS --build-arg {{ key }}='{{ value }}'"
34
+ {% endfor %}
35
+ {% endif %}
36
+
37
+ # Google Cloud Build command to build the Docker image
38
+ # Build and push the image to GCR
39
+ gcloud builds submit --tag ${IMAGE_NAME}:${IMAGE_TAG} --project {{ config.gcloud.project_id }} {{ BUILD_ARGS }}
@@ -0,0 +1,69 @@
1
+ FROM {{ params.image_base }}
2
+
3
+ {# BUN INSTALL #}
4
+ RUN npm install -g bun
5
+
6
+ {% if config.env %}
7
+ # Add ARG and ENV for config.env
8
+ {% for key, value in config.env %}
9
+ ARG {{ key }}
10
+ ENV {{ key }}=${{ key }}
11
+ {% endfor %}
12
+ {% endif %}
13
+
14
+ {% if config.args %}
15
+ # Add ARG for config.args (build-time only)
16
+ {% for key, value in config.args %}
17
+ ARG {{ key }}
18
+ {% endfor %}
19
+ {% endif %}
20
+
21
+ USER root
22
+
23
+ WORKDIR /app
24
+
25
+ {% if config.files %}
26
+ # Handle files from config.files
27
+ {% for file in config.files %}
28
+ {% if file.srcfile %}
29
+ # Copy file from {{ file.srcfile }} to {{ file.path }}
30
+ COPY {{ file.srcfile }} {{ file.path }}
31
+ {% elif file.content %}
32
+ # Create file {{ file.path }} from raw content
33
+ RUN mkdir -p $(dirname {{ file.path }}) && echo '{{ file.content | replace("\n", "\\n") | replace("'", "'\\''") }}' > {{ file.path }}
34
+ {% elif file.base64 %}
35
+ # Create file {{ file.path }} from base64 content
36
+ RUN mkdir -p $(dirname {{ file.path }}) && echo '{{ file.base64 }}' | base64 -d > {{ file.path }}
37
+ {% endif %}
38
+ {% endfor %}
39
+ {% endif %}
40
+
41
+ COPY package.json ./
42
+ COPY package-lock.json ./ 2>/dev/null || true
43
+ COPY bun.lock ./ 2>/dev/null || true
44
+
45
+ COPY dist ./dist
46
+
47
+ ENV NODE_ENV=production
48
+
49
+ {% if config.scripts.start %}
50
+ {% for script in config.scripts.start %}
51
+ {{ script }}
52
+ {% endfor %}
53
+ {% endif %}
54
+
55
+ {% if params.dev ===true %}
56
+ RUN npm install --force
57
+ {% else %}
58
+ RUN npm install --omit=dev --force
59
+ {% endif %}
60
+
61
+ {% if config.scripts.end %}
62
+ {% for script in config.scripts.end %}
63
+ {{ script }}
64
+ {% endfor %}
65
+ {% endif %}
66
+
67
+ EXPOSE 8080
68
+
69
+ CMD ["npm", "run", "cli" ]
@@ -0,0 +1,44 @@
1
+ #!/bin/bash
2
+ set -e # Exit immediately if any command fails
3
+
4
+ # Image name
5
+ IMAGE_NAME="{{ params.image_name }}"
6
+
7
+ # Generate image tag with current date and time
8
+ IMAGE_TAG="{{ params.version }}"
9
+
10
+ # Manifest name (based on the image name and tag)
11
+ MANIFEST_NAME="${IMAGE_NAME}:${IMAGE_TAG}-multi-arch"
12
+
13
+ # Build arguments
14
+ BUILD_ARGS=""
15
+
16
+ # Add build arguments from config.env
17
+ {% if config.env %}
18
+ {% for key, value in config.env %}
19
+ BUILD_ARGS="$BUILD_ARGS --build-arg {{ key }}='{{ value }}'"
20
+ {% endfor %}
21
+ {% endif %}
22
+
23
+ # Add build arguments from config.args
24
+ {% if config.args %}
25
+ {% for key, value in config.args %}
26
+ BUILD_ARGS="$BUILD_ARGS --build-arg {{ key }}='{{ value }}'"
27
+ {% endfor %}
28
+ {% endif %}
29
+
30
+ # Create or reset the Podman manifest
31
+ if podman manifest inspect $MANIFEST_NAME > /dev/null 2>&1; then
32
+ echo "Manifest $MANIFEST_NAME already exists, resetting..."
33
+ podman manifest rm $MANIFEST_NAME
34
+ fi
35
+ podman manifest create $MANIFEST_NAME
36
+
37
+ # Build and push the image for multiple platforms
38
+ {% if params.push == true %}
39
+ podman build --platform linux/arm64,linux/amd64 $BUILD_ARGS --manifest $MANIFEST_NAME -t ${IMAGE_NAME}:latest -t ${IMAGE_NAME}:${IMAGE_TAG} .
40
+ podman manifest push $MANIFEST_NAME docker://${IMAGE_NAME}:${IMAGE_TAG}
41
+ {% else %}
42
+ podman build --platform linux/arm64,linux/amd64 $BUILD_ARGS --manifest $MANIFEST_NAME -t ${IMAGE_NAME}:latest -t ${IMAGE_NAME}:${IMAGE_TAG} .
43
+ echo "Manifest created locally. To push, use: podman manifest push $MANIFEST_NAME docker://${IMAGE_NAME}:${IMAGE_TAG}"
44
+ {% endif %}
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ {# <key>com.apple.security.app-sandbox</key>
6
+ <true/>
7
+ <key>com.apple.security.device.audio-input</key>
8
+ <true/> #}
9
+ <key>com.apple.security.files.user-selected.read-only</key>
10
+ <true/>
11
+ <key>com.apple.security.network.client</key>
12
+ <true/>
13
+ <key>com.apple.security.cs.allow-jit</key>
14
+ <true/>
15
+ <key>com.apple.security.device.microphone</key>
16
+ <true/>
17
+ </dict>
18
+ </plist>
@@ -0,0 +1,37 @@
1
+ const { app, BrowserWindow } = require('electron');
2
+
3
+ {% if params.protocol.enabled %}
4
+ app.setAsDefaultProtocolClient('{{ params.protocol.scheme }}');
5
+ {% endif %}
6
+
7
+ let mainWindow;
8
+
9
+ function createWindow() {
10
+ mainWindow = new BrowserWindow({
11
+ width: 960,
12
+ height: 720,
13
+ webPreferences: {
14
+ nodeIntegration: true
15
+ }
16
+ });
17
+
18
+ mainWindow.loadFile('src/index.html');
19
+
20
+ mainWindow.on('closed', function () {
21
+ mainWindow = null;
22
+ });
23
+ }
24
+
25
+ app.on('ready', createWindow);
26
+
27
+ app.on('window-all-closed', function () {
28
+ if (process.platform !== 'darwin') {
29
+ app.quit();
30
+ }
31
+ });
32
+
33
+ app.on('activate', function () {
34
+ if (mainWindow === null) {
35
+ createWindow();
36
+ }
37
+ });
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "{{params.package_name}}",
3
+ "version": "{{params.version}}",
4
+ "main": "main.js",
5
+ "scripts": {
6
+ "start": "electron .",
7
+ "pack": "electron-builder --dir",
8
+ "dist": "electron-builder"
9
+ },
10
+ "description": "{{params.description}}",
11
+ "author": "{{params.author}}",
12
+ "build": {
13
+ "appId": "{{params.id}}",
14
+ "directories": {
15
+ "output": "{{params.package_dir}}"
16
+ },
17
+ "mac": {
18
+ "category": "public.app-category.productivity",
19
+ "entitlements": "./mac/entitlements.plist"
20
+ }
21
+ {% if params.protocol.enabled %}
22
+ ,"protocols": [
23
+ {
24
+ "name": "{{params.protocol.name}}",
25
+ "schemes": [
26
+ "{{params.protocol.scheme}}"
27
+ ]
28
+ }
29
+ ]
30
+ {% endif %}
31
+ },
32
+ "devDependencies": {
33
+ "electron": "^26.1",
34
+ "electron-builder": "^24.6"
35
+ }
36
+ }
@@ -0,0 +1,23 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>{{params.title}}</title>
8
+ {% if params.include_css===true %}
9
+ <link rel="stylesheet" href='./dist/{{params.entry}}/index.css' />
10
+ {% endif %}
11
+ <script src="./dist/{{params.entry}}/index.js"></script>
12
+ </head>
13
+ <body style="height:100vh;margin:0;padding:0;background-color: #eeeeee;">
14
+ <div id="container" style="height:100%;"></div>
15
+ <script>
16
+ const { createApp } = window['{{params.bundle_name}}'];
17
+ const run = createApp({
18
+ container: document.getElementById("container"),
19
+ });
20
+ const dispose = run();
21
+ </script>
22
+ </body>
23
+ </html>