contensis-cli 1.0.0-beta.55 → 1.0.0-beta.56
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.
|
@@ -40,7 +40,7 @@ var import_os = require("os");
|
|
|
40
40
|
var import_path = __toESM(require("path"));
|
|
41
41
|
var import_util = require("../util");
|
|
42
42
|
const userHomeDir = (0, import_os.homedir)();
|
|
43
|
-
const appRootDir = import_path.default.join(userHomeDir, ".contensis/");
|
|
43
|
+
const appRootDir = process.env.CONTAINER_CONTEXT === "true" ? process.cwd() : import_path.default.join(userHomeDir, ".contensis/");
|
|
44
44
|
const readJsonFile = (filePath) => {
|
|
45
45
|
const file = readFile(filePath);
|
|
46
46
|
if (file)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/providers/file-provider.ts"],
|
|
4
|
-
"sourcesContent": ["import fs from 'fs';\nimport { homedir } from 'os';\nimport path from 'path';\nimport { tryParse } from '~/util';\n\nconst userHomeDir = homedir();\nexport const appRootDir
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAe;AACf,gBAAwB;AACxB,kBAAiB;AACjB,kBAAyB;AAEzB,MAAM,kBAAc,mBAAQ;
|
|
4
|
+
"sourcesContent": ["import fs from 'fs';\nimport { homedir } from 'os';\nimport path from 'path';\nimport { tryParse } from '~/util';\n\nconst userHomeDir = homedir();\n\nexport const appRootDir =\n process.env.CONTAINER_CONTEXT === 'true'\n ? process.cwd()\n : path.join(userHomeDir, '.contensis/');\n\nexport const readJsonFile = <T>(filePath: string) => {\n const file = readFile(filePath);\n if (file) return tryParse(file) as T | string;\n return undefined;\n};\nexport const readFile = (filePath: string) => {\n const directoryPath = localPath(filePath);\n if (fs.existsSync(directoryPath)) {\n const file = fs.readFileSync(directoryPath, 'utf8');\n return file;\n } else {\n return undefined;\n }\n};\n\nexport const readFiles = (directory: string) => {\n const directoryPath = localPath(directory);\n if (fs.existsSync(directoryPath)) {\n const files = fs.readdirSync(directoryPath);\n return files;\n } else {\n fs.mkdirSync(directoryPath, { recursive: true });\n return [];\n }\n};\n\nexport const writeFile = (filePath: string, content: string) => {\n const directoryPath = localPath(filePath);\n fs.writeFileSync(directoryPath, content, { encoding: 'utf-8' });\n};\n\nexport const removeFile = (filePath: string) => {\n const directoryPath = localPath(filePath);\n if (fs.existsSync(directoryPath)) {\n fs.rmSync(directoryPath);\n }\n};\n\nexport const moveFile = (file: string, fromPath: string, toPath: string) => {\n const from = path.join(appRootDir, `${fromPath}${file}`);\n const to = path.join(appRootDir, `${toPath}${file}`);\n if (fs.existsSync(from)) {\n checkDir(toPath);\n // if (!fs.existsSync(toPath)) fs.mkdirSync(toPath, { recursive: true });\n\n fs.rename(from, to, err => {\n if (err)\n console.error(\n `Could not rename file \"${file}\" from: ${fromPath} to: ${toPath}`,\n err\n );\n console.info(`Renamed file \"${file}\" from: ${fromPath} to: ${toPath}`);\n });\n } else {\n console.error(\n `Could not rename file \"${file}\" from: ${fromPath} to: ${toPath}\\nFile does not exist!`\n );\n }\n};\n\nexport const checkDir = (filePath: string) => {\n const directoryPath = path.dirname(localPath(filePath));\n if (!fs.existsSync(directoryPath))\n fs.mkdirSync(directoryPath, { recursive: true });\n};\n\nexport const localPath = (filePath: string) =>\n path.isAbsolute(filePath) ? filePath : path.join(appRootDir, filePath);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAe;AACf,gBAAwB;AACxB,kBAAiB;AACjB,kBAAyB;AAEzB,MAAM,kBAAc,mBAAQ;AAErB,MAAM,aACX,QAAQ,IAAI,sBAAsB,SAC9B,QAAQ,IAAI,IAC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AAQ;AAAA,UACN,0BAA0B,eAAe,gBAAgB;AAAA,UACzD;AAAA,QACF;AACF,cAAQ,KAAK,iBAAiB,eAAe,gBAAgB,QAAQ;AAAA,IACvE,CAAC;AAAA,EACH,OAAO;AACL,YAAQ;AAAA,MACN,0BAA0B,eAAe,gBAAgB;AAAA;AAAA,IAC3D;AAAA,EACF;AACF;AAEO,MAAM,WAAW,CAAC,aAAqB;AAC5C,QAAM,gBAAgB,YAAAD,QAAK,QAAQ,UAAU,QAAQ,CAAC;AACtD,MAAI,CAAC,UAAAC,QAAG,WAAW,aAAa;AAC9B,cAAAA,QAAG,UAAU,eAAe,EAAE,WAAW,KAAK,CAAC;AACnD;AAEO,MAAM,YAAY,CAAC,aACxB,YAAAD,QAAK,WAAW,QAAQ,IAAI,WAAW,YAAAA,QAAK,KAAK,YAAY,QAAQ;",
|
|
6
6
|
"names": ["path", "fs"]
|
|
7
7
|
}
|
package/dist/version.js
CHANGED
|
@@ -21,7 +21,7 @@ __export(version_exports, {
|
|
|
21
21
|
LIB_VERSION: () => LIB_VERSION
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(version_exports);
|
|
24
|
-
const LIB_VERSION = "1.0.0-beta.
|
|
24
|
+
const LIB_VERSION = "1.0.0-beta.56";
|
|
25
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
26
|
0 && (module.exports = {
|
|
27
27
|
LIB_VERSION
|
package/dist/version.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/version.ts"],
|
|
4
|
-
"sourcesContent": ["export const LIB_VERSION = \"1.0.0-beta.
|
|
4
|
+
"sourcesContent": ["export const LIB_VERSION = \"1.0.0-beta.56\";\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contensis-cli",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.56",
|
|
4
4
|
"description": "A fully featured Contensis command line interface with a shell UI provides simple and intuitive ways to manage or profile your content in any NodeJS terminal.",
|
|
5
5
|
"repository": "https://github.com/contensis/node-cli",
|
|
6
6
|
"homepage": "https://github.com/contensis/node-cli/tree/main/packages/contensis-cli#readme",
|
|
@@ -4,7 +4,11 @@ import path from 'path';
|
|
|
4
4
|
import { tryParse } from '~/util';
|
|
5
5
|
|
|
6
6
|
const userHomeDir = homedir();
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
export const appRootDir =
|
|
9
|
+
process.env.CONTAINER_CONTEXT === 'true'
|
|
10
|
+
? process.cwd()
|
|
11
|
+
: path.join(userHomeDir, '.contensis/');
|
|
8
12
|
|
|
9
13
|
export const readJsonFile = <T>(filePath: string) => {
|
|
10
14
|
const file = readFile(filePath);
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "1.0.0-beta.
|
|
1
|
+
export const LIB_VERSION = "1.0.0-beta.56";
|