@baic/yolk-cli 2.1.0-alpha.272 → 2.1.0-alpha.274
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/es/_util.js +1 -1
- package/lib/_util.js +1 -1
- package/package.json +12 -12
- package/templates/umi-mobile/src/pages/demo/index.tsx +1 -1
- package/templates/umi-mobile-h5+app/src/pages/demo/index.tsx +1 -1
- package/templates/umi-mobile-native/src/common/bluetooth.ts +1 -1
- package/templates/umi-mobile-native/src/common/bridge.ts +1 -1
- package/templates/umi-mobile-native/src/pages/demo/examples/Xprinter/index.tsx +6 -5
- package/templates/umi-mobile-native/src/pages/demo/index.tsx +1 -1
- package/templates/umi-mobile-uni-app/src/pages/demo/index.tsx +1 -1
- package/templates/umi-web/src/pages/demo/index.tsx +1 -1
- package/templates/umi-web-screen/src/components/resize-container/index.tsx +1 -1
- package/templates/umi-web-screen/src/pages/template/controller/index.tsx +9 -9
package/es/_util.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{spawn as
|
|
1
|
+
import{spawn as o,spawnSync as r}from"node:child_process";import{existsSync as t,readFileSync as e}from"node:fs";import{join as n}from"node:path";import c from"chalk";import s from"exit-x";import{globSync as i}from"glob";import{rimrafSync as a,windowsSync as m}from"rimraf";import{program as p}from"../compiled/commander";export const cwd=process.cwd();const g=console;export const ENCODING="utf-8";export const warn=o=>o&&g.log(c.yellow("warn -"),o);export const error=o=>o&&g.log(c.red("error -"),c.red(o));export const ready=o=>o&&g.log(c.green("ready -"),o);export const info=o=>o&&g.log(c.blue("info -"),o);const l=()=>"win32"===process.platform;export const transformCommand=o=>l()?`${o}.cmd`:o;export const rimrafSync=o=>l()?m(o):a(o);export const breakExit=()=>{warn("yolk break!"),s(0)};export const spawnCommand=({command:r,args:t,complete:e,exit:n=!0,options:c})=>{const i=o(transformCommand(r),t||[],{stdio:"inherit",shell:!0,windowsHide:!0,...c}).on("close",o=>{o?s(o):(e?.(),n&&s(0))});process.on("SIGINT",()=>{p.exitOverride(),i.kill(),s(0)})};export const spawnSyncCommand=({command:o,args:t,complete:e,options:n})=>{try{const{status:c}=r(transformCommand(o),t||[],{stdio:"inherit",shell:!0,windowsHide:!0,...n});e?.(),c&&s(c)}catch(c){error(c?.message),s(1)}process.on("SIGINT",()=>{p.exitOverride(),s(0)})};export const getYolkConfig=()=>{const o=i("*.yolkrc*",{cwd:cwd,dot:!0});if(!o.length)return{};const r=n(cwd,o[0]);if(!t(r))return{};try{return JSON.parse(e(r,ENCODING))||{}}catch(error){return error(error.message||".yolkrc\u8f6c\u6362\u9519\u8bef"),{}}};export const getProjectConfigJSON=()=>{const o=n(cwd,"project.config.json");if(!t(o))return{};try{return JSON.parse(e(o,ENCODING))||{}}catch(error){return error(error.message||"project.config.json\u8f6c\u6362\u9519\u8bef"),{}}};export const getPackageJSON=()=>{const o=n(cwd,"package.json");if(!t(o))return{};try{return JSON.parse(e(o,ENCODING))||{}}catch(error){return error(error.message||"package.json\u8f6c\u6362\u9519\u8bef"),{}}};export const getConfigFilePath=o=>{const r=getYolkConfig();let e="";try{e=require.resolve(`@baic/${o}-config-yolk`)}catch(error){}const n=i(`*.${o}rc*`,{cwd:cwd,dot:!0}),c=n?.[0];return!1===r.strict&&c&&t(c)?c:t(e)?e:c};export const getEsLintConfigPath=()=>getConfigFilePath("eslint");export const getStyleLintConfigPath=()=>getConfigFilePath("stylelint");export const getPrettierConfigPath=()=>getConfigFilePath("prettier");export const getBiomeConfigPath=()=>getConfigFilePath("biome");
|
package/lib/_util.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.warn=exports.transformCommand=exports.spawnSyncCommand=exports.spawnCommand=exports.rimrafSync=exports.ready=exports.info=exports.getYolkConfig=exports.getStyleLintConfigPath=exports.getProjectConfigJSON=exports.getPrettierConfigPath=exports.getPackageJSON=exports.getEsLintConfigPath=exports.getConfigFilePath=exports.getBiomeConfigPath=exports.error=exports.cwd=exports.breakExit=exports.ENCODING=void 0;var t=require("node:child_process"),r=require("node:fs"),o=require("node:path"),s=e(require("chalk")),n=e(require("exit-x")),i=require("glob"),c=require("rimraf"),a=require("../compiled/commander");const p=exports.cwd=process.cwd(),l=console,
|
|
1
|
+
"use strict";var e=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.warn=exports.transformCommand=exports.spawnSyncCommand=exports.spawnCommand=exports.rimrafSync=exports.ready=exports.info=exports.getYolkConfig=exports.getStyleLintConfigPath=exports.getProjectConfigJSON=exports.getPrettierConfigPath=exports.getPackageJSON=exports.getEsLintConfigPath=exports.getConfigFilePath=exports.getBiomeConfigPath=exports.error=exports.cwd=exports.breakExit=exports.ENCODING=void 0;var t=require("node:child_process"),r=require("node:fs"),o=require("node:path"),s=e(require("chalk")),n=e(require("exit-x")),i=require("glob"),c=require("rimraf"),a=require("../compiled/commander");const p=exports.cwd=process.cwd(),l=console,d=exports.ENCODING="utf-8",g=e=>e&&l.log(s.default.yellow("warn -"),e);exports.warn=g;const x=e=>e&&l.log(s.default.red("error -"),s.default.red(e));exports.error=x;const f=e=>e&&l.log(s.default.green("ready -"),e);exports.ready=f;const u=e=>e&&l.log(s.default.blue("info -"),e);exports.info=u;const m=()=>"win32"===process.platform,y=e=>m()?`${e}.cmd`:e;exports.transformCommand=y;const S=e=>m()?(0,c.windowsSync)(e):(0,c.rimrafSync)(e);exports.rimrafSync=S;const h=()=>{g("yolk break!"),(0,n.default)(0)};exports.breakExit=h;const w=({command:e,args:r,complete:o,exit:s=!0,options:i})=>{const c=(0,t.spawn)(y(e),r||[],{stdio:"inherit",shell:!0,windowsHide:!0,...i}).on("close",e=>{e?(0,n.default)(e):(o?.(),s&&(0,n.default)(0))});process.on("SIGINT",()=>{a.program.exitOverride(),c.kill(),(0,n.default)(0)})};exports.spawnCommand=w;const C=({command:e,args:r,complete:o,options:s})=>{try{const{status:i}=(0,t.spawnSync)(y(e),r||[],{stdio:"inherit",shell:!0,windowsHide:!0,...s});o?.(),i&&(0,n.default)(i)}catch(i){x(i?.message),(0,n.default)(1)}process.on("SIGINT",()=>{a.program.exitOverride(),(0,n.default)(0)})};exports.spawnSyncCommand=C;const P=()=>{const e=(0,i.globSync)("*.yolkrc*",{cwd:p,dot:!0});if(!e.length)return{};const t=(0,o.join)(p,e[0]);if(!(0,r.existsSync)(t))return{};try{return JSON.parse((0,r.readFileSync)(t,d))||{}}catch(x){return x(x.message||".yolkrc\u8f6c\u6362\u9519\u8bef"),{}}};exports.getYolkConfig=P;const k=()=>{const e=(0,o.join)(p,"project.config.json");if(!(0,r.existsSync)(e))return{};try{return JSON.parse((0,r.readFileSync)(e,d))||{}}catch(x){return x(x.message||"project.config.json\u8f6c\u6362\u9519\u8bef"),{}}};exports.getProjectConfigJSON=k;const N=()=>{const e=(0,o.join)(p,"package.json");if(!(0,r.existsSync)(e))return{};try{return JSON.parse((0,r.readFileSync)(e,d))||{}}catch(x){return x(x.message||"package.json\u8f6c\u6362\u9519\u8bef"),{}}};exports.getPackageJSON=N;const b=e=>{const t=P();let o="";try{o=require.resolve(`@baic/${e}-config-yolk`)}catch(x){}const s=(0,i.globSync)(`*.${e}rc*`,{cwd:p,dot:!0}),n=s?.[0];return!1===t.strict&&n&&(0,r.existsSync)(n)?n:(0,r.existsSync)(o)?o:n};exports.getConfigFilePath=b;const j=()=>b("eslint");exports.getEsLintConfigPath=j;const O=()=>b("stylelint");exports.getStyleLintConfigPath=O;const q=()=>b("prettier");exports.getPrettierConfigPath=q;const v=()=>b("biome");exports.getBiomeConfigPath=v;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baic/yolk-cli",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.274",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/303394539/yolk.git"
|
|
@@ -25,22 +25,21 @@
|
|
|
25
25
|
"prebundle": "father prebundle"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@baic/biome-config-yolk": "2.1.0-alpha.
|
|
29
|
-
"@baic/eslint-config-yolk": "2.1.0-alpha.
|
|
30
|
-
"@baic/prettier-config-yolk": "2.1.0-alpha.
|
|
31
|
-
"@baic/stylelint-config-yolk": "2.1.0-alpha.
|
|
32
|
-
"@baic/yolk-test": "2.1.0-alpha.
|
|
33
|
-
"@democrance/imagemin-lint-staged": "5.
|
|
34
|
-
"@types/lodash": "4.x",
|
|
28
|
+
"@baic/biome-config-yolk": "2.1.0-alpha.274",
|
|
29
|
+
"@baic/eslint-config-yolk": "2.1.0-alpha.274",
|
|
30
|
+
"@baic/prettier-config-yolk": "2.1.0-alpha.274",
|
|
31
|
+
"@baic/stylelint-config-yolk": "2.1.0-alpha.274",
|
|
32
|
+
"@baic/yolk-test": "2.1.0-alpha.274",
|
|
33
|
+
"@democrance/imagemin-lint-staged": "5.1.x",
|
|
35
34
|
"chalk": "4.x",
|
|
36
35
|
"eslint": "8.x",
|
|
37
36
|
"exit-x": "0.2.x",
|
|
38
37
|
"glob": "10.4.x",
|
|
39
38
|
"husky": "9.1.x",
|
|
40
39
|
"inquirer": "8.x",
|
|
41
|
-
"lint-staged": "16.
|
|
40
|
+
"lint-staged": "16.2.x",
|
|
42
41
|
"lodash": "4.x",
|
|
43
|
-
"miniprogram-ci": "2.1.
|
|
42
|
+
"miniprogram-ci": "2.1.26",
|
|
44
43
|
"mkdirp": "3.0.x",
|
|
45
44
|
"postcss": "8.5.x",
|
|
46
45
|
"postcss-less": "6.0.x",
|
|
@@ -54,11 +53,12 @@
|
|
|
54
53
|
"@types/inquirer": "8.x",
|
|
55
54
|
"@types/js-yaml": "4.x",
|
|
56
55
|
"@types/lint-staged": "14.x",
|
|
56
|
+
"@types/lodash": "4.x",
|
|
57
57
|
"@types/mustache": "4.x",
|
|
58
58
|
"commander": "12.1.x",
|
|
59
59
|
"js-yaml": "4.1.x",
|
|
60
60
|
"mustache": "4.2.x",
|
|
61
|
-
"type-fest": "
|
|
61
|
+
"type-fest": "5.1.x"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=18"
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "a4ce2f0237b8cb1801f1c7cdbad2a292b5771609"
|
|
70
70
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { useCallback, useState } from 'react';
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { Toast } from 'antd-mobile';
|
|
4
4
|
|
|
5
|
-
import { useMount } from 'ahooks';
|
|
6
|
-
|
|
7
5
|
import type { BondedDevice } from '@/common/Xprinter';
|
|
8
6
|
|
|
9
7
|
import Xprinter from '@/common/Xprinter';
|
|
@@ -39,9 +37,12 @@ export default () => {
|
|
|
39
37
|
},
|
|
40
38
|
[],
|
|
41
39
|
);
|
|
42
|
-
|
|
40
|
+
const initBondList = useCallback(async () => {
|
|
43
41
|
setBondList((await Xprinter.getBondedDevices()) || []);
|
|
44
|
-
});
|
|
42
|
+
}, []);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
initBondList();
|
|
45
|
+
}, []);
|
|
45
46
|
return (
|
|
46
47
|
<>
|
|
47
48
|
<div className={style.title}>蓝牙设备</div>
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { PropsWithChildren } from 'react';
|
|
2
|
-
import { createContext, useCallback, useEffect,useRef, useState } from 'react';
|
|
3
|
-
|
|
4
|
-
import { useMount, useUnmount } from 'ahooks';
|
|
2
|
+
import { createContext, useCallback, useEffect, useRef, useState } from 'react';
|
|
5
3
|
|
|
6
4
|
import useSize from '@/hooks/use-size';
|
|
7
5
|
|
|
@@ -54,12 +52,14 @@ const Component = ({ children }: Props) => {
|
|
|
54
52
|
},
|
|
55
53
|
});
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
initDataHandler();
|
|
57
|
+
return () => {
|
|
58
|
+
if (timeoutID.current) {
|
|
59
|
+
clearTimeout(timeoutID.current);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}, []);
|
|
63
63
|
|
|
64
64
|
useEffect(() => {
|
|
65
65
|
setLayout({
|