@capgo/cli 4.12.2 → 4.12.3
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 +7 -0
- package/dist/index.js +14 -11
- package/package.json +1 -1
- package/src/utils.ts +17 -15
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [4.12.3](https://github.com/Cap-go/CLI/compare/v4.12.2...v4.12.3) (2024-07-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* getLocalDepenencies for windows ([ca7bf4e](https://github.com/Cap-go/CLI/commit/ca7bf4e97c6a2ff766978ed61089fd805126dde1))
|
|
11
|
+
|
|
5
12
|
### [4.12.2](https://github.com/Cap-go/CLI/compare/v4.12.1...v4.12.2) (2024-07-08)
|
|
6
13
|
|
|
7
14
|
|
package/dist/index.js
CHANGED
|
@@ -87381,7 +87381,7 @@ var {
|
|
|
87381
87381
|
// package.json
|
|
87382
87382
|
var package_default = {
|
|
87383
87383
|
name: "@capgo/cli",
|
|
87384
|
-
version: "4.12.
|
|
87384
|
+
version: "4.12.3",
|
|
87385
87385
|
description: "A CLI to upload to capgo servers",
|
|
87386
87386
|
author: "github.com/riderx",
|
|
87387
87387
|
license: "Apache 2.0",
|
|
@@ -89129,13 +89129,14 @@ function getPMAndCommand() {
|
|
|
89129
89129
|
}
|
|
89130
89130
|
async function getLocalDepenencies() {
|
|
89131
89131
|
const dir = (0, import_find_root.findRootSync)(import_node_process8.default.cwd());
|
|
89132
|
-
|
|
89132
|
+
const packageJsonPath = (0, import_node_path2.join)(import_node_process8.default.cwd(), "package.json");
|
|
89133
|
+
if (!(0, import_node_fs4.existsSync)(packageJsonPath)) {
|
|
89133
89134
|
f2.error("Missing package.json, you need to be in a capacitor project");
|
|
89134
89135
|
program.error("");
|
|
89135
89136
|
}
|
|
89136
89137
|
let packageJson;
|
|
89137
89138
|
try {
|
|
89138
|
-
packageJson = JSON.parse((0, import_node_fs4.readFileSync)(
|
|
89139
|
+
packageJson = JSON.parse((0, import_node_fs4.readFileSync)(packageJsonPath, "utf8"));
|
|
89139
89140
|
} catch (err) {
|
|
89140
89141
|
f2.error("Invalid package.json, JSON parsing failed");
|
|
89141
89142
|
console.error("json parse error: ", err);
|
|
@@ -89152,7 +89153,8 @@ async function getLocalDepenencies() {
|
|
|
89152
89153
|
program.error("");
|
|
89153
89154
|
}
|
|
89154
89155
|
}
|
|
89155
|
-
|
|
89156
|
+
const nodeModulesPath = (0, import_node_path2.join)(import_node_process8.default.cwd(), "node_modules");
|
|
89157
|
+
if (!(0, import_node_fs4.existsSync)(nodeModulesPath)) {
|
|
89156
89158
|
const pm2 = findPackageManagerType(dir.rootDir, "npm");
|
|
89157
89159
|
const installCmd = findInstallCommand(pm2);
|
|
89158
89160
|
f2.error(`Missing node_modules folder, please run ${pm2} ${installCmd}`);
|
|
@@ -89160,7 +89162,8 @@ async function getLocalDepenencies() {
|
|
|
89160
89162
|
}
|
|
89161
89163
|
let anyInvalid = false;
|
|
89162
89164
|
const dependenciesObject = await Promise.all(Object.entries(dependencies).map(async ([key2, value]) => {
|
|
89163
|
-
const
|
|
89165
|
+
const dependencyFolderPath = (0, import_node_path2.join)(nodeModulesPath, key2);
|
|
89166
|
+
const dependencyFolderExists = (0, import_node_fs4.existsSync)(dependencyFolderPath);
|
|
89164
89167
|
if (!dependencyFolderExists) {
|
|
89165
89168
|
anyInvalid = true;
|
|
89166
89169
|
const pm2 = findPackageManagerType(dir.rootDir, "npm");
|
|
@@ -89169,14 +89172,14 @@ async function getLocalDepenencies() {
|
|
|
89169
89172
|
return { name: key2, version: value };
|
|
89170
89173
|
}
|
|
89171
89174
|
let hasNativeFiles = false;
|
|
89172
|
-
|
|
89173
|
-
|
|
89174
|
-
|
|
89175
|
-
}
|
|
89176
|
-
f2.error(`Error reading
|
|
89175
|
+
try {
|
|
89176
|
+
const files = await (0, import_node_dir.promiseFiles)(dependencyFolderPath);
|
|
89177
|
+
hasNativeFiles = files.some((fileName) => nativeFileRegex.test(fileName));
|
|
89178
|
+
} catch (error) {
|
|
89179
|
+
f2.error(`Error reading node_modules files for ${key2} package`);
|
|
89177
89180
|
console.error(error);
|
|
89178
89181
|
program.error("");
|
|
89179
|
-
}
|
|
89182
|
+
}
|
|
89180
89183
|
return {
|
|
89181
89184
|
name: key2,
|
|
89182
89185
|
version: value,
|
package/package.json
CHANGED
package/src/utils.ts
CHANGED
|
@@ -842,14 +842,16 @@ export function getPMAndCommand() {
|
|
|
842
842
|
|
|
843
843
|
export async function getLocalDepenencies() {
|
|
844
844
|
const dir = findRootSync(process.cwd())
|
|
845
|
-
|
|
845
|
+
const packageJsonPath = join(process.cwd(), 'package.json')
|
|
846
|
+
|
|
847
|
+
if (!existsSync(packageJsonPath)) {
|
|
846
848
|
p.log.error('Missing package.json, you need to be in a capacitor project')
|
|
847
849
|
program.error('')
|
|
848
850
|
}
|
|
849
851
|
|
|
850
852
|
let packageJson
|
|
851
853
|
try {
|
|
852
|
-
packageJson = JSON.parse(readFileSync(
|
|
854
|
+
packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'))
|
|
853
855
|
}
|
|
854
856
|
catch (err) {
|
|
855
857
|
p.log.error('Invalid package.json, JSON parsing failed')
|
|
@@ -870,7 +872,8 @@ export async function getLocalDepenencies() {
|
|
|
870
872
|
}
|
|
871
873
|
}
|
|
872
874
|
|
|
873
|
-
|
|
875
|
+
const nodeModulesPath = join(process.cwd(), 'node_modules')
|
|
876
|
+
if (!existsSync(nodeModulesPath)) {
|
|
874
877
|
const pm = findPackageManagerType(dir.rootDir, 'npm')
|
|
875
878
|
const installCmd = findInstallCommand(pm)
|
|
876
879
|
p.log.error(`Missing node_modules folder, please run ${pm} ${installCmd}`)
|
|
@@ -880,9 +883,9 @@ export async function getLocalDepenencies() {
|
|
|
880
883
|
let anyInvalid = false
|
|
881
884
|
|
|
882
885
|
const dependenciesObject = await Promise.all(Object.entries(dependencies as Record<string, string>)
|
|
883
|
-
|
|
884
886
|
.map(async ([key, value]) => {
|
|
885
|
-
const
|
|
887
|
+
const dependencyFolderPath = join(nodeModulesPath, key)
|
|
888
|
+
const dependencyFolderExists = existsSync(dependencyFolderPath)
|
|
886
889
|
|
|
887
890
|
if (!dependencyFolderExists) {
|
|
888
891
|
anyInvalid = true
|
|
@@ -893,16 +896,15 @@ export async function getLocalDepenencies() {
|
|
|
893
896
|
}
|
|
894
897
|
|
|
895
898
|
let hasNativeFiles = false
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
.
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
})
|
|
899
|
+
try {
|
|
900
|
+
const files = await promiseFiles(dependencyFolderPath)
|
|
901
|
+
hasNativeFiles = files.some(fileName => nativeFileRegex.test(fileName))
|
|
902
|
+
}
|
|
903
|
+
catch (error) {
|
|
904
|
+
p.log.error(`Error reading node_modules files for ${key} package`)
|
|
905
|
+
console.error(error)
|
|
906
|
+
program.error('')
|
|
907
|
+
}
|
|
906
908
|
|
|
907
909
|
return {
|
|
908
910
|
name: key,
|