@moneko/core 3.26.9 → 3.26.10
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/build-app.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
import { argv } from 'node:process';
|
|
5
5
|
import { buildPlist, buildXml, createDir, ink, jsonToYaml, loadFileSync, parsePlist, parseXml, parseYaml, print, println, removeDir, saveFile, saveFileSync } from '@moneko/utils';
|
|
6
6
|
import { bundleApk, bundleIOS } from './utils/bundle-app.mjs';
|
|
7
|
-
import {
|
|
7
|
+
import { cwd } from './utils/config.mjs';
|
|
8
8
|
import { __dirname } from './file.mjs';
|
|
9
9
|
export declare function copyFileSync(source: string, target: string);
|
|
10
10
|
export declare function copyFolderRecursiveSync(source: string, target: string, sun?: boolean);
|
package/lib/bin/build-app.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{execSync as e}from"node:child_process";import{existsSync as i,readdirSync as n,statSync as o}from"node:fs";import s from"node:path";import{argv as r}from"node:process";import{buildPlist as t,buildXml as l,createDir as a,ink as c,jsonToYaml as d,loadFileSync as p,parsePlist as m,parseXml as u,parseYaml as f,print as y,println as S,removeDir as $,saveFile as b,saveFileSync as j}from"@moneko/utils";import{bundleApk as _,bundleIOS as g}from"./utils/bundle-app.mjs";import{
|
|
1
|
+
import{execSync as e}from"node:child_process";import{existsSync as i,readdirSync as n,statSync as o}from"node:fs";import s from"node:path";import{argv as r}from"node:process";import{buildPlist as t,buildXml as l,createDir as a,ink as c,jsonToYaml as d,loadFileSync as p,parsePlist as m,parseXml as u,parseYaml as f,print as y,println as S,removeDir as $,saveFile as b,saveFileSync as j}from"@moneko/utils";import{bundleApk as _,bundleIOS as g}from"./utils/bundle-app.mjs";import{cwd as w}from"./utils/config.mjs";import{__dirname as k}from"./file.mjs";export function copyFileSync(e,i){let n=p(e);if(null!==n){let r=i;o(i).isDirectory()&&(r=s.join(i,s.basename(e))),j(r,n)}}export function copyFolderRecursiveSync(e,i,r){let t=i;r&&(t=s.join(i,s.basename(e))),o(e).isDirectory()&&n(e).forEach(function(i){let n=s.join(e,i);o(n).isDirectory()?copyFolderRecursiveSync(n,t,!0):copyFileSync(n,t)})}export default async function O(){r.slice(3).forEach(e=>{let[i,n]=e.replace(/^--/,"").split("=");process.env[`__args__${i}__`]=n});let{CONFIG:j}=await import("../config.mjs"),O=j.bundleId;O||(S(c("请配置 bundleId","red")),process.exit(1)),/(^com\.)([a-zA-Z_][a-zA-Z0-9_]*[.])*([a-zA-Z_][a-zA-Z0-9_]*)$/.test(O)&&3===O.split(".").length||(S(c("软件包名不合法","red")),process.exit(1));let A=j.bundles;A&&0!==A.length||(S(c("请配置 bundles (打包类型)","red")),process.exit(1));let N=O.split(".").splice(-1,1).join(""),x=s.join(w,"/dist"),h=`flutter create -t app --org ${O} -i swift -a kotlin ${N}`,E=s.join(w,`/${N}`),R=s.join(E,"assets/web/");e(h,{encoding:"utf-8"}),a(R),y(c("正在注册资产...","yellow"),!0),copyFolderRecursiveSync(x,R);let T=s.join(E,"pubspec.yaml"),V=JSON.parse(await f(T)||"{}"),v=[],I=(e,i="assets/web")=>{let s=n(e);!function n(r){r!=s.length&&(o(`${e}/${s[r]}`).isDirectory()&&(v.push(`${i}/${s[r]}/`),I(`${e}/${s[r]}`,`${i}/${s[r]}`)),n(r+1))}(0)};if(I(x),V.dependencies.webview_flutter_plus="^0.2.3",V.flutter.assets=["assets/web/",...v],b(T,await d(JSON.stringify(V))),y(`${c("注册资产","cyan")}: ${c("完成","cyan")}`,!0),A.includes("apk -release")||A.includes("apk -debug")){y(c("正在配置安卓权限...","yellow"),!0);let e=s.join(E,"android/app/src/main/AndroidManifest.xml"),i=JSON.parse(u(e));i.manifest.application.$["android:usesCleartextTraffic"]="true",i.manifest["uses-permission"]=[{$:{"android:name":"android.permission.INTERNET"}},{$:{"android:name":"android.permission.ACCESS_NETWORK_STATE"}},{$:{"android:name":"android.permission.WAKE_LOCK"}}],b(e,l(JSON.stringify(i)));let n=s.join(E,"android/app/build.gradle"),o=p(n)||"",r="minSdkVersion flutter.minSdkVersion";if(o?.includes(r))o=o.replace(r,"minSdkVersion 20");else{let e=o.indexOf("minSdkVersion "),i=o.substring(e,e+16);o=o.replace(i,"minSdkVersion 20")}let t="compileSdkVersion flutter.compileSdkVersion";o.includes(t)&&(o=o.replace(t,"compileSdkVersion 32")),b(n,o),y(`${c("安卓权限配置","cyan")}: ${c("完成","cyan")}`,!0)}if(A.includes("ios -release")||A.includes("ios -debug")){y(c("开始配置IOS权限","yellow"),!0);let e=s.join(E,"ios/Runner/Info.plist"),i=Object.assign(JSON.parse(await m(e)),{NSAppTransportSecurity:{NSAllowsArbitraryLoads:!0},"io.flutter.embedded_views_preview":!0});b(e,await t(JSON.stringify(i))),y(`${c("IOS权限配置","cyan")}: ${c("完成","cyan")}`,!0)}b(s.join(E,"lib/main.dart"),p(s.join(k,"./conf/bootstrap"))||"");let J=s.join(w,"./bundle/");a(J),setTimeout(()=>{A.forEach(e=>{let i=e.split(" ");"apk"===i[0]&&_(E,J,i[1]),"ios"===i[0]&&g(E,J,i[1])}),$(E),i(s.join(J,"Runner"))&&$(s.join(J,"Runner")),y(`✨ ${c("Done","green")}`,!0),process.exit(0)},1e3)}
|
package/lib/bin/lessc.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { exec } from 'node:child_process';
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { loadFile, saveFile, scanFolderSync } from '@moneko/utils';
|
|
4
4
|
import require from '../commom/require.mjs';
|
|
5
|
-
import {
|
|
5
|
+
import { runtimePath } from './utils/config.mjs';
|
|
6
6
|
declare let modifyVarBash: string;
|
|
7
7
|
declare function lessc(file: string);
|
|
8
8
|
declare const lessRegExp: RegExp;
|
package/lib/bin/lessc.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{exec as e}from"node:child_process";import{join as o}from"node:path";import{loadFile as s,saveFile as t,scanFolderSync as
|
|
1
|
+
import{exec as e}from"node:child_process";import{join as o}from"node:path";import{loadFile as s,saveFile as t,scanFolderSync as r}from"@moneko/utils";import i from"../commom/require.mjs";import{runtimePath as l}from"./utils/config.mjs";let m="";function n(s){let t=o(i.resolve("less"),"../bin/lessc");return new Promise((o,r)=>{e(`${l} ${t} --js ${m} ${s} > ${s.replace(/\.less$/g,".css")}`,function(e){if(e)return r(e);o(!0)})})}let a=/\*?\.less/g;async function c(e){let o=await s(e);o&&a.test(o)&&await t(e,o.replace(a,".css"))}export async function lesscCommonjs(){let e=r("lib",["\\.less$"]),o=(await import("../options/modify-vars.mjs")).default;for(let e in o)Object.hasOwnProperty.call(o,e)&&(m+=`--modify-var="${e}=${o[e]}" `);Promise.all(e.map(n)),e.length&&Promise.all(r("lib",["\\.js$"]).map(c))}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { CONFIG } from '../config.mjs';
|
|
2
2
|
import htmlPluginOption from './html-plugin-option.mjs';
|
|
3
3
|
declare const prefixCls: string;
|
|
4
|
-
declare const modifyVars:
|
|
5
|
-
readonly '@prefix-cls';
|
|
6
|
-
readonly '@ant-prefix';
|
|
7
|
-
readonly '@iconfont-css-prefix';
|
|
8
|
-
readonly '@favicon';
|
|
9
|
-
};
|
|
4
|
+
declare const modifyVars: Record<string, string | false | undefined>;
|
|
10
5
|
export default modifyVars;
|