@umijs/utils 4.0.0-rc.21 → 4.0.0-rc.24

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/dist/index.d.ts CHANGED
@@ -27,6 +27,7 @@ import * as logger from './logger';
27
27
  import updatePackageJSON from './updatePackageJSON';
28
28
  export * from './getCorejsVersion';
29
29
  export * from './importLazy';
30
+ export * from './isLocalDev';
30
31
  export * from './isStyleFile';
31
32
  export * from './npmClient';
32
33
  export * from './randomColor/randomColor';
package/dist/index.js CHANGED
@@ -87,6 +87,7 @@ const updatePackageJSON_1 = __importDefault(require("./updatePackageJSON"));
87
87
  exports.updatePackageJSON = updatePackageJSON_1.default;
88
88
  __exportStar(require("./getCorejsVersion"), exports);
89
89
  __exportStar(require("./importLazy"), exports);
90
+ __exportStar(require("./isLocalDev"), exports);
90
91
  __exportStar(require("./isStyleFile"), exports);
91
92
  __exportStar(require("./npmClient"), exports);
92
93
  __exportStar(require("./randomColor/randomColor"), exports);
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Check whether it is development in local
3
+ */
4
+ export declare const isLocalDev: () => string | false;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isLocalDev = void 0;
4
+ const fs_1 = require("fs");
5
+ const path_1 = require("path");
6
+ const root = (0, path_1.join)(__dirname, '../../../');
7
+ const rootPkg = (0, path_1.join)(root, './package.json');
8
+ /**
9
+ * Check whether it is development in local
10
+ */
11
+ const isLocalDev = () => {
12
+ const isLocal = (0, fs_1.existsSync)(rootPkg) && require(rootPkg)._local;
13
+ return isLocal ? root : false;
14
+ };
15
+ exports.isLocalDev = isLocalDev;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/utils",
3
- "version": "4.0.0-rc.21",
3
+ "version": "4.0.0-rc.24",
4
4
  "homepage": "https://github.com/umijs/umi-next/tree/master/packages/utils#readme",
5
5
  "bugs": "https://github.com/umijs/umi-next/issues",
6
6
  "repository": {