@yarn-tool/static-file 2.0.5 → 2.0.6

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/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.0.6](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/static-file@2.0.5...@yarn-tool/static-file@2.0.6) (2022-08-26)
7
+
8
+
9
+
10
+ ### 🔖 Miscellaneous
11
+
12
+ * . ([b3cfb9b](https://github.com/bluelovers/ws-yarn-workspaces/commit/b3cfb9bd8105fed14522ee3d3898141ba831471a))
13
+ * . ([157d5dc](https://github.com/bluelovers/ws-yarn-workspaces/commit/157d5dc8959261d9326f6e633987182898ae9670))
14
+ * . ([dafc19c](https://github.com/bluelovers/ws-yarn-workspaces/commit/dafc19c43afb42c904b6e7dcc49d93567897c092))
15
+
16
+
17
+
6
18
  ## [2.0.5](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/static-file@2.0.4...@yarn-tool/static-file@2.0.5) (2022-08-25)
7
19
 
8
20
 
package/__root.d.ts CHANGED
@@ -1,2 +1 @@
1
- declare const __root: string;
2
- export default __root;
1
+ export declare const __STATIC_ROOT: string;
package/__root.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const __root = __dirname;
4
- exports.default = __root;
3
+ exports.__STATIC_ROOT = void 0;
4
+ exports.__STATIC_ROOT = __dirname;
5
5
  //# sourceMappingURL=__root.js.map
package/__root.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"__root.js","sourceRoot":"","sources":["__root.ts"],"names":[],"mappings":";;AACA,MAAM,MAAM,GAAG,SAAS,CAAC;AACzB,kBAAe,MAAM,CAAA","sourcesContent":["\nconst __root = __dirname;\nexport default __root\n"]}
1
+ {"version":3,"file":"__root.js","sourceRoot":"","sources":["__root.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG,SAAS,CAAC","sourcesContent":["export const __STATIC_ROOT = __dirname;\n"]}
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.copyStaticFiles = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const fs_extra_1 = require("fs-extra");
6
5
  const const_1 = require("./const");
7
6
  const parseStaticMap_1 = require("./parseStaticMap");
8
7
  const copyStaticFilesEntry_1 = require("./copyStaticFilesEntry");
9
- const __root_1 = tslib_1.__importDefault(require("../__root"));
8
+ const __root_1 = require("../__root");
10
9
  function copyStaticFiles(options) {
11
10
  var _a, _b;
12
11
  if (typeof options.cwd !== 'string' || !((_a = options.cwd) === null || _a === void 0 ? void 0 : _a.length) || !options.cwd) {
@@ -19,7 +18,7 @@ function copyStaticFiles(options) {
19
18
  if (!ls.length) {
20
19
  throw new TypeError(`Invalid file map: ${options.file_map}`);
21
20
  }
22
- const staticRoot = options.staticRoot || __root_1.default;
21
+ const staticRoot = options.staticRoot || __root_1.__STATIC_ROOT;
23
22
  const { cwd, overwrite } = options;
24
23
  return ls.filter((entry) => {
25
24
  return (0, copyStaticFilesEntry_1.copyStaticFilesEntry)(entry, cwd, staticRoot, overwrite);
@@ -1 +1 @@
1
- {"version":3,"file":"copyStaticFiles.js","sourceRoot":"","sources":["copyStaticFiles.ts"],"names":[],"mappings":";;;;AACA,uCAAgG;AAEhG,mCAAiD;AACjD,qDAAkD;AAClD,iEAA8D;AAC9D,+DAA+B;AAE/B,SAAgB,eAAe,CAAmB,OAAmC;;IAEpF,IAAI,OAAO,OAAO,CAAC,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAA,MAAA,OAAO,CAAC,GAAG,0CAAE,MAAM,CAAA,IAAI,CAAC,OAAO,CAAC,GAAG,EAC3E;QACC,MAAM,IAAI,SAAS,CAAC,4BAA4B,CAAC,CAAA;KACjD;IAED,IAAI,CAAC,IAAA,yBAAc,EAAC,OAAO,CAAC,GAAG,CAAC,EAChC;QACC,MAAM,IAAI,SAAS,CAAC,wBAAwB,CAAC,CAAA;KAC7C;IAED,IAAI,EAAE,GAAG,IAAA,+BAAc,EAAI,MAAA,OAAO,CAAC,QAAQ,mCAAI,8BAAiD,CAAC,CAAC;IAElG,IAAI,CAAC,EAAE,CAAC,MAAM,EACd;QACC,MAAM,IAAI,SAAS,CAAC,qBAAqB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;KAC5D;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,gBAAM,CAAC;IAChD,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAEnC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QAEzB,OAAO,IAAA,2CAAoB,EAAC,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,CAAC,CAAA;IAC/D,CAAC,CAAC,CACD;AACH,CAAC;AA3BD,0CA2BC","sourcesContent":["import { ICopyStaticFilesOptions, IStaticFilesMapArray, IStaticFilesMapArrayEntry } from './types';\nimport { CopyOptionsSync, copySync, ensureDirSync, existsSync, pathExistsSync } from 'fs-extra';\nimport { dirname, resolve } from 'path';\nimport { defaultCopyStaticFiles } from './const';\nimport { parseStaticMap } from './parseStaticMap';\nimport { copyStaticFilesEntry } from './copyStaticFilesEntry';\nimport __root from '../__root';\n\nexport function copyStaticFiles<K extends string>(options: ICopyStaticFilesOptions<K>)\n{\n\tif (typeof options.cwd !== 'string' || !options.cwd?.length || !options.cwd)\n\t{\n\t\tthrow new TypeError(`options.cwd must is string`)\n\t}\n\n\tif (!pathExistsSync(options.cwd))\n\t{\n\t\tthrow new TypeError(`options.cwd not exists`)\n\t}\n\n\tlet ls = parseStaticMap<K>(options.file_map ?? defaultCopyStaticFiles as IStaticFilesMapArray<K>);\n\n\tif (!ls.length)\n\t{\n\t\tthrow new TypeError(`Invalid file map: ${options.file_map}`)\n\t}\n\n\tconst staticRoot = options.staticRoot || __root;\n\tconst { cwd, overwrite } = options;\n\n\treturn ls.filter((entry) =>\n\t\t{\n\t\t\treturn copyStaticFilesEntry(entry, cwd, staticRoot, overwrite)\n\t\t})\n\t\t;\n}\n\n"]}
1
+ {"version":3,"file":"copyStaticFiles.js","sourceRoot":"","sources":["copyStaticFiles.ts"],"names":[],"mappings":";;;AACA,uCAAgG;AAEhG,mCAAiD;AACjD,qDAAkD;AAClD,iEAA8D;AAC9D,sCAA0C;AAE1C,SAAgB,eAAe,CAAmB,OAAmC;;IAEpF,IAAI,OAAO,OAAO,CAAC,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAA,MAAA,OAAO,CAAC,GAAG,0CAAE,MAAM,CAAA,IAAI,CAAC,OAAO,CAAC,GAAG,EAC3E;QACC,MAAM,IAAI,SAAS,CAAC,4BAA4B,CAAC,CAAA;KACjD;IAED,IAAI,CAAC,IAAA,yBAAc,EAAC,OAAO,CAAC,GAAG,CAAC,EAChC;QACC,MAAM,IAAI,SAAS,CAAC,wBAAwB,CAAC,CAAA;KAC7C;IAED,IAAI,EAAE,GAAG,IAAA,+BAAc,EAAI,MAAA,OAAO,CAAC,QAAQ,mCAAI,8BAAiD,CAAC,CAAC;IAElG,IAAI,CAAC,EAAE,CAAC,MAAM,EACd;QACC,MAAM,IAAI,SAAS,CAAC,qBAAqB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;KAC5D;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,sBAAa,CAAC;IACvD,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAEnC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QAEzB,OAAO,IAAA,2CAAoB,EAAC,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,CAAC,CAAA;IAC/D,CAAC,CAAC,CACD;AACH,CAAC;AA3BD,0CA2BC","sourcesContent":["import { ICopyStaticFilesOptions, IStaticFilesMapArray, IStaticFilesMapArrayEntry } from './types';\nimport { CopyOptionsSync, copySync, ensureDirSync, existsSync, pathExistsSync } from 'fs-extra';\nimport { dirname, resolve } from 'path';\nimport { defaultCopyStaticFiles } from './const';\nimport { parseStaticMap } from './parseStaticMap';\nimport { copyStaticFilesEntry } from './copyStaticFilesEntry';\nimport { __STATIC_ROOT } from '../__root';\n\nexport function copyStaticFiles<K extends string>(options: ICopyStaticFilesOptions<K>)\n{\n\tif (typeof options.cwd !== 'string' || !options.cwd?.length || !options.cwd)\n\t{\n\t\tthrow new TypeError(`options.cwd must is string`)\n\t}\n\n\tif (!pathExistsSync(options.cwd))\n\t{\n\t\tthrow new TypeError(`options.cwd not exists`)\n\t}\n\n\tlet ls = parseStaticMap<K>(options.file_map ?? defaultCopyStaticFiles as IStaticFilesMapArray<K>);\n\n\tif (!ls.length)\n\t{\n\t\tthrow new TypeError(`Invalid file map: ${options.file_map}`)\n\t}\n\n\tconst staticRoot = options.staticRoot || __STATIC_ROOT;\n\tconst { cwd, overwrite } = options;\n\n\treturn ls.filter((entry) =>\n\t\t{\n\t\t\treturn copyStaticFilesEntry(entry, cwd, staticRoot, overwrite)\n\t\t})\n\t\t;\n}\n"]}
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.copyStaticFilesEntry = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const path_1 = require("path");
6
5
  const fs_extra_1 = require("fs-extra");
7
- const __root_1 = tslib_1.__importDefault(require("../__root"));
8
- function copyStaticFilesEntry(entry, cwd, staticRoot = __root_1.default, overwrite) {
6
+ const __root_1 = require("../__root");
7
+ function copyStaticFilesEntry(entry, cwd, staticRoot = __root_1.__STATIC_ROOT, overwrite) {
9
8
  const [targetFile, staticFile, detectFile] = entry;
10
9
  if (detectFile === null || detectFile === void 0 ? void 0 : detectFile.length) {
11
10
  const fc = (0, path_1.resolve)(cwd, detectFile);
@@ -1 +1 @@
1
- {"version":3,"file":"copyStaticFilesEntry.js","sourceRoot":"","sources":["copyStaticFilesEntry.ts"],"names":[],"mappings":";;;;AACA,+BAAwC;AACxC,uCAA+D;AAC/D,+DAA+B;AAE/B,SAAgB,oBAAoB,CAAC,KAAwC,EAC5E,GAAW,EACX,aAAqB,gBAAM,EAC3B,SAAmB;IAGnB,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC;IAEnD,IAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,EACtB;QACC,MAAM,EAAE,GAAG,IAAA,cAAO,EAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAEpC,IAAI,IAAA,qBAAU,EAAC,EAAE,CAAC,EAClB;YACC,OAAO;SACP;KACD;IAED,MAAM,EAAE,GAAG,IAAA,cAAO,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAE3C,IAAI,CAAC,IAAA,qBAAU,EAAC,EAAE,CAAC,EACnB;QACC,MAAM,IAAI,KAAK,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAA;KACzC;IAED,MAAM,EAAE,GAAG,IAAA,cAAO,EAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAEpC,IAAA,wBAAa,EAAC,IAAA,cAAO,EAAC,EAAE,CAAC,CAAC,CAAA;IAC1B,IAAA,mBAAQ,EAAC,EAAE,EAAE,EAAE,EAAE;QAChB,SAAS,EAAE,SAAS,IAAI,KAAK;QAC7B,kBAAkB,EAAE,IAAI;QACxB,YAAY,EAAE,KAAK;KACnB,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACb,CAAC;AAnCD,oDAmCC","sourcesContent":["import { IStaticFilesMapArrayEntry } from './types';\nimport { dirname, resolve } from 'path';\nimport { copySync, ensureDirSync, existsSync } from 'fs-extra';\nimport __root from '../__root';\n\nexport function copyStaticFilesEntry(entry: IStaticFilesMapArrayEntry<string>,\n\tcwd: string,\n\tstaticRoot: string = __root,\n\toverwrite?: boolean,\n)\n{\n\tconst [targetFile, staticFile, detectFile] = entry;\n\n\tif (detectFile?.length)\n\t{\n\t\tconst fc = resolve(cwd, detectFile);\n\n\t\tif (existsSync(fc))\n\t\t{\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst fb = resolve(staticRoot, staticFile);\n\n\tif (!existsSync(fb))\n\t{\n\t\tthrow new Error(`file not exists. ${fb}`)\n\t}\n\n\tconst fa = resolve(cwd, targetFile);\n\n\tensureDirSync(dirname(fa))\n\tcopySync(fb, fa, {\n\t\toverwrite: overwrite || false,\n\t\tpreserveTimestamps: true,\n\t\terrorOnExist: false,\n\t});\n\n\treturn true;\n}\n"]}
1
+ {"version":3,"file":"copyStaticFilesEntry.js","sourceRoot":"","sources":["copyStaticFilesEntry.ts"],"names":[],"mappings":";;;AACA,+BAAwC;AACxC,uCAA+D;AAC/D,sCAA0C;AAE1C,SAAgB,oBAAoB,CAAC,KAAwC,EAC5E,GAAW,EACX,aAAqB,sBAAa,EAClC,SAAmB;IAGnB,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC;IAEnD,IAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,EACtB;QACC,MAAM,EAAE,GAAG,IAAA,cAAO,EAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAEpC,IAAI,IAAA,qBAAU,EAAC,EAAE,CAAC,EAClB;YACC,OAAO;SACP;KACD;IAED,MAAM,EAAE,GAAG,IAAA,cAAO,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAE3C,IAAI,CAAC,IAAA,qBAAU,EAAC,EAAE,CAAC,EACnB;QACC,MAAM,IAAI,KAAK,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAA;KACzC;IAED,MAAM,EAAE,GAAG,IAAA,cAAO,EAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAEpC,IAAA,wBAAa,EAAC,IAAA,cAAO,EAAC,EAAE,CAAC,CAAC,CAAA;IAC1B,IAAA,mBAAQ,EAAC,EAAE,EAAE,EAAE,EAAE;QAChB,SAAS,EAAE,SAAS,IAAI,KAAK;QAC7B,kBAAkB,EAAE,IAAI;QACxB,YAAY,EAAE,KAAK;KACnB,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACb,CAAC;AAnCD,oDAmCC","sourcesContent":["import { IStaticFilesMapArrayEntry } from './types';\nimport { dirname, resolve } from 'path';\nimport { copySync, ensureDirSync, existsSync } from 'fs-extra';\nimport { __STATIC_ROOT } from '../__root';\n\nexport function copyStaticFilesEntry(entry: IStaticFilesMapArrayEntry<string>,\n\tcwd: string,\n\tstaticRoot: string = __STATIC_ROOT,\n\toverwrite?: boolean,\n)\n{\n\tconst [targetFile, staticFile, detectFile] = entry;\n\n\tif (detectFile?.length)\n\t{\n\t\tconst fc = resolve(cwd, detectFile);\n\n\t\tif (existsSync(fc))\n\t\t{\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst fb = resolve(staticRoot, staticFile);\n\n\tif (!existsSync(fb))\n\t{\n\t\tthrow new Error(`file not exists. ${fb}`)\n\t}\n\n\tconst fa = resolve(cwd, targetFile);\n\n\tensureDirSync(dirname(fa))\n\tcopySync(fb, fa, {\n\t\toverwrite: overwrite || false,\n\t\tpreserveTimestamps: true,\n\t\terrorOnExist: false,\n\t});\n\n\treturn true;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yarn-tool/static-file",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/bluelovers/ws-yarn-workspaces/tree/master/packages/@yarn-tool/static-file#readme",
6
6
  "bugs": {
@@ -17,6 +17,9 @@
17
17
  "coverage": "npx nyc npm run test",
18
18
  "lint": "npx eslint **/*.ts",
19
19
  "test": "echo \"Error: no test specified\"",
20
+ "test:jest": "jest --passWithNoTests",
21
+ "test:jest:snapshot": "yarn run test:jest -- -u",
22
+ "test:snapshot": "yarn run test -- -u",
20
23
  "npm:publish": "npm publish",
21
24
  "preversion": "yarn run test",
22
25
  "prepublishOnly": "echo prepublishOnly",
@@ -31,5 +34,5 @@
31
34
  "publishConfig": {
32
35
  "access": "public"
33
36
  },
34
- "gitHead": "3484e0721f85ac8235922ab980cf60993cdcbcd9"
37
+ "gitHead": "150365d3846067505842c6503564abe98ebe508d"
35
38
  }