@cedarjs/cli 6.0.0-canary.2921 → 6.0.0-canary.2924

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.
@@ -3,6 +3,7 @@ import path from "node:path";
3
3
  import { context } from "@opentelemetry/api";
4
4
  import { suppressTracing } from "@opentelemetry/core";
5
5
  import { Listr } from "listr2";
6
+ import { Parser } from "yargs/helpers";
6
7
  import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
7
8
  import { findScripts } from "@cedarjs/internal/dist/files";
8
9
  import { runScriptFunction } from "../lib/exec.js";
@@ -50,6 +51,17 @@ const handler = async (args) => {
50
51
  delete scriptArgs.l;
51
52
  delete scriptArgs.s;
52
53
  delete scriptArgs.silent;
54
+ if (Array.isArray(scriptArgs._)) {
55
+ const dashBlockIndex = scriptArgs._.findIndex(
56
+ (arg) => typeof arg === "string" && arg.startsWith("-")
57
+ );
58
+ if (dashBlockIndex !== -1) {
59
+ const unparsedTail = scriptArgs._.splice(dashBlockIndex);
60
+ const { _: reparsedPositionals, ...reparsedFlags } = Parser(unparsedTail);
61
+ scriptArgs._.push(...reparsedPositionals);
62
+ Object.assign(scriptArgs, reparsedFlags);
63
+ }
64
+ }
53
65
  const scriptPath = resolveScriptPath(name);
54
66
  if (!scriptPath) {
55
67
  console.error(
@@ -3,12 +3,17 @@
3
3
  // To access your database uncomment the line below
4
4
  // import { db } from 'api/src/lib/db'
5
5
 
6
- interface Args {
7
- _: string[]
8
- [key: string]: unknown
6
+ interface ScriptArgs {
7
+ args: {
8
+ // positional args, e.g. `yarn cedar exec myScript foo 123` -> ['foo', 123]
9
+ // numeric-looking args are parsed as numbers, others as strings
10
+ _: Array<string | number>
11
+ // named flags, e.g. `--force` -> { force: true }
12
+ [flag: string]: unknown
13
+ }
9
14
  }
10
15
 
11
- export default async ({ args }: Args) => {
16
+ export default async ({ args }: ScriptArgs) => {
12
17
  // Your script here...
13
18
  console.log(':: Executing script with args ::')
14
19
  console.log(args)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "6.0.0-canary.2921",
3
+ "version": "6.0.0-canary.2924",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,17 +36,17 @@
36
36
  "@babel/preset-typescript": "7.29.7",
37
37
  "@babel/traverse": "7.29.7",
38
38
  "@babel/types": "7.29.7",
39
- "@cedarjs/api-server": "6.0.0-canary.2921",
40
- "@cedarjs/babel-config": "6.0.0-canary.2921",
41
- "@cedarjs/cli-helpers": "6.0.0-canary.2921",
42
- "@cedarjs/internal": "6.0.0-canary.2921",
43
- "@cedarjs/prerender": "6.0.0-canary.2921",
44
- "@cedarjs/project-config": "6.0.0-canary.2921",
45
- "@cedarjs/structure": "6.0.0-canary.2921",
46
- "@cedarjs/telemetry": "6.0.0-canary.2921",
47
- "@cedarjs/utils": "6.0.0-canary.2921",
48
- "@cedarjs/vite": "6.0.0-canary.2921",
49
- "@cedarjs/web-server": "6.0.0-canary.2921",
39
+ "@cedarjs/api-server": "6.0.0-canary.2924",
40
+ "@cedarjs/babel-config": "6.0.0-canary.2924",
41
+ "@cedarjs/cli-helpers": "6.0.0-canary.2924",
42
+ "@cedarjs/internal": "6.0.0-canary.2924",
43
+ "@cedarjs/prerender": "6.0.0-canary.2924",
44
+ "@cedarjs/project-config": "6.0.0-canary.2924",
45
+ "@cedarjs/structure": "6.0.0-canary.2924",
46
+ "@cedarjs/telemetry": "6.0.0-canary.2924",
47
+ "@cedarjs/utils": "6.0.0-canary.2924",
48
+ "@cedarjs/vite": "6.0.0-canary.2924",
49
+ "@cedarjs/web-server": "6.0.0-canary.2924",
50
50
  "@listr2/prompt-adapter-enquirer": "4.3.0",
51
51
  "@opentelemetry/api": "1.9.1",
52
52
  "@opentelemetry/core": "1.30.1",
@@ -82,7 +82,7 @@
82
82
  "prettier": "3.8.4",
83
83
  "prisma": "7.8.0",
84
84
  "prompts": "2.4.2",
85
- "semver": "7.7.4",
85
+ "semver": "7.8.5",
86
86
  "smol-toml": "1.6.1",
87
87
  "srvx": "0.11.16",
88
88
  "string-env-interpolation": "1.0.1",
@@ -94,7 +94,7 @@
94
94
  "yargs": "17.7.3"
95
95
  },
96
96
  "devDependencies": {
97
- "@cedarjs/framework-tools": "6.0.0-canary.2921",
97
+ "@cedarjs/framework-tools": "6.0.0-canary.2924",
98
98
  "@prisma/dmmf": "7.8.0",
99
99
  "@types/archiver": "^7.0.0",
100
100
  "memfs": "4.68.1",