creatium 0.1.15 → 0.1.17

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/main.cjs CHANGED
@@ -754,6 +754,22 @@ const cache = async (opts) => {
754
754
  };
755
755
  };
756
756
 
757
+ const getClosestPackageJson = async (startDir = process__default.cwd()) => {
758
+ let currentDir = resolvePath(startDir);
759
+ while (true) {
760
+ const pkgPath = joinPath(currentDir, "package.json");
761
+ if (await existsFile(pkgPath)) return pkgPath;
762
+ const parentDir = getDirName(currentDir);
763
+ if (parentDir === currentDir)
764
+ throw new Error("No package.json found in any parent directory.");
765
+ currentDir = parentDir;
766
+ }
767
+ };
768
+ const getClosestPackageDir = async (startDir = process__default.cwd()) => {
769
+ const pkgPath = await getClosestPackageJson(startDir);
770
+ return getDirName(pkgPath);
771
+ };
772
+
757
773
  const _sys = {
758
774
  __proto__: null,
759
775
  arePathsEqual: arePathsEqual,
@@ -770,6 +786,8 @@ const _sys = {
770
786
  getAbsolutePath: getAbsolutePath,
771
787
  getArch: getArch,
772
788
  getBaseName: getBaseName,
789
+ getClosestPackageDir: getClosestPackageDir,
790
+ getClosestPackageJson: getClosestPackageJson,
773
791
  getCurrentDir: getCurrentDir,
774
792
  getDirName: getDirName,
775
793
  getExtName: getExtName,
@@ -1530,9 +1548,22 @@ class CreatiumCore {
1530
1548
  this.debugMode = false;
1531
1549
  this.#style = { tick: this.utils.style.color.green(this.utils.style.color.dim("\u2713")) };
1532
1550
  }
1551
+ #_spinnerFN;
1533
1552
  /** Force debug mode */
1534
1553
  set debugMode(value) {
1535
1554
  this.#core.debugMode = value;
1555
+ if (value === true) {
1556
+ this.#_spinnerFN = this.utils.prompt.spinner;
1557
+ this.utils.prompt.spinner = (_) => {
1558
+ return {
1559
+ start: (m) => this.utils.prompt.log.message(m),
1560
+ message: (m) => this.utils.prompt.log.message(m),
1561
+ stop: (m) => this.utils.prompt.log.message(m)
1562
+ };
1563
+ };
1564
+ } else {
1565
+ if (this.#_spinnerFN) this.utils.prompt.spinner = this.#_spinnerFN;
1566
+ }
1536
1567
  }
1537
1568
  async #exec(values) {
1538
1569
  this.#data = { values };
package/dist/main.d.cts CHANGED
@@ -605,6 +605,22 @@ declare const cache: <Values extends Record<string, unknown>>(opts: CacheOptions
605
605
  type CommonObj = Record<string, unknown> | Record<string, unknown>[] | unknown[];
606
606
  declare const getObjectFromJSONFile: <Res extends CommonObj = CommonObj>(path: string) => Promise<Res>;
607
607
 
608
+ /**
609
+ * Finds the closest package.json by traversing up the directory tree.
610
+ *
611
+ * @param {string} [startDir] - Directory to start searching from.
612
+ * @returns {string} Absolute path to the closest package.json.
613
+ * @throws {Error} If no package.json is found.
614
+ */
615
+ declare const getClosestPackageJson: (startDir?: string) => Promise<string>;
616
+ /**
617
+ * Finds the closest package directory by traversing up the directory tree.
618
+ *
619
+ * @param {string} [startDir] - Directory to start searching from.
620
+ * @returns {string} Absolute path to the closest package directory.
621
+ */
622
+ declare const getClosestPackageDir: (startDir?: string) => Promise<string>;
623
+
608
624
  type _sys_CommonObj = CommonObj;
609
625
  declare const _sys_arePathsEqual: typeof arePathsEqual;
610
626
  declare const _sys_cache: typeof cache;
@@ -620,6 +636,8 @@ declare const _sys_fileURLToPath: typeof fileURLToPath;
620
636
  declare const _sys_getAbsolutePath: typeof getAbsolutePath;
621
637
  declare const _sys_getArch: typeof getArch;
622
638
  declare const _sys_getBaseName: typeof getBaseName;
639
+ declare const _sys_getClosestPackageDir: typeof getClosestPackageDir;
640
+ declare const _sys_getClosestPackageJson: typeof getClosestPackageJson;
623
641
  declare const _sys_getCurrentDir: typeof getCurrentDir;
624
642
  declare const _sys_getDirName: typeof getDirName;
625
643
  declare const _sys_getExtName: typeof getExtName;
@@ -648,7 +666,7 @@ declare const _sys_validateHomeDir: typeof validateHomeDir;
648
666
  declare const _sys_writeFile: typeof writeFile;
649
667
  declare const _sys_writeFileContent: typeof writeFileContent;
650
668
  declare namespace _sys {
651
- export { type _sys_CommonObj as CommonObj, _sys_arePathsEqual as arePathsEqual, _sys_cache as cache, _sys_copyDir as copyDir, _sys_copyFile as copyFile, _sys_createDir as createDir, _sys_createSymlink as createSymlink, _sys_ensureDir as ensureDir, _sys_existsDir as existsDir, _sys_existsFile as existsFile, _sys_existsPath as existsPath, _sys_fileURLToPath as fileURLToPath, _sys_getAbsolutePath as getAbsolutePath, _sys_getArch as getArch, _sys_getBaseName as getBaseName, _sys_getCurrentDir as getCurrentDir, _sys_getDirName as getDirName, _sys_getExtName as getExtName, _sys_getFilteredFileNames as getFilteredFileNames, _sys_getHomeDir as getHomeDir, _sys_getObjectFromJSONFile as getObjectFromJSONFile, _sys_getPaths as getPaths, _sys_getPlatform as getPlatform, _sys_getSystemEnvPaths as getSystemEnvPaths, _sys_getTempDir as getTempDir, _sys_isAbsolutePath as isAbsolutePath, _sys_isDirectory as isDirectory, _sys_isPath as isPath, _sys_joinPath as joinPath, _sys_normalizePath as normalizePath, _sys_readDir as readDir, _sys_readFile as readFile, _sys_relativePath as relativePath, _sys_removeDir as removeDir, _sys_removeDirIfExist as removeDirIfExist, _sys_removeFile as removeFile, _sys_removeFileIfExist as removeFileIfExist, _sys_removePathIfExist as removePathIfExist, _sys_resolvePath as resolvePath, _sys_validateHomeDir as validateHomeDir, _sys_writeFile as writeFile, _sys_writeFileContent as writeFileContent };
669
+ export { type _sys_CommonObj as CommonObj, _sys_arePathsEqual as arePathsEqual, _sys_cache as cache, _sys_copyDir as copyDir, _sys_copyFile as copyFile, _sys_createDir as createDir, _sys_createSymlink as createSymlink, _sys_ensureDir as ensureDir, _sys_existsDir as existsDir, _sys_existsFile as existsFile, _sys_existsPath as existsPath, _sys_fileURLToPath as fileURLToPath, _sys_getAbsolutePath as getAbsolutePath, _sys_getArch as getArch, _sys_getBaseName as getBaseName, _sys_getClosestPackageDir as getClosestPackageDir, _sys_getClosestPackageJson as getClosestPackageJson, _sys_getCurrentDir as getCurrentDir, _sys_getDirName as getDirName, _sys_getExtName as getExtName, _sys_getFilteredFileNames as getFilteredFileNames, _sys_getHomeDir as getHomeDir, _sys_getObjectFromJSONFile as getObjectFromJSONFile, _sys_getPaths as getPaths, _sys_getPlatform as getPlatform, _sys_getSystemEnvPaths as getSystemEnvPaths, _sys_getTempDir as getTempDir, _sys_isAbsolutePath as isAbsolutePath, _sys_isDirectory as isDirectory, _sys_isPath as isPath, _sys_joinPath as joinPath, _sys_normalizePath as normalizePath, _sys_readDir as readDir, _sys_readFile as readFile, _sys_relativePath as relativePath, _sys_removeDir as removeDir, _sys_removeDirIfExist as removeDirIfExist, _sys_removeFile as removeFile, _sys_removeFileIfExist as removeFileIfExist, _sys_removePathIfExist as removePathIfExist, _sys_resolvePath as resolvePath, _sys_validateHomeDir as validateHomeDir, _sys_writeFile as writeFile, _sys_writeFileContent as writeFileContent };
652
670
  }
653
671
 
654
672
  /** System functions */
package/dist/main.d.mts CHANGED
@@ -605,6 +605,22 @@ declare const cache: <Values extends Record<string, unknown>>(opts: CacheOptions
605
605
  type CommonObj = Record<string, unknown> | Record<string, unknown>[] | unknown[];
606
606
  declare const getObjectFromJSONFile: <Res extends CommonObj = CommonObj>(path: string) => Promise<Res>;
607
607
 
608
+ /**
609
+ * Finds the closest package.json by traversing up the directory tree.
610
+ *
611
+ * @param {string} [startDir] - Directory to start searching from.
612
+ * @returns {string} Absolute path to the closest package.json.
613
+ * @throws {Error} If no package.json is found.
614
+ */
615
+ declare const getClosestPackageJson: (startDir?: string) => Promise<string>;
616
+ /**
617
+ * Finds the closest package directory by traversing up the directory tree.
618
+ *
619
+ * @param {string} [startDir] - Directory to start searching from.
620
+ * @returns {string} Absolute path to the closest package directory.
621
+ */
622
+ declare const getClosestPackageDir: (startDir?: string) => Promise<string>;
623
+
608
624
  type _sys_CommonObj = CommonObj;
609
625
  declare const _sys_arePathsEqual: typeof arePathsEqual;
610
626
  declare const _sys_cache: typeof cache;
@@ -620,6 +636,8 @@ declare const _sys_fileURLToPath: typeof fileURLToPath;
620
636
  declare const _sys_getAbsolutePath: typeof getAbsolutePath;
621
637
  declare const _sys_getArch: typeof getArch;
622
638
  declare const _sys_getBaseName: typeof getBaseName;
639
+ declare const _sys_getClosestPackageDir: typeof getClosestPackageDir;
640
+ declare const _sys_getClosestPackageJson: typeof getClosestPackageJson;
623
641
  declare const _sys_getCurrentDir: typeof getCurrentDir;
624
642
  declare const _sys_getDirName: typeof getDirName;
625
643
  declare const _sys_getExtName: typeof getExtName;
@@ -648,7 +666,7 @@ declare const _sys_validateHomeDir: typeof validateHomeDir;
648
666
  declare const _sys_writeFile: typeof writeFile;
649
667
  declare const _sys_writeFileContent: typeof writeFileContent;
650
668
  declare namespace _sys {
651
- export { type _sys_CommonObj as CommonObj, _sys_arePathsEqual as arePathsEqual, _sys_cache as cache, _sys_copyDir as copyDir, _sys_copyFile as copyFile, _sys_createDir as createDir, _sys_createSymlink as createSymlink, _sys_ensureDir as ensureDir, _sys_existsDir as existsDir, _sys_existsFile as existsFile, _sys_existsPath as existsPath, _sys_fileURLToPath as fileURLToPath, _sys_getAbsolutePath as getAbsolutePath, _sys_getArch as getArch, _sys_getBaseName as getBaseName, _sys_getCurrentDir as getCurrentDir, _sys_getDirName as getDirName, _sys_getExtName as getExtName, _sys_getFilteredFileNames as getFilteredFileNames, _sys_getHomeDir as getHomeDir, _sys_getObjectFromJSONFile as getObjectFromJSONFile, _sys_getPaths as getPaths, _sys_getPlatform as getPlatform, _sys_getSystemEnvPaths as getSystemEnvPaths, _sys_getTempDir as getTempDir, _sys_isAbsolutePath as isAbsolutePath, _sys_isDirectory as isDirectory, _sys_isPath as isPath, _sys_joinPath as joinPath, _sys_normalizePath as normalizePath, _sys_readDir as readDir, _sys_readFile as readFile, _sys_relativePath as relativePath, _sys_removeDir as removeDir, _sys_removeDirIfExist as removeDirIfExist, _sys_removeFile as removeFile, _sys_removeFileIfExist as removeFileIfExist, _sys_removePathIfExist as removePathIfExist, _sys_resolvePath as resolvePath, _sys_validateHomeDir as validateHomeDir, _sys_writeFile as writeFile, _sys_writeFileContent as writeFileContent };
669
+ export { type _sys_CommonObj as CommonObj, _sys_arePathsEqual as arePathsEqual, _sys_cache as cache, _sys_copyDir as copyDir, _sys_copyFile as copyFile, _sys_createDir as createDir, _sys_createSymlink as createSymlink, _sys_ensureDir as ensureDir, _sys_existsDir as existsDir, _sys_existsFile as existsFile, _sys_existsPath as existsPath, _sys_fileURLToPath as fileURLToPath, _sys_getAbsolutePath as getAbsolutePath, _sys_getArch as getArch, _sys_getBaseName as getBaseName, _sys_getClosestPackageDir as getClosestPackageDir, _sys_getClosestPackageJson as getClosestPackageJson, _sys_getCurrentDir as getCurrentDir, _sys_getDirName as getDirName, _sys_getExtName as getExtName, _sys_getFilteredFileNames as getFilteredFileNames, _sys_getHomeDir as getHomeDir, _sys_getObjectFromJSONFile as getObjectFromJSONFile, _sys_getPaths as getPaths, _sys_getPlatform as getPlatform, _sys_getSystemEnvPaths as getSystemEnvPaths, _sys_getTempDir as getTempDir, _sys_isAbsolutePath as isAbsolutePath, _sys_isDirectory as isDirectory, _sys_isPath as isPath, _sys_joinPath as joinPath, _sys_normalizePath as normalizePath, _sys_readDir as readDir, _sys_readFile as readFile, _sys_relativePath as relativePath, _sys_removeDir as removeDir, _sys_removeDirIfExist as removeDirIfExist, _sys_removeFile as removeFile, _sys_removeFileIfExist as removeFileIfExist, _sys_removePathIfExist as removePathIfExist, _sys_resolvePath as resolvePath, _sys_validateHomeDir as validateHomeDir, _sys_writeFile as writeFile, _sys_writeFileContent as writeFileContent };
652
670
  }
653
671
 
654
672
  /** System functions */
package/dist/main.d.ts CHANGED
@@ -605,6 +605,22 @@ declare const cache: <Values extends Record<string, unknown>>(opts: CacheOptions
605
605
  type CommonObj = Record<string, unknown> | Record<string, unknown>[] | unknown[];
606
606
  declare const getObjectFromJSONFile: <Res extends CommonObj = CommonObj>(path: string) => Promise<Res>;
607
607
 
608
+ /**
609
+ * Finds the closest package.json by traversing up the directory tree.
610
+ *
611
+ * @param {string} [startDir] - Directory to start searching from.
612
+ * @returns {string} Absolute path to the closest package.json.
613
+ * @throws {Error} If no package.json is found.
614
+ */
615
+ declare const getClosestPackageJson: (startDir?: string) => Promise<string>;
616
+ /**
617
+ * Finds the closest package directory by traversing up the directory tree.
618
+ *
619
+ * @param {string} [startDir] - Directory to start searching from.
620
+ * @returns {string} Absolute path to the closest package directory.
621
+ */
622
+ declare const getClosestPackageDir: (startDir?: string) => Promise<string>;
623
+
608
624
  type _sys_CommonObj = CommonObj;
609
625
  declare const _sys_arePathsEqual: typeof arePathsEqual;
610
626
  declare const _sys_cache: typeof cache;
@@ -620,6 +636,8 @@ declare const _sys_fileURLToPath: typeof fileURLToPath;
620
636
  declare const _sys_getAbsolutePath: typeof getAbsolutePath;
621
637
  declare const _sys_getArch: typeof getArch;
622
638
  declare const _sys_getBaseName: typeof getBaseName;
639
+ declare const _sys_getClosestPackageDir: typeof getClosestPackageDir;
640
+ declare const _sys_getClosestPackageJson: typeof getClosestPackageJson;
623
641
  declare const _sys_getCurrentDir: typeof getCurrentDir;
624
642
  declare const _sys_getDirName: typeof getDirName;
625
643
  declare const _sys_getExtName: typeof getExtName;
@@ -648,7 +666,7 @@ declare const _sys_validateHomeDir: typeof validateHomeDir;
648
666
  declare const _sys_writeFile: typeof writeFile;
649
667
  declare const _sys_writeFileContent: typeof writeFileContent;
650
668
  declare namespace _sys {
651
- export { type _sys_CommonObj as CommonObj, _sys_arePathsEqual as arePathsEqual, _sys_cache as cache, _sys_copyDir as copyDir, _sys_copyFile as copyFile, _sys_createDir as createDir, _sys_createSymlink as createSymlink, _sys_ensureDir as ensureDir, _sys_existsDir as existsDir, _sys_existsFile as existsFile, _sys_existsPath as existsPath, _sys_fileURLToPath as fileURLToPath, _sys_getAbsolutePath as getAbsolutePath, _sys_getArch as getArch, _sys_getBaseName as getBaseName, _sys_getCurrentDir as getCurrentDir, _sys_getDirName as getDirName, _sys_getExtName as getExtName, _sys_getFilteredFileNames as getFilteredFileNames, _sys_getHomeDir as getHomeDir, _sys_getObjectFromJSONFile as getObjectFromJSONFile, _sys_getPaths as getPaths, _sys_getPlatform as getPlatform, _sys_getSystemEnvPaths as getSystemEnvPaths, _sys_getTempDir as getTempDir, _sys_isAbsolutePath as isAbsolutePath, _sys_isDirectory as isDirectory, _sys_isPath as isPath, _sys_joinPath as joinPath, _sys_normalizePath as normalizePath, _sys_readDir as readDir, _sys_readFile as readFile, _sys_relativePath as relativePath, _sys_removeDir as removeDir, _sys_removeDirIfExist as removeDirIfExist, _sys_removeFile as removeFile, _sys_removeFileIfExist as removeFileIfExist, _sys_removePathIfExist as removePathIfExist, _sys_resolvePath as resolvePath, _sys_validateHomeDir as validateHomeDir, _sys_writeFile as writeFile, _sys_writeFileContent as writeFileContent };
669
+ export { type _sys_CommonObj as CommonObj, _sys_arePathsEqual as arePathsEqual, _sys_cache as cache, _sys_copyDir as copyDir, _sys_copyFile as copyFile, _sys_createDir as createDir, _sys_createSymlink as createSymlink, _sys_ensureDir as ensureDir, _sys_existsDir as existsDir, _sys_existsFile as existsFile, _sys_existsPath as existsPath, _sys_fileURLToPath as fileURLToPath, _sys_getAbsolutePath as getAbsolutePath, _sys_getArch as getArch, _sys_getBaseName as getBaseName, _sys_getClosestPackageDir as getClosestPackageDir, _sys_getClosestPackageJson as getClosestPackageJson, _sys_getCurrentDir as getCurrentDir, _sys_getDirName as getDirName, _sys_getExtName as getExtName, _sys_getFilteredFileNames as getFilteredFileNames, _sys_getHomeDir as getHomeDir, _sys_getObjectFromJSONFile as getObjectFromJSONFile, _sys_getPaths as getPaths, _sys_getPlatform as getPlatform, _sys_getSystemEnvPaths as getSystemEnvPaths, _sys_getTempDir as getTempDir, _sys_isAbsolutePath as isAbsolutePath, _sys_isDirectory as isDirectory, _sys_isPath as isPath, _sys_joinPath as joinPath, _sys_normalizePath as normalizePath, _sys_readDir as readDir, _sys_readFile as readFile, _sys_relativePath as relativePath, _sys_removeDir as removeDir, _sys_removeDirIfExist as removeDirIfExist, _sys_removeFile as removeFile, _sys_removeFileIfExist as removeFileIfExist, _sys_removePathIfExist as removePathIfExist, _sys_resolvePath as resolvePath, _sys_validateHomeDir as validateHomeDir, _sys_writeFile as writeFile, _sys_writeFileContent as writeFileContent };
652
670
  }
653
671
 
654
672
  /** System functions */
package/dist/main.mjs CHANGED
@@ -728,6 +728,22 @@ const cache = async (opts) => {
728
728
  };
729
729
  };
730
730
 
731
+ const getClosestPackageJson = async (startDir = process$1.cwd()) => {
732
+ let currentDir = resolvePath(startDir);
733
+ while (true) {
734
+ const pkgPath = joinPath(currentDir, "package.json");
735
+ if (await existsFile(pkgPath)) return pkgPath;
736
+ const parentDir = getDirName(currentDir);
737
+ if (parentDir === currentDir)
738
+ throw new Error("No package.json found in any parent directory.");
739
+ currentDir = parentDir;
740
+ }
741
+ };
742
+ const getClosestPackageDir = async (startDir = process$1.cwd()) => {
743
+ const pkgPath = await getClosestPackageJson(startDir);
744
+ return getDirName(pkgPath);
745
+ };
746
+
731
747
  const _sys = {
732
748
  __proto__: null,
733
749
  arePathsEqual: arePathsEqual,
@@ -744,6 +760,8 @@ const _sys = {
744
760
  getAbsolutePath: getAbsolutePath,
745
761
  getArch: getArch,
746
762
  getBaseName: getBaseName,
763
+ getClosestPackageDir: getClosestPackageDir,
764
+ getClosestPackageJson: getClosestPackageJson,
747
765
  getCurrentDir: getCurrentDir,
748
766
  getDirName: getDirName,
749
767
  getExtName: getExtName,
@@ -1504,9 +1522,22 @@ class CreatiumCore {
1504
1522
  this.debugMode = false;
1505
1523
  this.#style = { tick: this.utils.style.color.green(this.utils.style.color.dim("\u2713")) };
1506
1524
  }
1525
+ #_spinnerFN;
1507
1526
  /** Force debug mode */
1508
1527
  set debugMode(value) {
1509
1528
  this.#core.debugMode = value;
1529
+ if (value === true) {
1530
+ this.#_spinnerFN = this.utils.prompt.spinner;
1531
+ this.utils.prompt.spinner = (_) => {
1532
+ return {
1533
+ start: (m) => this.utils.prompt.log.message(m),
1534
+ message: (m) => this.utils.prompt.log.message(m),
1535
+ stop: (m) => this.utils.prompt.log.message(m)
1536
+ };
1537
+ };
1538
+ } else {
1539
+ if (this.#_spinnerFN) this.utils.prompt.spinner = this.#_spinnerFN;
1540
+ }
1510
1541
  }
1511
1542
  async #exec(values) {
1512
1543
  this.#data = { values };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "creatium",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Build your create-bins quickly and easily",
5
5
  "keywords": [
6
6
  "bin",
@@ -67,7 +67,7 @@
67
67
  "devDependencies": {
68
68
  "@types/columnify": "1.5.4",
69
69
  "@types/yargs": "17.0.33",
70
- "@creatium/repo-config": "0.1.15"
70
+ "@creatium/repo-config": "0.1.17"
71
71
  },
72
72
  "publishConfig": {
73
73
  "access": "public",