as-soon 0.0.7 → 0.0.8
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/chunk-AVQVENQ2.js +25 -0
- package/dist/chunk-AVQVENQ2.js.map +1 -0
- package/dist/cli.cjs +12 -10
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +1 -0
- package/dist/cli.js +13 -11
- package/dist/cli.js.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.js +1 -1
- package/package.json +9 -9
- package/src/cli.ts +9 -5
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
__async
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=chunk-AVQVENQ2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/cli.cjs
CHANGED
|
@@ -88,13 +88,12 @@ var commandToUse = command;
|
|
|
88
88
|
console.log(`"${commandToUse} ${(commandArgs == null ? void 0 : commandArgs.join(" ")) || ""}"`);
|
|
89
89
|
(0, import_ldenv.loadEnv)({ mode: deploymentContext });
|
|
90
90
|
function _execute() {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
});
|
|
91
|
+
try {
|
|
92
|
+
(0, import_child_process.execFileSync)(commandToUse, commandArgs, { stdio: ["inherit", "inherit", "inherit"] });
|
|
93
|
+
} catch (err) {
|
|
94
|
+
console.error("failed to execue", err);
|
|
95
|
+
}
|
|
96
|
+
console.log(`-------------------------------------`);
|
|
98
97
|
}
|
|
99
98
|
function subscribe_target(absolute_path, execute) {
|
|
100
99
|
return __async(this, null, function* () {
|
|
@@ -136,19 +135,22 @@ function listen(absolute_path, execute) {
|
|
|
136
135
|
}
|
|
137
136
|
function main() {
|
|
138
137
|
return __async(this, null, function* () {
|
|
139
|
-
const execute = (0, import_lodash.debounce)(_execute, 50
|
|
138
|
+
const execute = (0, import_lodash.debounce)(_execute, 50, {
|
|
139
|
+
leading: true
|
|
140
|
+
});
|
|
141
|
+
execute();
|
|
140
142
|
if (options["w"]) {
|
|
141
143
|
const folders = options["w"].map((p) => import_node_path.default.normalize(import_node_path.default.join(process.cwd(), p)));
|
|
142
|
-
console.log(`listening on: ${folders.join(", ")}`);
|
|
143
144
|
for (const folder of folders) {
|
|
144
145
|
listen(folder, execute);
|
|
146
|
+
console.log(`Now listening on ${folder}`);
|
|
147
|
+
console.log(`-------------------------------------`);
|
|
145
148
|
}
|
|
146
149
|
} else {
|
|
147
150
|
const folder = import_node_path.default.normalize(process.cwd());
|
|
148
151
|
console.log(`listening on current folder: ${folder}`);
|
|
149
152
|
listen(folder, execute);
|
|
150
153
|
}
|
|
151
|
-
execute();
|
|
152
154
|
});
|
|
153
155
|
}
|
|
154
156
|
main();
|
package/dist/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport {execFileSync} from 'child_process';\nimport watcher, {AsyncSubscription} from '@parcel/watcher';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport {debounce} from 'lodash';\nimport {loadEnv} from 'ldenv';\n\nconst args = process.argv.slice(2);\n\nfunction error(msg: string) {\n\tconsole.error(msg);\n\tprocess.exit(1);\n}\n\nlet deploymentContext = 'localhost';\nlet argToConsume;\nlet command: string | undefined;\nlet commandArgs: string[] | undefined;\nconst options: {[key: string]: string[]} = {};\nfor (let i = 0; i < args.length; i++) {\n\tconst arg = args[i];\n\tif (arg.startsWith('--')) {\n\t\targToConsume = arg.substring(2);\n\t} else if (arg.startsWith('-')) {\n\t\targToConsume = arg.substring(1);\n\t} else {\n\t\tif (argToConsume) {\n\t\t\tif (options[argToConsume]) {\n\t\t\t\toptions[argToConsume].push(arg);\n\t\t\t} else {\n\t\t\t\toptions[argToConsume] = [arg];\n\t\t\t}\n\t\t\targToConsume = undefined;\n\t\t} else {\n\t\t\tcommand = arg;\n\t\t\tcommandArgs = args.slice(i + 1);\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nif (!command) {\n\terror(`please specify a command`);\n}\nconst commandToUse = command!;\n\nconsole.log(`\"${commandToUse} ${commandArgs?.join(' ') || ''}\"`);\n\nloadEnv({mode: deploymentContext});\n\
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport {execFileSync} from 'child_process';\nimport watcher, {AsyncSubscription} from '@parcel/watcher';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport {debounce} from 'lodash';\nimport {loadEnv} from 'ldenv';\n\nconst args = process.argv.slice(2);\n\nfunction error(msg: string) {\n\tconsole.error(msg);\n\tprocess.exit(1);\n}\n\nlet deploymentContext = 'localhost';\nlet argToConsume;\nlet command: string | undefined;\nlet commandArgs: string[] | undefined;\nconst options: {[key: string]: string[]} = {};\nfor (let i = 0; i < args.length; i++) {\n\tconst arg = args[i];\n\tif (arg.startsWith('--')) {\n\t\targToConsume = arg.substring(2);\n\t} else if (arg.startsWith('-')) {\n\t\targToConsume = arg.substring(1);\n\t} else {\n\t\tif (argToConsume) {\n\t\t\tif (options[argToConsume]) {\n\t\t\t\toptions[argToConsume].push(arg);\n\t\t\t} else {\n\t\t\t\toptions[argToConsume] = [arg];\n\t\t\t}\n\t\t\targToConsume = undefined;\n\t\t} else {\n\t\t\tcommand = arg;\n\t\t\tcommandArgs = args.slice(i + 1);\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nif (!command) {\n\terror(`please specify a command`);\n}\nconst commandToUse = command!;\n\nconsole.log(`\"${commandToUse} ${commandArgs?.join(' ') || ''}\"`);\n\nloadEnv({mode: deploymentContext});\n\nfunction _execute() {\n\ttry {\n\t\texecFileSync(commandToUse, commandArgs, {stdio: ['inherit', 'inherit', 'inherit']});\n\t} catch (err) {\n\t\tconsole.error('failed to execue', err);\n\t}\n\tconsole.log(`-------------------------------------`);\n}\n\n// let counter = 0;\nasync function subscribe_target(absolute_path: string, execute: () => void) {\n\t// const c = ++counter;\n\tconst p = path.relative(process.cwd(), absolute_path);\n\tconst subscription = await watcher.subscribe(absolute_path, (err, events) => {\n\t\t// console.log(`Files changed under ${p} (${c})`);\n\t\tconsole.log(`Files changed under ${p}`);\n\t\tfor (const event of events) {\n\t\t\tif (event.type === 'delete' && event.path === absolute_path) {\n\t\t\t\tsubscription.unsubscribe();\n\t\t\t\tlisten(absolute_path, execute);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\texecute();\n\t});\n}\n\nasync function listen(absolute_path: string, execute: () => void) {\n\tif (fs.existsSync(absolute_path)) {\n\t\tsubscribe_target(absolute_path, execute);\n\t} else {\n\t\t// console.log(`${absolute_path} do not exist yet, listening on parent`)\n\t\tlet tmp_subscription: AsyncSubscription | undefined = await watcher.subscribe(\n\t\t\tpath.dirname(absolute_path),\n\t\t\t(err, events) => {\n\t\t\t\tfor (const event of events) {\n\t\t\t\t\tif (event.type === 'create' && path.normalize(event.path) === absolute_path) {\n\t\t\t\t\t\t// console.log(`${absolute_path} just got created, listening for it...`);\n\t\t\t\t\t\ttmp_subscription?.unsubscribe();\n\t\t\t\t\t\ttmp_subscription = undefined;\n\t\t\t\t\t\t// wrap in a timeout to ensure @parcel/watcher hook on the correct inode?\n\t\t\t\t\t\tsetTimeout((v) => {\n\t\t\t\t\t\t\tsubscribe_target(absolute_path, execute);\n\t\t\t\t\t\t}, 500);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n}\n\nasync function main() {\n\tconst execute = debounce(_execute, 50, {\n\t\tleading: true,\n\t});\n\texecute();\n\tif (options['w']) {\n\t\tconst folders = options['w'].map((p) => path.normalize(path.join(process.cwd(), p)));\n\t\tfor (const folder of folders) {\n\t\t\tlisten(folder, execute);\n\n\t\t\tconsole.log(`Now listening on ${folder}`);\n\t\t\tconsole.log(`-------------------------------------`);\n\t\t}\n\t} else {\n\t\tconst folder = path.normalize(process.cwd());\n\t\tconsole.log(`listening on current folder: ${folder}`);\n\t\tlisten(folder, execute);\n\t}\n}\nmain();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2BAA2B;AAC3B,qBAAyC;AACzC,uBAAiB;AACjB,qBAAe;AACf,oBAAuB;AACvB,mBAAsB;AAEtB,IAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAEjC,SAAS,MAAM,KAAa;AAC3B,UAAQ,MAAM,GAAG;AACjB,UAAQ,KAAK,CAAC;AACf;AAEA,IAAI,oBAAoB;AACxB,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAM,UAAqC,CAAC;AAC5C,SAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACrC,QAAM,MAAM,KAAK,CAAC;AAClB,MAAI,IAAI,WAAW,IAAI,GAAG;AACzB,mBAAe,IAAI,UAAU,CAAC;AAAA,EAC/B,WAAW,IAAI,WAAW,GAAG,GAAG;AAC/B,mBAAe,IAAI,UAAU,CAAC;AAAA,EAC/B,OAAO;AACN,QAAI,cAAc;AACjB,UAAI,QAAQ,YAAY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Aa;AAAA,QAC1B,CAAC,KAAK,WAAW;AAChB,qBAAW,SAAS,QAAQ;AAC3B,gBAAI,MAAM,SAAS,YAAY,iBAAAA,QAAK,UAAU,MAAM,IAAI,MAAM,eAAe;AAE5E,mEAAkB;AAClB,iCAAmB;AAEnB,yBAAW,CAAC,MAAM;AACjB,iCAAiB,eAAe,OAAO;AAAA,cACxC,GAAG,GAAG;AAAA,YACP;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA;AAEA,SAAe,OAAO;AAAA;AACrB,UAAM,cAAU,wBAAS,UAAU,IAAI;AAAA,MACtC,SAAS;AAAA,IACV,CAAC;AACD,YAAQ;AACR,QAAI,QAAQ,GAAG,GAAG;AACjB,YAAM,UAAU,QAAQ,GAAG,EAAE,IAAI,CAAC,MAAM,iBAAAA,QAAK,UAAU,iBAAAA,QAAK,KAAK,QAAQ,IAAI,GAAG,CAAC,CAAC,CAAC;AACnF,iBAAW,UAAU,SAAS;AAC7B,eAAO,QAAQ,OAAO;AAEtB,gBAAQ,IAAI,oBAAoB,MAAM,EAAE;AACxC,gBAAQ,IAAI,uCAAuC;AAAA,MACpD;AAAA,IACD,OAAO;AACN,YAAM,SAAS,iBAAAA,QAAK,UAAU,QAAQ,IAAI,CAAC;AAC3C,cAAQ,IAAI,gCAAgC,MAAM,EAAE;AACpD,aAAO,QAAQ,OAAO;AAAA,IACvB;AAAA,EACD;AAAA;AACA,KAAK;","names":["path","watcher","fs"]}
|
package/dist/cli.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
__async
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AVQVENQ2.js";
|
|
5
5
|
|
|
6
6
|
// src/cli.ts
|
|
7
7
|
import { execFileSync } from "child_process";
|
|
@@ -48,13 +48,12 @@ var commandToUse = command;
|
|
|
48
48
|
console.log(`"${commandToUse} ${(commandArgs == null ? void 0 : commandArgs.join(" ")) || ""}"`);
|
|
49
49
|
loadEnv({ mode: deploymentContext });
|
|
50
50
|
function _execute() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
});
|
|
51
|
+
try {
|
|
52
|
+
execFileSync(commandToUse, commandArgs, { stdio: ["inherit", "inherit", "inherit"] });
|
|
53
|
+
} catch (err) {
|
|
54
|
+
console.error("failed to execue", err);
|
|
55
|
+
}
|
|
56
|
+
console.log(`-------------------------------------`);
|
|
58
57
|
}
|
|
59
58
|
function subscribe_target(absolute_path, execute) {
|
|
60
59
|
return __async(this, null, function* () {
|
|
@@ -96,19 +95,22 @@ function listen(absolute_path, execute) {
|
|
|
96
95
|
}
|
|
97
96
|
function main() {
|
|
98
97
|
return __async(this, null, function* () {
|
|
99
|
-
const execute = debounce(_execute, 50
|
|
98
|
+
const execute = debounce(_execute, 50, {
|
|
99
|
+
leading: true
|
|
100
|
+
});
|
|
101
|
+
execute();
|
|
100
102
|
if (options["w"]) {
|
|
101
103
|
const folders = options["w"].map((p) => path.normalize(path.join(process.cwd(), p)));
|
|
102
|
-
console.log(`listening on: ${folders.join(", ")}`);
|
|
103
104
|
for (const folder of folders) {
|
|
104
105
|
listen(folder, execute);
|
|
106
|
+
console.log(`Now listening on ${folder}`);
|
|
107
|
+
console.log(`-------------------------------------`);
|
|
105
108
|
}
|
|
106
109
|
} else {
|
|
107
110
|
const folder = path.normalize(process.cwd());
|
|
108
111
|
console.log(`listening on current folder: ${folder}`);
|
|
109
112
|
listen(folder, execute);
|
|
110
113
|
}
|
|
111
|
-
execute();
|
|
112
114
|
});
|
|
113
115
|
}
|
|
114
116
|
main();
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport {execFileSync} from 'child_process';\nimport watcher, {AsyncSubscription} from '@parcel/watcher';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport {debounce} from 'lodash';\nimport {loadEnv} from 'ldenv';\n\nconst args = process.argv.slice(2);\n\nfunction error(msg: string) {\n\tconsole.error(msg);\n\tprocess.exit(1);\n}\n\nlet deploymentContext = 'localhost';\nlet argToConsume;\nlet command: string | undefined;\nlet commandArgs: string[] | undefined;\nconst options: {[key: string]: string[]} = {};\nfor (let i = 0; i < args.length; i++) {\n\tconst arg = args[i];\n\tif (arg.startsWith('--')) {\n\t\targToConsume = arg.substring(2);\n\t} else if (arg.startsWith('-')) {\n\t\targToConsume = arg.substring(1);\n\t} else {\n\t\tif (argToConsume) {\n\t\t\tif (options[argToConsume]) {\n\t\t\t\toptions[argToConsume].push(arg);\n\t\t\t} else {\n\t\t\t\toptions[argToConsume] = [arg];\n\t\t\t}\n\t\t\targToConsume = undefined;\n\t\t} else {\n\t\t\tcommand = arg;\n\t\t\tcommandArgs = args.slice(i + 1);\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nif (!command) {\n\terror(`please specify a command`);\n}\nconst commandToUse = command!;\n\nconsole.log(`\"${commandToUse} ${commandArgs?.join(' ') || ''}\"`);\n\nloadEnv({mode: deploymentContext});\n\
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport {execFileSync} from 'child_process';\nimport watcher, {AsyncSubscription} from '@parcel/watcher';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport {debounce} from 'lodash';\nimport {loadEnv} from 'ldenv';\n\nconst args = process.argv.slice(2);\n\nfunction error(msg: string) {\n\tconsole.error(msg);\n\tprocess.exit(1);\n}\n\nlet deploymentContext = 'localhost';\nlet argToConsume;\nlet command: string | undefined;\nlet commandArgs: string[] | undefined;\nconst options: {[key: string]: string[]} = {};\nfor (let i = 0; i < args.length; i++) {\n\tconst arg = args[i];\n\tif (arg.startsWith('--')) {\n\t\targToConsume = arg.substring(2);\n\t} else if (arg.startsWith('-')) {\n\t\targToConsume = arg.substring(1);\n\t} else {\n\t\tif (argToConsume) {\n\t\t\tif (options[argToConsume]) {\n\t\t\t\toptions[argToConsume].push(arg);\n\t\t\t} else {\n\t\t\t\toptions[argToConsume] = [arg];\n\t\t\t}\n\t\t\targToConsume = undefined;\n\t\t} else {\n\t\t\tcommand = arg;\n\t\t\tcommandArgs = args.slice(i + 1);\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nif (!command) {\n\terror(`please specify a command`);\n}\nconst commandToUse = command!;\n\nconsole.log(`\"${commandToUse} ${commandArgs?.join(' ') || ''}\"`);\n\nloadEnv({mode: deploymentContext});\n\nfunction _execute() {\n\ttry {\n\t\texecFileSync(commandToUse, commandArgs, {stdio: ['inherit', 'inherit', 'inherit']});\n\t} catch (err) {\n\t\tconsole.error('failed to execue', err);\n\t}\n\tconsole.log(`-------------------------------------`);\n}\n\n// let counter = 0;\nasync function subscribe_target(absolute_path: string, execute: () => void) {\n\t// const c = ++counter;\n\tconst p = path.relative(process.cwd(), absolute_path);\n\tconst subscription = await watcher.subscribe(absolute_path, (err, events) => {\n\t\t// console.log(`Files changed under ${p} (${c})`);\n\t\tconsole.log(`Files changed under ${p}`);\n\t\tfor (const event of events) {\n\t\t\tif (event.type === 'delete' && event.path === absolute_path) {\n\t\t\t\tsubscription.unsubscribe();\n\t\t\t\tlisten(absolute_path, execute);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\texecute();\n\t});\n}\n\nasync function listen(absolute_path: string, execute: () => void) {\n\tif (fs.existsSync(absolute_path)) {\n\t\tsubscribe_target(absolute_path, execute);\n\t} else {\n\t\t// console.log(`${absolute_path} do not exist yet, listening on parent`)\n\t\tlet tmp_subscription: AsyncSubscription | undefined = await watcher.subscribe(\n\t\t\tpath.dirname(absolute_path),\n\t\t\t(err, events) => {\n\t\t\t\tfor (const event of events) {\n\t\t\t\t\tif (event.type === 'create' && path.normalize(event.path) === absolute_path) {\n\t\t\t\t\t\t// console.log(`${absolute_path} just got created, listening for it...`);\n\t\t\t\t\t\ttmp_subscription?.unsubscribe();\n\t\t\t\t\t\ttmp_subscription = undefined;\n\t\t\t\t\t\t// wrap in a timeout to ensure @parcel/watcher hook on the correct inode?\n\t\t\t\t\t\tsetTimeout((v) => {\n\t\t\t\t\t\t\tsubscribe_target(absolute_path, execute);\n\t\t\t\t\t\t}, 500);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n}\n\nasync function main() {\n\tconst execute = debounce(_execute, 50, {\n\t\tleading: true,\n\t});\n\texecute();\n\tif (options['w']) {\n\t\tconst folders = options['w'].map((p) => path.normalize(path.join(process.cwd(), p)));\n\t\tfor (const folder of folders) {\n\t\t\tlisten(folder, execute);\n\n\t\t\tconsole.log(`Now listening on ${folder}`);\n\t\t\tconsole.log(`-------------------------------------`);\n\t\t}\n\t} else {\n\t\tconst folder = path.normalize(process.cwd());\n\t\tconsole.log(`listening on current folder: ${folder}`);\n\t\tlisten(folder, execute);\n\t}\n}\nmain();\n"],"mappings":";;;;;;AACA,SAAQ,oBAAmB;AAC3B,OAAO,aAAkC;AACzC,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,SAAQ,gBAAe;AACvB,SAAQ,eAAc;AAEtB,IAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAEjC,SAAS,MAAM,KAAa;AAC3B,UAAQ,MAAM,GAAG;AACjB,UAAQ,KAAK,CAAC;AACf;AAEA,IAAI,oBAAoB;AACxB,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAM,UAAqC,CAAC;AAC5C,SAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACrC,QAAM,MAAM,KAAK,CAAC;AAClB,MAAI,IAAI,WAAW,IAAI,GAAG;AACzB,mBAAe,IAAI,UAAU,CAAC;AAAA,EAC/B,WAAW,IAAI,WAAW,GAAG,GAAG;AAC/B,mBAAe,IA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;AAAA,QACnE,KAAK,QAAQ,aAAa;AAAA,QAC1B,CAAC,KAAK,WAAW;AAChB,qBAAW,SAAS,QAAQ;AAC3B,gBAAI,MAAM,SAAS,YAAY,KAAK,UAAU,MAAM,IAAI,MAAM,eAAe;AAE5E,mEAAkB;AAClB,iCAAmB;AAEnB,yBAAW,CAAC,MAAM;AACjB,iCAAiB,eAAe,OAAO;AAAA,cACxC,GAAG,GAAG;AAAA,YACP;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA;AAEA,SAAe,OAAO;AAAA;AACrB,UAAM,UAAU,SAAS,UAAU,IAAI;AAAA,MACtC,SAAS;AAAA,IACV,CAAC;AACD,YAAQ;AACR,QAAI,QAAQ,GAAG,GAAG;AACjB,YAAM,UAAU,QAAQ,GAAG,EAAE,IAAI,CAAC,MAAM,KAAK,UAAU,KAAK,KAAK,QAAQ,IAAI,GAAG,CAAC,CAAC,CAAC;AACnF,iBAAW,UAAU,SAAS;AAC7B,eAAO,QAAQ,OAAO;AAEtB,gBAAQ,IAAI,oBAAoB,MAAM,EAAE;AACxC,gBAAQ,IAAI,uCAAuC;AAAA,MACpD;AAAA,IACD,OAAO;AACN,YAAM,SAAS,KAAK,UAAU,QAAQ,IAAI,CAAC;AAC3C,cAAQ,IAAI,gCAAgC,MAAM,EAAE;AACpD,aAAO,QAAQ,OAAO;AAAA,IACvB;AAAA,EACD;AAAA;AACA,KAAK;","names":[]}
|
package/dist/index.d.cts
ADDED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "as-soon",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "watch and execute",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -13,18 +13,18 @@
|
|
|
13
13
|
"as-soon": "dist/cli.cjs"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@parcel/watcher": "^2.
|
|
17
|
-
"ldenv": "^0.
|
|
16
|
+
"@parcel/watcher": "^2.4.0",
|
|
17
|
+
"ldenv": "^0.3.9",
|
|
18
18
|
"lodash": "^4.17.21",
|
|
19
19
|
"lodash-es": "^4.17.21"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@types/lodash": "^4.14.
|
|
23
|
-
"@types/lodash-es": "^4.17.
|
|
24
|
-
"@types/node": "^
|
|
25
|
-
"set-defaults": "^0.0.
|
|
26
|
-
"tsup": "^
|
|
27
|
-
"typescript": "^
|
|
22
|
+
"@types/lodash": "^4.14.202",
|
|
23
|
+
"@types/lodash-es": "^4.17.12",
|
|
24
|
+
"@types/node": "^20.11.16",
|
|
25
|
+
"set-defaults": "^0.0.2",
|
|
26
|
+
"tsup": "^8.0.1",
|
|
27
|
+
"typescript": "^5.3.3"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"prepare": "set-defaults .vscode",
|
package/src/cli.ts
CHANGED
|
@@ -49,12 +49,13 @@ console.log(`"${commandToUse} ${commandArgs?.join(' ') || ''}"`);
|
|
|
49
49
|
|
|
50
50
|
loadEnv({mode: deploymentContext});
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
function _execute() {
|
|
53
53
|
try {
|
|
54
54
|
execFileSync(commandToUse, commandArgs, {stdio: ['inherit', 'inherit', 'inherit']});
|
|
55
55
|
} catch (err) {
|
|
56
56
|
console.error('failed to execue', err);
|
|
57
57
|
}
|
|
58
|
+
console.log(`-------------------------------------`);
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
// let counter = 0;
|
|
@@ -100,19 +101,22 @@ async function listen(absolute_path: string, execute: () => void) {
|
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
async function main() {
|
|
103
|
-
const execute = debounce(_execute, 50
|
|
104
|
+
const execute = debounce(_execute, 50, {
|
|
105
|
+
leading: true,
|
|
106
|
+
});
|
|
107
|
+
execute();
|
|
104
108
|
if (options['w']) {
|
|
105
109
|
const folders = options['w'].map((p) => path.normalize(path.join(process.cwd(), p)));
|
|
106
|
-
console.log(`listening on: ${folders.join(', ')}`);
|
|
107
110
|
for (const folder of folders) {
|
|
108
111
|
listen(folder, execute);
|
|
112
|
+
|
|
113
|
+
console.log(`Now listening on ${folder}`);
|
|
114
|
+
console.log(`-------------------------------------`);
|
|
109
115
|
}
|
|
110
116
|
} else {
|
|
111
117
|
const folder = path.normalize(process.cwd());
|
|
112
118
|
console.log(`listening on current folder: ${folder}`);
|
|
113
119
|
listen(folder, execute);
|
|
114
120
|
}
|
|
115
|
-
|
|
116
|
-
execute();
|
|
117
121
|
}
|
|
118
122
|
main();
|