@ms-cloudpack/json-utilities 0.0.6 → 0.0.8
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/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/readJson.d.ts +1 -0
- package/lib/readJson.d.ts.map +1 -0
- package/lib/tsdoc-metadata.json +11 -11
- package/lib/writeJson.d.ts +1 -0
- package/lib/writeJson.d.ts.map +1 -0
- package/lib/writeJson.js +3 -3
- package/lib/writeJson.js.map +1 -1
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
package/lib/readJson.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readJson.d.ts","sourceRoot":"","sources":["../src/readJson.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAsB,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAU9E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAUnE"}
|
package/lib/tsdoc-metadata.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
-
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
-
{
|
|
4
|
-
"tsdocVersion": "0.12",
|
|
5
|
-
"toolPackages": [
|
|
6
|
-
{
|
|
7
|
-
"packageName": "@microsoft/api-extractor",
|
|
8
|
-
"packageVersion": "7.
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.36.4"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
package/lib/writeJson.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeJson.d.ts","sourceRoot":"","sources":["../src/writeJson.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAK1E;AAED;;GAEG;AAEH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI,CAK/D"}
|
package/lib/writeJson.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import fsPromises from 'fs/promises';
|
|
3
3
|
import path from 'path';
|
|
4
|
-
import
|
|
4
|
+
import fsExtra from 'fs-extra';
|
|
5
5
|
/**
|
|
6
6
|
* Writes json to a path. Ensures the path exists.
|
|
7
7
|
*/
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
9
|
export async function writeJson(filePath, data) {
|
|
10
10
|
const folderPath = path.dirname(filePath);
|
|
11
|
-
await ensureDir(folderPath);
|
|
11
|
+
await fsExtra.ensureDir(folderPath);
|
|
12
12
|
await fsPromises.writeFile(filePath, JSON.stringify(data, null, 2), 'utf8');
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
@@ -17,7 +17,7 @@ export async function writeJson(filePath, data) {
|
|
|
17
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
18
|
export function writeJsonSync(filePath, data) {
|
|
19
19
|
const folderPath = path.dirname(filePath);
|
|
20
|
-
ensureDirSync(folderPath);
|
|
20
|
+
fsExtra.ensureDirSync(folderPath);
|
|
21
21
|
fs.writeFileSync(filePath, JSON.stringify(data, null, 2), 'utf8');
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=writeJson.js.map
|
package/lib/writeJson.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeJson.js","sourceRoot":"","sources":["../src/writeJson.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"writeJson.js","sourceRoot":"","sources":["../src/writeJson.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAAO,MAAM,UAAU,CAAC;AAE/B;;GAEG;AACH,8DAA8D;AAC9D,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,QAAgB,EAAE,IAAS;IACzD,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE1C,MAAM,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACpC,MAAM,UAAU,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAC9E,CAAC;AAED;;GAEG;AACH,8DAA8D;AAC9D,MAAM,UAAU,aAAa,CAAC,QAAgB,EAAE,IAAS;IACvD,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE1C,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAClC,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import fs from 'fs';\nimport fsPromises from 'fs/promises';\nimport path from 'path';\nimport fsExtra from 'fs-extra';\n\n/**\n * Writes json to a path. Ensures the path exists.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport async function writeJson(filePath: string, data: any): Promise<void> {\n const folderPath = path.dirname(filePath);\n\n await fsExtra.ensureDir(folderPath);\n await fsPromises.writeFile(filePath, JSON.stringify(data, null, 2), 'utf8');\n}\n\n/**\n * Synchronously writes json to a path. Ensures the path exists.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function writeJsonSync(filePath: string, data: any): void {\n const folderPath = path.dirname(filePath);\n\n fsExtra.ensureDirSync(folderPath);\n fs.writeFileSync(filePath, JSON.stringify(data, null, 2), 'utf8');\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/json-utilities",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "Helpers for reading/writing json files.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
+
"source": "./src/index.ts",
|
|
11
12
|
"types": "./lib/index.d.ts",
|
|
12
13
|
"import": "./lib/index.js"
|
|
13
14
|
}
|
|
@@ -16,11 +17,10 @@
|
|
|
16
17
|
"fs-extra": "^11.0.0"
|
|
17
18
|
},
|
|
18
19
|
"devDependencies": {
|
|
19
|
-
"@ms-cloudpack/eslint-
|
|
20
|
+
"@ms-cloudpack/eslint-plugin-internal": "*",
|
|
20
21
|
"@ms-cloudpack/scripts": "*"
|
|
21
22
|
},
|
|
22
23
|
"scripts": {
|
|
23
|
-
"api:update": "cloudpack-scripts api-update",
|
|
24
24
|
"api": "cloudpack-scripts api",
|
|
25
25
|
"build:watch": "cloudpack-scripts build-watch",
|
|
26
26
|
"build": "cloudpack-scripts build",
|