@archlast/cli 0.1.3 → 0.1.5

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/README.md CHANGED
@@ -62,7 +62,7 @@ Example `archlast.config.js`:
62
62
  export default {
63
63
  docker: {
64
64
  image: "algochad/archlast-server",
65
- tag: "0.1.0",
65
+ tag: "latest",
66
66
  containerName: "archlast-server",
67
67
  volumeName: "archlast-data",
68
68
  },
package/dist/cli.js CHANGED
@@ -263846,7 +263846,7 @@ ${suffix}`;
263846
263846
  var require_SFTP = __commonJS((exports, module) => {
263847
263847
  var EventEmitter4 = __require("events");
263848
263848
  var fs7 = __require("fs");
263849
- var { constants } = fs7;
263849
+ var { constants: constants2 } = fs7;
263850
263850
  var {
263851
263851
  Readable: ReadableStream,
263852
263852
  Writable: WritableStream
@@ -265606,25 +265606,25 @@ var require_SFTP = __commonJS((exports, module) => {
265606
265606
  this.extended = initial && initial.extended;
265607
265607
  }
265608
265608
  isDirectory() {
265609
- return (this.mode & constants.S_IFMT) === constants.S_IFDIR;
265609
+ return (this.mode & constants2.S_IFMT) === constants2.S_IFDIR;
265610
265610
  }
265611
265611
  isFile() {
265612
- return (this.mode & constants.S_IFMT) === constants.S_IFREG;
265612
+ return (this.mode & constants2.S_IFMT) === constants2.S_IFREG;
265613
265613
  }
265614
265614
  isBlockDevice() {
265615
- return (this.mode & constants.S_IFMT) === constants.S_IFBLK;
265615
+ return (this.mode & constants2.S_IFMT) === constants2.S_IFBLK;
265616
265616
  }
265617
265617
  isCharacterDevice() {
265618
- return (this.mode & constants.S_IFMT) === constants.S_IFCHR;
265618
+ return (this.mode & constants2.S_IFMT) === constants2.S_IFCHR;
265619
265619
  }
265620
265620
  isSymbolicLink() {
265621
- return (this.mode & constants.S_IFMT) === constants.S_IFLNK;
265621
+ return (this.mode & constants2.S_IFMT) === constants2.S_IFLNK;
265622
265622
  }
265623
265623
  isFIFO() {
265624
- return (this.mode & constants.S_IFMT) === constants.S_IFIFO;
265624
+ return (this.mode & constants2.S_IFMT) === constants2.S_IFIFO;
265625
265625
  }
265626
265626
  isSocket() {
265627
- return (this.mode & constants.S_IFMT) === constants.S_IFSOCK;
265627
+ return (this.mode & constants2.S_IFMT) === constants2.S_IFSOCK;
265628
265628
  }
265629
265629
  }
265630
265630
  function attrsToBytes(attrs) {
@@ -272716,7 +272716,7 @@ var require_end_of_stream2 = __commonJS((exports, module) => {
272716
272716
 
272717
272717
  // ../../node_modules/.bun/tar-stream@2.2.0/node_modules/tar-stream/pack.js
272718
272718
  var require_pack = __commonJS((exports, module) => {
272719
- var constants = require_fs_constants();
272719
+ var constants2 = require_fs_constants();
272720
272720
  var eos = require_end_of_stream2();
272721
272721
  var inherits = require_inherits();
272722
272722
  var alloc = Buffer.alloc;
@@ -272734,16 +272734,16 @@ var require_pack = __commonJS((exports, module) => {
272734
272734
  self2.push(END_OF_TAR.slice(0, 512 - size));
272735
272735
  };
272736
272736
  function modeToType(mode) {
272737
- switch (mode & constants.S_IFMT) {
272738
- case constants.S_IFBLK:
272737
+ switch (mode & constants2.S_IFMT) {
272738
+ case constants2.S_IFBLK:
272739
272739
  return "block-device";
272740
- case constants.S_IFCHR:
272740
+ case constants2.S_IFCHR:
272741
272741
  return "character-device";
272742
- case constants.S_IFDIR:
272742
+ case constants2.S_IFDIR:
272743
272743
  return "directory";
272744
- case constants.S_IFIFO:
272744
+ case constants2.S_IFIFO:
272745
272745
  return "fifo";
272746
- case constants.S_IFLNK:
272746
+ case constants2.S_IFLNK:
272747
272747
  return "symlink";
272748
272748
  }
272749
272749
  return "file";
@@ -314824,6 +314824,22 @@ async function generateDI(outputDir, injectables) {
314824
314824
  }
314825
314825
 
314826
314826
  // src/generator.ts
314827
+ async function readTextIfExists(filePath) {
314828
+ const bun = globalThis.Bun;
314829
+ if (bun?.file) {
314830
+ const file = bun.file(filePath);
314831
+ if (await file.exists()) {
314832
+ return await file.text();
314833
+ }
314834
+ return null;
314835
+ }
314836
+ try {
314837
+ await fs4.promises.access(filePath, fs4.constants.F_OK);
314838
+ return await fs4.promises.readFile(filePath, "utf-8");
314839
+ } catch {
314840
+ return null;
314841
+ }
314842
+ }
314827
314843
  function resolveImport(typeText, sourceFile) {
314828
314844
  return typeText.replace(/import\("([^"]+)"\)\./g, (match2, path6) => {
314829
314845
  if (path6.includes("packages/server/src/db/sqlite")) {
@@ -315328,20 +315344,24 @@ class TypeGenerator {
315328
315344
  const schemaIndexPath = join5(schemaFolderPath, "index.ts");
315329
315345
  let schemaContent = "";
315330
315346
  let schemaSource = "";
315331
- if (await Bun.file(schemaPath).exists()) {
315332
- schemaContent = await Bun.file(schemaPath).text();
315347
+ const schemaFile = await readTextIfExists(schemaPath);
315348
+ if (schemaFile !== null) {
315349
+ schemaContent = schemaFile;
315333
315350
  schemaSource = "schema.ts";
315334
315351
  console.log(`Reading schema from ${schemaPath}`);
315335
- } else if (await Bun.file(schemaIndexPath).exists()) {
315336
- schemaContent = await Bun.file(schemaIndexPath).text();
315337
- schemaSource = "schema/index.ts";
315338
- console.log(`Reading schema from ${schemaIndexPath}`);
315339
315352
  } else {
315340
- const folderFiles = await this.scanSchemaFolder(schemaFolderPath);
315341
- schemaContent = folderFiles.map((f) => f.content).join(`
315353
+ const schemaIndexFile = await readTextIfExists(schemaIndexPath);
315354
+ if (schemaIndexFile !== null) {
315355
+ schemaContent = schemaIndexFile;
315356
+ schemaSource = "schema/index.ts";
315357
+ console.log(`Reading schema from ${schemaIndexPath}`);
315358
+ } else {
315359
+ const folderFiles = await this.scanSchemaFolder(schemaFolderPath);
315360
+ schemaContent = folderFiles.map((f) => f.content).join(`
315342
315361
  `);
315343
- schemaSource = "schema/*.ts";
315344
- console.log(`Reading schema from folder: ${schemaFolderPath}`);
315362
+ schemaSource = "schema/*.ts";
315363
+ console.log(`Reading schema from folder: ${schemaFolderPath}`);
315364
+ }
315345
315365
  }
315346
315366
  const tableMatches = schemaContent.matchAll(/(?:export\s+(?:const|let)\s+)?(\w+)\s*(?::\s*\w+)?\s*[:=]\s*defineTable\s*\(\s*\{([\s\S]+?)\n\s*}(?:,\s*({[\s\S]+?\n\s*}))?\s*\)/g);
315347
315367
  const tables = {};
@@ -320991,7 +321011,7 @@ import { createRequire as createRequire2 } from "module";
320991
321011
  var DEFAULTS = {
320992
321012
  docker: {
320993
321013
  image: "algochad/archlast-server",
320994
- tag: "0.1.0",
321014
+ tag: "latest",
320995
321015
  containerName: "archlast-server",
320996
321016
  volumeName: "archlast-data"
320997
321017
  },
@@ -322320,7 +322340,7 @@ async function configCommand(options) {
322320
322340
 
322321
322341
  // src/cli.ts
322322
322342
  var program2 = new Command;
322323
- program2.name("archlast").description("Archlast CLI for development and deployment").version("0.1.1");
322343
+ program2.name("archlast").description("Archlast CLI for development and deployment").version("0.1.5");
322324
322344
  program2.command("build").description("Generate types without deploying").option("--path <path>", "Path to archlast folder", ".").action(buildCommand);
322325
322345
  program2.command("dev").description("Start development mode with file watching").option("-p, --port <port>", "Server port", "3001").option("--path <path>", "Path to archlast folder", ".").option("--server <url>", "Server URL for code upload", "http://localhost:4000").option("--max-poll <number>", "Maximum server polling retries", "30").action(devCommand);
322326
322346
  program2.command("deploy").description("Deploy to production").option("--path <path>", "Path to archlast folder", ".").option("--server <url>", "Server URL for code upload", "http://localhost:4000").option("--max-poll <number>", "Maximum server polling retries", "30").action(deployCommand);
@@ -1 +1 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAmC5C,qBAAa,aAAa;IACtB,OAAO,CAAC,YAAY,CAAS;gBAEjB,YAAY,EAAE,MAAM;IAI1B,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;YAiDzC,uBAAuB;YAgDvB,0BAA0B;IA6CxC,OAAO,CAAC,kBAAkB;IA6H1B,OAAO,CAAC,eAAe;IA+GvB,OAAO,CAAC,cAA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CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archlast/cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Archlast CLI for development and deployment",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",