@rimelight/cli 0.0.7 → 0.0.9

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rimelight Entertainment
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/bin/rimelight.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimelight/cli",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "private": false,
5
5
  "description": "Rimelight Entertainment's Command Line Interface",
6
6
  "homepage": "https://rimelight.com/docs",
@@ -27,18 +27,23 @@
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
- "scripts": {
31
- "create": "node ./bin/rimelight.js create",
32
- "check": "vp check --fix"
33
- },
34
30
  "dependencies": {
35
31
  "@clack/prompts": "1.8.1",
36
32
  "cross-spawn": "7.0.6",
37
33
  "mri": "1.2.0",
38
34
  "picocolors": "1.1.1"
39
35
  },
36
+ "devDependencies": {
37
+ "@rimelight/config": "0.0.13",
38
+ "@types/node": "26.5.1",
39
+ "typescript": "6.0.3",
40
+ "vite-plus": "0.3.2"
41
+ },
40
42
  "engines": {
41
43
  "node": ">=26.8.2"
42
44
  },
43
- "packageManager": "pnpm@12.4.1"
44
- }
45
+ "scripts": {
46
+ "create": "node ./bin/rimelight.js create",
47
+ "check": "vp check --fix"
48
+ }
49
+ }
package/src/index.js CHANGED
@@ -8,7 +8,7 @@ import spawn from "cross-spawn"
8
8
  const starterPath = path.resolve(import.meta.dirname, "../../starter")
9
9
 
10
10
  // Helper to parse JSON with comments (JSONC)
11
- function parseJsonc(content) {
11
+ export function parseJsonc(content) {
12
12
  let stripped = content.replace(/(?:^|\s)\/\*[\s\S]*?\*\//g, "")
13
13
  stripped = stripped.replace(/(^|[^\\:])\/\/.*$/gm, "$1")
14
14
  return JSON.parse(stripped)
@@ -44,7 +44,7 @@ async function copyDir(src, dest) {
44
44
  }
45
45
 
46
46
  // Helper to update astro.config.ts and wrangler.jsonc with the chosen domain
47
- async function updateDomainConfigs(resolvedTargetDir, domain, displayProjectName) {
47
+ export async function updateDomainConfigs(resolvedTargetDir, domain, displayProjectName) {
48
48
  // Update astro.config.ts
49
49
  const astroConfigPath = path.join(resolvedTargetDir, "astro.config.ts")
50
50
  if (existsSync(astroConfigPath) && domain) {
@@ -360,7 +360,7 @@ export async function runCreate(options) {
360
360
  }
361
361
 
362
362
  // Helper to get nested properties in an object
363
- function getNested(obj, propPath) {
363
+ export function getNested(obj, propPath) {
364
364
  const parts = propPath.split(".")
365
365
  let current = obj
366
366
  for (const part of parts) {
@@ -371,7 +371,7 @@ function getNested(obj, propPath) {
371
371
  }
372
372
 
373
373
  // Helper to set nested properties in an object
374
- function setNested(obj, propPath, value) {
374
+ export function setNested(obj, propPath, value) {
375
375
  const parts = propPath.split(".")
376
376
  let current = obj
377
377
  for (let i = 0; i < parts.length - 1; i++) {
@@ -385,13 +385,13 @@ function setNested(obj, propPath, value) {
385
385
  }
386
386
 
387
387
  // Generic index finder for arrays containing primitives or objects
388
- function findArrayItemIndex(arr, item) {
388
+ export function findArrayItemIndex(arr, item) {
389
389
  const itemStr = JSON.stringify(item)
390
390
  return arr.findIndex((x) => JSON.stringify(x) === itemStr)
391
391
  }
392
392
 
393
393
  // Inject an item at the exact index matched semantically against the starter array order
394
- function injectIntoArray(targetArr, starterArr, value) {
394
+ export function injectIntoArray(targetArr, starterArr, value) {
395
395
  const sIdx = findArrayItemIndex(starterArr, value)
396
396
  if (sIdx === -1) {
397
397
  targetArr.push(value)
@@ -433,7 +433,7 @@ function injectIntoArray(targetArr, starterArr, value) {
433
433
  const cleanLine = (l) => l.trim().replace(/\s+/g, "")
434
434
 
435
435
  // Inject a missing line cleanly at its semantic index inside targetLines based on starterLines order
436
- function injectIntoLines(targetLines, starterLines, value) {
436
+ export function injectIntoLines(targetLines, starterLines, value) {
437
437
  const valueClean = cleanLine(value)
438
438
 
439
439
  const sIdx = starterLines.findIndex((x) => cleanLine(x) === valueClean)
@@ -479,7 +479,7 @@ function injectIntoLines(targetLines, starterLines, value) {
479
479
  }
480
480
 
481
481
  // Reorder target object keys to cleanly match starter template order, preserving custom keys
482
- function reorderKeys(targetObj, starterObj) {
482
+ export function reorderKeys(targetObj, starterObj) {
483
483
  const ordered = {}
484
484
  for (const key of Object.keys(starterObj)) {
485
485
  if (targetObj[key] !== undefined) {
@@ -505,7 +505,7 @@ function reorderKeys(targetObj, starterObj) {
505
505
  }
506
506
 
507
507
  // Resolve domains in injected lines specifically for astro.config.ts
508
- function resolveDomainInLine(line, targetContent) {
508
+ export function resolveDomainInLine(line, targetContent) {
509
509
  const siteMatch = targetContent.match(/site:\s*["']https?:\/\/([^"']+)["']/)
510
510
  const targetDomain = siteMatch ? siteMatch[1] : ""
511
511
  if (targetDomain) {
@@ -517,7 +517,7 @@ function resolveDomainInLine(line, targetContent) {
517
517
  }
518
518
 
519
519
  // Helper to structurally diff JSON/JSONC
520
- function getStructuredJsonDiffs(starterContent, targetContent, file) {
520
+ export function getStructuredJsonDiffs(starterContent, targetContent, file) {
521
521
  const starterObj = parseJsonc(starterContent)
522
522
  const targetObj = parseJsonc(targetContent)
523
523
 
@@ -623,7 +623,7 @@ const cleanLines = (c) =>
623
623
  .filter(Boolean)
624
624
 
625
625
  // Helper to diff files line-by-line
626
- function getStructuredLineDiffs(starterContent, targetContent, file, targetDir) {
626
+ export function getStructuredLineDiffs(starterContent, targetContent, file, targetDir) {
627
627
  let normalizedTarget = targetContent
628
628
  let normalizedStarter = starterContent
629
629
 
@@ -665,7 +665,7 @@ function getStructuredLineDiffs(starterContent, targetContent, file, targetDir)
665
665
  }
666
666
 
667
667
  // Helper to dynamically calculate line-level differences between config files
668
- function getDiffLines(starterContent, targetContent, file, targetDir) {
668
+ export function getDiffLines(starterContent, targetContent, file, targetDir) {
669
669
  // Parse JSONC config structurally (tsconfig, wrangler, knip, lunaria, etc.)
670
670
  if (file.endsWith(".json") || file.endsWith(".jsonc")) {
671
671
  try {