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