@certik/skynet 0.25.1 → 0.25.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.25.3
4
+
5
+ - Add `getDeployBin` function to `cli` library to run ts files via bun so Nomad/Doppler don't try to exec the file directly.
6
+
7
+ ## 0.25.2
8
+
9
+ - Update deploy command to check for bun.lock file.
10
+ - Use --production flag when installing packages.
11
+
3
12
  ## 0.25.1
4
13
 
5
14
  - Updated README.md for deployment instructions
@@ -64,6 +73,7 @@
64
73
  ## 0.20.0
65
74
 
66
75
  - Fix databricks with bun (extra step needed for projects using the lib):
76
+
67
77
  - Copy the patch file `patches/@databricks%2Fsql@1.9.0.patch`
68
78
  - Add the following configs to your `package.json`:
69
79
 
package/dist/app.js CHANGED
@@ -637,6 +637,9 @@ function detectBin() {
637
637
  const wd = detectDirectory(process.argv[1], "package.json");
638
638
  return process.argv[1].slice(wd.length + path.sep.length).replace(path.sep, "/");
639
639
  }
640
+ function getDeployBin(bin) {
641
+ return bin.endsWith(".ts") ? `bun ${bin}` : bin;
642
+ }
640
643
  // src/indexer.ts
641
644
  import meow from "meow";
642
645
  var STATE_TABLE_NAME = "skynet-" + getEnvironment() + "-indexer-state";
@@ -1174,7 +1177,7 @@ var genConfig = ({
1174
1177
  command = "sh"
1175
1178
  args = [
1176
1179
  "-c",
1177
- "cd \${meta.skynet_code_path}/${workingDirectory} && if [ -e bun.lockb ]; then bun install --silent; else yarn install --silent; fi && exec ${cmd}"
1180
+ "cd \${meta.skynet_code_path}/${workingDirectory} && if [ -e bun.lockb ] || [ -e bun.lock ]; then bun install --production --silent; else yarn install --production --silent; fi && exec ${cmd}"
1178
1181
  ]
1179
1182
  }
1180
1183
 
@@ -1834,12 +1837,13 @@ function indexer({
1834
1837
  },
1835
1838
  onDeploy: () => {
1836
1839
  const bin = detectBin();
1840
+ const runBin = getDeployBin(bin);
1837
1841
  const needDoppler = Object.values(env).some((v) => v === SENSITIVE_VALUE);
1838
1842
  const { deploy } = createDeploy({
1839
1843
  binaryName: `${getBinaryName()} deploy`,
1840
1844
  name,
1841
1845
  workingDirectory: detectWorkingDirectory(),
1842
- bin: needDoppler ? `doppler run -- ${bin} run` : `${bin} run`,
1846
+ bin: needDoppler ? `doppler run -- ${runBin} run` : `${runBin} run`,
1843
1847
  selector,
1844
1848
  region,
1845
1849
  env,
@@ -1917,12 +1921,13 @@ function modeIndexer({
1917
1921
  },
1918
1922
  onDeploy: () => {
1919
1923
  const bin = detectBin();
1924
+ const runBin = getDeployBin(bin);
1920
1925
  const needDoppler = Object.values(env).some((v) => v === SENSITIVE_VALUE);
1921
1926
  const { deploy } = createModeDeploy({
1922
1927
  binaryName: `${getBinaryName()} deploy`,
1923
1928
  name,
1924
1929
  workingDirectory: detectWorkingDirectory(),
1925
- bin: needDoppler ? `doppler run -- ${bin} run` : `${bin} run`,
1930
+ bin: needDoppler ? `doppler run -- ${runBin} run` : `${runBin} run`,
1926
1931
  selector,
1927
1932
  region,
1928
1933
  env,
@@ -2012,12 +2017,13 @@ function api({
2012
2017
  },
2013
2018
  onDeploy: () => {
2014
2019
  const bin = detectBin();
2020
+ const runBin = getDeployBin(bin);
2015
2021
  const needDoppler = Object.values(env).some((v) => v === SENSITIVE_VALUE);
2016
2022
  const { deploy } = createDeploy({
2017
2023
  binaryName: `${getBinaryName()} deploy`,
2018
2024
  name,
2019
2025
  workingDirectory: detectWorkingDirectory(),
2020
- bin: needDoppler ? `doppler run -- ${bin} run` : `${bin} run`,
2026
+ bin: needDoppler ? `doppler run -- ${runBin} run` : `${runBin} run`,
2021
2027
  selector,
2022
2028
  region,
2023
2029
  env,
package/dist/cli.d.ts CHANGED
@@ -2,4 +2,5 @@ declare function getBinaryName(): string;
2
2
  declare function detectSkynetDirectory(): string;
3
3
  declare function detectWorkingDirectory(): string;
4
4
  declare function detectBin(): string;
5
- export { getBinaryName, detectSkynetDirectory, detectWorkingDirectory, detectBin };
5
+ declare function getDeployBin(bin: string): string;
6
+ export { getBinaryName, detectSkynetDirectory, detectWorkingDirectory, detectBin, getDeployBin };
package/dist/cli.js CHANGED
@@ -33,7 +33,11 @@ function detectBin() {
33
33
  const wd = detectDirectory(process.argv[1], "package.json");
34
34
  return process.argv[1].slice(wd.length + path.sep.length).replace(path.sep, "/");
35
35
  }
36
+ function getDeployBin(bin) {
37
+ return bin.endsWith(".ts") ? `bun ${bin}` : bin;
38
+ }
36
39
  export {
40
+ getDeployBin,
37
41
  getBinaryName,
38
42
  detectWorkingDirectory,
39
43
  detectSkynetDirectory,
package/dist/deploy.js CHANGED
@@ -90,6 +90,9 @@ function detectBin() {
90
90
  const wd = detectDirectory(process.argv[1], "package.json");
91
91
  return process.argv[1].slice(wd.length + path.sep.length).replace(path.sep, "/");
92
92
  }
93
+ function getDeployBin(bin) {
94
+ return bin.endsWith(".ts") ? `bun ${bin}` : bin;
95
+ }
93
96
  // src/deploy.ts
94
97
  import fs2 from "fs/promises";
95
98
  import fso from "fs";
@@ -172,7 +175,7 @@ var genConfig = ({
172
175
  command = "sh"
173
176
  args = [
174
177
  "-c",
175
- "cd \${meta.skynet_code_path}/${workingDirectory} && if [ -e bun.lockb ]; then bun install --silent; else yarn install --silent; fi && exec ${cmd}"
178
+ "cd \${meta.skynet_code_path}/${workingDirectory} && if [ -e bun.lockb ] || [ -e bun.lock ]; then bun install --production --silent; else yarn install --production --silent; fi && exec ${cmd}"
176
179
  ]
177
180
  }
178
181
 
package/dist/indexer.js CHANGED
@@ -637,6 +637,9 @@ function detectBin() {
637
637
  const wd = detectDirectory(process.argv[1], "package.json");
638
638
  return process.argv[1].slice(wd.length + path.sep.length).replace(path.sep, "/");
639
639
  }
640
+ function getDeployBin(bin) {
641
+ return bin.endsWith(".ts") ? `bun ${bin}` : bin;
642
+ }
640
643
  // src/indexer.ts
641
644
  import meow from "meow";
642
645
  var STATE_TABLE_NAME = "skynet-" + getEnvironment() + "-indexer-state";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@certik/skynet",
3
- "version": "0.25.1",
3
+ "version": "0.25.3",
4
4
  "description": "Skynet Shared JS library",
5
5
  "type": "module",
6
6
  "exports": {
package/src/app.ts CHANGED
@@ -5,7 +5,7 @@ import { createDeploy, createModeDeploy } from "./deploy";
5
5
  import type { Env } from "./deploy";
6
6
  import { startApiApp } from "./api.js";
7
7
  import type { Middleware } from "./api";
8
- import { getBinaryName, detectBin, detectWorkingDirectory } from "./cli.js";
8
+ import { getBinaryName, detectBin, detectWorkingDirectory, getDeployBin } from "./cli.js";
9
9
  import type { Selector } from "./selector";
10
10
  import type { Request, Response, Application } from "express";
11
11
 
@@ -203,13 +203,14 @@ function indexer<TSelector extends Selector>({
203
203
  },
204
204
  onDeploy: () => {
205
205
  const bin = detectBin();
206
+ const runBin = getDeployBin(bin);
206
207
  const needDoppler = Object.values(env).some((v) => v === SENSITIVE_VALUE);
207
208
 
208
209
  const { deploy } = createDeploy({
209
210
  binaryName: `${getBinaryName()} deploy`,
210
211
  name,
211
212
  workingDirectory: detectWorkingDirectory(),
212
- bin: needDoppler ? `doppler run -- ${bin} run` : `${bin} run`,
213
+ bin: needDoppler ? `doppler run -- ${runBin} run` : `${runBin} run`,
213
214
  selector,
214
215
  region,
215
216
  env,
@@ -313,13 +314,14 @@ function modeIndexer<T extends IndexerStateValue, TSelector extends Selector>({
313
314
  },
314
315
  onDeploy: () => {
315
316
  const bin = detectBin();
317
+ const runBin = getDeployBin(bin);
316
318
  const needDoppler = Object.values(env).some((v) => v === SENSITIVE_VALUE);
317
319
 
318
320
  const { deploy } = createModeDeploy({
319
321
  binaryName: `${getBinaryName()} deploy`,
320
322
  name,
321
323
  workingDirectory: detectWorkingDirectory(),
322
- bin: needDoppler ? `doppler run -- ${bin} run` : `${bin} run`,
324
+ bin: needDoppler ? `doppler run -- ${runBin} run` : `${runBin} run`,
323
325
  selector,
324
326
  region,
325
327
  env,
@@ -437,13 +439,14 @@ function api({
437
439
  },
438
440
  onDeploy: () => {
439
441
  const bin = detectBin();
442
+ const runBin = getDeployBin(bin);
440
443
  const needDoppler = Object.values(env).some((v) => v === SENSITIVE_VALUE);
441
444
 
442
445
  const { deploy } = createDeploy({
443
446
  binaryName: `${getBinaryName()} deploy`,
444
447
  name,
445
448
  workingDirectory: detectWorkingDirectory(),
446
- bin: needDoppler ? `doppler run -- ${bin} run` : `${bin} run`,
449
+ bin: needDoppler ? `doppler run -- ${runBin} run` : `${runBin} run`,
447
450
  selector,
448
451
  region,
449
452
  env,
package/src/cli.ts CHANGED
@@ -45,4 +45,9 @@ function detectBin() {
45
45
  return process.argv[1].slice(wd.length + path.sep.length).replace(path.sep, "/");
46
46
  }
47
47
 
48
- export { getBinaryName, detectSkynetDirectory, detectWorkingDirectory, detectBin };
48
+ // Run ts files via bun so Nomad/Doppler don't try to exec the file directly.
49
+ function getDeployBin(bin: string): string {
50
+ return bin.endsWith(".ts") ? `bun ${bin}` : bin;
51
+ }
52
+
53
+ export { getBinaryName, detectSkynetDirectory, detectWorkingDirectory, detectBin, getDeployBin };
package/src/deploy.ts CHANGED
@@ -143,7 +143,7 @@ const genConfig = ({
143
143
  command = "sh"
144
144
  args = [
145
145
  "-c",
146
- "cd \${meta.skynet_code_path}/${workingDirectory} && if [ -e bun.lockb ]; then bun install --silent; else yarn install --silent; fi && exec ${cmd}"
146
+ "cd \${meta.skynet_code_path}/${workingDirectory} && if [ -e bun.lockb ] || [ -e bun.lock ]; then bun install --production --silent; else yarn install --production --silent; fi && exec ${cmd}"
147
147
  ]
148
148
  }
149
149