@lazycatcloud/lzc-cli 1.1.11 → 1.1.12
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/lib/app/lpk_build.js +9 -0
- package/package.json +1 -1
package/lib/app/lpk_build.js
CHANGED
|
@@ -130,6 +130,11 @@ function convenientEnv() {
|
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
function isValidPackageName(packageName) {
|
|
134
|
+
const regex = /^([a-zA-Z_][a-zA-Z0-9_]*\.)*[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
135
|
+
return regex.test(packageName);
|
|
136
|
+
}
|
|
137
|
+
|
|
133
138
|
export class LpkBuild {
|
|
134
139
|
constructor(cwd, lzcBuild = "lzc-build.yml") {
|
|
135
140
|
this.pwd = cwd ?? process.cwd();
|
|
@@ -191,6 +196,10 @@ export class LpkBuild {
|
|
|
191
196
|
let lpkM = new LpkManifest();
|
|
192
197
|
await lpkM.init(this.manifestFilePath);
|
|
193
198
|
this.manifest = lpkM.manifest;
|
|
199
|
+
|
|
200
|
+
if (!isValidPackageName(this.manifest["package"])) {
|
|
201
|
+
throw `${this.manifest["package"]} 含有非法字符,请使用正确的包名格式(java的包名格式),如:cloud.lazycat.apps.video`;
|
|
202
|
+
}
|
|
194
203
|
return this.manifest;
|
|
195
204
|
}
|
|
196
205
|
|