flightdeck 0.3.0 → 0.3.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.
- package/dist/flightdeck.x.js +6 -1
- package/dist/flightdeck.x.js.map +1 -1
- package/package.json +4 -4
- package/src/flightdeck.x.ts +13 -2
package/dist/flightdeck.x.js
CHANGED
|
@@ -95,18 +95,22 @@ const { inputs, writeJsonSchema } = cli({
|
|
|
95
95
|
cliName: `flightdeck`,
|
|
96
96
|
routes: optional({
|
|
97
97
|
schema: null,
|
|
98
|
+
kill: optional({ $configPath: null }),
|
|
98
99
|
$configPath: null
|
|
99
100
|
}),
|
|
100
101
|
routeOptions: {
|
|
101
102
|
"": FLIGHTDECK_MANUAL,
|
|
102
103
|
$configPath: FLIGHTDECK_MANUAL,
|
|
103
104
|
kill: KILL_MANUAL,
|
|
105
|
+
"kill/$configPath": KILL_MANUAL,
|
|
104
106
|
schema: SCHEMA_MANUAL
|
|
105
107
|
},
|
|
106
108
|
debugOutput: true,
|
|
107
109
|
discoverConfigPath: (args) => {
|
|
108
110
|
if (args[0] === `schema`) return;
|
|
109
|
-
|
|
111
|
+
let idx = 0;
|
|
112
|
+
if (args[0] === `kill`) idx = 1;
|
|
113
|
+
return args[idx] ?? path.join(process.cwd(), `flightdeck.config.json`);
|
|
110
114
|
}
|
|
111
115
|
}, console)(process.argv);
|
|
112
116
|
switch (inputs.case) {
|
|
@@ -117,6 +121,7 @@ switch (inputs.case) {
|
|
|
117
121
|
}
|
|
118
122
|
break;
|
|
119
123
|
case `kill`:
|
|
124
|
+
case `kill/$configPath`:
|
|
120
125
|
{
|
|
121
126
|
const { flightdeckRootDir, packageName } = inputs.opts;
|
|
122
127
|
await FlightDeck.kill(flightdeckRootDir, packageName);
|
package/dist/flightdeck.x.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flightdeck.x.js","names":[],"sources":["../src/flightdeck.x.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport * as path from \"node:path\"\n\nimport { type } from \"arktype\"\nimport type { OptionsGroup } from \"comline\"\nimport {\n\tcli,\n\toptional,\n\toptions,\n\tparseBooleanOption,\n\tparseNumberOption,\n} from \"comline\"\n\nimport type { FlightDeckOptions } from \"./flightdeck.lib.ts\"\nimport { FlightDeck, FlightDeckLogger } from \"./flightdeck.lib.ts\"\n\nconst CLI_LOGGER = new FlightDeckLogger(`comline`, process.pid, undefined, {\n\tjsonLogging: true,\n})\nObject.assign(console, {\n\tlog: CLI_LOGGER.info.bind(CLI_LOGGER),\n\tinfo: CLI_LOGGER.info.bind(CLI_LOGGER),\n\twarn: CLI_LOGGER.warn.bind(CLI_LOGGER),\n\terror: CLI_LOGGER.error.bind(CLI_LOGGER),\n})\n\nconst FLIGHTDECK_MANUAL = options(\n\t`Run the FlightDeck process manager.`,\n\ttype({\n\t\t\"port?\": `number`,\n\t\tpackageName: `string`,\n\t\tservices: { \"[string]\": { run: `string`, waitFor: `boolean` } },\n\t\tflightdeckRootDir: `string`,\n\t\tscripts: {\n\t\t\tdownload: `string`,\n\t\t\tinstall: `string`,\n\t\t\tcheckAvailability: `string`,\n\t\t},\n\t\t\"jsonLogging?\": `boolean`,\n\t}),\n\t{\n\t\tport: {\n\t\t\tflag: `p`,\n\t\t\trequired: false,\n\t\t\tdescription: `Port to run the flightdeck server on.`,\n\t\t\texample: `--port=8080`,\n\t\t\tparse: parseNumberOption,\n\t\t},\n\t\tpackageName: {\n\t\t\tflag: `n`,\n\t\t\trequired: true,\n\t\t\tdescription: `Name of the package.`,\n\t\t\texample: `--packageName=\"my-app\"`,\n\t\t},\n\t\tservices: {\n\t\t\tflag: `s`,\n\t\t\trequired: true,\n\t\t\tdescription: `Map of service names to executables.`,\n\t\t\texample: `--services=\"{\\\\\"frontend\\\\\":{\\\\\"run\\\\\":\\\\\"./frontend\\\\\",\\\\\"waitFor\\\\\":false},\\\\\"backend\\\\\":{\\\\\"run\\\\\":\\\\\"./backend\\\\\",\\\\\"waitFor\\\\\":true}}\"`,\n\t\t\tparse: JSON.parse,\n\t\t},\n\t\tflightdeckRootDir: {\n\t\t\tflag: `d`,\n\t\t\trequired: true,\n\t\t\tdescription: `Directory where the service is stored.`,\n\t\t\texample: `--flightdeckRootDir=\"./services/sample/repo/my-app/current\"`,\n\t\t},\n\t\tscripts: {\n\t\t\tflag: `r`,\n\t\t\trequired: true,\n\t\t\tdescription: `Map of scripts to run.`,\n\t\t\texample: `--scripts=\"{\\\\\"download\\\\\":\\\\\"npm i\",\\\\\"install\\\\\":\\\\\"npm run build\\\\\"}\"`,\n\t\t\tparse: JSON.parse,\n\t\t},\n\t\tjsonLogging: {\n\t\t\tflag: `j`,\n\t\t\trequired: false,\n\t\t\tdescription: `Enable json logging.`,\n\t\t\texample: `--jsonLogging`,\n\t\t\tparse: parseBooleanOption,\n\t\t},\n\t},\n) satisfies OptionsGroup<FlightDeckOptions>\n\nconst KILL_MANUAL = options(\n\t`Kill the FlightDeck process.`,\n\ttype({ flightdeckRootDir: `string`, packageName: `string` }),\n\t{\n\t\tflightdeckRootDir: {\n\t\t\tflag: `d`,\n\t\t\trequired: true,\n\t\t\tdescription: `Directory where the service is stored.`,\n\t\t\texample: `--flightdeckRootDir=\"./services/sample/repo/my-app/current\"`,\n\t\t},\n\t\tpackageName: {\n\t\t\tflag: `n`,\n\t\t\trequired: true,\n\t\t\tdescription: `Name of the package.`,\n\t\t\texample: `--packageName=\"my-app\"`,\n\t\t},\n\t},\n)\n\nconst SCHEMA_MANUAL = options(\n\t`Write a json schema for the FlightDeck options.`,\n\ttype({ \"outdir?\": `string` }),\n\t{\n\t\toutdir: {\n\t\t\tflag: `o`,\n\t\t\trequired: false,\n\t\t\tdescription: `Directory to write the schema to.`,\n\t\t\texample: `--outdir=./dist`,\n\t\t},\n\t},\n) satisfies OptionsGroup<{ outdir?: string | undefined }>\n\nconst parse = cli(\n\t{\n\t\tcliName: `flightdeck`,\n\t\troutes: optional({
|
|
1
|
+
{"version":3,"file":"flightdeck.x.js","names":[],"sources":["../src/flightdeck.x.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport * as path from \"node:path\"\nimport { kill } from \"node:process\"\n\nimport { type } from \"arktype\"\nimport type { OptionsGroup } from \"comline\"\nimport {\n\tcli,\n\toptional,\n\toptions,\n\tparseBooleanOption,\n\tparseNumberOption,\n} from \"comline\"\n\nimport type { FlightDeckOptions } from \"./flightdeck.lib.ts\"\nimport { FlightDeck, FlightDeckLogger } from \"./flightdeck.lib.ts\"\n\nconst CLI_LOGGER = new FlightDeckLogger(`comline`, process.pid, undefined, {\n\tjsonLogging: true,\n})\nObject.assign(console, {\n\tlog: CLI_LOGGER.info.bind(CLI_LOGGER),\n\tinfo: CLI_LOGGER.info.bind(CLI_LOGGER),\n\twarn: CLI_LOGGER.warn.bind(CLI_LOGGER),\n\terror: CLI_LOGGER.error.bind(CLI_LOGGER),\n})\n\nconst FLIGHTDECK_MANUAL = options(\n\t`Run the FlightDeck process manager.`,\n\ttype({\n\t\t\"port?\": `number`,\n\t\tpackageName: `string`,\n\t\tservices: { \"[string]\": { run: `string`, waitFor: `boolean` } },\n\t\tflightdeckRootDir: `string`,\n\t\tscripts: {\n\t\t\tdownload: `string`,\n\t\t\tinstall: `string`,\n\t\t\tcheckAvailability: `string`,\n\t\t},\n\t\t\"jsonLogging?\": `boolean`,\n\t}),\n\t{\n\t\tport: {\n\t\t\tflag: `p`,\n\t\t\trequired: false,\n\t\t\tdescription: `Port to run the flightdeck server on.`,\n\t\t\texample: `--port=8080`,\n\t\t\tparse: parseNumberOption,\n\t\t},\n\t\tpackageName: {\n\t\t\tflag: `n`,\n\t\t\trequired: true,\n\t\t\tdescription: `Name of the package.`,\n\t\t\texample: `--packageName=\"my-app\"`,\n\t\t},\n\t\tservices: {\n\t\t\tflag: `s`,\n\t\t\trequired: true,\n\t\t\tdescription: `Map of service names to executables.`,\n\t\t\texample: `--services=\"{\\\\\"frontend\\\\\":{\\\\\"run\\\\\":\\\\\"./frontend\\\\\",\\\\\"waitFor\\\\\":false},\\\\\"backend\\\\\":{\\\\\"run\\\\\":\\\\\"./backend\\\\\",\\\\\"waitFor\\\\\":true}}\"`,\n\t\t\tparse: JSON.parse,\n\t\t},\n\t\tflightdeckRootDir: {\n\t\t\tflag: `d`,\n\t\t\trequired: true,\n\t\t\tdescription: `Directory where the service is stored.`,\n\t\t\texample: `--flightdeckRootDir=\"./services/sample/repo/my-app/current\"`,\n\t\t},\n\t\tscripts: {\n\t\t\tflag: `r`,\n\t\t\trequired: true,\n\t\t\tdescription: `Map of scripts to run.`,\n\t\t\texample: `--scripts=\"{\\\\\"download\\\\\":\\\\\"npm i\",\\\\\"install\\\\\":\\\\\"npm run build\\\\\"}\"`,\n\t\t\tparse: JSON.parse,\n\t\t},\n\t\tjsonLogging: {\n\t\t\tflag: `j`,\n\t\t\trequired: false,\n\t\t\tdescription: `Enable json logging.`,\n\t\t\texample: `--jsonLogging`,\n\t\t\tparse: parseBooleanOption,\n\t\t},\n\t},\n) satisfies OptionsGroup<FlightDeckOptions>\n\nconst KILL_MANUAL = options(\n\t`Kill the FlightDeck process.`,\n\ttype({ flightdeckRootDir: `string`, packageName: `string` }),\n\t{\n\t\tflightdeckRootDir: {\n\t\t\tflag: `d`,\n\t\t\trequired: true,\n\t\t\tdescription: `Directory where the service is stored.`,\n\t\t\texample: `--flightdeckRootDir=\"./services/sample/repo/my-app/current\"`,\n\t\t},\n\t\tpackageName: {\n\t\t\tflag: `n`,\n\t\t\trequired: true,\n\t\t\tdescription: `Name of the package.`,\n\t\t\texample: `--packageName=\"my-app\"`,\n\t\t},\n\t},\n)\n\nconst SCHEMA_MANUAL = options(\n\t`Write a json schema for the FlightDeck options.`,\n\ttype({ \"outdir?\": `string` }),\n\t{\n\t\toutdir: {\n\t\t\tflag: `o`,\n\t\t\trequired: false,\n\t\t\tdescription: `Directory to write the schema to.`,\n\t\t\texample: `--outdir=./dist`,\n\t\t},\n\t},\n) satisfies OptionsGroup<{ outdir?: string | undefined }>\n\nconst parse = cli(\n\t{\n\t\tcliName: `flightdeck`,\n\t\troutes: optional({\n\t\t\tschema: null,\n\t\t\tkill: optional({ $configPath: null }),\n\t\t\t$configPath: null,\n\t\t}),\n\t\trouteOptions: {\n\t\t\t\"\": FLIGHTDECK_MANUAL,\n\t\t\t$configPath: FLIGHTDECK_MANUAL,\n\t\t\tkill: KILL_MANUAL,\n\t\t\t\"kill/$configPath\": KILL_MANUAL,\n\t\t\tschema: SCHEMA_MANUAL,\n\t\t},\n\t\tdebugOutput: true,\n\t\tdiscoverConfigPath: (args) => {\n\t\t\tif (args[0] === `schema`) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet idx = 0\n\t\t\tif (args[0] === `kill`) {\n\t\t\t\tidx = 1\n\t\t\t}\n\t\t\tconst configPath =\n\t\t\t\targs[idx] ?? path.join(process.cwd(), `flightdeck.config.json`)\n\t\t\treturn configPath\n\t\t},\n\t},\n\tconsole,\n)\n\nconst { inputs, writeJsonSchema } = parse(process.argv)\n\nswitch (inputs.case) {\n\tcase `schema`:\n\t\t{\n\t\t\tconst { outdir } = inputs.opts\n\t\t\twriteJsonSchema(outdir ?? `.`)\n\t\t}\n\t\tbreak\n\tcase `kill`:\n\tcase `kill/$configPath`:\n\t\t{\n\t\t\tconst { flightdeckRootDir, packageName } = inputs.opts\n\t\t\tawait FlightDeck.kill(flightdeckRootDir, packageName)\n\t\t}\n\t\tbreak\n\tcase ``:\n\tcase `$configPath`: {\n\t\tnew FlightDeck(inputs.opts)\n\t}\n}\n"],"mappings":";;;;;;;AAkBA,MAAM,aAAa,IAAI,iBAAiB,WAAW,QAAQ,KAAK,QAAW,EAC1E,aAAa,MACb,CAAC;AACF,OAAO,OAAO,SAAS;CACtB,KAAK,WAAW,KAAK,KAAK,WAAW;CACrC,MAAM,WAAW,KAAK,KAAK,WAAW;CACtC,MAAM,WAAW,KAAK,KAAK,WAAW;CACtC,OAAO,WAAW,MAAM,KAAK,WAAW;CACxC,CA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;CACb,qBAAqB,SAAS;AAC7B,MAAI,KAAK,OAAO,SACf;EAED,IAAI,MAAM;AACV,MAAI,KAAK,OAAO,OACf,OAAM;AAIP,SADC,KAAK,QAAQ,KAAK,KAAK,QAAQ,KAAK,EAAE,yBAAyB;;CAGjE,EACD,QACA,CAEyC,QAAQ,KAAK;AAEvD,QAAQ,OAAO,MAAf;CACC,KAAK;EACJ;GACC,MAAM,EAAE,WAAW,OAAO;AAC1B,mBAAgB,UAAU,IAAI;;AAE/B;CACD,KAAK;CACL,KAAK;EACJ;GACC,MAAM,EAAE,mBAAmB,gBAAgB,OAAO;AAClD,SAAM,WAAW,KAAK,mBAAmB,YAAY;;AAEtD;CACD,KAAK;CACL,KAAK,cACJ,KAAI,WAAW,OAAO,KAAK"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flightdeck",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jeremy Banka",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@t3-oss/env-core": "0.13.8",
|
|
32
32
|
"cron": "4.3.4",
|
|
33
33
|
"atom.io": "0.44.3",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
34
|
+
"safedeposit": "0.1.2",
|
|
35
|
+
"comline": "0.4.3"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@biomejs/js-api": "4.0.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@types/bun": "npm:bun-types@1.3.2",
|
|
41
41
|
"@types/node": "24.10.0",
|
|
42
42
|
"@types/tmp": "0.2.6",
|
|
43
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
43
|
+
"@typescript/native-preview": "7.0.0-dev.20251109.1",
|
|
44
44
|
"concurrently": "9.2.1",
|
|
45
45
|
"eslint": "9.39.1",
|
|
46
46
|
"json-schema-to-zod": "2.6.1",
|
package/src/flightdeck.x.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import * as path from "node:path"
|
|
4
|
+
import { kill } from "node:process"
|
|
4
5
|
|
|
5
6
|
import { type } from "arktype"
|
|
6
7
|
import type { OptionsGroup } from "comline"
|
|
@@ -118,11 +119,16 @@ const SCHEMA_MANUAL = options(
|
|
|
118
119
|
const parse = cli(
|
|
119
120
|
{
|
|
120
121
|
cliName: `flightdeck`,
|
|
121
|
-
routes: optional({
|
|
122
|
+
routes: optional({
|
|
123
|
+
schema: null,
|
|
124
|
+
kill: optional({ $configPath: null }),
|
|
125
|
+
$configPath: null,
|
|
126
|
+
}),
|
|
122
127
|
routeOptions: {
|
|
123
128
|
"": FLIGHTDECK_MANUAL,
|
|
124
129
|
$configPath: FLIGHTDECK_MANUAL,
|
|
125
130
|
kill: KILL_MANUAL,
|
|
131
|
+
"kill/$configPath": KILL_MANUAL,
|
|
126
132
|
schema: SCHEMA_MANUAL,
|
|
127
133
|
},
|
|
128
134
|
debugOutput: true,
|
|
@@ -130,8 +136,12 @@ const parse = cli(
|
|
|
130
136
|
if (args[0] === `schema`) {
|
|
131
137
|
return
|
|
132
138
|
}
|
|
139
|
+
let idx = 0
|
|
140
|
+
if (args[0] === `kill`) {
|
|
141
|
+
idx = 1
|
|
142
|
+
}
|
|
133
143
|
const configPath =
|
|
134
|
-
args[
|
|
144
|
+
args[idx] ?? path.join(process.cwd(), `flightdeck.config.json`)
|
|
135
145
|
return configPath
|
|
136
146
|
},
|
|
137
147
|
},
|
|
@@ -148,6 +158,7 @@ switch (inputs.case) {
|
|
|
148
158
|
}
|
|
149
159
|
break
|
|
150
160
|
case `kill`:
|
|
161
|
+
case `kill/$configPath`:
|
|
151
162
|
{
|
|
152
163
|
const { flightdeckRootDir, packageName } = inputs.opts
|
|
153
164
|
await FlightDeck.kill(flightdeckRootDir, packageName)
|