Skip to content

Commit de87149

Browse files
committed
feat: add check server command
1 parent 85fd1f2 commit de87149

27 files changed

+5907
-1
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/dist

.eslintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["oclif", "oclif-typescript", "prettier"]
3+
}

.github/workflows/onPushToMain.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# test
2+
name: version, tag and github release
3+
4+
on:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
- name: Check if version already exists
15+
id: version-check
16+
run: |
17+
package_version=$(node -p "require('./package.json').version")
18+
exists=$(gh api repos/${{ github.repository }}/releases/tags/v$package_version >/dev/null 2>&1 && echo "true" || echo "")
19+
20+
if [ -n "$exists" ];
21+
then
22+
echo "Version v$package_version already exists"
23+
echo "::warning file=package.json,line=1::Version v$package_version already exists - no release will be created. If you want to create a new release, please update the version in package.json and push again."
24+
echo "skipped=true" >> $GITHUB_OUTPUT
25+
else
26+
echo "Version v$package_version does not exist. Creating release..."
27+
echo "skipped=false" >> $GITHUB_OUTPUT
28+
echo "tag=v$package_version" >> $GITHUB_OUTPUT
29+
fi
30+
env:
31+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
32+
- name: Setup git
33+
if: ${{ steps.version-check.outputs.skipped == 'false' }}
34+
run: |
35+
git config --global user.email ${{ secrets.GH_EMAIL }}
36+
git config --global user.name ${{ secrets.GH_USERNAME }}
37+
- name: Generate oclif README
38+
if: ${{ steps.version-check.outputs.skipped == 'false' }}
39+
id: oclif-readme
40+
run: |
41+
pnpm install
42+
pnpm exec oclif readme
43+
if [ -n "$(git status --porcelain)" ]; then
44+
git add .
45+
git commit -am "chore: update README.md"
46+
git push -u origin ${{ github.ref_name }}
47+
fi
48+
- name: Create Github Release
49+
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5
50+
if: ${{ steps.version-check.outputs.skipped == 'false' }}
51+
with:
52+
name: ${{ steps.version-check.outputs.tag }}
53+
tag: ${{ steps.version-check.outputs.tag }}
54+
commit: ${{ github.ref_name }}
55+
token: ${{ secrets.GH_TOKEN }}
56+
skipIfReleaseExists: true

.github/workflows/onRelease.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: publish
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: latest
15+
- run: pnpm install
16+
- uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c
17+
with:
18+
token: ${{ secrets.NPM_TOKEN }}

.github/workflows/test.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: tests
2+
on:
3+
push:
4+
branches-ignore: [main]
5+
workflow_dispatch:
6+
7+
jobs:
8+
unit-tests:
9+
strategy:
10+
matrix:
11+
os: ['ubuntu-latest', 'windows-latest']
12+
node_version: [lts/-1, lts/*, latest]
13+
fail-fast: false
14+
runs-on: ${{ matrix.os }}
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: ${{ matrix.node_version }}
20+
cache: pnpm
21+
- run: pnpm install
22+
- run: pnpm run build
23+
- run: pnpm run test

.gitignore

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
*-debug.log
2+
*-error.log
3+
**/.DS_Store
4+
/.idea
5+
/dist
6+
/tmp
7+
/node_modules
8+
oclif.manifest.json
9+
10+
11+
yarn.lock
12+
package-lock.json
13+
14+

.mocharc.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"require": [
3+
"ts-node/register"
4+
],
5+
"watch-extensions": [
6+
"ts"
7+
],
8+
"recursive": true,
9+
"reporter": "spec",
10+
"timeout": 60000,
11+
"node-option": [
12+
"loader=ts-node/esm",
13+
"experimental-specifier-resolution=node"
14+
]
15+
}

.prettierrc.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"@oclif/prettier-config"

.vscode/launch.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "node",
6+
"request": "attach",
7+
"name": "Attach",
8+
"port": 9229,
9+
"skipFiles": ["<node_internals>/**"]
10+
},
11+
{
12+
"type": "node",
13+
"request": "launch",
14+
"name": "Execute Command",
15+
"skipFiles": ["<node_internals>/**"],
16+
"program": "${workspaceFolder}/bin/dev",
17+
"args": ["hello", "world"]
18+
}
19+
]
20+
}

bin/dev.cmd

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
3+
node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*

bin/dev.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning
2+
3+
// eslint-disable-next-line n/shebang
4+
import {execute} from '@oclif/core'
5+
6+
await execute({development: true, dir: import.meta.url})

bin/run.cmd

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
3+
node "%~dp0\run" %*

bin/run.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env node
2+
3+
import {execute} from '@oclif/core'
4+
5+
await execute({dir: import.meta.url})

package.json

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"name": "dokploy",
3+
"description": "A CLI to manage dokploy server remotely",
4+
"version": "0.0.0",
5+
"author": "Mauricio Siu",
6+
"bin": {
7+
"dokploy": "./bin/run.js"
8+
},
9+
"bugs": "https://github.com/Dokploy/cli/issues",
10+
"dependencies": {
11+
"@oclif/core": "^3",
12+
"@oclif/plugin-help": "^6",
13+
"@oclif/plugin-plugins": "^5",
14+
"axios": "^1.7.2"
15+
},
16+
"devDependencies": {
17+
"@oclif/prettier-config": "^0.2.1",
18+
"@oclif/test": "^4",
19+
"@types/chai": "^4",
20+
"@types/mocha": "^10",
21+
"@types/node": "^18",
22+
"chai": "^4",
23+
"eslint": "^8",
24+
"eslint-config-oclif": "^5",
25+
"eslint-config-oclif-typescript": "^3",
26+
"eslint-config-prettier": "^9",
27+
"mocha": "^10",
28+
"oclif": "^4",
29+
"shx": "^0.3.3",
30+
"ts-node": "^10",
31+
"typescript": "^5"
32+
},
33+
"engines": {
34+
"node": ">=18.0.0"
35+
},
36+
"files": [
37+
"/bin",
38+
"/dist",
39+
"/oclif.manifest.json"
40+
],
41+
"homepage": "https://github.com/Dokploy/cli",
42+
"keywords": [
43+
"oclif"
44+
],
45+
"license": "MIT",
46+
"main": "dist/index.js",
47+
"type": "module",
48+
"oclif": {
49+
"bin": "dokploy",
50+
"dirname": "dokploy",
51+
"commands": "./dist/commands",
52+
"plugins": [
53+
"@oclif/plugin-help",
54+
"@oclif/plugin-plugins"
55+
],
56+
"topicSeparator": " ",
57+
"topics": {
58+
"hello": {
59+
"description": "Say hello to the world and others"
60+
}
61+
}
62+
},
63+
"repository": "Dokploy/cli",
64+
"scripts": {
65+
"build": "shx rm -rf dist && tsc -b",
66+
"lint": "eslint . --ext .ts",
67+
"postpack": "shx rm -f oclif.manifest.json",
68+
"posttest": "pnpm run lint",
69+
"prepack": "oclif manifest && oclif readme",
70+
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
71+
"version": "oclif readme && git add README.md"
72+
},
73+
"types": "dist/index.d.ts"
74+
}

0 commit comments

Comments
 (0)