sdnext 0.0.24 → 0.0.26
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/README.md +111 -1
- package/dist/index.js +145 -14
- package/dist/utils/build.js +5 -8
- package/dist/utils/createAction.js +10 -17
- package/dist/utils/createRoute.d.ts +9 -0
- package/dist/utils/createRoute.js +64 -0
- package/dist/utils/dev.js +22 -9
- package/dist/utils/hook.d.ts +11 -1
- package/dist/utils/hook.js +101 -65
- package/dist/utils/readSdNextSetting.d.ts +3 -0
- package/dist/utils/readSdNextSetting.js +8 -3
- package/dist/utils/runCommand.d.ts +7 -0
- package/dist/utils/runCommand.js +25 -0
- package/dist/utils/sharedArtifact.d.ts +23 -0
- package/dist/utils/sharedArtifact.js +67 -0
- package/dist/utils/syncSharedArtifacts.d.ts +3 -0
- package/dist/utils/syncSharedArtifacts.js +28 -0
- package/dist/utils/watch.js +5 -21
- package/package.json +1 -1
- package/src/index.ts +5 -4
- package/src/utils/build.ts +4 -10
- package/src/utils/createAction.ts +12 -19
- package/src/utils/createRoute.ts +86 -0
- package/src/utils/dev.ts +24 -10
- package/src/utils/hook.ts +125 -74
- package/src/utils/readSdNextSetting.ts +14 -4
- package/src/utils/runCommand.ts +35 -0
- package/src/utils/sharedArtifact.ts +90 -0
- package/src/utils/syncSharedArtifacts.ts +38 -0
- package/src/utils/watch.ts +5 -16
- package/dist/utils/excludeActions.d.ts +0 -1
- package/dist/utils/excludeActions.js +0 -9
- package/dist/utils/writeVsCodeSetting.d.ts +0 -1
- package/dist/utils/writeVsCodeSetting.js +0 -18
- package/src/utils/excludeActions.ts +0 -9
- package/src/utils/writeVsCodeSetting.ts +0 -22
package/src/utils/watch.ts
CHANGED
|
@@ -1,27 +1,16 @@
|
|
|
1
|
-
import { rm } from "fs/promises"
|
|
2
|
-
import { join, relative } from "path"
|
|
3
|
-
|
|
4
1
|
import { watch } from "chokidar"
|
|
5
2
|
|
|
6
|
-
import {
|
|
3
|
+
import { removeSharedArtifactDirectory, removeSharedArtifacts, syncSharedArtifacts } from "./syncSharedArtifacts"
|
|
7
4
|
|
|
8
5
|
const watcher = watch("shared", {
|
|
9
6
|
awaitWriteFinish: true,
|
|
10
7
|
persistent: true,
|
|
11
8
|
})
|
|
12
9
|
|
|
13
|
-
watcher.on("add",
|
|
10
|
+
watcher.on("add", syncSharedArtifacts)
|
|
14
11
|
|
|
15
|
-
watcher.on("change",
|
|
12
|
+
watcher.on("change", syncSharedArtifacts)
|
|
16
13
|
|
|
17
|
-
watcher.on("unlink",
|
|
18
|
-
path = relative("shared", path).replace(/\\/g, "/")
|
|
19
|
-
const actionPath = join("actions", path)
|
|
20
|
-
await rm(actionPath, { recursive: true, force: true })
|
|
21
|
-
})
|
|
14
|
+
watcher.on("unlink", removeSharedArtifacts)
|
|
22
15
|
|
|
23
|
-
watcher.on("unlinkDir",
|
|
24
|
-
path = relative("shared", path).replace(/\\/g, "/")
|
|
25
|
-
const actionPath = join("actions", path)
|
|
26
|
-
await rm(actionPath, { recursive: true, force: true })
|
|
27
|
-
})
|
|
16
|
+
watcher.on("unlinkDir", removeSharedArtifactDirectory)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function excludeActions(): Promise<Record<string, any>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function writeVsCodeSetting(config: Record<string, any>): Promise<Record<string, any>>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
2
|
-
import { merge } from "deepsea-tools";
|
|
3
|
-
async function writeVsCodeSetting(config) {
|
|
4
|
-
await mkdir(".vscode", {
|
|
5
|
-
recursive: true
|
|
6
|
-
});
|
|
7
|
-
let data;
|
|
8
|
-
try {
|
|
9
|
-
const json = await readFile(".vscode/settings.json", "utf-8");
|
|
10
|
-
data = JSON.parse(json);
|
|
11
|
-
} catch (error) {
|
|
12
|
-
data = {};
|
|
13
|
-
}
|
|
14
|
-
data = merge(data, config);
|
|
15
|
-
await writeFile(".vscode/settings.json", JSON.stringify(data, null, 4));
|
|
16
|
-
return data;
|
|
17
|
-
}
|
|
18
|
-
export { writeVsCodeSetting };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { mkdir, readFile, writeFile } from "fs/promises"
|
|
2
|
-
|
|
3
|
-
import { merge } from "deepsea-tools"
|
|
4
|
-
|
|
5
|
-
export async function writeVsCodeSetting(config: Record<string, any>) {
|
|
6
|
-
await mkdir(".vscode", { recursive: true })
|
|
7
|
-
|
|
8
|
-
let data: Record<string, any>
|
|
9
|
-
|
|
10
|
-
try {
|
|
11
|
-
const json = await readFile(".vscode/settings.json", "utf-8")
|
|
12
|
-
data = JSON.parse(json)
|
|
13
|
-
} catch (error) {
|
|
14
|
-
data = {}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
data = merge(data, config)
|
|
18
|
-
|
|
19
|
-
await writeFile(".vscode/settings.json", JSON.stringify(data, null, 4))
|
|
20
|
-
|
|
21
|
-
return data
|
|
22
|
-
}
|