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.
@@ -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 { createAction } from "./createAction"
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", createAction)
10
+ watcher.on("add", syncSharedArtifacts)
14
11
 
15
- watcher.on("change", createAction)
12
+ watcher.on("change", syncSharedArtifacts)
16
13
 
17
- watcher.on("unlink", async path => {
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", async path => {
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,9 +0,0 @@
1
- import { writeVsCodeSetting } from "./writeVsCodeSetting.js";
2
- function excludeActions() {
3
- return writeVsCodeSetting({
4
- "files.exclude": {
5
- "actions/**": true
6
- }
7
- });
8
- }
9
- export { excludeActions };
@@ -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,9 +0,0 @@
1
- import { writeVsCodeSetting } from "./writeVsCodeSetting"
2
-
3
- export function excludeActions() {
4
- return writeVsCodeSetting({
5
- "files.exclude": {
6
- "actions/**": true,
7
- },
8
- })
9
- }
@@ -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
- }