@backstage/cli-common 0.1.6 → 0.1.7
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/CHANGELOG.md +6 -0
- package/dist/index.cjs.js +4 -4
- package/package.json +12 -8
- package/dist/index.d.ts +0 -47
package/CHANGELOG.md
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -13,7 +13,7 @@ function findRootPath(searchDir, filterFunc) {
|
|
|
13
13
|
let path$1 = searchDir;
|
|
14
14
|
for (let i = 0; i < 1e3; i++) {
|
|
15
15
|
const packagePath = path.resolve(path$1, "package.json");
|
|
16
|
-
const exists = fs__default[
|
|
16
|
+
const exists = fs__default["default"].existsSync(packagePath);
|
|
17
17
|
if (exists && filterFunc(packagePath)) {
|
|
18
18
|
return path$1;
|
|
19
19
|
}
|
|
@@ -33,7 +33,7 @@ function findOwnDir(searchDir) {
|
|
|
33
33
|
return path;
|
|
34
34
|
}
|
|
35
35
|
function findOwnRootDir(ownDir) {
|
|
36
|
-
const isLocal = fs__default[
|
|
36
|
+
const isLocal = fs__default["default"].existsSync(path.resolve(ownDir, "src"));
|
|
37
37
|
if (!isLocal) {
|
|
38
38
|
throw new Error("Tried to access monorepo package root dir outside of Backstage repository");
|
|
39
39
|
}
|
|
@@ -41,7 +41,7 @@ function findOwnRootDir(ownDir) {
|
|
|
41
41
|
}
|
|
42
42
|
function findPaths(searchDir) {
|
|
43
43
|
const ownDir = findOwnDir(searchDir);
|
|
44
|
-
const targetDir = fs__default[
|
|
44
|
+
const targetDir = fs__default["default"].realpathSync(process.cwd()).replace(/^[a-z]:/, (str) => str.toLocaleUpperCase("en-US"));
|
|
45
45
|
let ownRoot = "";
|
|
46
46
|
const getOwnRoot = () => {
|
|
47
47
|
if (!ownRoot) {
|
|
@@ -56,7 +56,7 @@ function findPaths(searchDir) {
|
|
|
56
56
|
targetRoot = (_a = findRootPath(targetDir, (path) => {
|
|
57
57
|
var _a2;
|
|
58
58
|
try {
|
|
59
|
-
const content = fs__default[
|
|
59
|
+
const content = fs__default["default"].readFileSync(path, "utf8");
|
|
60
60
|
const data = JSON.parse(content);
|
|
61
61
|
return Boolean((_a2 = data.workspaces) == null ? void 0 : _a2.packages);
|
|
62
62
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/cli-common",
|
|
3
3
|
"description": "Common functionality used by cli, backend, and create-app",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.7",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
"main": "dist/index.cjs.js",
|
|
11
11
|
"types": "dist/index.d.ts"
|
|
12
12
|
},
|
|
13
|
+
"backstage": {
|
|
14
|
+
"role": "node-library"
|
|
15
|
+
},
|
|
13
16
|
"homepage": "https://backstage.io",
|
|
14
17
|
"repository": {
|
|
15
18
|
"type": "git",
|
|
@@ -21,12 +24,13 @@
|
|
|
21
24
|
],
|
|
22
25
|
"license": "Apache-2.0",
|
|
23
26
|
"scripts": {
|
|
24
|
-
"build": "backstage-cli build
|
|
25
|
-
"lint": "backstage-cli lint",
|
|
26
|
-
"test": "backstage-cli test",
|
|
27
|
-
"prepack": "backstage-cli prepack",
|
|
28
|
-
"postpack": "backstage-cli postpack",
|
|
29
|
-
"clean": "backstage-cli clean"
|
|
27
|
+
"build": "backstage-cli package build",
|
|
28
|
+
"lint": "backstage-cli package lint",
|
|
29
|
+
"test": "backstage-cli package test",
|
|
30
|
+
"prepack": "backstage-cli package prepack",
|
|
31
|
+
"postpack": "backstage-cli package postpack",
|
|
32
|
+
"clean": "backstage-cli package clean",
|
|
33
|
+
"start": "backstage-cli package start"
|
|
30
34
|
},
|
|
31
35
|
"devDependencies": {
|
|
32
36
|
"@types/jest": "^26.0.7",
|
|
@@ -35,5 +39,5 @@
|
|
|
35
39
|
"files": [
|
|
36
40
|
"dist"
|
|
37
41
|
],
|
|
38
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "4805c3d13ce9bfc369e53c271b1b95e722b3b4dc"
|
|
39
43
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A function that takes a set of path fragments and resolves them into a
|
|
3
|
-
* single complete path, relative to some root.
|
|
4
|
-
*
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
declare type ResolveFunc = (...paths: string[]) => string;
|
|
8
|
-
/**
|
|
9
|
-
* Common paths and resolve functions used by the cli.
|
|
10
|
-
* Currently assumes it is being executed within a monorepo.
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
declare type Paths = {
|
|
15
|
-
ownDir: string;
|
|
16
|
-
ownRoot: string;
|
|
17
|
-
targetDir: string;
|
|
18
|
-
targetRoot: string;
|
|
19
|
-
resolveOwn: ResolveFunc;
|
|
20
|
-
resolveOwnRoot: ResolveFunc;
|
|
21
|
-
resolveTarget: ResolveFunc;
|
|
22
|
-
resolveTargetRoot: ResolveFunc;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Find paths related to a package and its execution context.
|
|
26
|
-
*
|
|
27
|
-
* @public
|
|
28
|
-
* @example
|
|
29
|
-
*
|
|
30
|
-
* const paths = findPaths(__dirname)
|
|
31
|
-
*/
|
|
32
|
-
declare function findPaths(searchDir: string): Paths;
|
|
33
|
-
/**
|
|
34
|
-
* The name of the backstage's config file
|
|
35
|
-
*
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
|
-
declare const BACKSTAGE_JSON = "backstage.json";
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Checks if path is the same as or a child path of base.
|
|
42
|
-
*
|
|
43
|
-
* @public
|
|
44
|
-
*/
|
|
45
|
-
declare function isChildPath(base: string, path: string): boolean;
|
|
46
|
-
|
|
47
|
-
export { BACKSTAGE_JSON, Paths, ResolveFunc, findPaths, isChildPath };
|