@featurevisor/core 0.35.0 → 0.36.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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
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
+ # [0.36.0](https://github.com/fahad19/featurevisor/compare/v0.35.0...v0.36.0) (2023-07-13)
7
+
8
+
9
+ ### Features
10
+
11
+ * restore state files ([#100](https://github.com/fahad19/featurevisor/issues/100)) ([796695d](https://github.com/fahad19/featurevisor/commit/796695d0f645869ec305c3446282fba7e45e2bb5))
12
+
13
+
14
+
15
+
16
+
6
17
  # [0.35.0](https://github.com/fahad19/featurevisor/compare/v0.34.0...v0.35.0) (2023-07-13)
7
18
 
8
19
  **Note:** Version bump only for package @featurevisor/core
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1689264623176" clover="3.2.0">
3
- <project timestamp="1689264623176" name="All files">
2
+ <coverage generated="1689281573324" clover="3.2.0">
3
+ <project timestamp="1689281573324" name="All files">
4
4
  <metrics statements="169" coveredstatements="161" conditionals="75" coveredconditionals="62" methods="28" coveredmethods="28" elements="272" coveredelements="251" complexity="0" loc="169" ncloc="169" packages="2" files="4" classes="4"/>
5
5
  <package name="lib">
6
6
  <metrics statements="88" coveredstatements="84" conditionals="42" coveredconditionals="35" methods="14" coveredmethods="14"/>
@@ -116,7 +116,7 @@
116
116
  <div class='footer quiet pad2 space-top1 center small'>
117
117
  Code coverage generated by
118
118
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
119
- at 2023-07-13T16:10:23.164Z
119
+ at 2023-07-13T20:52:53.304Z
120
120
  </div>
121
121
  <script src="prettify.js"></script>
122
122
  <script>
@@ -175,7 +175,7 @@ exports.getUpdatedAvailableRangesAfterFilling = getUpdatedAvailableRangesAfterFi
175
175
  <div class='footer quiet pad2 space-top1 center small'>
176
176
  Code coverage generated by
177
177
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
178
- at 2023-07-13T16:10:23.164Z
178
+ at 2023-07-13T20:52:53.304Z
179
179
  </div>
180
180
  <script src="../prettify.js"></script>
181
181
  <script>
@@ -116,7 +116,7 @@
116
116
  <div class='footer quiet pad2 space-top1 center small'>
117
117
  Code coverage generated by
118
118
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
119
- at 2023-07-13T16:10:23.164Z
119
+ at 2023-07-13T20:52:53.304Z
120
120
  </div>
121
121
  <script src="../prettify.js"></script>
122
122
  <script>
@@ -427,7 +427,7 @@ exports.getTraffic = getTraffic;
427
427
  <div class='footer quiet pad2 space-top1 center small'>
428
428
  Code coverage generated by
429
429
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
430
- at 2023-07-13T16:10:23.164Z
430
+ at 2023-07-13T20:52:53.304Z
431
431
  </div>
432
432
  <script src="../prettify.js"></script>
433
433
  <script>
@@ -193,7 +193,7 @@ export function getUpdatedAvailableRangesAfterFilling(
193
193
  <div class='footer quiet pad2 space-top1 center small'>
194
194
  Code coverage generated by
195
195
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
196
- at 2023-07-13T16:10:23.164Z
196
+ at 2023-07-13T20:52:53.304Z
197
197
  </div>
198
198
  <script src="../prettify.js"></script>
199
199
  <script>
@@ -116,7 +116,7 @@
116
116
  <div class='footer quiet pad2 space-top1 center small'>
117
117
  Code coverage generated by
118
118
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
119
- at 2023-07-13T16:10:23.164Z
119
+ at 2023-07-13T20:52:53.304Z
120
120
  </div>
121
121
  <script src="../prettify.js"></script>
122
122
  <script>
@@ -535,7 +535,7 @@ export function getTraffic(
535
535
  <div class='footer quiet pad2 space-top1 center small'>
536
536
  Code coverage generated by
537
537
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
538
- at 2023-07-13T16:10:23.164Z
538
+ at 2023-07-13T20:52:53.304Z
539
539
  </div>
540
540
  <script src="../prettify.js"></script>
541
541
  <script>
package/lib/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export * from "./tester";
5
5
  export * from "./init";
6
6
  export * from "./site";
7
7
  export * from "./generate-code";
8
+ export * from "./restore";
package/lib/index.js CHANGED
@@ -21,4 +21,5 @@ __exportStar(require("./tester"), exports);
21
21
  __exportStar(require("./init"), exports);
22
22
  __exportStar(require("./site"), exports);
23
23
  __exportStar(require("./generate-code"), exports);
24
+ __exportStar(require("./restore"), exports);
24
25
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,2CAAyB;AACzB,yCAAuB;AACvB,yCAAuB;AACvB,kDAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,2CAAyB;AACzB,yCAAuB;AACvB,yCAAuB;AACvB,kDAAgC;AAChC,4CAA0B"}
@@ -0,0 +1,2 @@
1
+ import { ProjectConfig } from "./config";
2
+ export declare function restoreProject(rootDirectoryPath: any, projectConfig: ProjectConfig): void;
package/lib/restore.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.restoreProject = void 0;
4
+ var path = require("path");
5
+ var child_process_1 = require("child_process");
6
+ function restoreProject(rootDirectoryPath, projectConfig) {
7
+ var relativeStateDirPath = path.relative(rootDirectoryPath, projectConfig.stateDirectoryPath);
8
+ var cmd = "git checkout -- ".concat(relativeStateDirPath).concat(path.sep);
9
+ try {
10
+ var output = (0, child_process_1.execSync)(cmd, {
11
+ cwd: rootDirectoryPath,
12
+ });
13
+ console.log("State files restored successfully.");
14
+ }
15
+ catch (e) {
16
+ console.log("error:", e.message);
17
+ throw new Error("Failed to restore state files.");
18
+ }
19
+ }
20
+ exports.restoreProject = restoreProject;
21
+ //# sourceMappingURL=restore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restore.js","sourceRoot":"","sources":["../src/restore.ts"],"names":[],"mappings":";;;AAAA,2BAA6B;AAC7B,+CAAyC;AAIzC,SAAgB,cAAc,CAAC,iBAAiB,EAAE,aAA4B;IAC5E,IAAM,oBAAoB,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAChG,IAAM,GAAG,GAAG,0BAAmB,oBAAoB,SAAG,IAAI,CAAC,GAAG,CAAE,CAAC;IAEjE,IAAI;QACF,IAAM,MAAM,GAAG,IAAA,wBAAQ,EAAC,GAAG,EAAE;YAC3B,GAAG,EAAE,iBAAiB;SACvB,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;KACnD;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;QAEjC,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;KACnD;AACH,CAAC;AAfD,wCAeC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@featurevisor/core",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "Core package of Featurevisor for Node.js usage",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -41,9 +41,9 @@
41
41
  },
42
42
  "license": "MIT",
43
43
  "dependencies": {
44
- "@featurevisor/sdk": "^0.35.0",
45
- "@featurevisor/site": "^0.35.0",
46
- "@featurevisor/types": "^0.35.0",
44
+ "@featurevisor/sdk": "^0.36.0",
45
+ "@featurevisor/site": "^0.36.0",
46
+ "@featurevisor/types": "^0.36.0",
47
47
  "axios": "^1.3.4",
48
48
  "joi": "^17.8.3",
49
49
  "js-yaml": "^4.1.0",
@@ -54,5 +54,5 @@
54
54
  "@types/js-yaml": "^4.0.5",
55
55
  "@types/tar": "^6.1.4"
56
56
  },
57
- "gitHead": "1c8bb99f1dce49b87a95c7e1903bc0308fc7db4d"
57
+ "gitHead": "a8591d17d227b56f93cb59d13de7fce4d20b2890"
58
58
  }
package/src/index.ts CHANGED
@@ -5,3 +5,4 @@ export * from "./tester";
5
5
  export * from "./init";
6
6
  export * from "./site";
7
7
  export * from "./generate-code";
8
+ export * from "./restore";
package/src/restore.ts ADDED
@@ -0,0 +1,21 @@
1
+ import * as path from "path";
2
+ import { execSync } from "child_process";
3
+
4
+ import { ProjectConfig } from "./config";
5
+
6
+ export function restoreProject(rootDirectoryPath, projectConfig: ProjectConfig) {
7
+ const relativeStateDirPath = path.relative(rootDirectoryPath, projectConfig.stateDirectoryPath);
8
+ const cmd = `git checkout -- ${relativeStateDirPath}${path.sep}`;
9
+
10
+ try {
11
+ const output = execSync(cmd, {
12
+ cwd: rootDirectoryPath,
13
+ });
14
+
15
+ console.log("State files restored successfully.");
16
+ } catch (e) {
17
+ console.log("error:", e.message);
18
+
19
+ throw new Error("Failed to restore state files.");
20
+ }
21
+ }