@dimina/compiler 1.0.2 → 1.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.
- package/dist/bin/index.cjs +5 -4
- package/dist/bin/index.js +5 -4
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/dist/bin/index.cjs
CHANGED
|
@@ -5,14 +5,15 @@ const path = require("node:path");
|
|
|
5
5
|
const commander = require("commander");
|
|
6
6
|
const chokidar = require("chokidar");
|
|
7
7
|
const index = require("../index.cjs");
|
|
8
|
-
const version = "1.0.
|
|
8
|
+
const version = "1.0.3";
|
|
9
9
|
const pack = {
|
|
10
10
|
version
|
|
11
11
|
};
|
|
12
|
-
commander.program.command("build").option("-c, --work-path <path>", "编译工作目录").option("-s, --target-path <path>", "编译产物存放路径").option("-w, --watch", "启用监听文件改动").action(async (options) => {
|
|
12
|
+
commander.program.command("build").option("-c, --work-path <path>", "编译工作目录").option("-s, --target-path <path>", "编译产物存放路径").option("-w, --watch", "启用监听文件改动").option("--no-app-id-dir", "产物根目录不包含appId").action(async (options) => {
|
|
13
13
|
const workPath = options.workPath ? path.resolve(options.workPath) : process.cwd();
|
|
14
14
|
const targetPath = options.targetPath ? path.resolve(options.targetPath) : process.cwd();
|
|
15
|
-
|
|
15
|
+
const useAppIdDir = options.appIdDir !== false;
|
|
16
|
+
await index(targetPath, workPath, useAppIdDir);
|
|
16
17
|
const watch = options.watch;
|
|
17
18
|
if (watch) {
|
|
18
19
|
chokidar.watch(workPath, {
|
|
@@ -23,7 +24,7 @@ commander.program.command("build").option("-c, --work-path <path>", "编译工
|
|
|
23
24
|
}).on("all", async (event, path2) => {
|
|
24
25
|
if (event === "change") {
|
|
25
26
|
console.log(`${path2} 改动,重新编译`);
|
|
26
|
-
await index(targetPath, workPath);
|
|
27
|
+
await index(targetPath, workPath, useAppIdDir);
|
|
27
28
|
}
|
|
28
29
|
});
|
|
29
30
|
}
|
package/dist/bin/index.js
CHANGED
|
@@ -4,14 +4,15 @@ import path from "node:path";
|
|
|
4
4
|
import { program } from "commander";
|
|
5
5
|
import chokidar from "chokidar";
|
|
6
6
|
import build from "../index.js";
|
|
7
|
-
const version = "1.0.
|
|
7
|
+
const version = "1.0.3";
|
|
8
8
|
const pack = {
|
|
9
9
|
version
|
|
10
10
|
};
|
|
11
|
-
program.command("build").option("-c, --work-path <path>", "编译工作目录").option("-s, --target-path <path>", "编译产物存放路径").option("-w, --watch", "启用监听文件改动").action(async (options) => {
|
|
11
|
+
program.command("build").option("-c, --work-path <path>", "编译工作目录").option("-s, --target-path <path>", "编译产物存放路径").option("-w, --watch", "启用监听文件改动").option("--no-app-id-dir", "产物根目录不包含appId").action(async (options) => {
|
|
12
12
|
const workPath = options.workPath ? path.resolve(options.workPath) : process.cwd();
|
|
13
13
|
const targetPath = options.targetPath ? path.resolve(options.targetPath) : process.cwd();
|
|
14
|
-
|
|
14
|
+
const useAppIdDir = options.appIdDir !== false;
|
|
15
|
+
await build(targetPath, workPath, useAppIdDir);
|
|
15
16
|
const watch = options.watch;
|
|
16
17
|
if (watch) {
|
|
17
18
|
chokidar.watch(workPath, {
|
|
@@ -22,7 +23,7 @@ program.command("build").option("-c, --work-path <path>", "编译工作目录").
|
|
|
22
23
|
}).on("all", async (event, path2) => {
|
|
23
24
|
if (event === "change") {
|
|
24
25
|
console.log(`${path2} 改动,重新编译`);
|
|
25
|
-
await build(targetPath, workPath);
|
|
26
|
+
await build(targetPath, workPath, useAppIdDir);
|
|
26
27
|
}
|
|
27
28
|
});
|
|
28
29
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -39,10 +39,10 @@ function createDist() {
|
|
|
39
39
|
}
|
|
40
40
|
shelljs.mkdir("-p", `${distPath}`);
|
|
41
41
|
}
|
|
42
|
-
function publishToDist(dist) {
|
|
42
|
+
function publishToDist(dist, useAppIdDir = true) {
|
|
43
43
|
const distPath = env.getTargetPath();
|
|
44
44
|
const appId = env.getAppId();
|
|
45
|
-
const absolutePath = `${path.resolve(process.cwd(), dist)}/${appId}`;
|
|
45
|
+
const absolutePath = useAppIdDir ? `${path.resolve(process.cwd(), dist)}/${appId}` : `${path.resolve(process.cwd(), dist)}`;
|
|
46
46
|
shelljs.rm("-rf", absolutePath);
|
|
47
47
|
shelljs.mkdir("-p", absolutePath);
|
|
48
48
|
shelljs.cp("-r", `${distPath}/*`, absolutePath);
|
|
@@ -113,7 +113,7 @@ class WorkerPool {
|
|
|
113
113
|
}
|
|
114
114
|
const workerPool = new WorkerPool();
|
|
115
115
|
let isPrinted = false;
|
|
116
|
-
async function build(targetPath, workPath) {
|
|
116
|
+
async function build(targetPath, workPath, useAppIdDir = true) {
|
|
117
117
|
if (!isPrinted) {
|
|
118
118
|
artCode$1();
|
|
119
119
|
isPrinted = true;
|
|
@@ -183,7 +183,7 @@ async function build(targetPath, workPath) {
|
|
|
183
183
|
{
|
|
184
184
|
title: "输出编译产物",
|
|
185
185
|
task: () => {
|
|
186
|
-
publishToDist(targetPath);
|
|
186
|
+
publishToDist(targetPath, useAppIdDir);
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
],
|
package/dist/index.js
CHANGED
|
@@ -37,10 +37,10 @@ function createDist() {
|
|
|
37
37
|
}
|
|
38
38
|
shelljs.mkdir("-p", `${distPath}`);
|
|
39
39
|
}
|
|
40
|
-
function publishToDist(dist) {
|
|
40
|
+
function publishToDist(dist, useAppIdDir = true) {
|
|
41
41
|
const distPath = getTargetPath();
|
|
42
42
|
const appId = getAppId();
|
|
43
|
-
const absolutePath = `${path.resolve(process.cwd(), dist)}/${appId}`;
|
|
43
|
+
const absolutePath = useAppIdDir ? `${path.resolve(process.cwd(), dist)}/${appId}` : `${path.resolve(process.cwd(), dist)}`;
|
|
44
44
|
shelljs.rm("-rf", absolutePath);
|
|
45
45
|
shelljs.mkdir("-p", absolutePath);
|
|
46
46
|
shelljs.cp("-r", `${distPath}/*`, absolutePath);
|
|
@@ -111,7 +111,7 @@ class WorkerPool {
|
|
|
111
111
|
}
|
|
112
112
|
const workerPool = new WorkerPool();
|
|
113
113
|
let isPrinted = false;
|
|
114
|
-
async function build(targetPath, workPath) {
|
|
114
|
+
async function build(targetPath, workPath, useAppIdDir = true) {
|
|
115
115
|
if (!isPrinted) {
|
|
116
116
|
artCode$1();
|
|
117
117
|
isPrinted = true;
|
|
@@ -181,7 +181,7 @@ async function build(targetPath, workPath) {
|
|
|
181
181
|
{
|
|
182
182
|
title: "输出编译产物",
|
|
183
183
|
task: () => {
|
|
184
|
-
publishToDist(targetPath);
|
|
184
|
+
publishToDist(targetPath, useAppIdDir);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
],
|