piral-cli 0.14.24-beta.4157 → 0.14.24-beta.4161
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/lib/common/info.d.ts +1 -0
- package/lib/common/info.js +2 -1
- package/lib/common/info.js.map +1 -1
- package/lib/plugin.js +27 -2
- package/lib/plugin.js.map +1 -1
- package/package.json +2 -2
- package/src/common/info.ts +1 -0
- package/src/plugin.ts +33 -4
package/lib/common/info.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare function findCompatVersion(version: string): string;
|
|
2
2
|
export declare const nodeVersion: string;
|
|
3
|
+
export declare const cliName: any;
|
|
3
4
|
export declare const cliVersion: any;
|
|
4
5
|
export declare const compatVersion: string;
|
|
5
6
|
export declare const repositoryUrl: any;
|
package/lib/common/info.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cpuCount = exports.pathSeparator = exports.isWindows = exports.repositoryUrl = exports.compatVersion = exports.cliVersion = exports.nodeVersion = exports.findCompatVersion = void 0;
|
|
3
|
+
exports.cpuCount = exports.pathSeparator = exports.isWindows = exports.repositoryUrl = exports.compatVersion = exports.cliVersion = exports.cliName = exports.nodeVersion = exports.findCompatVersion = void 0;
|
|
4
4
|
const os_1 = require("os");
|
|
5
5
|
const info = require('../../package.json');
|
|
6
6
|
function findCompatVersion(version) {
|
|
@@ -14,6 +14,7 @@ function findCompatVersion(version) {
|
|
|
14
14
|
}
|
|
15
15
|
exports.findCompatVersion = findCompatVersion;
|
|
16
16
|
exports.nodeVersion = process.version.substring(1);
|
|
17
|
+
exports.cliName = info.name;
|
|
17
18
|
exports.cliVersion = info.version;
|
|
18
19
|
exports.compatVersion = findCompatVersion(exports.cliVersion);
|
|
19
20
|
exports.repositoryUrl = info.repository.url;
|
package/lib/common/info.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info.js","sourceRoot":"","sources":["../../src/common/info.ts"],"names":[],"mappings":";;;AAAA,2BAA0B;AAE1B,MAAM,IAAI,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE3C,SAAgB,iBAAiB,CAAC,OAAe;IAC/C,qCAAqC;IACrC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE1C,IAAI,KAAK,KAAK,GAAG,EAAE;QACjB,kEAAkE;QAClE,OAAO,GAAG,KAAK,IAAI,KAAK,EAAE,CAAC;KAC5B;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAVD,8CAUC;AAEY,QAAA,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAC3C,QAAA,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC;AAC1B,QAAA,aAAa,GAAG,iBAAiB,CAAC,kBAAU,CAAC,CAAC;AAC9C,QAAA,aAAa,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;AACpC,QAAA,SAAS,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AACzC,QAAA,aAAa,GAAG,iBAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACtC,QAAA,QAAQ,GAAG,IAAA,SAAI,GAAE,CAAC,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"info.js","sourceRoot":"","sources":["../../src/common/info.ts"],"names":[],"mappings":";;;AAAA,2BAA0B;AAE1B,MAAM,IAAI,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE3C,SAAgB,iBAAiB,CAAC,OAAe;IAC/C,qCAAqC;IACrC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE1C,IAAI,KAAK,KAAK,GAAG,EAAE;QACjB,kEAAkE;QAClE,OAAO,GAAG,KAAK,IAAI,KAAK,EAAE,CAAC;KAC5B;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAVD,8CAUC;AAEY,QAAA,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAC3C,QAAA,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC;AACpB,QAAA,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC;AAC1B,QAAA,aAAa,GAAG,iBAAiB,CAAC,kBAAU,CAAC,CAAC;AAC9C,QAAA,aAAa,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;AACpC,QAAA,SAAS,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AACzC,QAAA,aAAa,GAAG,iBAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACtC,QAAA,QAAQ,GAAG,IAAA,SAAI,GAAE,CAAC,MAAM,CAAC"}
|
package/lib/plugin.js
CHANGED
|
@@ -14,9 +14,34 @@ const fs_1 = require("fs");
|
|
|
14
14
|
const path_1 = require("path");
|
|
15
15
|
const common_1 = require("./common");
|
|
16
16
|
const inject_1 = require("./inject");
|
|
17
|
-
function
|
|
17
|
+
function getContainerDir() {
|
|
18
|
+
const currentDir = __dirname.split(path_1.sep).join(path_1.posix.sep);
|
|
19
|
+
if (currentDir.includes(`/.pnpm/${common_1.cliName}@${common_1.cliVersion}/node_modules/${common_1.cliName}/`)) {
|
|
20
|
+
return (0, path_1.resolve)(__dirname, '..', '..', '..', '..', '..');
|
|
21
|
+
}
|
|
18
22
|
return (0, path_1.resolve)(__dirname, '..', '..');
|
|
19
23
|
}
|
|
24
|
+
function getLocalPackageDir() {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const proposedDirs = [
|
|
27
|
+
getContainerDir(),
|
|
28
|
+
(0, path_1.resolve)(process.cwd(), 'node_modules'),
|
|
29
|
+
(0, path_1.resolve)(process.cwd(), '..', 'node_modules'),
|
|
30
|
+
(0, path_1.resolve)(process.cwd(), '..', '..', 'node_modules'),
|
|
31
|
+
(0, path_1.resolve)(process.cwd(), '..', '..', '..', 'node_modules'),
|
|
32
|
+
];
|
|
33
|
+
// Right now we always take the first one, but in the future this may be different
|
|
34
|
+
// once we come up with more / better criteria to identify if its a good/valid
|
|
35
|
+
// plugin root directory
|
|
36
|
+
for (const dir of proposedDirs) {
|
|
37
|
+
(0, common_1.log)('generalDebug_0003', `Checking for potential plugin directory "${dir}" ...`);
|
|
38
|
+
if (yield isDirectory(dir)) {
|
|
39
|
+
return dir;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
20
45
|
function isDirectory(dir) {
|
|
21
46
|
return new Promise((resolve, reject) => {
|
|
22
47
|
(0, fs_1.stat)(dir, (err, stats) => {
|
|
@@ -86,7 +111,7 @@ function getAllPlugins(rootDir) {
|
|
|
86
111
|
}
|
|
87
112
|
function loadPlugins() {
|
|
88
113
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
const localDir = getLocalPackageDir();
|
|
114
|
+
const localDir = yield getLocalPackageDir();
|
|
90
115
|
const allPlugins = yield getAllPlugins(localDir);
|
|
91
116
|
for (const pluginPath of allPlugins) {
|
|
92
117
|
(0, inject_1.inject)(pluginPath);
|
package/lib/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2BAAmC;AACnC,+
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2BAAmC;AACnC,+BAAiD;AACjD,qCAAoD;AACpD,qCAAkC;AAElC,SAAS,eAAe;IACtB,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC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AG,MAAM,kBAAkB,EAAE,CAAC;QAC5C,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC,CAAC;QAEjD,KAAK,MAAM,UAAU,IAAI,UAAU,EAAE;YACnC,IAAA,eAAM,EAAC,UAAU,CAAC,CAAC;SACpB;IACH,CAAC;CAAA;AAPD,kCAOC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-cli",
|
|
3
|
-
"version": "0.14.24-beta.
|
|
3
|
+
"version": "0.14.24-beta.4161",
|
|
4
4
|
"description": "The standard CLI for creating and building a Piral instance or a Pilet.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"portal",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"typescript": "^4.0.2",
|
|
78
78
|
"yargs": "^15.4.1"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "a3e3fde68f96231ad3a65b25b90d358d2648fc68"
|
|
81
81
|
}
|
package/src/common/info.ts
CHANGED
|
@@ -15,6 +15,7 @@ export function findCompatVersion(version: string) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export const nodeVersion = process.version.substring(1);
|
|
18
|
+
export const cliName = info.name;
|
|
18
19
|
export const cliVersion = info.version;
|
|
19
20
|
export const compatVersion = findCompatVersion(cliVersion);
|
|
20
21
|
export const repositoryUrl = info.repository.url;
|
package/src/plugin.ts
CHANGED
|
@@ -1,12 +1,41 @@
|
|
|
1
1
|
import { readdir, stat } from 'fs';
|
|
2
|
-
import { join, resolve } from 'path';
|
|
3
|
-
import { log } from './common';
|
|
2
|
+
import { join, resolve, sep, posix } from 'path';
|
|
3
|
+
import { cliName, cliVersion, log } from './common';
|
|
4
4
|
import { inject } from './inject';
|
|
5
5
|
|
|
6
|
-
function
|
|
6
|
+
function getContainerDir() {
|
|
7
|
+
const currentDir = __dirname.split(sep).join(posix.sep);
|
|
8
|
+
|
|
9
|
+
if (currentDir.includes(`/.pnpm/${cliName}@${cliVersion}/node_modules/${cliName}/`)) {
|
|
10
|
+
return resolve(__dirname, '..', '..', '..', '..', '..');
|
|
11
|
+
}
|
|
12
|
+
|
|
7
13
|
return resolve(__dirname, '..', '..');
|
|
8
14
|
}
|
|
9
15
|
|
|
16
|
+
async function getLocalPackageDir() {
|
|
17
|
+
const proposedDirs = [
|
|
18
|
+
getContainerDir(),
|
|
19
|
+
resolve(process.cwd(), 'node_modules'),
|
|
20
|
+
resolve(process.cwd(), '..', 'node_modules'),
|
|
21
|
+
resolve(process.cwd(), '..', '..', 'node_modules'),
|
|
22
|
+
resolve(process.cwd(), '..', '..', '..', 'node_modules'),
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
// Right now we always take the first one, but in the future this may be different
|
|
26
|
+
// once we come up with more / better criteria to identify if its a good/valid
|
|
27
|
+
// plugin root directory
|
|
28
|
+
for (const dir of proposedDirs) {
|
|
29
|
+
log('generalDebug_0003', `Checking for potential plugin directory "${dir}" ...`);
|
|
30
|
+
|
|
31
|
+
if (await isDirectory(dir)) {
|
|
32
|
+
return dir;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
10
39
|
function isDirectory(dir: string) {
|
|
11
40
|
return new Promise<boolean>((resolve, reject) => {
|
|
12
41
|
stat(dir, (err, stats) => {
|
|
@@ -83,7 +112,7 @@ async function getAllPlugins(rootDir: string): Promise<Array<string>> {
|
|
|
83
112
|
}
|
|
84
113
|
|
|
85
114
|
export async function loadPlugins() {
|
|
86
|
-
const localDir = getLocalPackageDir();
|
|
115
|
+
const localDir = await getLocalPackageDir();
|
|
87
116
|
const allPlugins = await getAllPlugins(localDir);
|
|
88
117
|
|
|
89
118
|
for (const pluginPath of allPlugins) {
|