@ldsg/utils 0.1.0-alpha.8 → 0.2.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.
@@ -1,4 +1,4 @@
1
- import { AppData } from "@ldsg/common";
1
+ import { AppData } from "@ldsg/types";
2
2
  export interface ExtendAppDataWithPathParams {
3
3
  appData: AppData;
4
4
  extraAppDataPath?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"extend-app-data-with-path.d.ts","sourceRoot":"","sources":["../src/extend-app-data-with-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAIvC,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,KAAK,qBAAqB,GAAG,CAC3B,MAAM,EAAE,2BAA2B,KAChC,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtB,eAAO,MAAM,qBAAqB,EAAE,qBAmBnC,CAAC"}
1
+ {"version":3,"file":"extend-app-data-with-path.d.ts","sourceRoot":"","sources":["../src/extend-app-data-with-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAItC,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,KAAK,qBAAqB,GAAG,CAC3B,MAAM,EAAE,2BAA2B,KAChC,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtB,eAAO,MAAM,qBAAqB,EAAE,qBAmBnC,CAAC"}
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -15,13 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
6
  exports.extendAppDataWithPath = void 0;
16
7
  const fs_extra_1 = __importDefault(require("fs-extra"));
17
8
  const extend_app_data_1 = require("./extend-app-data");
18
- const extendAppDataWithPath = (params) => __awaiter(void 0, void 0, void 0, function* () {
9
+ const extendAppDataWithPath = async (params) => {
19
10
  const { appData, extraAppDataPath } = params;
20
11
  let extraAppData = {};
21
12
  if (extraAppDataPath) {
22
- const existsRes = yield fs_extra_1.default.exists(extraAppDataPath);
13
+ const existsRes = await fs_extra_1.default.exists(extraAppDataPath);
23
14
  if (existsRes) {
24
- extraAppData = yield fs_extra_1.default.readJson(extraAppDataPath);
15
+ extraAppData = await fs_extra_1.default.readJson(extraAppDataPath);
25
16
  }
26
17
  }
27
18
  const res = (0, extend_app_data_1.extendAppData)({
@@ -29,5 +20,5 @@ const extendAppDataWithPath = (params) => __awaiter(void 0, void 0, void 0, func
29
20
  extraAppData,
30
21
  });
31
22
  return res;
32
- });
23
+ };
33
24
  exports.extendAppDataWithPath = extendAppDataWithPath;
@@ -1,4 +1,4 @@
1
- import { AppData } from "@ldsg/common";
1
+ import { AppData } from "@ldsg/types";
2
2
  export interface ExtendAppDataParams {
3
3
  appData: AppData;
4
4
  extraAppData?: Partial<AppData>;
@@ -1 +1 @@
1
- {"version":3,"file":"extend-app-data.d.ts","sourceRoot":"","sources":["../src/extend-app-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC;AAED,KAAK,aAAa,GAAG,CAAC,MAAM,EAAE,mBAAmB,KAAK,OAAO,CAAC;AAE9D,eAAO,MAAM,aAAa,EAAE,aAS3B,CAAC"}
1
+ {"version":3,"file":"extend-app-data.d.ts","sourceRoot":"","sources":["../src/extend-app-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC;AAED,KAAK,aAAa,GAAG,CAAC,MAAM,EAAE,mBAAmB,KAAK,OAAO,CAAC;AAE9D,eAAO,MAAM,aAAa,EAAE,aAS3B,CAAC"}
@@ -3,7 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.extendAppData = void 0;
4
4
  const extendAppData = (params) => {
5
5
  const { appData, extraAppData } = params;
6
- const res = Object.assign(Object.assign({}, extraAppData), appData);
6
+ const res = {
7
+ ...extraAppData,
8
+ ...appData,
9
+ };
7
10
  return res;
8
11
  };
9
12
  exports.extendAppData = extendAppData;
@@ -1,4 +1,4 @@
1
- import { AppData } from "@ldsg/common";
1
+ import { AppData } from "@ldsg/types";
2
2
  export interface FetchAppDataParams {
3
3
  lgsgAppDataUrl: string;
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fetch-app-data.d.ts","sourceRoot":"","sources":["../src/fetch-app-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,KAAK,YAAY,GAAG,CAAC,MAAM,EAAE,kBAAkB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAErE,eAAO,MAAM,YAAY,EAAE,YAU1B,CAAC"}
1
+ {"version":3,"file":"fetch-app-data.d.ts","sourceRoot":"","sources":["../src/fetch-app-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,KAAK,YAAY,GAAG,CAAC,MAAM,EAAE,kBAAkB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAErE,eAAO,MAAM,YAAY,EAAE,YAU1B,CAAC"}
@@ -1,25 +1,16 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
14
5
  Object.defineProperty(exports, "__esModule", { value: true });
15
6
  exports.fetchAppData = void 0;
16
7
  const axios_1 = __importDefault(require("axios"));
17
- const fetchAppData = (params) => __awaiter(void 0, void 0, void 0, function* () {
8
+ const fetchAppData = async (params) => {
18
9
  const { lgsgAppDataUrl: url } = params;
19
- const axiosRes = yield (0, axios_1.default)({
10
+ const axiosRes = await (0, axios_1.default)({
20
11
  url,
21
12
  });
22
13
  const res = axiosRes.data;
23
14
  return res;
24
- });
15
+ };
25
16
  exports.fetchAppData = fetchAppData;
@@ -1,4 +1,4 @@
1
- import { AppData } from "@ldsg/common";
1
+ import { AppData } from "@ldsg/types";
2
2
  interface GenerateByAppDataParams {
3
3
  appData: AppData;
4
4
  outputPath: string;
@@ -1 +1 @@
1
- {"version":3,"file":"generate-by-app-data.d.ts","sourceRoot":"","sources":["../src/generate-by-app-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAc,MAAM,cAAc,CAAC;AAGnD,UAAU,uBAAuB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,KAAK,iBAAiB,GAAG,CAAC,MAAM,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5E,eAAO,MAAM,iBAAiB,EAAE,iBAa/B,CAAC"}
1
+ {"version":3,"file":"generate-by-app-data.d.ts","sourceRoot":"","sources":["../src/generate-by-app-data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,UAAU,uBAAuB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,KAAK,iBAAiB,GAAG,CAAC,MAAM,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5E,eAAO,MAAM,iBAAiB,EAAE,iBAa/B,CAAC"}
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -15,11 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
6
  exports.generateByAppData = void 0;
16
7
  const common_1 = require("@ldsg/common");
17
8
  const adm_zip_1 = __importDefault(require("adm-zip"));
18
- const generateByAppData = (params) => __awaiter(void 0, void 0, void 0, function* () {
9
+ const generateByAppData = async (params) => {
19
10
  const { appData, outputPath } = params;
20
- const zipAppDataRes = yield (0, common_1.zipAppData)(Object.assign(Object.assign({}, appData), { type: "nodebuffer" }));
11
+ const zipAppDataRes = await (0, common_1.zipAppData)({
12
+ ...appData,
13
+ type: "nodebuffer",
14
+ });
21
15
  const { archive } = zipAppDataRes;
22
16
  const admZip = new adm_zip_1.default(archive);
23
17
  admZip.extractAllTo(outputPath, true);
24
- });
18
+ };
25
19
  exports.generateByAppData = generateByAppData;
package/dist/generate.js CHANGED
@@ -1,20 +1,11 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.generate = void 0;
13
4
  const generate_by_app_data_1 = require("./generate-by-app-data");
14
5
  const get_app_data_1 = require("./get-app-data");
15
- const generate = (params) => __awaiter(void 0, void 0, void 0, function* () {
6
+ const generate = async (params) => {
16
7
  const { outputPath } = params;
17
- const appData = yield (0, get_app_data_1.getAppData)(params);
18
- yield (0, generate_by_app_data_1.generateByAppData)({ appData, outputPath });
19
- });
8
+ const appData = await (0, get_app_data_1.getAppData)(params);
9
+ await (0, generate_by_app_data_1.generateByAppData)({ appData, outputPath });
10
+ };
20
11
  exports.generate = generate;
@@ -1,4 +1,4 @@
1
- import { AppData } from "@ldsg/common";
1
+ import { AppData } from "@ldsg/types";
2
2
  import { FetchAppDataParams } from "./fetch-app-data";
3
3
  interface GetAppDataParams extends FetchAppDataParams {
4
4
  extraAppDataPath?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"get-app-data.d.ts","sourceRoot":"","sources":["../src/get-app-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAgB,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEpE,UAAU,gBAAiB,SAAQ,kBAAkB;IACnD,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,KAAK,UAAU,GAAG,CAAC,MAAM,EAAE,gBAAgB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEjE,eAAO,MAAM,UAAU,EAAE,UAWxB,CAAC"}
1
+ {"version":3,"file":"get-app-data.d.ts","sourceRoot":"","sources":["../src/get-app-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAgB,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEpE,UAAU,gBAAiB,SAAQ,kBAAkB;IACnD,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,KAAK,UAAU,GAAG,CAAC,MAAM,EAAE,gBAAgB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEjE,eAAO,MAAM,UAAU,EAAE,UAWxB,CAAC"}
@@ -1,24 +1,15 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.getAppData = void 0;
13
4
  const extend_app_data_with_path_1 = require("./extend-app-data-with-path");
14
5
  const fetch_app_data_1 = require("./fetch-app-data");
15
- const getAppData = (params) => __awaiter(void 0, void 0, void 0, function* () {
6
+ const getAppData = async (params) => {
16
7
  const { extraAppDataPath } = params;
17
- const appData = yield (0, fetch_app_data_1.fetchAppData)(params);
18
- const res = yield (0, extend_app_data_with_path_1.extendAppDataWithPath)({
8
+ const appData = await (0, fetch_app_data_1.fetchAppData)(params);
9
+ const res = await (0, extend_app_data_with_path_1.extendAppDataWithPath)({
19
10
  appData,
20
11
  extraAppDataPath,
21
12
  });
22
13
  return res;
23
- });
14
+ };
24
15
  exports.getAppData = getAppData;
package/dist/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,14 +1,11 @@
1
1
  {
2
2
  "name": "@ldsg/utils",
3
- "version": "0.1.0-alpha.8",
3
+ "version": "0.2.0",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/"
7
7
  ],
8
8
  "types": "dist",
9
- "bin": {
10
- "ldsg": "dist/index.js"
11
- },
12
9
  "author": "wanxger",
13
10
  "license": "MIT",
14
11
  "publishConfig": {
@@ -21,9 +18,9 @@
21
18
  "commander": "^12.1.0",
22
19
  "fs-extra": "^11.2.0",
23
20
  "lodash": "^4.17.21",
24
- "@ldsg/app": "0.1.0-alpha.8",
25
- "@ldsg/common": "0.1.0-alpha.8",
26
- "@ldsg/services": "0.1.0-alpha.8"
21
+ "@ldsg/create-app": "0.2.0",
22
+ "@ldsg/types": "0.2.0",
23
+ "@ldsg/common": "0.2.0"
27
24
  },
28
25
  "devDependencies": {
29
26
  "@types/adm-zip": "^0.5.6",
@@ -41,6 +38,7 @@
41
38
  "webpack-cli": "^5.1.4"
42
39
  },
43
40
  "scripts": {
44
- "build": "rm -rf dist && tsc --project tsconfig.build.json"
41
+ "build": "pnpm clean && tsc --project tsconfig.build.json",
42
+ "clean": "rm -rf dist"
45
43
  }
46
44
  }