Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

utils.d.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /// <reference types="node" />
  2. import childProcess from 'child_process';
  3. import { DepGraph } from 'dependency-graph';
  4. import { JSONObject } from '@lumino/coreutils';
  5. declare type Dict<T> = {
  6. [key: string]: T;
  7. };
  8. /**
  9. * Exit with an error code on uncaught error.
  10. */
  11. export declare function exitOnUuncaughtException(): void;
  12. /**
  13. * Get all of the lerna package paths.
  14. */
  15. export declare function getLernaPaths(basePath?: string): string[];
  16. /**
  17. * Get all of the core package paths.
  18. */
  19. export declare function getCorePaths(): string[];
  20. /**
  21. * Write a package.json if necessary.
  22. *
  23. * @param data - The package data.
  24. *
  25. * @oaram pkgJsonPath - The path to the package.json file.
  26. *
  27. * @returns Whether the file has changed.
  28. */
  29. export declare function writePackageData(pkgJsonPath: string, data: JSONObject): boolean;
  30. /**
  31. * Read a json file.
  32. */
  33. export declare function readJSONFile(filePath: string): any;
  34. /**
  35. * Write a json file.
  36. */
  37. export declare function writeJSONFile(filePath: string, data: JSONObject): boolean;
  38. /**
  39. * Simple template substitution for template vars of the form {{name}}
  40. *
  41. * @param templ: the template string.
  42. * Ex: `This header generated by {{funcName}}`
  43. *
  44. * @param subs: an object in which the parameter keys are the template
  45. * variables and the parameter values are the substitutions.
  46. *
  47. * @param options: function options.
  48. *
  49. * @param options.autoindent: default = true. If true, will try to match
  50. * indentation level of {{var}} in substituted template.
  51. *
  52. * @param options.end: default = '\n'. Inserted at the end of
  53. * a template post-substitution and post-trim.
  54. *
  55. * @returns the input template with all {{vars}} substituted, then `.trim`-ed.
  56. */
  57. export declare function fromTemplate(templ: string, subs: Dict<string>, options?: {
  58. autoindent?: boolean;
  59. end?: string;
  60. }): string;
  61. /**
  62. *
  63. * Call a command, checking its status.
  64. */
  65. export declare function checkStatus(cmd: string): number | null;
  66. /**
  67. * Get the current version of JupyterLab
  68. */
  69. export declare function getPythonVersion(): string;
  70. /**
  71. * Get the current version of a package
  72. */
  73. export declare function getJSVersion(pkg: string): string;
  74. /**
  75. * Pre-bump.
  76. */
  77. export declare function prebump(): void;
  78. /**
  79. * Post-bump.
  80. */
  81. export declare function postbump(commit?: boolean): void;
  82. /**
  83. * Run a command with terminal output.
  84. *
  85. * @param cmd - The command to run.
  86. */
  87. export declare function run(cmd: string, options?: childProcess.ExecSyncOptions, quiet?: boolean): string;
  88. /**
  89. * Get a graph that has all of the package data for the local packages and their
  90. * first order dependencies.
  91. */
  92. export declare function getPackageGraph(): DepGraph<Dict<unknown>>;
  93. /**
  94. * Ensure the given path uses '/' as path separator.
  95. */
  96. export declare function ensureUnixPathSep(source: string): string;
  97. /**
  98. * Get the last portion of a path, without its extension (if any).
  99. *
  100. * @param pathArg - The file path.
  101. *
  102. * @returns the last part of the path, sans extension.
  103. */
  104. export declare function stem(pathArg: string): string;
  105. /**
  106. * Given a 'snake-case', 'snake_case', or 'snake case' string,
  107. * will return the camel case version: 'snakeCase'.
  108. *
  109. * @param str: the snake-case input string.
  110. *
  111. * @param upper: default = false. If true, the first letter of the
  112. * returned string will be capitalized.
  113. *
  114. * @returns the camel case version of the input string.
  115. */
  116. export declare function camelCase(str: string, upper?: boolean): string;
  117. export {};