glyphix 1.0.31 → 1.0.32
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/bin/glyphix.js +1 -66
- package/package.json +1 -1
- package/types/index.d.ts +2 -0
package/bin/glyphix.js
CHANGED
|
@@ -136,7 +136,6 @@ var import_fs_extra2 = require("fs-extra");
|
|
|
136
136
|
var import_eslint = require("eslint");
|
|
137
137
|
var import_glob = require("glob");
|
|
138
138
|
var import_chalk2 = __toESM(require("chalk"));
|
|
139
|
-
var import_node_process = require("process");
|
|
140
139
|
var import_dotenv = __toESM(require("dotenv"));
|
|
141
140
|
var import_lodash = require("lodash");
|
|
142
141
|
function loadEnv() {
|
|
@@ -164,65 +163,6 @@ function loadEnv() {
|
|
|
164
163
|
import_dotenv.default.config({ path: dotenvFile });
|
|
165
164
|
});
|
|
166
165
|
}
|
|
167
|
-
function getOriginFilePath(filePath, rootPath) {
|
|
168
|
-
const relativePath = (0, import_node_path3.relative)(rootPath, filePath);
|
|
169
|
-
const projectRoot = process.cwd();
|
|
170
|
-
const originPath = (0, import_node_path3.resolve)(projectRoot, "src", relativePath);
|
|
171
|
-
if (originPath.endsWith(".ts")) {
|
|
172
|
-
const uxOrigin = originPath.slice(0, -3) + ".ux";
|
|
173
|
-
if ((0, import_node_fs.existsSync)(uxOrigin)) {
|
|
174
|
-
return uxOrigin;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return originPath;
|
|
178
|
-
}
|
|
179
|
-
function outErrorLog(results, filepath) {
|
|
180
|
-
results.messages.forEach((item) => {
|
|
181
|
-
console.log(
|
|
182
|
-
`${filepath}:${item.line}:${item.column}`,
|
|
183
|
-
"\n ",
|
|
184
|
-
import_chalk2.default.red("error"),
|
|
185
|
-
" ",
|
|
186
|
-
item.message,
|
|
187
|
-
" ",
|
|
188
|
-
import_chalk2.default.gray(item.ruleId)
|
|
189
|
-
);
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
function lintFile(rootPath) {
|
|
193
|
-
const distPath = (0, import_node_path3.join)(rootPath, ".vite-dist");
|
|
194
|
-
if ((0, import_node_fs.existsSync)(distPath)) {
|
|
195
|
-
(0, import_fs_extra2.removeSync)(distPath);
|
|
196
|
-
}
|
|
197
|
-
const sources = (0, import_glob.sync)([
|
|
198
|
-
`${(0, import_node_path3.resolve)(rootPath)}/**/*.ts`,
|
|
199
|
-
`${(0, import_node_path3.resolve)(rootPath)}/**/*.js`
|
|
200
|
-
]);
|
|
201
|
-
const eslint = new import_eslint.ESLint({
|
|
202
|
-
warnIgnored: true,
|
|
203
|
-
overrideConfig: {
|
|
204
|
-
rules: {
|
|
205
|
-
"no-console": "off",
|
|
206
|
-
"prettier/prettier": "off",
|
|
207
|
-
"@typescript-eslint/ban-ts-comment": "warn",
|
|
208
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
209
|
-
"@typescript-eslint/no-unused-vars": "warn",
|
|
210
|
-
quotes: "off"
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
return eslint.lintFiles(sources).then((res) => {
|
|
215
|
-
return res.filter((item) => item.errorCount).map((item) => {
|
|
216
|
-
return item;
|
|
217
|
-
}).flat();
|
|
218
|
-
}).then((res) => {
|
|
219
|
-
res.forEach((item) => {
|
|
220
|
-
const originPath = getOriginFilePath(item.filePath, rootPath);
|
|
221
|
-
outErrorLog(item, originPath);
|
|
222
|
-
});
|
|
223
|
-
return res;
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
166
|
function dealResource() {
|
|
227
167
|
if (!process.env["VITE_BUILD_DIR"])
|
|
228
168
|
throw Error("not set glyphix project path");
|
|
@@ -314,12 +254,7 @@ function build(rootPath, entriedFullPath) {
|
|
|
314
254
|
function generateGlyphix() {
|
|
315
255
|
const config = dealResource();
|
|
316
256
|
loadEnv();
|
|
317
|
-
|
|
318
|
-
if (res.length) {
|
|
319
|
-
(0, import_node_process.exit)(1);
|
|
320
|
-
}
|
|
321
|
-
build(config.root, config.entry);
|
|
322
|
-
});
|
|
257
|
+
build(config.root, config.entry);
|
|
323
258
|
}
|
|
324
259
|
|
|
325
260
|
// src/cli/index.ts
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -17,10 +17,12 @@
|
|
|
17
17
|
/// <reference path="./exchange.d.ts" />
|
|
18
18
|
/// <reference path="./audiokit.d.ts" />
|
|
19
19
|
|
|
20
|
+
|
|
20
21
|
declare global {
|
|
21
22
|
function $t(key: string): string;
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
|
|
24
26
|
type ComputedResults<C, D> = {
|
|
25
27
|
readonly [K in keyof C as C[K] extends (this: D) => any
|
|
26
28
|
? K
|