hfs 0.45.0-beta10 → 0.45.0-beta11

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,6 +1,6 @@
1
1
  {
2
2
  "name": "hfs",
3
- "version": "0.45.0-beta10",
3
+ "version": "0.45.0-beta11",
4
4
  "description": "HTTP File Server",
5
5
  "keywords": [
6
6
  "file server",
package/src/config.js CHANGED
@@ -14,6 +14,7 @@ const misc_1 = require("./misc");
14
14
  const fs_1 = require("fs");
15
15
  const path_1 = require("path");
16
16
  const events_2 = __importDefault(require("./events"));
17
+ const os_1 = require("os");
17
18
  const FILE = 'config.yaml';
18
19
  // keep definition of config properties
19
20
  const configProps = {};
@@ -32,8 +33,7 @@ const filePath = (0, misc_1.with_)(const_1.argv.config || process.env.HFS_CONFIG
32
33
  catch (_a) { }
33
34
  return p;
34
35
  });
35
- console.log("config", filePath);
36
- const legacyPosition = (0, path_1.join)(const_1.APP_PATH, FILE);
36
+ const legacyPosition = (0, path_1.join)((0, os_1.homedir)(), FILE); // this was happening with npx on Windows for some time. Remove around v0.47
37
37
  if (!(0, fs_1.existsSync)(filePath) && (0, fs_1.existsSync)(legacyPosition))
38
38
  try {
39
39
  (0, fs_1.renameSync)(legacyPosition, filePath);
@@ -46,12 +46,6 @@ if (!(0, fs_1.existsSync)(filePath) && (0, fs_1.existsSync)(legacyPosition))
46
46
  }
47
47
  catch (_b) { }
48
48
  }
49
- const { save } = (0, watchLoad_1.watchLoad)(filePath, text => setConfig(yaml_1.default.parse(text) || {}, false), {
50
- failedOnFirstAttempt() {
51
- console.log("No config file, using defaults");
52
- setConfig({}, false);
53
- }
54
- });
55
49
  // takes a semver like 1.2.3-alpha1, but alpha and beta numbers must share the number progression
56
50
  const versionToScalar = lodash_1.default.memoize((ver) => {
57
51
  var _a;
@@ -189,7 +183,7 @@ function setConfig1(k, newV, saveChanges = true, valueVersion) {
189
183
  const saveDebounced = (0, misc_1.debounceAsync)(async () => {
190
184
  while (!started)
191
185
  await (0, misc_1.wait)(100);
192
- let txt = yaml_1.default.stringify({ version: const_1.VERSION, ...state }, { lineWidth: 1000 });
186
+ let txt = yaml_1.default.stringify({ ...state, version: const_1.VERSION }, { lineWidth: 1000 });
193
187
  if (txt.trim() === '{}') // most users wouldn't understand
194
188
  txt = '';
195
189
  save(filePath, txt)
@@ -197,3 +191,10 @@ const saveDebounced = (0, misc_1.debounceAsync)(async () => {
197
191
  });
198
192
  const saveConfigAsap = () => void (saveDebounced());
199
193
  exports.saveConfigAsap = saveConfigAsap;
194
+ console.log("config", filePath);
195
+ const { save } = (0, watchLoad_1.watchLoad)(filePath, text => setConfig(yaml_1.default.parse(text) || {}, false), {
196
+ failedOnFirstAttempt() {
197
+ console.log("No config file, using defaults");
198
+ setConfig({}, false);
199
+ }
200
+ });
package/src/const.js CHANGED
@@ -38,7 +38,7 @@ exports.DEV = process.env.DEV || exports.argv.dev ? 'DEV' : '';
38
38
  exports.ORIGINAL_CWD = process.cwd();
39
39
  exports.HFS_STARTED = new Date();
40
40
  const PKG_PATH = (0, path_1.join)(__dirname, '..', 'package.json');
41
- exports.BUILD_TIMESTAMP = "2023-05-16T09:05:52.263Z";
41
+ exports.BUILD_TIMESTAMP = "2023-05-16T17:38:57.591Z";
42
42
  const pkg = JSON.parse(fs.readFileSync(PKG_PATH, 'utf8'));
43
43
  exports.VERSION = pkg.version;
44
44
  exports.DAY = 86400000;