@lsst/pik-plugin-select 0.6.5 → 0.6.6
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/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import pc from "picocolors";
|
|
3
|
-
import {
|
|
3
|
+
import { relative, extname } from "path";
|
|
4
4
|
import { Parser, loadConfig, SingleSwitcher } from "@lsst/pik-core";
|
|
5
5
|
import { readFile, writeFile } from "fs/promises";
|
|
6
6
|
import { glob } from "glob";
|
|
@@ -18,8 +18,7 @@ class Scanner {
|
|
|
18
18
|
const results = [];
|
|
19
19
|
for (const filePath of files) {
|
|
20
20
|
const content = await readFile(filePath, "utf-8");
|
|
21
|
-
const
|
|
22
|
-
const parser = Parser.forExtension(extension);
|
|
21
|
+
const parser = Parser.forFilePath(filePath);
|
|
23
22
|
const { selectors } = parser.parse(content);
|
|
24
23
|
if (selectors.length > 0) {
|
|
25
24
|
results.push({ path: filePath, selectors, content });
|
|
@@ -182,8 +181,7 @@ const switchCommand = new Command("switch").alias("sw").description("Interactive
|
|
|
182
181
|
if (selectedOption === BACK_VALUE) {
|
|
183
182
|
continue;
|
|
184
183
|
}
|
|
185
|
-
const
|
|
186
|
-
const switcher = SingleSwitcher.forExtension(extension);
|
|
184
|
+
const switcher = SingleSwitcher.forFilePath(selectedChoice.file.path);
|
|
187
185
|
const newContent = switcher.switch(
|
|
188
186
|
selectedChoice.file.content,
|
|
189
187
|
selectedChoice.selector,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/lib/commands/switch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,OAAO,aAAa,CAAC;AAarB,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/lib/commands/switch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,OAAO,aAAa,CAAC;AAarB,eAAO,MAAM,aAAa,SAyGtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../src/lib/scanner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../src/lib/scanner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,OAAO;IACN,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAE3C,IAAI,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;CAqB/D"}
|