@dxtmisha/scripts 0.5.12 → 0.5.13
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxtmisha/scripts",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.13",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Development scripts and CLI tools for DXT UI projects - automated component generation, library building and project management tools",
|
|
7
7
|
"keywords": [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Datetime, toArray, toKebabCase, transformation } from '@dxtmisha/functional-basic'
|
|
1
|
+
import { Datetime, forEach, toArray, toKebabCase, transformation } from '@dxtmisha/functional-basic'
|
|
2
2
|
|
|
3
3
|
import requireFs from 'fs'
|
|
4
4
|
import requirePath from 'path'
|
|
@@ -64,7 +64,12 @@ export class PropertiesFile {
|
|
|
64
64
|
* @param path a sequence of path segments/ последовательность сегментов пути
|
|
65
65
|
*/
|
|
66
66
|
static joinPath(path: PropertiesFilePath): string {
|
|
67
|
-
|
|
67
|
+
const pathArray = forEach(
|
|
68
|
+
toArray(path),
|
|
69
|
+
item => this.toSep(item)
|
|
70
|
+
) as string[]
|
|
71
|
+
|
|
72
|
+
return requirePath.join(...pathArray)
|
|
68
73
|
}
|
|
69
74
|
|
|
70
75
|
/**
|
|
@@ -226,6 +231,23 @@ export class PropertiesFile {
|
|
|
226
231
|
return new Datetime(this.stat(path)?.mtimeMs, 'full').standard()
|
|
227
232
|
}
|
|
228
233
|
|
|
234
|
+
/**
|
|
235
|
+
* Converts the path to use the current OS separator.
|
|
236
|
+
*
|
|
237
|
+
* Преобразует путь для использования текущего разделителя ОС.
|
|
238
|
+
* @param path path to the directory/ путь к директории
|
|
239
|
+
*/
|
|
240
|
+
static toSep(path: PropertiesFilePath): PropertiesFilePath {
|
|
241
|
+
const sep = this.sep()
|
|
242
|
+
|
|
243
|
+
if (sep === '/') {
|
|
244
|
+
return path
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return this.joinPath(path)
|
|
248
|
+
.replace('/', this.sep())
|
|
249
|
+
}
|
|
250
|
+
|
|
229
251
|
/**
|
|
230
252
|
* Reads the contents of the directory.
|
|
231
253
|
*
|