Skip to content

Commit

Permalink
6.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
piano-analytics committed Sep 22, 2022
1 parent 34ab287 commit 2f41a83
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 6.5.0
### Added or Changed
- Added React Native compatibility

## 6.4.1
### Added or Changed
- Fix version number
Expand Down
4 changes: 4 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ module.exports = function (grunt) {
src: 'src/utils/request/http-browserless.js',
dest: 'src/utils/request/http.js'
},
reactnative: {
src: 'src/utils/request/http-react-native.js',
dest: 'src/utils/request/http.js'
},
browser: {
src: 'src/utils/request/http-browser.js',
dest: 'src/utils/request/http.js'
Expand Down
27 changes: 15 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "piano-analytics-js",
"description": "JavaScript library for Piano Analytics",
"version": "6.4.1",
"version": "6.5.0",
"main": "dist/browserless/piano-analytics.cjs.js",
"module": "dist/browserless/piano-analytics.esm.js",
"browser": "dist/browser/piano-analytics.umd.js",
"react-native": "dist/browserless/piano-analytics.react-native.umd.js",
"license": "MIT",
"author": {
"name": "Atinternet A Piano Company",
Expand All @@ -22,34 +23,36 @@
"scripts": {
"prebuild:browser": "grunt copy:browser",
"prebuild:browserless": "grunt copy:browserless",
"postbuild": "grunt copy:clean",
"rollup:browser": "npm run prebuild:browser && rollup --config rollup.config-browser.js && npm run postbuild",
"rollup:browserless": "npm run prebuild:browserless && rollup --config rollup.config-browserless.js && npm run postbuild",
"build": "npm run rollup:browser --omit=dev && npm run rollup:browserless --omit=dev",
"prebuild:reactnative": "grunt copy:reactnative",
"clean": "grunt copy:clean",
"rollup:browser": "npm run prebuild:browser && rollup --config rollup.config-browser.js && npm run clean",
"rollup:browserless": "npm run prebuild:browserless && rollup --config rollup.config-browserless.js && npm run clean",
"rollup:reactnative": "npm run prebuild:reactnative && rollup --config rollup.config-react-native.js && npm run clean",
"build": "npm run rollup:browser --omit=dev && npm run rollup:browserless --omit=dev && npm run rollup:reactnative --omit=dev",
"test": "npm run test:browser && npm run test:browserless",
"test:browser": "npm run rollup:browser && karma start",
"test:browserless": "npm run rollup:browserless && node test/browserless.run.js"
},
"devDependencies": {
"@babel/core": "7.18.10",
"@babel/preset-env": "7.18.10",
"@babel/core": "7.19.1",
"@babel/preset-env": "7.19.1",
"@rollup/plugin-babel": "5.3.1",
"chai": "4.3.6",
"eslint": "8.21.0",
"eslint": "8.23.1",
"eslint-config-standard": "17.0.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "6.0.0",
"eslint-plugin-promise": "6.0.1",
"grunt": "1.5.3",
"grunt-contrib-copy": "^1.0.0",
"karma": "6.4.0",
"karma": "6.4.1",
"karma-chai": "0.1.0",
"karma-chrome-launcher": "3.1.1",
"karma-mocha": "2.0.1",
"load-grunt-tasks": "5.1.0",
"mocha": "10.0.0",
"puppeteer": "16.1.0",
"rollup": "2.77.3",
"puppeteer": "18.0.4",
"rollup": "2.79.1",
"rollup-plugin-eslint": "7.0.0",
"rollup-plugin-replace": "2.2.0",
"rollup-plugin-uglify": "6.0.4"
Expand Down
25 changes: 25 additions & 0 deletions rollup.config-react-native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {babel} from '@rollup/plugin-babel';
import {eslint} from 'rollup-plugin-eslint';
import {uglify} from 'rollup-plugin-uglify';
import replace from 'rollup-plugin-replace';

export default {
input: 'src/exports.js',
plugins: [
eslint({
configFile: './src/.eslintrc.json'
}),
replace({
BUILD_BROWSER: 'false'
}),
babel({babelHelpers: 'bundled'}),
process.env.NODE_ENV === 'production' && uglify()
],
output: [
{
file: 'dist/browserless/piano-analytics.react-native.umd.js',
format: 'umd',
name: 'pianoAnalytics'
}
]
};
2 changes: 1 addition & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default {
],
'storageVisitor': 'pa_vid',
'storageUser': 'pa_user',
'version': '6.4.1',
'version': '6.5.0',
'minHeartbeat': 5,
'minBufferingHeartbeat': 1,
'queueVarName': '_paq',
Expand Down
21 changes: 21 additions & 0 deletions src/utils/request/http-react-native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const http = {
post: function (url, data, callback) {
return fetch(url, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
'Content-Length': data.length
},
body: data
})
.then((data) => {
callback && callback(url, data);
})
.catch((error) => {
console.error(error);
});
}
};

export {http};

0 comments on commit 2f41a83

Please sign in to comment.