Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ lib
yarn-error.log
package-lock.json
.vscode
.DS_Store
1 change: 0 additions & 1 deletion WeChat/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export function initialize(options: FPConfig): FeatureProbe | undefined {

/**
* Get the SDK client
*
*/
export function getClient() {
return featureProbeClient;
Expand Down
3 changes: 3 additions & 0 deletions WeChat/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { IHttpRequest } from "featureprobe-client-sdk-js";
import { IPlatForm } from "./types";
import StorageProvider from "./localstorage";
import pkg from '../package.json';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const io = require("weapp.socket.io");

const PKG_VERSION = pkg.version;
const UA = "MINIPROGRAM/" + PKG_VERSION;
Expand Down Expand Up @@ -56,4 +58,5 @@ export const platform: IPlatForm = {
localStorage: new StorageProvider(),
UA: UA,
httpRequest: httpRequest,
socket: io,
};
6 changes: 6 additions & 0 deletions WeChat/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,10 @@ export interface IPlatForm {
*
*/
httpRequest: IHttpRequest;

/**
* Socket.io client used in Wechat miniprogram
*
*/
socket: any;
}
2 changes: 2 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
miniprogram_npm/
1 change: 1 addition & 0 deletions example/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { initialize, FPUser } from "featureprobe-client-sdk-miniprogram";
// import { initialize, FPUser } from "./dist/index";

App({
onLaunch() {
Expand Down
1 change: 1 addition & 0 deletions example/pages/index/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// index.js
import { getClient } from "featureprobe-client-sdk-miniprogram";
// import { getClient } from "../../dist/index";

Page({
data: {},
Expand Down
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'weapp.socket.io';
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "featureprobe-client-sdk-miniprogram",
"version": "1.1.0",
"version": "1.2.0",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"description": "FeatureProbe Client Side SDK for MiniProgram",
Expand Down Expand Up @@ -34,7 +34,6 @@
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^14.1.0",
"@rollup/plugin-typescript": "^8.5.0",
"@types/jest": "^27.0.1",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
Expand All @@ -44,19 +43,18 @@
"prettier": "^2.7.1",
"rollup": "^2.79.1",
"rollup-plugin-babel-minify": "^10.0.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-polyfills": "^0.2.1",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-typescript2": "^0.34.1",
"ts-jest": "^27.0.5",
"typedoc": "^0.23.16",
"typescript": "^4.8.3"
},
"dependencies": {
"featureprobe-client-sdk-js": "^1.2.0",
"featureprobe-client-sdk-js": "^2.1.0",
"js-base64": "^3.7.2",
"tiny-emitter": "^2.1.0",
"weapp.socket.io": "^3.0.0",
"wefetch": "^1.3.6"
}
}
14 changes: 8 additions & 6 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import typescript from "rollup-plugin-typescript2";
import minify from "rollup-plugin-babel-minify";
import resolve from "rollup-plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import nodePolyfills from "rollup-plugin-node-polyfills";
import json from "@rollup/plugin-json";
import replace from 'rollup-plugin-replace';
Expand All @@ -14,8 +14,9 @@ export default {
format: 'esm',
},
plugins: [
nodePolyfills(),
resolve({}),
resolve({
browser: true,
}),
commonjs({
include: "node_modules/**",
}),
Expand All @@ -24,6 +25,7 @@ export default {
json(),
replace({
SDK_VERSION: pkg.version
})
}),
nodePolyfills(),
]
};
};
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true
},
"include": ["WeChat/**/*"],
"include": ["WeChat/**/*", "index.d.ts"],
}
Loading