@niche-works/dev 0.1.0 → 0.3.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/LICENSE +21 -0
- package/README.md +3 -0
- package/package.json +31 -18
- package/src/addExports/addExports.ts +98 -0
- package/src/addExports/index.ts +2 -0
- package/src/addExports/types.ts +33 -0
- package/src/addJsExtensions/addJsExtensions.ts +31 -0
- package/src/addJsExtensions/index.ts +1 -0
- package/src/checkExistence/checkExistence.ts +16 -0
- package/src/checkExistence/index.ts +1 -0
- package/src/editJsonFile/editJsonFile.ts +30 -0
- package/src/editJsonFile/index.ts +1 -0
- package/src/generatePublishPackageJson/generatePublishPackageJson.ts +55 -0
- package/src/generatePublishPackageJson/index.ts +2 -0
- package/src/generatePublishPackageJson/types.ts +61 -0
- package/src/index.ts +10 -0
- package/src/indexes/constants.ts +135 -0
- package/src/indexes/index.ts +2 -0
- package/src/indexes/indexes.ts +194 -0
- package/src/indexes/types.ts +87 -0
- package/src/installFromLocal/index.ts +2 -0
- package/{installFromLocal/installFromLocal.js → src/installFromLocal/installFromLocal.ts} +63 -48
- package/src/installFromLocal/types.ts +19 -0
- package/src/isMatchingPath/_types.ts +65 -0
- package/src/isMatchingPath/index.ts +2 -0
- package/src/isMatchingPath/isMatchingPath.ts +88 -0
- package/src/isMatchingPath/types.ts +21 -0
- package/src/moveFilesToSubdir/index.ts +1 -0
- package/src/moveFilesToSubdir/moveFilesToSubdir.ts +23 -0
- package/src/ver/index.ts +2 -0
- package/src/ver/types.ts +13 -0
- package/src/ver/ver.ts +38 -0
- package/tsconfig.json +46 -0
- package/tsup.config.ts +36 -0
- package/addExports/addExports.cjs +0 -71
- package/addExports/addExports.cjs.map +0 -1
- package/addExports/addExports.d.cts +0 -13
- package/addExports/addExports.d.ts +0 -13
- package/addExports/addExports.js +0 -71
- package/addExports/addExports.js.map +0 -1
- package/addExports/index.cjs +0 -5
- package/addExports/index.cjs.map +0 -1
- package/addExports/index.d.cts +0 -5
- package/addExports/index.d.ts +0 -5
- package/addExports/index.js +0 -5
- package/addExports/index.js.map +0 -1
- package/addExports/types.cjs +0 -1
- package/addExports/types.cjs.map +0 -1
- package/addExports/types.d.cts +0 -33
- package/addExports/types.d.ts +0 -33
- package/addExports/types.js +0 -1
- package/addExports/types.js.map +0 -1
- package/checkExistence/checkExistence.cjs +0 -15
- package/checkExistence/checkExistence.cjs.map +0 -1
- package/checkExistence/checkExistence.d.cts +0 -8
- package/checkExistence/checkExistence.d.ts +0 -8
- package/checkExistence/checkExistence.js +0 -15
- package/checkExistence/checkExistence.js.map +0 -1
- package/checkExistence/index.cjs +0 -5
- package/checkExistence/index.cjs.map +0 -1
- package/checkExistence/index.d.cts +0 -1
- package/checkExistence/index.d.ts +0 -1
- package/checkExistence/index.js +0 -5
- package/checkExistence/index.js.map +0 -1
- package/editJsonFile/editJsonFile.cjs +0 -22
- package/editJsonFile/editJsonFile.cjs.map +0 -1
- package/editJsonFile/editJsonFile.d.cts +0 -8
- package/editJsonFile/editJsonFile.d.ts +0 -8
- package/editJsonFile/editJsonFile.js +0 -22
- package/editJsonFile/editJsonFile.js.map +0 -1
- package/editJsonFile/index.cjs +0 -5
- package/editJsonFile/index.cjs.map +0 -1
- package/editJsonFile/index.d.cts +0 -1
- package/editJsonFile/index.d.ts +0 -1
- package/editJsonFile/index.js +0 -5
- package/editJsonFile/index.js.map +0 -1
- package/index.cjs +0 -19
- package/index.cjs.map +0 -1
- package/index.d.cts +0 -15
- package/index.d.ts +0 -15
- package/index.js +0 -19
- package/index.js.map +0 -1
- package/indexes/constants.cjs +0 -91
- package/indexes/constants.cjs.map +0 -1
- package/indexes/constants.d.cts +0 -66
- package/indexes/constants.d.ts +0 -66
- package/indexes/constants.js +0 -91
- package/indexes/constants.js.map +0 -1
- package/indexes/index.cjs +0 -5
- package/indexes/index.cjs.map +0 -1
- package/indexes/index.d.cts +0 -5
- package/indexes/index.d.ts +0 -5
- package/indexes/index.js +0 -5
- package/indexes/index.js.map +0 -1
- package/indexes/indexes.cjs +0 -161
- package/indexes/indexes.cjs.map +0 -1
- package/indexes/indexes.d.cts +0 -13
- package/indexes/indexes.d.ts +0 -13
- package/indexes/indexes.js +0 -161
- package/indexes/indexes.js.map +0 -1
- package/indexes/types.cjs +0 -1
- package/indexes/types.cjs.map +0 -1
- package/indexes/types.d.cts +0 -81
- package/indexes/types.d.ts +0 -81
- package/indexes/types.js +0 -1
- package/indexes/types.js.map +0 -1
- package/installFromLocal/index.cjs +0 -5
- package/installFromLocal/index.cjs.map +0 -1
- package/installFromLocal/index.d.cts +0 -2
- package/installFromLocal/index.d.ts +0 -2
- package/installFromLocal/index.js +0 -5
- package/installFromLocal/index.js.map +0 -1
- package/installFromLocal/installFromLocal.cjs +0 -48
- package/installFromLocal/installFromLocal.cjs.map +0 -1
- package/installFromLocal/installFromLocal.d.cts +0 -10
- package/installFromLocal/installFromLocal.d.ts +0 -10
- package/installFromLocal/installFromLocal.js.map +0 -1
- package/installFromLocal/types.cjs +0 -1
- package/installFromLocal/types.cjs.map +0 -1
- package/installFromLocal/types.d.cts +0 -19
- package/installFromLocal/types.d.ts +0 -19
- package/installFromLocal/types.js +0 -1
- package/installFromLocal/types.js.map +0 -1
- package/isMatchingPath/_types.cjs +0 -1
- package/isMatchingPath/_types.cjs.map +0 -1
- package/isMatchingPath/_types.d.cts +0 -52
- package/isMatchingPath/_types.d.ts +0 -52
- package/isMatchingPath/_types.js +0 -1
- package/isMatchingPath/_types.js.map +0 -1
- package/isMatchingPath/index.cjs +0 -5
- package/isMatchingPath/index.cjs.map +0 -1
- package/isMatchingPath/index.d.cts +0 -4
- package/isMatchingPath/index.d.ts +0 -4
- package/isMatchingPath/index.js +0 -5
- package/isMatchingPath/index.js.map +0 -1
- package/isMatchingPath/isMatchingPath.cjs +0 -57
- package/isMatchingPath/isMatchingPath.cjs.map +0 -1
- package/isMatchingPath/isMatchingPath.d.cts +0 -14
- package/isMatchingPath/isMatchingPath.d.ts +0 -14
- package/isMatchingPath/isMatchingPath.js +0 -57
- package/isMatchingPath/isMatchingPath.js.map +0 -1
- package/isMatchingPath/types.cjs +0 -1
- package/isMatchingPath/types.cjs.map +0 -1
- package/isMatchingPath/types.d.cts +0 -19
- package/isMatchingPath/types.d.ts +0 -19
- package/isMatchingPath/types.js +0 -1
- package/isMatchingPath/types.js.map +0 -1
- package/moveFilesToSubdir/index.cjs +0 -5
- package/moveFilesToSubdir/index.cjs.map +0 -1
- package/moveFilesToSubdir/index.d.cts +0 -1
- package/moveFilesToSubdir/index.d.ts +0 -1
- package/moveFilesToSubdir/index.js +0 -5
- package/moveFilesToSubdir/index.js.map +0 -1
- package/moveFilesToSubdir/moveFilesToSubdir.cjs +0 -19
- package/moveFilesToSubdir/moveFilesToSubdir.cjs.map +0 -1
- package/moveFilesToSubdir/moveFilesToSubdir.d.cts +0 -7
- package/moveFilesToSubdir/moveFilesToSubdir.d.ts +0 -7
- package/moveFilesToSubdir/moveFilesToSubdir.js +0 -19
- package/moveFilesToSubdir/moveFilesToSubdir.js.map +0 -1
- package/ver/index.cjs +0 -5
- package/ver/index.cjs.map +0 -1
- package/ver/index.d.cts +0 -2
- package/ver/index.d.ts +0 -2
- package/ver/index.js +0 -5
- package/ver/index.js.map +0 -1
- package/ver/types.cjs +0 -1
- package/ver/types.cjs.map +0 -1
- package/ver/types.d.cts +0 -14
- package/ver/types.d.ts +0 -14
- package/ver/types.js +0 -1
- package/ver/types.js.map +0 -1
- package/ver/ver.cjs +0 -31
- package/ver/ver.cjs.map +0 -1
- package/ver/ver.d.cts +0 -10
- package/ver/ver.d.ts +0 -10
- package/ver/ver.js +0 -31
- package/ver/ver.js.map +0 -1
package/isMatchingPath/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/isMatchingPath/index.ts"],"sourcesContent":["export { default } from './isMatchingPath';\r\nexport type * from './types';\r\n"],"mappings":"AAAA,SAAS,WAAAA,gBAAe;","names":["default"]}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
2
|
-
var _path = require('path');
|
|
3
|
-
var _remeda = require('remeda');
|
|
4
|
-
function isMatchingPath(targetPath, conditions, options = {}) {
|
|
5
|
-
if (!conditions) {
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
const conditionList = Array.isArray(conditions) ? conditions : [conditions];
|
|
9
|
-
const posixPath = _path.posix.normalize(targetPath);
|
|
10
|
-
const parsedPath = _path.posix.parse(posixPath);
|
|
11
|
-
const parsedDir = _path.posix.parse(parsedPath.dir);
|
|
12
|
-
const values = {
|
|
13
|
-
path: posixPath,
|
|
14
|
-
...parsedPath,
|
|
15
|
-
dirpath: parsedPath.dir,
|
|
16
|
-
dirbase: parsedDir.base,
|
|
17
|
-
dirname: parsedDir.name,
|
|
18
|
-
dirext: parsedDir.ext
|
|
19
|
-
};
|
|
20
|
-
values.path = posixPath;
|
|
21
|
-
for (const condition of conditionList) {
|
|
22
|
-
if (_isMatching(values.path, values, condition, options)) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
function _isMatching(value, values, condition, options) {
|
|
29
|
-
if (_remeda.isString.call(void 0, condition)) {
|
|
30
|
-
if (value.includes(condition)) {
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
} else if (condition instanceof RegExp) {
|
|
34
|
-
if (condition.test(value)) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
} else if (_remeda.isFunction.call(void 0, condition)) {
|
|
38
|
-
return condition(values, _nullishCoalesce(options.conditionOptions, () => ( {})));
|
|
39
|
-
} else {
|
|
40
|
-
const { valueType = "path", entryType = "both", conditions } = condition;
|
|
41
|
-
if (entryType !== "both") {
|
|
42
|
-
const stat = _fsextra2.default.statSync(values.path);
|
|
43
|
-
if (stat.isDirectory() && entryType !== "dir" || stat.isFile() && entryType !== "file") {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const conditionList = Array.isArray(conditions) ? conditions : [conditions];
|
|
48
|
-
return conditionList.every(
|
|
49
|
-
(cond) => _isMatching(values[valueType], values, cond, options)
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
exports.default = isMatchingPath;
|
|
57
|
-
//# sourceMappingURL=isMatchingPath.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["c:\\Users\\mitsu\\Documents\\git\\@niche-works\\packages\\dev\\dist\\isMatchingPath\\isMatchingPath.cjs"],"names":[],"mappings":"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","file":"C:\\Users\\mitsu\\Documents\\git\\@niche-works\\packages\\dev\\dist\\isMatchingPath\\isMatchingPath.cjs","sourcesContent":[null]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IsMatchingPathCondition, IsMatchingPathOptions } from './types.cjs';
|
|
2
|
-
import './_types.cjs';
|
|
3
|
-
import 'path';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 処理対象のパスか判定する
|
|
7
|
-
* @param targetPath 検査対象のパス
|
|
8
|
-
* @param conditions 一致条件
|
|
9
|
-
* @param options オプション
|
|
10
|
-
* @returns 一致するか
|
|
11
|
-
*/
|
|
12
|
-
declare function isMatchingPath(targetPath: string, conditions: IsMatchingPathCondition | IsMatchingPathCondition[], options?: IsMatchingPathOptions): boolean;
|
|
13
|
-
|
|
14
|
-
export { isMatchingPath as default };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IsMatchingPathCondition, IsMatchingPathOptions } from './types.js';
|
|
2
|
-
import './_types.js';
|
|
3
|
-
import 'path';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 処理対象のパスか判定する
|
|
7
|
-
* @param targetPath 検査対象のパス
|
|
8
|
-
* @param conditions 一致条件
|
|
9
|
-
* @param options オプション
|
|
10
|
-
* @returns 一致するか
|
|
11
|
-
*/
|
|
12
|
-
declare function isMatchingPath(targetPath: string, conditions: IsMatchingPathCondition | IsMatchingPathCondition[], options?: IsMatchingPathOptions): boolean;
|
|
13
|
-
|
|
14
|
-
export { isMatchingPath as default };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import fs from "fs-extra";
|
|
2
|
-
import { posix as path } from "path";
|
|
3
|
-
import { isFunction, isString } from "remeda";
|
|
4
|
-
function isMatchingPath(targetPath, conditions, options = {}) {
|
|
5
|
-
if (!conditions) {
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
const conditionList = Array.isArray(conditions) ? conditions : [conditions];
|
|
9
|
-
const posixPath = path.normalize(targetPath);
|
|
10
|
-
const parsedPath = path.parse(posixPath);
|
|
11
|
-
const parsedDir = path.parse(parsedPath.dir);
|
|
12
|
-
const values = {
|
|
13
|
-
path: posixPath,
|
|
14
|
-
...parsedPath,
|
|
15
|
-
dirpath: parsedPath.dir,
|
|
16
|
-
dirbase: parsedDir.base,
|
|
17
|
-
dirname: parsedDir.name,
|
|
18
|
-
dirext: parsedDir.ext
|
|
19
|
-
};
|
|
20
|
-
values.path = posixPath;
|
|
21
|
-
for (const condition of conditionList) {
|
|
22
|
-
if (_isMatching(values.path, values, condition, options)) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
function _isMatching(value, values, condition, options) {
|
|
29
|
-
if (isString(condition)) {
|
|
30
|
-
if (value.includes(condition)) {
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
} else if (condition instanceof RegExp) {
|
|
34
|
-
if (condition.test(value)) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
} else if (isFunction(condition)) {
|
|
38
|
-
return condition(values, options.conditionOptions ?? {});
|
|
39
|
-
} else {
|
|
40
|
-
const { valueType = "path", entryType = "both", conditions } = condition;
|
|
41
|
-
if (entryType !== "both") {
|
|
42
|
-
const stat = fs.statSync(values.path);
|
|
43
|
-
if (stat.isDirectory() && entryType !== "dir" || stat.isFile() && entryType !== "file") {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const conditionList = Array.isArray(conditions) ? conditions : [conditions];
|
|
48
|
-
return conditionList.every(
|
|
49
|
-
(cond) => _isMatching(values[valueType], values, cond, options)
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
export {
|
|
55
|
-
isMatchingPath as default
|
|
56
|
-
};
|
|
57
|
-
//# sourceMappingURL=isMatchingPath.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/isMatchingPath/isMatchingPath.ts"],"sourcesContent":["import fs from 'fs-extra';\r\nimport { posix as path } from 'path';\r\nimport { isFunction, isString } from 'remeda';\r\nimport type { ConditionValues } from './_types';\r\nimport type { IsMatchingPathCondition, IsMatchingPathOptions } from './types';\r\n\r\n/**\r\n * 処理対象のパスか判定する\r\n * @param targetPath 検査対象のパス\r\n * @param conditions 一致条件\r\n * @param options オプション\r\n * @returns 一致するか\r\n */\r\nexport default function isMatchingPath(\r\n targetPath: string,\r\n conditions: IsMatchingPathCondition | IsMatchingPathCondition[],\r\n options: IsMatchingPathOptions = {},\r\n) {\r\n if (!conditions) {\r\n return false;\r\n }\r\n const conditionList = Array.isArray(conditions) ? conditions : [conditions];\r\n // パスは'/'区切り\r\n const posixPath = path.normalize(targetPath);\r\n const parsedPath = path.parse(posixPath);\r\n const parsedDir = path.parse(parsedPath.dir);\r\n const values = {\r\n path: posixPath,\r\n ...parsedPath,\r\n dirpath: parsedPath.dir,\r\n dirbase: parsedDir.base,\r\n dirname: parsedDir.name,\r\n dirext: parsedDir.ext,\r\n };\r\n values.path = posixPath;\r\n\r\n for (const condition of conditionList) {\r\n if (_isMatching(values.path, values, condition, options)) {\r\n // conditionの内の何れかがtrueならば一致\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nfunction _isMatching(\r\n value: string,\r\n values: ConditionValues,\r\n condition: IsMatchingPathCondition,\r\n options: IsMatchingPathOptions,\r\n): boolean {\r\n if (isString(condition)) {\r\n // 条件が文字列\r\n if (value.includes(condition)) {\r\n return true;\r\n }\r\n } else if (condition instanceof RegExp) {\r\n // 条件が正規表現\r\n if (condition.test(value)) {\r\n return true;\r\n }\r\n } else if (isFunction(condition)) {\r\n // 条件が関数\r\n return condition(values, options.conditionOptions ?? {});\r\n } else {\r\n // 条件が設定\r\n const { valueType = 'path', entryType = 'both', conditions } = condition;\r\n if (entryType !== 'both') {\r\n const stat = fs.statSync(values.path);\r\n if (\r\n (stat.isDirectory() && entryType !== 'dir') ||\r\n (stat.isFile() && entryType !== 'file')\r\n ) {\r\n return false;\r\n }\r\n }\r\n const conditionList = Array.isArray(conditions) ? conditions : [conditions];\r\n // 設定配下のconditionsはand条件\r\n return conditionList.every((cond) =>\r\n _isMatching(values[valueType], values, cond, options),\r\n );\r\n }\r\n return false;\r\n}\r\n"],"mappings":"AAAA,OAAO,QAAQ;AACf,SAAS,SAAS,YAAY;AAC9B,SAAS,YAAY,gBAAgB;AAWtB,SAAR,eACL,YACA,YACA,UAAiC,CAAC,GAClC;AACA,MAAI,CAAC,YAAY;AACf,WAAO;AAAA,EACT;AACA,QAAM,gBAAgB,MAAM,QAAQ,UAAU,IAAI,aAAa,CAAC,UAAU;AAE1E,QAAM,YAAY,KAAK,UAAU,UAAU;AAC3C,QAAM,aAAa,KAAK,MAAM,SAAS;AACvC,QAAM,YAAY,KAAK,MAAM,WAAW,GAAG;AAC3C,QAAM,SAAS;AAAA,IACb,MAAM;AAAA,IACN,GAAG;AAAA,IACH,SAAS,WAAW;AAAA,IACpB,SAAS,UAAU;AAAA,IACnB,SAAS,UAAU;AAAA,IACnB,QAAQ,UAAU;AAAA,EACpB;AACA,SAAO,OAAO;AAEd,aAAW,aAAa,eAAe;AACrC,QAAI,YAAY,OAAO,MAAM,QAAQ,WAAW,OAAO,GAAG;AAExD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,YACP,OACA,QACA,WACA,SACS;AACT,MAAI,SAAS,SAAS,GAAG;AAEvB,QAAI,MAAM,SAAS,SAAS,GAAG;AAC7B,aAAO;AAAA,IACT;AAAA,EACF,WAAW,qBAAqB,QAAQ;AAEtC,QAAI,UAAU,KAAK,KAAK,GAAG;AACzB,aAAO;AAAA,IACT;AAAA,EACF,WAAW,WAAW,SAAS,GAAG;AAEhC,WAAO,UAAU,QAAQ,QAAQ,oBAAoB,CAAC,CAAC;AAAA,EACzD,OAAO;AAEL,UAAM,EAAE,YAAY,QAAQ,YAAY,QAAQ,WAAW,IAAI;AAC/D,QAAI,cAAc,QAAQ;AACxB,YAAM,OAAO,GAAG,SAAS,OAAO,IAAI;AACpC,UACG,KAAK,YAAY,KAAK,cAAc,SACpC,KAAK,OAAO,KAAK,cAAc,QAChC;AACA,eAAO;AAAA,MACT;AAAA,IACF;AACA,UAAM,gBAAgB,MAAM,QAAQ,UAAU,IAAI,aAAa,CAAC,UAAU;AAE1E,WAAO,cAAc;AAAA,MAAM,CAAC,SAC1B,YAAY,OAAO,SAAS,GAAG,QAAQ,MAAM,OAAO;AAAA,IACtD;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
package/isMatchingPath/types.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";//# sourceMappingURL=types.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["c:\\Users\\mitsu\\Documents\\git\\@niche-works\\packages\\dev\\dist\\isMatchingPath\\types.cjs"],"names":[],"mappings":"AAAA","file":"C:\\Users\\mitsu\\Documents\\git\\@niche-works\\packages\\dev\\dist\\isMatchingPath\\types.cjs"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ConditionConfig, ConditionFn } from './_types.cjs';
|
|
2
|
-
import 'path';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 一致条件
|
|
6
|
-
*
|
|
7
|
-
* - string: 指定された文字列がパスに含まれているものに一致する際にtrue
|
|
8
|
-
* - RegExp: 指定された正規表現にパスが一致する際にtrue
|
|
9
|
-
* - ConditionConfig: 条件設定に従って検査し一致したときにtrue
|
|
10
|
-
*/
|
|
11
|
-
type IsMatchingPathCondition = string | RegExp | ConditionConfig | ConditionFn;
|
|
12
|
-
type IsMatchingPathOptions = {
|
|
13
|
-
/**
|
|
14
|
-
* ConditionFnに渡すオプション
|
|
15
|
-
*/
|
|
16
|
-
conditionOptions?: Record<string, any>;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export type { IsMatchingPathCondition, IsMatchingPathOptions };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ConditionConfig, ConditionFn } from './_types.js';
|
|
2
|
-
import 'path';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 一致条件
|
|
6
|
-
*
|
|
7
|
-
* - string: 指定された文字列がパスに含まれているものに一致する際にtrue
|
|
8
|
-
* - RegExp: 指定された正規表現にパスが一致する際にtrue
|
|
9
|
-
* - ConditionConfig: 条件設定に従って検査し一致したときにtrue
|
|
10
|
-
*/
|
|
11
|
-
type IsMatchingPathCondition = string | RegExp | ConditionConfig | ConditionFn;
|
|
12
|
-
type IsMatchingPathOptions = {
|
|
13
|
-
/**
|
|
14
|
-
* ConditionFnに渡すオプション
|
|
15
|
-
*/
|
|
16
|
-
conditionOptions?: Record<string, any>;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export type { IsMatchingPathCondition, IsMatchingPathOptions };
|
package/isMatchingPath/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _moveFilesToSubdir = require('./moveFilesToSubdir'); var _moveFilesToSubdir2 = _interopRequireDefault(_moveFilesToSubdir);
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.default = _moveFilesToSubdir2.default;
|
|
5
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["c:\\Users\\mitsu\\Documents\\git\\@niche-works\\packages\\dev\\dist\\moveFilesToSubdir\\index.cjs"],"names":[],"mappings":"AAAA,uSAAyD;AACzD;AACE;AACF,8CAAC","file":"C:\\Users\\mitsu\\Documents\\git\\@niche-works\\packages\\dev\\dist\\moveFilesToSubdir\\index.cjs","sourcesContent":[null]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './moveFilesToSubdir.cjs';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './moveFilesToSubdir.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/moveFilesToSubdir/index.ts"],"sourcesContent":["export { default } from './moveFilesToSubdir';\r\n"],"mappings":"AAAA,SAAS,WAAAA,gBAAe;","names":["default"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
2
|
-
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
3
|
-
async function moveFilesToSubdir(dirPath) {
|
|
4
|
-
const items = await _fsextra2.default.readdir(dirPath);
|
|
5
|
-
for (const item of items) {
|
|
6
|
-
const itemPath = _path2.default.join(dirPath, item);
|
|
7
|
-
const stat = _fsextra2.default.statSync(itemPath);
|
|
8
|
-
if (stat.isFile()) {
|
|
9
|
-
const fileName = _path2.default.parse(item).name;
|
|
10
|
-
const subdirPath = _path2.default.join(dirPath, fileName);
|
|
11
|
-
_fsextra2.default.ensureDirSync(subdirPath);
|
|
12
|
-
_fsextra2.default.moveSync(itemPath, _path2.default.join(subdirPath, item));
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
exports.default = moveFilesToSubdir;
|
|
19
|
-
//# sourceMappingURL=moveFilesToSubdir.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["c:\\Users\\mitsu\\Documents\\git\\@niche-works\\packages\\dev\\dist\\moveFilesToSubdir\\moveFilesToSubdir.cjs"],"names":[],"mappings":"AAAA,8PAAyB;AACzB,wEAAuB;AACvB,MAAM,SAAS,iBAAiB,CAAC,OAAO,EAAE;AAC1C,EAAE,MAAM,MAAM,EAAE,MAAM,iBAAE,CAAC,OAAO,CAAC,OAAO,CAAC;AACzC,EAAE,IAAI,CAAC,MAAM,KAAK,GAAG,KAAK,EAAE;AAC5B,IAAI,MAAM,SAAS,EAAE,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC;AAC7C,IAAI,MAAM,KAAK,EAAE,iBAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;AACtC,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE;AACvB,MAAM,MAAM,SAAS,EAAE,cAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI;AAC5C,MAAM,MAAM,WAAW,EAAE,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC;AACrD,MAAM,iBAAE,CAAC,aAAa,CAAC,UAAU,CAAC;AAClC,MAAM,iBAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AACxD,IAAI;AACJ,EAAE;AACF;AACA;AACE;AACF,oCAAC","file":"C:\\Users\\mitsu\\Documents\\git\\@niche-works\\packages\\dev\\dist\\moveFilesToSubdir\\moveFilesToSubdir.cjs","sourcesContent":[null]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import fs from "fs-extra";
|
|
2
|
-
import path from "path";
|
|
3
|
-
async function moveFilesToSubdir(dirPath) {
|
|
4
|
-
const items = await fs.readdir(dirPath);
|
|
5
|
-
for (const item of items) {
|
|
6
|
-
const itemPath = path.join(dirPath, item);
|
|
7
|
-
const stat = fs.statSync(itemPath);
|
|
8
|
-
if (stat.isFile()) {
|
|
9
|
-
const fileName = path.parse(item).name;
|
|
10
|
-
const subdirPath = path.join(dirPath, fileName);
|
|
11
|
-
fs.ensureDirSync(subdirPath);
|
|
12
|
-
fs.moveSync(itemPath, path.join(subdirPath, item));
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
moveFilesToSubdir as default
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=moveFilesToSubdir.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/moveFilesToSubdir/moveFilesToSubdir.ts"],"sourcesContent":["import fs from 'fs-extra';\r\nimport path from 'path';\r\n\r\n/**\r\n * 対象のディレクトリ直下のファイルを、拡張子を除いた同名のサブディレクトリ直下に移動する\r\n * @param dirPath 対象のディレクトリのパス\r\n */\r\nexport default async function moveFilesToSubdir(dirPath: string) {\r\n const items = await fs.readdir(dirPath);\r\n for (const item of items) {\r\n const itemPath = path.join(dirPath, item);\r\n const stat = fs.statSync(itemPath);\r\n if (stat.isFile()) {\r\n const fileName = path.parse(item).name;\r\n // 移動先のディレクトリパスを生成\r\n const subdirPath = path.join(dirPath, fileName);\r\n // 移動先のディレクトリが存在しなければ作成\r\n fs.ensureDirSync(subdirPath);\r\n // 移動先のファイルパスを生成\r\n fs.moveSync(itemPath, path.join(subdirPath, item));\r\n }\r\n }\r\n}\r\n"],"mappings":"AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAMjB,eAAO,kBAAyC,SAAiB;AAC/D,QAAM,QAAQ,MAAM,GAAG,QAAQ,OAAO;AACtC,aAAW,QAAQ,OAAO;AACxB,UAAM,WAAW,KAAK,KAAK,SAAS,IAAI;AACxC,UAAM,OAAO,GAAG,SAAS,QAAQ;AACjC,QAAI,KAAK,OAAO,GAAG;AACjB,YAAM,WAAW,KAAK,MAAM,IAAI,EAAE;AAElC,YAAM,aAAa,KAAK,KAAK,SAAS,QAAQ;AAE9C,SAAG,cAAc,UAAU;AAE3B,SAAG,SAAS,UAAU,KAAK,KAAK,YAAY,IAAI,CAAC;AAAA,IACnD;AAAA,EACF;AACF;","names":[]}
|
package/ver/index.cjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _ver = require('./ver'); var _ver2 = _interopRequireDefault(_ver);
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.default = _ver2.default;
|
|
5
|
-
//# sourceMappingURL=index.cjs.map
|
package/ver/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["c:\\Users\\mitsu\\Documents\\git\\@niche-works\\packages\\dev\\dist\\ver\\index.cjs"],"names":[],"mappings":"AAAA,+OAA2C;AAC3C;AACE;AACF,gCAAC","file":"C:\\Users\\mitsu\\Documents\\git\\@niche-works\\packages\\dev\\dist\\ver\\index.cjs","sourcesContent":[null]}
|
package/ver/index.d.cts
DELETED
package/ver/index.d.ts
DELETED
package/ver/index.js
DELETED
package/ver/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ver/index.ts"],"sourcesContent":["export type * from './types';\r\nexport { default } from './ver';\r\n"],"mappings":"AACA,SAAS,WAAAA,gBAAe;","names":["default"]}
|
package/ver/types.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";//# sourceMappingURL=types.cjs.map
|
package/ver/types.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["c:\\Users\\mitsu\\Documents\\git\\@niche-works\\packages\\dev\\dist\\ver\\types.cjs"],"names":[],"mappings":"AAAA","file":"C:\\Users\\mitsu\\Documents\\git\\@niche-works\\packages\\dev\\dist\\ver\\types.cjs"}
|
package/ver/types.d.cts
DELETED
package/ver/types.d.ts
DELETED
package/ver/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=types.js.map
|
package/ver/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/ver/ver.cjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
2
|
-
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
3
|
-
async function ver(version, options = {}) {
|
|
4
|
-
const {
|
|
5
|
-
workspacePackageJsonPath = "package.json",
|
|
6
|
-
packagesPath = "packages"
|
|
7
|
-
} = options;
|
|
8
|
-
if (_fsextra2.default.existsSync(workspacePackageJsonPath)) {
|
|
9
|
-
_updatePkgJson(version, workspacePackageJsonPath);
|
|
10
|
-
}
|
|
11
|
-
const pkgs = _fsextra2.default.readdirSync(packagesPath);
|
|
12
|
-
for (const pkg of pkgs) {
|
|
13
|
-
const packagePath = _path2.default.join(packagesPath, pkg);
|
|
14
|
-
const packageJsonPath = _path2.default.join(packagePath, "package.json");
|
|
15
|
-
if (_fsextra2.default.existsSync(packageJsonPath)) {
|
|
16
|
-
_updatePkgJson(version, packageJsonPath);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function _updatePkgJson(version, packageJsonPath) {
|
|
21
|
-
const packageJson = _fsextra2.default.readJsonSync(packageJsonPath, { encoding: "utf8" });
|
|
22
|
-
packageJson.version = version;
|
|
23
|
-
_fsextra2.default.writeJsonSync(packageJsonPath, packageJson, {
|
|
24
|
-
encoding: "utf8",
|
|
25
|
-
spaces: 2
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
exports.default = ver;
|
|
31
|
-
//# sourceMappingURL=ver.cjs.map
|
package/ver/ver.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["c:\\Users\\mitsu\\Documents\\git\\@niche-works\\packages\\dev\\dist\\ver\\ver.cjs"],"names":[],"mappings":"AAAA,8PAAyB;AACzB,wEAAuB;AACvB,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE;AAC1C,EAAE,MAAM;AACR,IAAI,yBAAyB,EAAE,cAAc;AAC7C,IAAI,aAAa,EAAE;AACnB,EAAE,EAAE,EAAE,OAAO;AACb,EAAE,GAAG,CAAC,iBAAE,CAAC,UAAU,CAAC,wBAAwB,CAAC,EAAE;AAC/C,IAAI,cAAc,CAAC,OAAO,EAAE,wBAAwB,CAAC;AACrD,EAAE;AACF,EAAE,MAAM,KAAK,EAAE,iBAAE,CAAC,WAAW,CAAC,YAAY,CAAC;AAC3C,EAAE,IAAI,CAAC,MAAM,IAAI,GAAG,IAAI,EAAE;AAC1B,IAAI,MAAM,YAAY,EAAE,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC;AACpD,IAAI,MAAM,gBAAgB,EAAE,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC;AAClE,IAAI,GAAG,CAAC,iBAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE;AACxC,MAAM,cAAc,CAAC,OAAO,EAAE,eAAe,CAAC;AAC9C,IAAI;AACJ,EAAE;AACF;AACA,SAAS,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE;AAClD,EAAE,MAAM,YAAY,EAAE,iBAAE,CAAC,YAAY,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC5E,EAAE,WAAW,CAAC,QAAQ,EAAE,OAAO;AAC/B,EAAE,iBAAE,CAAC,aAAa,CAAC,eAAe,EAAE,WAAW,EAAE;AACjD,IAAI,QAAQ,EAAE,MAAM;AACpB,IAAI,MAAM,EAAE;AACZ,EAAE,CAAC,CAAC;AACJ;AACA;AACE;AACF,sBAAC","file":"C:\\Users\\mitsu\\Documents\\git\\@niche-works\\packages\\dev\\dist\\ver\\ver.cjs","sourcesContent":[null]}
|
package/ver/ver.d.cts
DELETED
package/ver/ver.d.ts
DELETED
package/ver/ver.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import fs from "fs-extra";
|
|
2
|
-
import path from "path";
|
|
3
|
-
async function ver(version, options = {}) {
|
|
4
|
-
const {
|
|
5
|
-
workspacePackageJsonPath = "package.json",
|
|
6
|
-
packagesPath = "packages"
|
|
7
|
-
} = options;
|
|
8
|
-
if (fs.existsSync(workspacePackageJsonPath)) {
|
|
9
|
-
_updatePkgJson(version, workspacePackageJsonPath);
|
|
10
|
-
}
|
|
11
|
-
const pkgs = fs.readdirSync(packagesPath);
|
|
12
|
-
for (const pkg of pkgs) {
|
|
13
|
-
const packagePath = path.join(packagesPath, pkg);
|
|
14
|
-
const packageJsonPath = path.join(packagePath, "package.json");
|
|
15
|
-
if (fs.existsSync(packageJsonPath)) {
|
|
16
|
-
_updatePkgJson(version, packageJsonPath);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function _updatePkgJson(version, packageJsonPath) {
|
|
21
|
-
const packageJson = fs.readJsonSync(packageJsonPath, { encoding: "utf8" });
|
|
22
|
-
packageJson.version = version;
|
|
23
|
-
fs.writeJsonSync(packageJsonPath, packageJson, {
|
|
24
|
-
encoding: "utf8",
|
|
25
|
-
spaces: 2
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
ver as default
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=ver.js.map
|
package/ver/ver.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ver/ver.ts"],"sourcesContent":["import fs from 'fs-extra';\r\nimport path from 'path';\r\nimport type { VerOptions } from './types';\r\n\r\n/**\r\n * ワークスペースのパッケージにバージョンを反映する\r\n * @param version バージョン\r\n * @param options オプション\r\n */\r\nexport default async function ver(version: string, options: VerOptions = {}) {\r\n const {\r\n workspacePackageJsonPath = 'package.json',\r\n packagesPath = 'packages',\r\n } = options;\r\n\r\n if (fs.existsSync(workspacePackageJsonPath)) {\r\n // ワークスペースのpackage.jsonを更新\r\n _updatePkgJson(version, workspacePackageJsonPath);\r\n }\r\n const pkgs = fs.readdirSync(packagesPath);\r\n for (const pkg of pkgs) {\r\n const packagePath = path.join(packagesPath, pkg);\r\n const packageJsonPath = path.join(packagePath, 'package.json');\r\n if (fs.existsSync(packageJsonPath)) {\r\n // 各パッケージのpackage.jsonを更新\r\n _updatePkgJson(version, packageJsonPath);\r\n }\r\n }\r\n}\r\n\r\nfunction _updatePkgJson(version: string, packageJsonPath: string) {\r\n const packageJson = fs.readJsonSync(packageJsonPath, { encoding: 'utf8' });\r\n packageJson.version = version;\r\n fs.writeJsonSync(packageJsonPath, packageJson, {\r\n encoding: 'utf8',\r\n spaces: 2,\r\n });\r\n}\r\n"],"mappings":"AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAQjB,eAAO,IAA2B,SAAiB,UAAsB,CAAC,GAAG;AAC3E,QAAM;AAAA,IACJ,2BAA2B;AAAA,IAC3B,eAAe;AAAA,EACjB,IAAI;AAEJ,MAAI,GAAG,WAAW,wBAAwB,GAAG;AAE3C,mBAAe,SAAS,wBAAwB;AAAA,EAClD;AACA,QAAM,OAAO,GAAG,YAAY,YAAY;AACxC,aAAW,OAAO,MAAM;AACtB,UAAM,cAAc,KAAK,KAAK,cAAc,GAAG;AAC/C,UAAM,kBAAkB,KAAK,KAAK,aAAa,cAAc;AAC7D,QAAI,GAAG,WAAW,eAAe,GAAG;AAElC,qBAAe,SAAS,eAAe;AAAA,IACzC;AAAA,EACF;AACF;AAEA,SAAS,eAAe,SAAiB,iBAAyB;AAChE,QAAM,cAAc,GAAG,aAAa,iBAAiB,EAAE,UAAU,OAAO,CAAC;AACzE,cAAY,UAAU;AACtB,KAAG,cAAc,iBAAiB,aAAa;AAAA,IAC7C,UAAU;AAAA,IACV,QAAQ;AAAA,EACV,CAAC;AACH;","names":[]}
|