unitup 0.3.0 → 0.4.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.
@@ -1,158 +0,0 @@
1
- import type {
2
- AppMetadata,
3
- CreateServiceOptions,
4
- DoctorInfo,
5
- InstallServiceOptions,
6
- ListServiceItem,
7
- LogOptions,
8
- NodeDiagnostics,
9
- NormalizedServiceConfig,
10
- PlatformCapabilities,
11
- ServiceFailure,
12
- ServiceStatus
13
- } from '../index.d.ts';
14
-
15
- // Compile-time type assertion checks for all exported interfaces
16
- function typeCheckTest() {
17
- const options: CreateServiceOptions = {
18
- name: 'test-app',
19
- script: './server.js',
20
- runtime: 'python',
21
- runtimeArgs: ['-u'],
22
- command: '/usr/bin/python3',
23
- cwd: '/path/to/cwd',
24
- nodePath: '/usr/bin/node',
25
- env: { NODE_ENV: 'production' },
26
- envFile: '.env',
27
- restart: 'always',
28
- args: ['--port', '3000'],
29
- start: true,
30
- memoryMax: '512M',
31
- memoryHigh: '256M'
32
- };
33
-
34
- const installOpts: InstallServiceOptions = {
35
- ...options,
36
- system: false,
37
- force: true
38
- };
39
-
40
- const status: ServiceStatus = {
41
- name: 'test-app',
42
- installed: true,
43
- state: 'running',
44
- status: 'active (running)',
45
- enabled: true,
46
- pid: '1234',
47
- restarts: '0',
48
- started: '2026-08-23T12:00:00Z',
49
- command: '/usr/bin/node',
50
- arguments: 'server.js',
51
- args: ['server.js'],
52
- cwd: '/path/to/cwd',
53
- platform: 'darwin',
54
- manager: 'launchd'
55
- };
56
-
57
- const doctor: DoctorInfo = {
58
- platform: 'darwin',
59
- systemdAvailable: false,
60
- systemctlAvailable: false,
61
- linux: false,
62
- systemdRunning: false,
63
- userSystemdAvailable: false,
64
- lingering: false,
65
- nodePath: '/usr/bin/node',
66
- nodeVersion: 'v20.0.0',
67
- nodeValid: true,
68
- username: 'user',
69
- unitDir: '/tmp',
70
- unitDirWritable: true
71
- };
72
-
73
- const nodeDiag: NodeDiagnostics = {
74
- found: true,
75
- path: '/usr/bin/node',
76
- version: '20.0.0',
77
- valid: true
78
- };
79
-
80
- const list: ListServiceItem[] = [{ name: 'test-app', status: 'running', pid: '1234' }];
81
-
82
- const failures: ServiceFailure[] = [
83
- {
84
- name: 'api',
85
- group: 'default',
86
- status: 'failed',
87
- exitCode: '1',
88
- restarts: '3',
89
- uptime: '10s'
90
- }
91
- ];
92
-
93
- const caps: PlatformCapabilities = {
94
- serviceManager: 'launchd',
95
- supports: {
96
- install: true,
97
- uninstall: true,
98
- start: true,
99
- stop: true,
100
- restart: true,
101
- enable: true,
102
- disable: true,
103
- status: true,
104
- logs: true,
105
- restartPolicy: true,
106
- userServices: true,
107
- systemServices: true,
108
- memoryLimits: false,
109
- schedule: false
110
- }
111
- };
112
-
113
- const logs: LogOptions = {
114
- follow: true,
115
- lines: 50,
116
- grep: 'ERROR',
117
- json: true
118
- };
119
-
120
- const meta: AppMetadata = {
121
- name: 'test-app',
122
- runtime: 'node',
123
- command: '/usr/bin/node',
124
- args: ['app.js'],
125
- cwd: '/tmp'
126
- };
127
-
128
- const norm: NormalizedServiceConfig = {
129
- name: 'test-app',
130
- displayName: 'Test App',
131
- description: 'Unitup test',
132
- runtime: 'node',
133
- command: '/usr/bin/node',
134
- args: ['app.js'],
135
- cwd: '/tmp',
136
- env: { FOO: 'bar' },
137
- autostart: true,
138
- restart: {
139
- enabled: true,
140
- policy: 'on-failure',
141
- delay: 3000
142
- },
143
- logs: {
144
- stdout: '/tmp/test.log',
145
- stderr: '/tmp/test-error.log'
146
- },
147
- group: 'default',
148
- system: false,
149
- shutdownTimeout: 10000,
150
- resources: {
151
- memoryMax: '512M'
152
- }
153
- };
154
-
155
- console.log(options, installOpts, status, doctor, nodeDiag, list, failures, caps, logs, meta, norm);
156
- }
157
-
158
- typeCheckTest();