@moneko/core 3.37.0 → 3.37.1
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/lib/bin/pure-lint.d.mts +4 -2
- package/lib/bin/pure-lint.mjs +1 -1
- package/lib/bin/utils/bundle-app.d.mts +1 -0
- package/lib/bin/utils/bundle-app.mjs +1 -1
- package/lib/commom/log.d.mts +1 -1
- package/lib/commom/log.mjs +3 -2
- package/lib/commom/timer.d.mts +12 -0
- package/lib/commom/timer.mjs +1 -0
- package/lib/index.d.mts +1 -0
- package/lib/index.mjs +1 -1
- package/package.json +1 -1
package/lib/bin/pure-lint.d.mts
CHANGED
|
@@ -3,9 +3,11 @@ import { spawnSync, type SpawnSyncReturns } from 'node:child_process';
|
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { argv } from 'node:process';
|
|
5
5
|
import { ESLint } from '@moneko/eslint';
|
|
6
|
-
import { stylelint as Stylelint } from '@moneko/stylelint';
|
|
7
|
-
import { loadFile } from '@moneko/utils';
|
|
6
|
+
import { LinterResult, stylelint as Stylelint } from '@moneko/stylelint';
|
|
7
|
+
import { ink, loadFile, println } from '@moneko/utils';
|
|
8
|
+
import log from '../commom/log.mjs';
|
|
8
9
|
import parseArgs from '../commom/parse-args.mjs';
|
|
10
|
+
import timer from '../commom/timer.mjs';
|
|
9
11
|
type Args = {
|
|
10
12
|
fix?: boolean;
|
|
11
13
|
cache?: boolean;
|
package/lib/bin/pure-lint.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{spawnSync as t}from"node:child_process";import{join as e}from"node:path";import{argv as o}from"node:process";import{ESLint as i}from"@moneko/eslint";import{stylelint as
|
|
2
|
+
import{spawnSync as t}from"node:child_process";import{join as e}from"node:path";import{argv as o}from"node:process";import{ESLint as i}from"@moneko/eslint";import{stylelint as r}from"@moneko/stylelint";import{ink as n,loadFile as s,println as l}from"@moneko/utils";import m from"../commom/log.mjs";import a from"../commom/parse-args.mjs";import c from"../commom/timer.mjs";let d=a(o.slice(2)),f=d.fix,p=d.cache||!0,y=e(process.cwd(),"node_modules/.cache"),u={ci:["diff","--name-only","HEAD^","HEAD"],commit:["diff","--cached","--name-only","--diff-filter=ACMR"]},h=/.*(?<!\.d)\.(j|t|mj|mt|cj|ct)sx?$/,w=/.*(?<!\.d)\.vue$/,g=/.*(?<!\.d)\.(c|sc|sa|le)ss$/,S=t("git",u[d.mode||"ci"]||u.ci).stdout.toString().trim().split("\n");async function $(){let t=n("ESLint","cyan");l(`${t}: ${n("runing...","yellow")}`,!0);try{c.start("ESLint");let t=S.filter(t=>h.test(t)||w.test(t));if(0===t.length){c.end("ESLint");return}let e=new i({cache:p,cacheLocation:`${y}/.eslintcache`,fix:f}),o=await e.lintFiles(t),r=await e.loadFormatter("stylish"),n=await r.format(o);f&&await i.outputFixes(o),n&&process.stdout.write(n);let s=o.some(t=>t.errorCount>0);c.end("ESLint"),s&&process.exit(1)}catch(t){m(t)}}let E=S.filter(t=>g.test(t)||w.test(t));async function j(){let t=n("Stylelint","cyan");if(l(`${t}: ${n("runing...","yellow")}`,!0),c.start("Stylelint"),0===E.length){c.end("Stylelint");return}let e=await Promise.all(E.map(async t=>{let e=await s(t);return await r.lint({codeFilename:t,code:e,cache:p,cacheLocation:`${y}/.stylelintcache`,fix:f,formatter:"string"}).catch(m)})),o=!1;e.forEach(t=>{t&&(t.report&&process.stdout.write(t.report),t.errored&&(o=!!t.errored))}),c.end("Stylelint"),o&&process.exit(1)}await Promise.all([$(),j()]);
|
|
@@ -2,5 +2,6 @@ import { execSync } from 'node:child_process';
|
|
|
2
2
|
import { renameSync } from 'node:fs';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { bundleIpa, createDir, ink, print } from '@moneko/utils';
|
|
5
|
+
import timer from '../../commom/timer.mjs';
|
|
5
6
|
export declare function bundleApk(outputPath: string, outputBundleDir: string, type?: string);
|
|
6
7
|
export declare function bundleIOS(outputPath: string, outputBundleDir: string, type?: string);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{execSync as e}from"node:child_process";import{renameSync as o}from"node:fs";import{join as n}from"node:path";import{bundleIpa as p,createDir as
|
|
1
|
+
import{execSync as e}from"node:child_process";import{renameSync as o}from"node:fs";import{join as n}from"node:path";import{bundleIpa as p,createDir as t,ink as a,print as r}from"@moneko/utils";import l from"../../commom/timer.mjs";export function bundleApk(p,i,u="-release"){r(a("正在编译 apk...","yellow"),!0),l.start(`bundle apk ${u}`),e(`flutter build apk -${u}`),l.end(`bundle apk ${u}`),t(i),o(n(p,`build/app/outputs/flutter-apk/app${u}.apk`),i),r(`✨ ${a("Apk 编译","cyan")}: ${a("完成","cyan")}`,!0)}export function bundleIOS(i,u,d="-release"){r(a("正在编译 ipa...","yellow"),!0),l.start(`bundle ipa ${d}`);let m=n(u,"Runner/Payload");e(`flutter build ios -${d} --no-codesign`),t(m),o(n(i,"build/ios/iphoneos/Runner.app"),m),p(n(u,"Runner"),u,d),l.end(`bundle ipa ${d}`),r(`✨ ${a("ipa 编译","cyan")}: ${a("完成","cyan")}`,!0)}
|
package/lib/commom/log.d.mts
CHANGED
|
@@ -2,5 +2,5 @@ import { appendToFile } from '@moneko/utils';
|
|
|
2
2
|
declare const startDate: Date;
|
|
3
3
|
declare const startHrTime: [number, number];
|
|
4
4
|
declare function getCurrentTime(): string;
|
|
5
|
-
declare function log(message:
|
|
5
|
+
declare function log(message: Error | string): void;
|
|
6
6
|
export default log;
|
package/lib/commom/log.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import{appendToFile as t}from"@moneko/utils";let e=new Date,r=process.hrtime();export default function(
|
|
1
|
+
import{appendToFile as t}from"@moneko/utils";let e=new Date,r=process.hrtime();export default function(a){let n=function(){let t=process.hrtime(r),a=t[0],n=t[1],i=new Date(e.getTime()+1e3*a+Math.floor(n/1e6)),o=i.getFullYear(),g=String(i.getMonth()+1).padStart(2,"0"),$=String(i.getDate()).padStart(2,"0"),s=String(i.getHours()).padStart(2,"0"),S=String(i.getMinutes()).padStart(2,"0"),l=String(i.getSeconds()).padStart(2,"0"),p=String(Math.floor(n%1e6/1e3)).padStart(3,"0"),d=String(n%1e3).padStart(3,"0");return`${o}-${g}-${$} ${s}:${S}:${l}.${p}${d}`}(),i=(a instanceof Error?`${a.message}
|
|
2
|
+
${a.stack||""}`:String(a)).split("\n"),o=`[${n}] ${i[0]}`,g=" ".repeat(`[${n}] `.length),$=i.slice(1).map(t=>`${g}${t}`).join("\n"),s=`${o}${$?`
|
|
2
3
|
${$}`:""}
|
|
3
|
-
`;t(`logs/${
|
|
4
|
+
`;t(`logs/${n.substring(0,16)}.log`,s)}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { hrtime } from 'node:process';
|
|
2
|
+
import { ink, println } from '@moneko/utils';
|
|
3
|
+
interface Timer {
|
|
4
|
+
start(label: string): void;
|
|
5
|
+
end(label: string): {
|
|
6
|
+
nanoseconds: bigint;
|
|
7
|
+
milliseconds: number;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
declare const timers: Map<string, bigint>;
|
|
11
|
+
declare const timer: Timer;
|
|
12
|
+
export default timer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{hrtime as e}from"node:process";import{ink as t,println as r}from"@moneko/utils";let o=new Map;export default{start(t){o.set(t,e.bigint())},end(i){let l=o.get(i);if(!l)throw Error(`No timer found for label: ${i}`);let n=e.bigint()-l,m=Number(n)/1e6;return o.delete(i),r(`⚡ ${t(i,"cyan",{bold:!0})}: ${t(`${m} ms`,"90")}`,!0),{nanoseconds:n,milliseconds:m}}};
|
package/lib/index.d.mts
CHANGED
|
@@ -4,6 +4,7 @@ export { getIPv4, getPort } from './commom/net.mjs';
|
|
|
4
4
|
export { CUSTOMCONFIG, default as paths, routeDir, yarnArgv } from './commom/paths.mjs';
|
|
5
5
|
export { default as require } from './commom/require.mjs';
|
|
6
6
|
export { default as Rule } from './commom/rule.mjs';
|
|
7
|
+
export { default as timer } from './commom/timer.mjs';
|
|
7
8
|
export { type MockConfiguration, type ProxyFuncType, type RequestFormData, yApiMock, type YApiOption, type YApiOptionBySchema, yApiSchemaMock } from './dev/mock.mjs';
|
|
8
9
|
export type { ProxyConfig } from './dev/proxy.mjs';
|
|
9
10
|
export type { CssInJsMinifyOption } from './loader/css-in-js-minify.cjs';
|
package/lib/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as hasPkg}from"./commom/has-pkg.mjs";export{getIPv4,getPort}from"./commom/net.mjs";export{CUSTOMCONFIG,default as paths,routeDir,yarnArgv}from"./commom/paths.mjs";export{default as require}from"./commom/require.mjs";export{default as Rule}from"./commom/rule.mjs";export{yApiMock,yApiSchemaMock}from"./dev/mock.mjs";export{default as jsxDomExpressions}from"./options/jsx-dom-expressions.mjs";export{default as splitChunk}from"./options/split-chunk.mjs";export{APPTYPE,coreName,FRAMEWORK,isCI,isDev,isLibrary,isMicro,mainDirectory,packageJson,PACKAGENAME}from"./process-env.mjs";export{resolveProgram,toCamelCase}from"./utils/index.mjs";
|
|
1
|
+
export{default as hasPkg}from"./commom/has-pkg.mjs";export{getIPv4,getPort}from"./commom/net.mjs";export{CUSTOMCONFIG,default as paths,routeDir,yarnArgv}from"./commom/paths.mjs";export{default as require}from"./commom/require.mjs";export{default as Rule}from"./commom/rule.mjs";export{default as timer}from"./commom/timer.mjs";export{yApiMock,yApiSchemaMock}from"./dev/mock.mjs";export{default as jsxDomExpressions}from"./options/jsx-dom-expressions.mjs";export{default as splitChunk}from"./options/split-chunk.mjs";export{APPTYPE,coreName,FRAMEWORK,isCI,isDev,isLibrary,isMicro,mainDirectory,packageJson,PACKAGENAME}from"./process-env.mjs";export{resolveProgram,toCamelCase}from"./utils/index.mjs";
|