qdmp-cli 0.0.2 → 0.0.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.
Files changed (2) hide show
  1. package/package.json +5 -2
  2. package/utils/common.js +9 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qdmp-cli",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "qdmp-cli",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -11,7 +11,10 @@
11
11
  "qdmp": "./index.js",
12
12
  "qdmp-cli": "./index.js"
13
13
  },
14
- "keywords": [],
14
+ "keywords": [
15
+ "千岛小程序",
16
+ "千岛小程序脚手架"
17
+ ],
15
18
  "author": "zhangyanran",
16
19
  "license": "ISC",
17
20
  "dependencies": {
package/utils/common.js CHANGED
@@ -47,7 +47,7 @@ export const isUrlAccessible = async (url) => {
47
47
  */
48
48
  export async function renameDistFolder(dirname, newname) {
49
49
  try {
50
- execSync(`rm -rf ./h5`, { stdio: "inherit" });
50
+ if (fs.existsSync(newname)) return true;
51
51
  execSync(`mv ${dirname} ${newname}`, { stdio: "inherit" });
52
52
  return true;
53
53
  } catch (e) {
@@ -89,7 +89,14 @@ async function compressProject(output, dirname = "") {
89
89
  */
90
90
  async function copyDistFolder(dirname) {
91
91
  try {
92
- execSync(`cp -r ${dirname} ./${WORKSPACE_DIR}`, {
92
+ const indexPath = execSync(`find ${dirname} -name index.html -print -quit`)
93
+ .toString()
94
+ .trim();
95
+ if (!indexPath) {
96
+ throw new Error("未找到index.html文件");
97
+ }
98
+ const parentDir = path.dirname(indexPath);
99
+ execSync(`cp -r ${parentDir} ./${WORKSPACE_DIR}`, {
93
100
  stdio: "inherit",
94
101
  });
95
102
  return true;