@edifice.io/cli 1.6.0-develop-docker.0 → 1.6.0-develop-b2school.11

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.
@@ -1,50 +1,50 @@
1
- // @ts-check
2
-
3
- import jsonfile from 'jsonfile';
4
-
5
- /** @param {string} version */
6
- export const releaseCommitMsg = (version) => `release: v${version}`;
7
-
8
- /** @param {string} str */
9
- export const capitalize = (str) => {
10
- return str.slice(0, 1).toUpperCase() + str.slice(1);
11
- };
12
-
13
- /**
14
- * @param {string} pathName
15
- * @returns {Promise<import('type-fest').PackageJson>}
16
- */
17
- export const readPackageJson = async (pathName) => {
18
- return await jsonfile.readFile(pathName);
19
- };
20
-
21
- /**
22
- * @param {string} pathName
23
- * @param {(json: import('type-fest').PackageJson) => Promise<void> | void} transform
24
- */
25
- export const updatePackageJson = async (pathName, transform) => {
26
- const json = await readPackageJson(pathName);
27
- await transform(json);
28
- await jsonfile.writeFile(pathName, json, {
29
- spaces: 2,
30
- });
31
- };
32
-
33
- /**
34
- * @template TItem
35
- * @param {((d: TItem) => number)} sorter
36
- * @returns {(a: TItem, b: TItem) => number}
37
- */
38
- export const getSorterFn = (sorter) => {
39
- return (a, b) => {
40
- const sortedA = sorter(a);
41
- const sortedB = sorter(b);
42
- if (sortedA > sortedB) {
43
- return 1;
44
- }
45
- if (sortedA < sortedB) {
46
- return -1;
47
- }
48
- return 0;
49
- };
50
- };
1
+ // @ts-check
2
+
3
+ import jsonfile from 'jsonfile';
4
+
5
+ /** @param {string} version */
6
+ export const releaseCommitMsg = (version) => `release: v${version}`;
7
+
8
+ /** @param {string} str */
9
+ export const capitalize = (str) => {
10
+ return str.slice(0, 1).toUpperCase() + str.slice(1);
11
+ };
12
+
13
+ /**
14
+ * @param {string} pathName
15
+ * @returns {Promise<import('type-fest').PackageJson>}
16
+ */
17
+ export const readPackageJson = async (pathName) => {
18
+ return await jsonfile.readFile(pathName);
19
+ };
20
+
21
+ /**
22
+ * @param {string} pathName
23
+ * @param {(json: import('type-fest').PackageJson) => Promise<void> | void} transform
24
+ */
25
+ export const updatePackageJson = async (pathName, transform) => {
26
+ const json = await readPackageJson(pathName);
27
+ await transform(json);
28
+ await jsonfile.writeFile(pathName, json, {
29
+ spaces: 2,
30
+ });
31
+ };
32
+
33
+ /**
34
+ * @template TItem
35
+ * @param {((d: TItem) => number)} sorter
36
+ * @returns {(a: TItem, b: TItem) => number}
37
+ */
38
+ export const getSorterFn = (sorter) => {
39
+ return (a, b) => {
40
+ const sortedA = sorter(a);
41
+ const sortedB = sorter(b);
42
+ if (sortedA > sortedB) {
43
+ return 1;
44
+ }
45
+ if (sortedA < sortedB) {
46
+ return -1;
47
+ }
48
+ return 0;
49
+ };
50
+ };