@archlast/cli 0.1.4 → 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/dist/cli.js +46 -26
- package/dist/generator.d.ts.map +1 -1
- package/package.json +1 -1
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 &
|
|
265609
|
+
return (this.mode & constants2.S_IFMT) === constants2.S_IFDIR;
|
|
265610
265610
|
}
|
|
265611
265611
|
isFile() {
|
|
265612
|
-
return (this.mode &
|
|
265612
|
+
return (this.mode & constants2.S_IFMT) === constants2.S_IFREG;
|
|
265613
265613
|
}
|
|
265614
265614
|
isBlockDevice() {
|
|
265615
|
-
return (this.mode &
|
|
265615
|
+
return (this.mode & constants2.S_IFMT) === constants2.S_IFBLK;
|
|
265616
265616
|
}
|
|
265617
265617
|
isCharacterDevice() {
|
|
265618
|
-
return (this.mode &
|
|
265618
|
+
return (this.mode & constants2.S_IFMT) === constants2.S_IFCHR;
|
|
265619
265619
|
}
|
|
265620
265620
|
isSymbolicLink() {
|
|
265621
|
-
return (this.mode &
|
|
265621
|
+
return (this.mode & constants2.S_IFMT) === constants2.S_IFLNK;
|
|
265622
265622
|
}
|
|
265623
265623
|
isFIFO() {
|
|
265624
|
-
return (this.mode &
|
|
265624
|
+
return (this.mode & constants2.S_IFMT) === constants2.S_IFIFO;
|
|
265625
265625
|
}
|
|
265626
265626
|
isSocket() {
|
|
265627
|
-
return (this.mode &
|
|
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
|
|
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 &
|
|
272738
|
-
case
|
|
272737
|
+
switch (mode & constants2.S_IFMT) {
|
|
272738
|
+
case constants2.S_IFBLK:
|
|
272739
272739
|
return "block-device";
|
|
272740
|
-
case
|
|
272740
|
+
case constants2.S_IFCHR:
|
|
272741
272741
|
return "character-device";
|
|
272742
|
-
case
|
|
272742
|
+
case constants2.S_IFDIR:
|
|
272743
272743
|
return "directory";
|
|
272744
|
-
case
|
|
272744
|
+
case constants2.S_IFIFO:
|
|
272745
272745
|
return "fifo";
|
|
272746
|
-
case
|
|
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
|
-
|
|
315332
|
-
|
|
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
|
|
315341
|
-
|
|
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
|
-
|
|
315344
|
-
|
|
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 = {};
|
|
@@ -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.
|
|
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);
|
package/dist/generator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAqD5C,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,cAAc;IAiDtB,OAAO,CAAC,eAAe;YA6RT,2BAA2B;IA4PzC;;OAEG;YACW,gBAAgB;YAyBhB,gBAAgB;YAuDhB,gBAAgB;IAgF9B;;;OAGG;YACW,kBAAkB;YA2GlB,mBAAmB;IA0iBjC,OAAO,CAAC,mBAAmB;IAS3B;;;OAGG;IACG,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoC/D;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAuBzB;;OAEG;IACH,2BAA2B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IA2HtD;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAkB5B"}
|