@yarn-tool/static-file 2.0.4 → 2.0.7

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,39 @@
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.7](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/static-file@2.0.6...@yarn-tool/static-file@2.0.7) (2022-08-28)
7
+
8
+
9
+
10
+ ### 📌 Dependencies
11
+
12
+ * update deps ([9c67e20](https://github.com/bluelovers/ws-yarn-workspaces/commit/9c67e20ac4960ee2c98d89c448a2ea5a7495a3bf))
13
+
14
+
15
+
16
+ ## [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)
17
+
18
+
19
+
20
+ ### 🔖 Miscellaneous
21
+
22
+ * . ([b3cfb9b](https://github.com/bluelovers/ws-yarn-workspaces/commit/b3cfb9bd8105fed14522ee3d3898141ba831471a))
23
+ * . ([157d5dc](https://github.com/bluelovers/ws-yarn-workspaces/commit/157d5dc8959261d9326f6e633987182898ae9670))
24
+ * . ([dafc19c](https://github.com/bluelovers/ws-yarn-workspaces/commit/dafc19c43afb42c904b6e7dcc49d93567897c092))
25
+
26
+
27
+
28
+ ## [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)
29
+
30
+
31
+
32
+ ### 🔖 Miscellaneous
33
+
34
+ * . ([e41ae72](https://github.com/bluelovers/ws-yarn-workspaces/commit/e41ae7243ba638952956984fbd582ded499a7f0b))
35
+ * . ([8e0574e](https://github.com/bluelovers/ws-yarn-workspaces/commit/8e0574e7e94ebb50a2335d6e0a74114e633812dc))
36
+
37
+
38
+
6
39
  ## [2.0.4](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/static-file@2.0.3...@yarn-tool/static-file@2.0.4) (2022-08-19)
7
40
 
8
41
 
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"]}
package/file/gitignore CHANGED
@@ -1,7 +1,7 @@
1
1
  # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
2
 
3
3
  # dependencies
4
- /node_modules
4
+ node_modules
5
5
  /.pnp
6
6
  .pnp.js
7
7
 
package/file/npmignore CHANGED
@@ -35,10 +35,10 @@ node_modules
35
35
  /bin/**/*.d.cts
36
36
  /bin/*.d.cts
37
37
 
38
- !./src/**/*.ts
39
- !./src/**/*.cts
40
- !./src/**/*.mts
41
- !./src/**/*.tsx
38
+ !/src/**/*.ts
39
+ !/src/**/*.cts
40
+ !/src/**/*.mts
41
+ !/src/**/*.tsx
42
42
 
43
43
  /src/**/*.d.ts
44
44
  /src/**/*.js
@@ -90,6 +90,7 @@ tsconfig.esm.json.tpl
90
90
  .mocharc.yml
91
91
  jest.config.js
92
92
  jest.config.*
93
+ /jest-preset.*
93
94
  /report.*.json
94
95
  now.json
95
96
  /Makefile
@@ -0,0 +1,12 @@
1
+ // DO NOT EDIT THIS FILE
2
+ const { resolve } = require('path');
3
+
4
+ /**
5
+ * // @type { import('@jest/types').Config.InitialOptions }
6
+ * @type { import('ts-jest').InitialOptionsTsJest }
7
+ */
8
+ const jestConfig = {
9
+ preset: __dirname,
10
+ };
11
+
12
+ module.exports = jestConfig
@@ -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.4",
3
+ "version": "2.0.7",
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": "04b0e35bd37a6cbe152fd6564f0ec2439625270a"
37
+ "gitHead": "e7aec5c1c202bac1026b9117bcb8ee18b9188916"
35
38
  }