@stacksjs/storage 0.50.0 → 0.52.0
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/README.md +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +11 -0
- package/package.json +17 -17
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ pnpm test
|
|
|
53
53
|
|
|
54
54
|
Please see our [releases](https://github.com/stacksjs/stacks/releases) page for more information on what has changed recently.
|
|
55
55
|
|
|
56
|
-
##
|
|
56
|
+
## 🚜 Contributing
|
|
57
57
|
|
|
58
58
|
Please review the [Contributing Guide](https://github.com/stacksjs/contributing) for details.
|
|
59
59
|
|
package/dist/index.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export declare function deleteFiles(dir: string, exclude?: string[]): void;
|
|
|
36
36
|
export declare function deleteEmptyFolders(dir: string): void;
|
|
37
37
|
export declare function doesFolderExist(path: string): any;
|
|
38
38
|
export declare function createFolder(dir: string): Promise<void>;
|
|
39
|
+
export declare function updateConfigFile(filePath: string, newConfig: Record<string, unknown>): Promise<void>;
|
|
39
40
|
export declare const filesystem: {
|
|
40
41
|
_dirname: any;
|
|
41
42
|
readJsonFile: typeof readJsonFile;
|
|
@@ -52,6 +53,7 @@ export declare const filesystem: {
|
|
|
52
53
|
deleteFiles: typeof deleteFiles;
|
|
53
54
|
deleteEmptyFolders: typeof deleteEmptyFolders;
|
|
54
55
|
doesFolderExist: typeof doesFolderExist;
|
|
56
|
+
updateConfigFile: typeof updateConfigFile;
|
|
55
57
|
fs: any;
|
|
56
58
|
};
|
|
57
59
|
export default filesystem;
|
package/dist/index.mjs
CHANGED
|
@@ -126,6 +126,16 @@ export function createFolder(dir) {
|
|
|
126
126
|
});
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
+
export function updateConfigFile(filePath, newConfig) {
|
|
130
|
+
return new Promise((resolve, reject) => {
|
|
131
|
+
const config = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
132
|
+
for (const key in newConfig) {
|
|
133
|
+
config[key] = newConfig[key];
|
|
134
|
+
}
|
|
135
|
+
fs.writeFileSync(filePath, JSON.stringify(config, null, 2));
|
|
136
|
+
resolve();
|
|
137
|
+
});
|
|
138
|
+
}
|
|
129
139
|
export const filesystem = {
|
|
130
140
|
_dirname,
|
|
131
141
|
readJsonFile,
|
|
@@ -142,6 +152,7 @@ export const filesystem = {
|
|
|
142
152
|
deleteFiles,
|
|
143
153
|
deleteEmptyFolders,
|
|
144
154
|
doesFolderExist,
|
|
155
|
+
updateConfigFile,
|
|
145
156
|
fs
|
|
146
157
|
// potentially refactor to `...fs` but, currently, there is an issues when building @stacksjs/config
|
|
147
158
|
// the problem is relating to https://github.com/microsoft/TypeScript/issues/5711#issuecomment-157793294
|
package/package.json
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/storage",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"packageManager": "pnpm@
|
|
4
|
+
"version": "0.52.0",
|
|
5
|
+
"packageManager": "pnpm@8.5.1",
|
|
6
6
|
"description": "The Stacks file system.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"license": "MIT",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.mjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
9
15
|
"funding": "https://github.com/sponsors/chrisbbreuer",
|
|
10
16
|
"homepage": "https://github.com/stacksjs/stacks/tree/main/.stacks/core/storage#readme",
|
|
11
17
|
"repository": {
|
|
@@ -36,26 +42,20 @@
|
|
|
36
42
|
"dist",
|
|
37
43
|
"README.md"
|
|
38
44
|
],
|
|
39
|
-
"engines": {
|
|
40
|
-
"node": ">=v18.13.0",
|
|
41
|
-
"pnpm": ">=7.25.1"
|
|
42
|
-
},
|
|
43
45
|
"peerDependencies": {
|
|
44
|
-
"fs-extra": "^11.1.
|
|
45
|
-
"unstorage": "^1.0
|
|
46
|
-
"@stacksjs/arrays": "0.
|
|
47
|
-
"@stacksjs/
|
|
48
|
-
"@stacksjs/
|
|
46
|
+
"fs-extra": "^11.1.1",
|
|
47
|
+
"unstorage": "^1.6.0",
|
|
48
|
+
"@stacksjs/arrays": "0.52.0",
|
|
49
|
+
"@stacksjs/path": "0.52.0",
|
|
50
|
+
"@stacksjs/types": "0.52.0",
|
|
51
|
+
"@stacksjs/utils": "0.52.0"
|
|
49
52
|
},
|
|
50
53
|
"devDependencies": {
|
|
51
|
-
"
|
|
52
|
-
"typescript": "^4.9.4",
|
|
53
|
-
"@stacksjs/path": "0.50.0",
|
|
54
|
-
"@stacksjs/testing": "0.50.0"
|
|
54
|
+
"@stacksjs/development": "0.52.0"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
|
-
"build": "
|
|
58
|
-
"dev": "
|
|
57
|
+
"build": "unbuild",
|
|
58
|
+
"dev": "unbuild --stub",
|
|
59
59
|
"typecheck": "tsc --noEmit"
|
|
60
60
|
}
|
|
61
61
|
}
|