@baic/yolk-cli 2.1.0-alpha.132 → 2.1.0-alpha.133
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/compiled/commander/package.json +1 -1
- package/compiled/glob/index.d.ts +102 -0
- package/compiled/glob/index.js +2222 -0
- package/compiled/glob/package.json +1 -0
- package/compiled/minimatch/index.d.ts +312 -0
- package/compiled/minimatch/index.js +1292 -0
- package/compiled/minimatch/package.json +1 -0
- package/compiled/mkdirp/index.d.ts +114 -0
- package/compiled/mkdirp/index.js +348 -0
- package/compiled/mkdirp/package.json +1 -0
- package/compiled/mustache/package.json +1 -1
- package/compiled/prettier/index.js +3 -3
- package/compiled/prettier/package.json +1 -1
- package/compiled/rimraf/index.d.ts +48 -0
- package/compiled/rimraf/index.js +449 -0
- package/compiled/rimraf/package.json +1 -0
- package/compiled/staged-git-files/package.json +1 -1
- package/es/yolk.js +1 -1
- package/lib/yolk.js +1 -1
- package/package.json +12 -10
- package/templates/miniprogram/project.config.json.tpl +1 -1
- package/templates/umi-mobile/src/pages/demo/index.tsx +3 -3
- package/templates/umi-mobile-h5+app/src/pages/demo/index.tsx +3 -3
- package/templates/umi-mobile-native/android/app/build.gradle +4 -19
- package/templates/umi-mobile-native/android/app/libs/Bluetooth-release.aar +0 -0
- package/templates/umi-mobile-native/android/gradle.properties +1 -1
- package/templates/umi-mobile-native/src/common/bluetooth.ts +6 -6
- package/templates/umi-mobile-native/src/common/bridge.ts +6 -6
- package/templates/umi-mobile-native/src/pages/demo/index.tsx +3 -3
- package/templates/umi-web/src/pages/demo/index.tsx +3 -3
- package/templates/umi-web-screen/src/components/resize-container/index.tsx +5 -5
- package/es/.lintstagedrc.js +0 -27
- package/es/index.d.ts +0 -3
- package/es/util.d.ts +0 -18
- package/es/util.js +0 -1
- package/es/yolk.d.ts +0 -2
- package/lib/.lintstagedrc.js +0 -27
- package/lib/index.d.ts +0 -3
- package/lib/util.d.ts +0 -18
- package/lib/util.js +0 -1
- package/lib/yolk.d.ts +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _ from 'lodash';
|
|
2
2
|
|
|
3
3
|
import type { FunctionComponent } from 'react';
|
|
4
4
|
import { createElement } from 'react';
|
|
@@ -56,14 +56,14 @@ export default () => {
|
|
|
56
56
|
<Tabs defaultActiveKey={keys[0]}>
|
|
57
57
|
{keys.map((key) => {
|
|
58
58
|
const tab = tabs[key];
|
|
59
|
-
if (isFunction(tab)) {
|
|
59
|
+
if (_.isFunction(tab)) {
|
|
60
60
|
return (
|
|
61
61
|
<Tab key={key} title={key}>
|
|
62
62
|
{createElement(tab)}
|
|
63
63
|
</Tab>
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
|
-
if (isObject(tab)) {
|
|
66
|
+
if (_.isObject(tab)) {
|
|
67
67
|
const keys2 = Object.keys(tab);
|
|
68
68
|
return (
|
|
69
69
|
<Tab key={key} title={key}>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import _ from 'lodash';
|
|
4
4
|
|
|
5
5
|
import { Tabs, Collapse } from 'antd-mobile';
|
|
6
6
|
|
|
@@ -55,14 +55,14 @@ export default () => {
|
|
|
55
55
|
<Tabs defaultActiveKey={keys[0]}>
|
|
56
56
|
{keys.map((key) => {
|
|
57
57
|
const tab = tabs[key];
|
|
58
|
-
if (isFunction(tab)) {
|
|
58
|
+
if (_.isFunction(tab)) {
|
|
59
59
|
return (
|
|
60
60
|
<Tab key={key} title={key}>
|
|
61
61
|
{React.createElement(tab)}
|
|
62
62
|
</Tab>
|
|
63
63
|
);
|
|
64
64
|
}
|
|
65
|
-
if (isObject(tab)) {
|
|
65
|
+
if (_.isObject(tab)) {
|
|
66
66
|
const keys2 = Object.keys(tab);
|
|
67
67
|
return (
|
|
68
68
|
<Tab key={key} title={key}>
|
|
@@ -7,13 +7,13 @@ android {
|
|
|
7
7
|
|
|
8
8
|
defaultConfig {
|
|
9
9
|
applicationId "plus.H5ECA1DEE"
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
minSdk 21
|
|
11
|
+
targetSdk 25
|
|
12
12
|
versionCode 100
|
|
13
13
|
versionName '1.0.0'
|
|
14
14
|
multiDexEnabled true
|
|
15
15
|
ndk {
|
|
16
|
-
abiFilters '
|
|
16
|
+
abiFilters 'armeabi-v7a'
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -51,31 +51,16 @@ android {
|
|
|
51
51
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
52
52
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
packagingOptions {
|
|
56
|
-
exclude 'resources.arsc'
|
|
57
|
-
exclude 'AndroidManifest.xml'
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
aaptOptions {
|
|
61
|
-
additionalParameters '--auto-add-overlay'
|
|
62
|
-
ignoreAssetsPattern "!.svn:!.git:.*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~"
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
lint {
|
|
66
|
-
checkReleaseBuilds false
|
|
67
|
-
}
|
|
68
54
|
}
|
|
69
55
|
|
|
70
56
|
dependencies {
|
|
71
57
|
// base
|
|
72
58
|
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
|
|
73
|
-
implementation 'androidx.appcompat:appcompat:1.
|
|
59
|
+
implementation 'androidx.appcompat:appcompat:1.3.0'
|
|
74
60
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
|
75
61
|
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
|
76
62
|
implementation 'com.facebook.fresco:fresco:2.6.0'
|
|
77
63
|
implementation 'com.facebook.fresco:animated-gif:2.6.0'
|
|
78
64
|
implementation 'com.github.bumptech.glide:glide:4.13.1'
|
|
79
65
|
implementation 'com.alibaba:fastjson:1.1.46.android'
|
|
80
|
-
implementation 'androidx.webkit:webkit:1.4.0'
|
|
81
66
|
}
|
|
Binary file
|
|
@@ -15,8 +15,8 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
|
|
15
15
|
# Android operating system, and which are packaged with your app"s APK
|
|
16
16
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
|
17
17
|
android.useAndroidX=true
|
|
18
|
-
android.enableJetifier=true
|
|
19
18
|
# Enables namespacing of each library's R class so that its R class includes only the
|
|
20
19
|
# resources declared in the library itself and none from the library's dependencies,
|
|
21
20
|
# thereby reducing the size of the R class for that library
|
|
22
21
|
android.nonTransitiveRClass=true
|
|
22
|
+
android.useNewApkCreator=false
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _ from 'lodash';
|
|
2
2
|
|
|
3
3
|
import { Toast } from 'antd-mobile';
|
|
4
4
|
|
|
@@ -112,7 +112,7 @@ class Bluetooth {
|
|
|
112
112
|
content: '蓝牙设备断开',
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
|
-
if (isFunction(e)) {
|
|
115
|
+
if (_.isFunction(e)) {
|
|
116
116
|
e({ connected, deviceId });
|
|
117
117
|
}
|
|
118
118
|
});
|
|
@@ -123,7 +123,7 @@ class Bluetooth {
|
|
|
123
123
|
) {
|
|
124
124
|
const { bluetooth } = window.plus || {};
|
|
125
125
|
bluetooth.onBluetoothDeviceFound(({ devices = [] }) => {
|
|
126
|
-
this.devices = unionBy(
|
|
126
|
+
this.devices = _.unionBy(
|
|
127
127
|
this.devices.concat(
|
|
128
128
|
devices.filter(
|
|
129
129
|
({ name }: plus.Bluetooth.BluetoothDeviceInfo) =>
|
|
@@ -132,7 +132,7 @@ class Bluetooth {
|
|
|
132
132
|
),
|
|
133
133
|
'deviceId',
|
|
134
134
|
);
|
|
135
|
-
if (isFunction(e)) {
|
|
135
|
+
if (_.isFunction(e)) {
|
|
136
136
|
e({ devices: this.devices });
|
|
137
137
|
}
|
|
138
138
|
});
|
|
@@ -142,7 +142,7 @@ class Bluetooth {
|
|
|
142
142
|
const { bluetooth } = window.plus || {};
|
|
143
143
|
const { notifyInterval = 200 } = this.options;
|
|
144
144
|
bluetooth.onBLECharacteristicValueChange(({ value }) => {
|
|
145
|
-
if (isFunction(onChange)) {
|
|
145
|
+
if (_.isFunction(onChange)) {
|
|
146
146
|
if (notifyInterval > 0) {
|
|
147
147
|
if (!this.isNotifyInterval) {
|
|
148
148
|
onChange(value);
|
|
@@ -222,7 +222,7 @@ class Bluetooth {
|
|
|
222
222
|
deviceId,
|
|
223
223
|
serviceId,
|
|
224
224
|
characteristicId,
|
|
225
|
-
value: isFunction(onWriteValue) ? onWriteValue() : new ArrayBuffer(0),
|
|
225
|
+
value: _.isFunction(onWriteValue) ? onWriteValue() : new ArrayBuffer(0),
|
|
226
226
|
});
|
|
227
227
|
if (writeInterval > 0) {
|
|
228
228
|
this.writeTimeoutId = setTimeout(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _ from 'lodash';
|
|
2
2
|
|
|
3
3
|
type Result<T = object> = {
|
|
4
4
|
code: number;
|
|
@@ -17,24 +17,24 @@ const bridge = {
|
|
|
17
17
|
) {
|
|
18
18
|
return new Promise<T | undefined>((resolve, reject) => {
|
|
19
19
|
const successCallback = (event: Result<T>) => {
|
|
20
|
-
if (isFunction(complete)) {
|
|
20
|
+
if (_.isFunction(complete)) {
|
|
21
21
|
complete(event);
|
|
22
22
|
}
|
|
23
23
|
if (event) {
|
|
24
24
|
const { code, data } = event;
|
|
25
25
|
if (0 === code) {
|
|
26
|
-
if (isFunction(success)) {
|
|
26
|
+
if (_.isFunction(success)) {
|
|
27
27
|
success(data);
|
|
28
28
|
}
|
|
29
29
|
resolve(data);
|
|
30
30
|
} else {
|
|
31
|
-
if (isFunction(fail)) {
|
|
31
|
+
if (_.isFunction(fail)) {
|
|
32
32
|
fail(event);
|
|
33
33
|
}
|
|
34
34
|
reject(event);
|
|
35
35
|
}
|
|
36
36
|
} else {
|
|
37
|
-
if (isFunction(fail)) {
|
|
37
|
+
if (_.isFunction(fail)) {
|
|
38
38
|
fail({
|
|
39
39
|
code: -1,
|
|
40
40
|
});
|
|
@@ -45,7 +45,7 @@ const bridge = {
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
const failCallback = (event?: Result<T>) => {
|
|
48
|
-
if (isFunction(fail)) {
|
|
48
|
+
if (_.isFunction(fail)) {
|
|
49
49
|
fail(event);
|
|
50
50
|
}
|
|
51
51
|
reject(event);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import _ from 'lodash';
|
|
4
4
|
|
|
5
5
|
import { Tabs, Collapse } from 'antd-mobile';
|
|
6
6
|
|
|
@@ -57,14 +57,14 @@ export default () => {
|
|
|
57
57
|
<Tabs defaultActiveKey={keys[0]}>
|
|
58
58
|
{keys.map((key) => {
|
|
59
59
|
const tab = tabs[key];
|
|
60
|
-
if (isFunction(tab)) {
|
|
60
|
+
if (_.isFunction(tab)) {
|
|
61
61
|
return (
|
|
62
62
|
<Tab key={key} title={key}>
|
|
63
63
|
{React.createElement(tab)}
|
|
64
64
|
</Tab>
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
|
-
if (isObject(tab)) {
|
|
67
|
+
if (_.isObject(tab)) {
|
|
68
68
|
const keys2 = Object.keys(tab);
|
|
69
69
|
return (
|
|
70
70
|
<Tab key={key} title={key}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _ from 'lodash';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
|
|
@@ -105,14 +105,14 @@ export default () => {
|
|
|
105
105
|
<Tabs defaultActiveKey={keys[0]}>
|
|
106
106
|
{keys.map((key) => {
|
|
107
107
|
const tab = tabs[key];
|
|
108
|
-
if (isFunction(tab)) {
|
|
108
|
+
if (_.isFunction(tab)) {
|
|
109
109
|
return (
|
|
110
110
|
<TabPane key={key} tab={key}>
|
|
111
111
|
{React.createElement(tab)}
|
|
112
112
|
</TabPane>
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
|
-
if (isObject(tab)) {
|
|
115
|
+
if (_.isObject(tab)) {
|
|
116
116
|
const keys2 = Object.keys(tab);
|
|
117
117
|
return (
|
|
118
118
|
<TabPane key={key} tab={key}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _ from 'lodash';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
|
|
4
4
|
import type { ReactNode, RefObject } from 'react';
|
|
@@ -38,7 +38,7 @@ const Component = forwardRef<ContainerInstance, ResizeContainerProps>(
|
|
|
38
38
|
) => {
|
|
39
39
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
40
40
|
const { width = 0, height = 0 } = useSize(
|
|
41
|
-
isFunction(getContainer)
|
|
41
|
+
_.isFunction(getContainer)
|
|
42
42
|
? getContainer()
|
|
43
43
|
: () => containerRef.current?.parentElement || null,
|
|
44
44
|
) || { width: 0, height: 0 };
|
|
@@ -50,7 +50,7 @@ const Component = forwardRef<ContainerInstance, ResizeContainerProps>(
|
|
|
50
50
|
container: containerRef.current,
|
|
51
51
|
};
|
|
52
52
|
if (containerRef.current) {
|
|
53
|
-
const $zoom = isNumber(containerParentElementZoom)
|
|
53
|
+
const $zoom = _.isNumber(containerParentElementZoom)
|
|
54
54
|
? containerParentElementZoom
|
|
55
55
|
: containerParentElementZoom
|
|
56
56
|
? Number(document.body.getAttribute('data-zoom') || 1)
|
|
@@ -68,7 +68,7 @@ const Component = forwardRef<ContainerInstance, ResizeContainerProps>(
|
|
|
68
68
|
containerRef.current.style.zoom = 1 / $zoom;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
if (isFunction(onResize)) {
|
|
71
|
+
if (_.isFunction(onResize)) {
|
|
72
72
|
onResize(res);
|
|
73
73
|
}
|
|
74
74
|
return res;
|
|
@@ -79,7 +79,7 @@ const Component = forwardRef<ContainerInstance, ResizeContainerProps>(
|
|
|
79
79
|
if (0 === containerWidth || 0 === containerHeight) {
|
|
80
80
|
return null;
|
|
81
81
|
}
|
|
82
|
-
return isFunction(children) ? children(instance) : children;
|
|
82
|
+
return _.isFunction(children) ? children(instance) : children;
|
|
83
83
|
}, [children, instance]);
|
|
84
84
|
return (
|
|
85
85
|
<div
|
package/es/.lintstagedrc.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const {
|
|
2
|
-
getYolkConfig,
|
|
3
|
-
getEsLintConfigPath,
|
|
4
|
-
getStyleLintConfigPath,
|
|
5
|
-
} = require('./util');
|
|
6
|
-
|
|
7
|
-
const yolkConfig = getYolkConfig();
|
|
8
|
-
const isStrict = yolkConfig.strict !== false;
|
|
9
|
-
|
|
10
|
-
const prettierCLI = 'prettier --write';
|
|
11
|
-
const eslintCLI = `eslint --fix ${
|
|
12
|
-
isStrict ? '--no-inline-config --no-ignore' : ''
|
|
13
|
-
} --no-error-on-unmatched-pattern --config ${getEsLintConfigPath()}`;
|
|
14
|
-
const stylelintCLI = `stylelint --fix ${
|
|
15
|
-
isStrict ? '--ignore-disables' : ''
|
|
16
|
-
} '--allow-empty-input' --config ${getStyleLintConfigPath()}`;
|
|
17
|
-
|
|
18
|
-
module.exports = {
|
|
19
|
-
'*.{md,json}': [prettierCLI],
|
|
20
|
-
'*.less': [prettierCLI, `${stylelintCLI} --custom-syntax postcss-less`],
|
|
21
|
-
'*.{sass,scss}': [
|
|
22
|
-
prettierCLI,
|
|
23
|
-
`${stylelintCLI} --custom-syntax postcss-scss`,
|
|
24
|
-
],
|
|
25
|
-
'*.{js,jsx}': [prettierCLI, eslintCLI],
|
|
26
|
-
'*.{ts,tsx}': [`${prettierCLI} --parser=typescript`, eslintCLI],
|
|
27
|
-
};
|
package/es/index.d.ts
DELETED
package/es/util.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import ora from 'ora';
|
|
2
|
-
export declare type YolkConfig = {
|
|
3
|
-
strict?: boolean;
|
|
4
|
-
eslintIgnore?: string | string[] | RegExp | RegExp[];
|
|
5
|
-
stylelintIgnore?: string | string[] | RegExp | RegExp[];
|
|
6
|
-
lintStaged?: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare const ENCODING = "utf-8";
|
|
9
|
-
export declare const warn: (text?: string) => "" | ora.Ora | undefined;
|
|
10
|
-
export declare const fail: (text?: string) => "" | ora.Ora | undefined;
|
|
11
|
-
export declare const succeed: (text?: string) => "" | ora.Ora | undefined;
|
|
12
|
-
export declare const info: (text?: string) => "" | ora.Ora | undefined;
|
|
13
|
-
export declare const getYolkConfig: () => YolkConfig;
|
|
14
|
-
export declare const getPrettierConfig: () => any;
|
|
15
|
-
export declare const getProjectConfigJSON: () => any;
|
|
16
|
-
export declare const getPackageJSON: () => any;
|
|
17
|
-
export declare const getEsLintConfigPath: () => string;
|
|
18
|
-
export declare const getStyleLintConfigPath: () => string;
|
package/es/util.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import r from"fs";import t from"path";import{globSync as e}from"glob";import n from"ora";var o=process.cwd();export var ENCODING="utf-8";var i=n();export var warn=function(r){return r&&i.warn(Buffer.from(r,ENCODING).toString())};export var fail=function(r){return r&&i.fail(Buffer.from(r,ENCODING).toString())};export var succeed=function(r){return r&&i.succeed(Buffer.from(r,ENCODING).toString())};export var info=function(r){return r&&i.info(Buffer.from(r,ENCODING).toString())};export var getYolkConfig=function(){var n=e("*.yolkrc*",{cwd:o,dot:!0});if(!n.length)return{};var i=t.join(o,n[0]);if(!r.existsSync(i))return{};try{return JSON.parse(r.readFileSync(i,ENCODING))||{}}catch(c){return fail(c.message||".yolkrc\u8f6c\u6362\u9519\u8bef"),{}}};export var getPrettierConfig=function(){var e=t.join(o,".prettierrc");if(r.existsSync(e))try{return JSON.parse(r.readFileSync(e,ENCODING))||{}}catch(n){return fail(n.message||".prettierrc\u8f6c\u6362\u9519\u8bef"),{}}return require("./.prettierrc")};export var getProjectConfigJSON=function(){var e=t.join(o,"project.config.json");if(!r.existsSync(e))return{};try{return JSON.parse(r.readFileSync(e,ENCODING))||{}}catch(n){return fail(n.message||"project.config.json\u8f6c\u6362\u9519\u8bef"),{}}};export var getPackageJSON=function(){var e=t.join(o,"package.json");if(!r.existsSync(e))return{};try{return JSON.parse(r.readFileSync(e,ENCODING))||{}}catch(n){return fail(n.message||"package.json\u8f6c\u6362\u9519\u8bef"),{}}};export var getEsLintConfigPath=function(){var t=getYolkConfig(),n="";try{n=require.resolve("@baic/eslint-config-yolk")}catch(a){}var i=e("*.eslintrc*",{cwd:o,dot:!0}),c=i[0];return!1===t.strict&&c&&r.existsSync(c)?c:r.existsSync(n)?n:c};export var getStyleLintConfigPath=function(){var t=getYolkConfig(),n="";try{n=require.resolve("@baic/stylelint-config-yolk")}catch(a){}var i=e("*.stylelintrc*",{cwd:o,dot:!0}),c=i[0];return!1===t.strict&&c&&r.existsSync(c)?c:r.existsSync(n)?n:c};
|
package/es/yolk.d.ts
DELETED
package/lib/.lintstagedrc.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const {
|
|
2
|
-
getYolkConfig,
|
|
3
|
-
getEsLintConfigPath,
|
|
4
|
-
getStyleLintConfigPath,
|
|
5
|
-
} = require('./util');
|
|
6
|
-
|
|
7
|
-
const yolkConfig = getYolkConfig();
|
|
8
|
-
const isStrict = yolkConfig.strict !== false;
|
|
9
|
-
|
|
10
|
-
const prettierCLI = 'prettier --write';
|
|
11
|
-
const eslintCLI = `eslint --fix ${
|
|
12
|
-
isStrict ? '--no-inline-config --no-ignore' : ''
|
|
13
|
-
} --no-error-on-unmatched-pattern --config ${getEsLintConfigPath()}`;
|
|
14
|
-
const stylelintCLI = `stylelint --fix ${
|
|
15
|
-
isStrict ? '--ignore-disables' : ''
|
|
16
|
-
} '--allow-empty-input' --config ${getStyleLintConfigPath()}`;
|
|
17
|
-
|
|
18
|
-
module.exports = {
|
|
19
|
-
'*.{md,json}': [prettierCLI],
|
|
20
|
-
'*.less': [prettierCLI, `${stylelintCLI} --custom-syntax postcss-less`],
|
|
21
|
-
'*.{sass,scss}': [
|
|
22
|
-
prettierCLI,
|
|
23
|
-
`${stylelintCLI} --custom-syntax postcss-scss`,
|
|
24
|
-
],
|
|
25
|
-
'*.{js,jsx}': [prettierCLI, eslintCLI],
|
|
26
|
-
'*.{ts,tsx}': [`${prettierCLI} --parser=typescript`, eslintCLI],
|
|
27
|
-
};
|
package/lib/index.d.ts
DELETED
package/lib/util.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import ora from 'ora';
|
|
2
|
-
export declare type YolkConfig = {
|
|
3
|
-
strict?: boolean;
|
|
4
|
-
eslintIgnore?: string | string[] | RegExp | RegExp[];
|
|
5
|
-
stylelintIgnore?: string | string[] | RegExp | RegExp[];
|
|
6
|
-
lintStaged?: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare const ENCODING = "utf-8";
|
|
9
|
-
export declare const warn: (text?: string) => "" | ora.Ora | undefined;
|
|
10
|
-
export declare const fail: (text?: string) => "" | ora.Ora | undefined;
|
|
11
|
-
export declare const succeed: (text?: string) => "" | ora.Ora | undefined;
|
|
12
|
-
export declare const info: (text?: string) => "" | ora.Ora | undefined;
|
|
13
|
-
export declare const getYolkConfig: () => YolkConfig;
|
|
14
|
-
export declare const getPrettierConfig: () => any;
|
|
15
|
-
export declare const getProjectConfigJSON: () => any;
|
|
16
|
-
export declare const getPackageJSON: () => any;
|
|
17
|
-
export declare const getEsLintConfigPath: () => string;
|
|
18
|
-
export declare const getStyleLintConfigPath: () => string;
|
package/lib/util.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,c=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,a=(e,r)=>{for(var n in r)t(e,n,{get:r[n],enumerable:!0})},i=(e,c,a,i)=>{if(c&&"object"===typeof c||"function"===typeof c)for(let s of n(c))o.call(e,s)||s===a||t(e,s,{get:()=>c[s],enumerable:!(i=r(c,s))||i.enumerable});return e},s=(r,n,o)=>(o=null!=r?e(c(r)):{},i(!n&&r&&r.__esModule?o:t(o,"default",{value:r,enumerable:!0}),r)),f=e=>i(t({},"__esModule",{value:!0}),e),l={};a(l,{ENCODING:()=>p,fail:()=>O,getEsLintConfigPath:()=>k,getPackageJSON:()=>N,getPrettierConfig:()=>w,getProjectConfigJSON:()=>x,getStyleLintConfigPath:()=>q,getYolkConfig:()=>P,info:()=>h,succeed:()=>m,warn:()=>b}),module.exports=f(l);var u=s(require("fs")),g=s(require("path")),y=require("glob"),d=s(require("ora")),S=process.cwd(),p="utf-8",j=(0,d.default)(),b=e=>e&&j.warn(Buffer.from(e,p).toString()),O=e=>e&&j.fail(Buffer.from(e,p).toString()),m=e=>e&&j.succeed(Buffer.from(e,p).toString()),h=e=>e&&j.info(Buffer.from(e,p).toString()),P=()=>{const e=(0,y.globSync)("*.yolkrc*",{cwd:S,dot:!0});if(!e.length)return{};const t=g.default.join(S,e[0]);if(!u.default.existsSync(t))return{};try{return JSON.parse(u.default.readFileSync(t,p))||{}}catch(r){return O(r.message||".yolkrc\u8f6c\u6362\u9519\u8bef"),{}}},w=()=>{const e=g.default.join(S,".prettierrc");if(u.default.existsSync(e))try{return JSON.parse(u.default.readFileSync(e,p))||{}}catch(t){return O(t.message||".prettierrc\u8f6c\u6362\u9519\u8bef"),{}}return require("./.prettierrc")},x=()=>{const e=g.default.join(S,"project.config.json");if(!u.default.existsSync(e))return{};try{return JSON.parse(u.default.readFileSync(e,p))||{}}catch(t){return O(t.message||"project.config.json\u8f6c\u6362\u9519\u8bef"),{}}},N=()=>{const e=g.default.join(S,"package.json");if(!u.default.existsSync(e))return{};try{return JSON.parse(u.default.readFileSync(e,p))||{}}catch(t){return O(t.message||"package.json\u8f6c\u6362\u9519\u8bef"),{}}},k=()=>{const e=P();let t="";try{t=require.resolve("@baic/eslint-config-yolk")}catch(c){}const r=(0,y.globSync)("*.eslintrc*",{cwd:S,dot:!0}),n=r[0];return!1===e.strict&&n&&u.default.existsSync(n)?n:u.default.existsSync(t)?t:n},q=()=>{const e=P();let t="";try{t=require.resolve("@baic/stylelint-config-yolk")}catch(c){}const r=(0,y.globSync)("*.stylelintrc*",{cwd:S,dot:!0}),n=r[0];return!1===e.strict&&n&&u.default.existsSync(n)?n:u.default.existsSync(t)?t:n};
|
package/lib/yolk.d.ts
DELETED