From df277ce5bae0cacc9c5b4d6957bdc786ac9cf571 Mon Sep 17 00:00:00 2001 From: lukasPan <55382908+lukasPan@users.noreply.github.com> Date: Mon, 8 Jun 2020 13:29:44 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=20Unified=20build=20and?= =?UTF-8?q?=20release=20process=20via=20rollup=20and=20lerna?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 24 +- README.md | 4 + _templates/plugin/create/.npmignore.t | 2 +- _templates/plugin/create/jest.conf.json.t | 24 -- _templates/plugin/create/jest.config.js.t | 8 + _templates/plugin/create/package.json.t | 5 +- _templates/plugin/create/rollup.config.js.t | 16 ++ jest.config.base.js | 12 + jest.config.js | 14 + lerna.json | 30 +- package.json | 60 +++- packages/babel-plugin-ima-logger/.npmignore | 26 +- .../babel-plugin-ima-logger/jest.conf.json | 21 -- .../babel-plugin-ima-logger/jest.config.js | 5 + packages/babel-plugin-ima-logger/package.json | 9 +- .../babel-plugin-ima-logger/rollup.config.js | 12 + packages/plugin-analytic-fb-pixel/.npmignore | 26 +- .../plugin-analytic-fb-pixel/jest.conf.json | 21 -- .../plugin-analytic-fb-pixel/jest.config.js | 5 + .../plugin-analytic-fb-pixel/package.json | 9 +- .../plugin-analytic-fb-pixel/rollup.config.js | 12 + packages/plugin-analytic-google/.npmignore | 26 +- .../plugin-analytic-google/jest.conf.json | 21 -- .../plugin-analytic-google/jest.config.js | 5 + packages/plugin-analytic-google/package.json | 12 +- .../plugin-analytic-google/rollup.config.js | 12 + packages/plugin-analytic/.npmignore | 26 +- packages/plugin-analytic/jest.conf.json | 21 -- packages/plugin-analytic/jest.config.js | 5 + packages/plugin-analytic/package.json | 11 +- packages/plugin-analytic/rollup.config.js | 12 + packages/plugin-hot-reload/.npmignore | 2 +- packages/plugin-hot-reload/jest.conf.json | 19 -- packages/plugin-hot-reload/jest.config.js | 5 + packages/plugin-hot-reload/package.json | 23 +- packages/plugin-hot-reload/rollup.config.js | 12 + packages/plugin-less-constants/.npmignore | 26 +- packages/plugin-less-constants/jest.conf.json | 21 -- packages/plugin-less-constants/jest.config.js | 5 + packages/plugin-less-constants/package.json | 3 +- packages/plugin-local-storage/.npmignore | 26 +- packages/plugin-local-storage/jest.conf.json | 21 -- packages/plugin-local-storage/jest.config.js | 5 + packages/plugin-local-storage/package.json | 12 +- .../plugin-local-storage/rollup.config.js | 12 + packages/plugin-logger/.npmignore | 26 +- packages/plugin-logger/jest.conf.json | 21 -- packages/plugin-logger/jest.config.js | 5 + packages/plugin-logger/package.json | 5 +- packages/plugin-logger/rollup.config.js | 12 + packages/plugin-resource-loader/.npmignore | 26 +- .../plugin-resource-loader/jest.conf.json | 21 -- .../plugin-resource-loader/jest.config.js | 5 + packages/plugin-resource-loader/package.json | 5 +- .../plugin-resource-loader/rollup.config.js | 12 + packages/plugin-rest-client/.npmignore | 2 +- packages/plugin-rest-client/jest.conf.json | 21 -- packages/plugin-rest-client/jest.config.js | 6 + packages/plugin-rest-client/package.json | 9 +- packages/plugin-rest-client/rollup.config.js | 12 + packages/plugin-rest-client/src/Request.js | 266 +++++++++--------- packages/plugin-script-loader/.npmignore | 26 +- packages/plugin-script-loader/jest.conf.json | 21 -- packages/plugin-script-loader/jest.config.js | 5 + packages/plugin-script-loader/package.json | 11 +- .../plugin-script-loader/rollup.config.js | 12 + packages/plugin-select/.npmignore | 28 +- packages/plugin-select/jest.conf.json | 24 -- packages/plugin-select/jest.config.js | 8 + packages/plugin-select/package.json | 15 +- packages/plugin-select/rollup.config.js | 12 + packages/plugin-self-xss/.npmignore | 26 +- packages/plugin-self-xss/jest.conf.json | 21 -- packages/plugin-self-xss/jest.config.js | 5 + packages/plugin-self-xss/package.json | 11 +- packages/plugin-self-xss/rollup.config.js | 12 + packages/plugin-shared-cache/.npmignore | 4 +- packages/plugin-shared-cache/jest.conf.json | 21 -- packages/plugin-shared-cache/jest.config.js | 5 + packages/plugin-shared-cache/package.json | 9 +- packages/plugin-shared-cache/rollup.config.js | 12 + packages/plugin-style-loader/.npmignore | 26 +- packages/plugin-style-loader/jest.conf.json | 21 -- packages/plugin-style-loader/jest.config.js | 5 + packages/plugin-style-loader/package.json | 11 +- packages/plugin-style-loader/rollup.config.js | 12 + .../plugin-testing-integration/.npmignore | 26 +- .../plugin-testing-integration/jest.conf.json | 21 -- .../plugin-testing-integration/jest.config.js | 5 + .../plugin-testing-integration/package.json | 11 +- .../rollup.config.js | 15 + packages/plugin-useragent/.npmignore | 26 +- packages/plugin-useragent/jest.conf.json | 21 -- packages/plugin-useragent/jest.config.js | 5 + packages/plugin-useragent/package.json | 5 +- packages/plugin-useragent/rollup.config.js | 12 + packages/plugin-websocket/.npmignore | 2 +- packages/plugin-websocket/jest.conf.json | 19 -- packages/plugin-websocket/jest.config.js | 5 + packages/plugin-websocket/package.json | 24 +- packages/plugin-websocket/rollup.config.js | 12 + packages/plugin-xhr/.npmignore | 26 +- packages/plugin-xhr/jest.conf.json | 21 -- packages/plugin-xhr/jest.config.js | 5 + packages/plugin-xhr/package.json | 11 +- packages/plugin-xhr/rollup.config.js | 12 + rollup.config.common.js | 48 ++++ 107 files changed, 920 insertions(+), 917 deletions(-) delete mode 100644 _templates/plugin/create/jest.conf.json.t create mode 100644 _templates/plugin/create/jest.config.js.t create mode 100644 _templates/plugin/create/rollup.config.js.t create mode 100644 jest.config.base.js create mode 100644 jest.config.js delete mode 100644 packages/babel-plugin-ima-logger/jest.conf.json create mode 100644 packages/babel-plugin-ima-logger/jest.config.js create mode 100644 packages/babel-plugin-ima-logger/rollup.config.js delete mode 100644 packages/plugin-analytic-fb-pixel/jest.conf.json create mode 100644 packages/plugin-analytic-fb-pixel/jest.config.js create mode 100644 packages/plugin-analytic-fb-pixel/rollup.config.js delete mode 100644 packages/plugin-analytic-google/jest.conf.json create mode 100644 packages/plugin-analytic-google/jest.config.js create mode 100644 packages/plugin-analytic-google/rollup.config.js delete mode 100644 packages/plugin-analytic/jest.conf.json create mode 100644 packages/plugin-analytic/jest.config.js create mode 100644 packages/plugin-analytic/rollup.config.js delete mode 100644 packages/plugin-hot-reload/jest.conf.json create mode 100644 packages/plugin-hot-reload/jest.config.js create mode 100644 packages/plugin-hot-reload/rollup.config.js delete mode 100644 packages/plugin-less-constants/jest.conf.json create mode 100644 packages/plugin-less-constants/jest.config.js delete mode 100644 packages/plugin-local-storage/jest.conf.json create mode 100644 packages/plugin-local-storage/jest.config.js create mode 100644 packages/plugin-local-storage/rollup.config.js delete mode 100644 packages/plugin-logger/jest.conf.json create mode 100644 packages/plugin-logger/jest.config.js create mode 100644 packages/plugin-logger/rollup.config.js delete mode 100644 packages/plugin-resource-loader/jest.conf.json create mode 100644 packages/plugin-resource-loader/jest.config.js create mode 100644 packages/plugin-resource-loader/rollup.config.js delete mode 100644 packages/plugin-rest-client/jest.conf.json create mode 100644 packages/plugin-rest-client/jest.config.js create mode 100644 packages/plugin-rest-client/rollup.config.js delete mode 100644 packages/plugin-script-loader/jest.conf.json create mode 100644 packages/plugin-script-loader/jest.config.js create mode 100644 packages/plugin-script-loader/rollup.config.js delete mode 100644 packages/plugin-select/jest.conf.json create mode 100644 packages/plugin-select/jest.config.js create mode 100644 packages/plugin-select/rollup.config.js delete mode 100644 packages/plugin-self-xss/jest.conf.json create mode 100644 packages/plugin-self-xss/jest.config.js create mode 100644 packages/plugin-self-xss/rollup.config.js delete mode 100755 packages/plugin-shared-cache/jest.conf.json create mode 100644 packages/plugin-shared-cache/jest.config.js create mode 100644 packages/plugin-shared-cache/rollup.config.js delete mode 100644 packages/plugin-style-loader/jest.conf.json create mode 100644 packages/plugin-style-loader/jest.config.js create mode 100644 packages/plugin-style-loader/rollup.config.js delete mode 100644 packages/plugin-testing-integration/jest.conf.json create mode 100644 packages/plugin-testing-integration/jest.config.js create mode 100644 packages/plugin-testing-integration/rollup.config.js delete mode 100644 packages/plugin-useragent/jest.conf.json create mode 100644 packages/plugin-useragent/jest.config.js create mode 100644 packages/plugin-useragent/rollup.config.js delete mode 100644 packages/plugin-websocket/jest.conf.json create mode 100644 packages/plugin-websocket/jest.config.js create mode 100644 packages/plugin-websocket/rollup.config.js delete mode 100644 packages/plugin-xhr/jest.conf.json create mode 100644 packages/plugin-xhr/jest.config.js create mode 100644 packages/plugin-xhr/rollup.config.js create mode 100644 rollup.config.common.js diff --git a/.travis.yml b/.travis.yml index fa7caf68..19008939 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,26 @@ language: node_js node_js: - "14" + notifications: email: false + install: - npm install -script: - - npm test - - npm run audit - - npm run doc - - npm run lint + +jobs: + include: + - name: "Unit Tests" + script: npm test + - name: "Audit" + script: npm audit || echo \"audit found some vulnerabilities.\" + - name: "Docs" + script: npm run doc + - name: "Lint" + script: npm run lint + - if: tag =~ ^v # Run only for tags + stage: "deploy" + script: + - echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" >> $HOME/.npmrc 2> /dev/null + - npm run release:publish + skip_cleanup: true diff --git a/README.md b/README.md index 2e2c9a54..31075196 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ [![Known Vulnerabilities](https://snyk.io/test/github/seznam/IMA.js-plugins/badge.svg)](https://snyk.io/test/github/seznam/IMA.js-plugins) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) +For release new version of packages use lerna. Use following script: + +`npm run release` + The IMA.js plugins is multi-package repository containing most commonly used plugins on IMA.js application development stack. - [**plugin-analytic**](packages/plugin-analytic) diff --git a/_templates/plugin/create/.npmignore.t b/_templates/plugin/create/.npmignore.t index 27af12ac..0bd4519f 100644 --- a/_templates/plugin/create/.npmignore.t +++ b/_templates/plugin/create/.npmignore.t @@ -9,7 +9,7 @@ doc/ coverage/ .gitignore gulpfile.js -jest.conf.json +jest.config.js preprocess.js jestSetupFile.js npm-debug.log diff --git a/_templates/plugin/create/jest.conf.json.t b/_templates/plugin/create/jest.conf.json.t deleted file mode 100644 index c279c6f9..00000000 --- a/_templates/plugin/create/jest.conf.json.t +++ /dev/null @@ -1,24 +0,0 @@ ---- -to: packages/<%= h.changeCase.paramCase(name) %>/jest.conf.json ---- -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 10, - "lines": 10, - "statements": 10 - } - }, - "testEnvironment": "node", - "setupFiles": [], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/_templates/plugin/create/jest.config.js.t b/_templates/plugin/create/jest.config.js.t new file mode 100644 index 00000000..ab1103d4 --- /dev/null +++ b/_templates/plugin/create/jest.config.js.t @@ -0,0 +1,8 @@ +--- +to: packages/<%= h.changeCase.paramCase(name) %>/jest.config.js +--- +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/_templates/plugin/create/package.json.t b/_templates/plugin/create/package.json.t index a7daaace..0960da7a 100644 --- a/_templates/plugin/create/package.json.t +++ b/_templates/plugin/create/package.json.t @@ -9,10 +9,11 @@ to: packages/<%= h.changeCase.paramCase(name) %>/package.json "description": "<%= h.changeCase.sentenceCase(description) %>", "main": "index.js", "scripts": { - "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.conf.json", + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.config.js", "lint": "../../node_modules/.bin/eslint './src/**/*.{js,jsx}' --fix", "doc": "../../node_modules/.bin/gulp doc", - "build": "../../node_modules/.bin/gulp build" + "prepare": "../../node_modules/.bin/rollup -c" }, "keywords": [ "IMA.js", diff --git a/_templates/plugin/create/rollup.config.js.t b/_templates/plugin/create/rollup.config.js.t new file mode 100644 index 00000000..d819d40f --- /dev/null +++ b/_templates/plugin/create/rollup.config.js.t @@ -0,0 +1,16 @@ +--- +to: packages/<%= h.changeCase.paramCase(name) %>/rollup.config.js +--- +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + external: [], + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/jest.config.base.js b/jest.config.base.js new file mode 100644 index 00000000..0667e065 --- /dev/null +++ b/jest.config.base.js @@ -0,0 +1,12 @@ +module.exports = { + bail: true, + verbose: true, + testRegex: "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$", + modulePaths: [ + "/" + ], + transform: { + "\\.jsx?": "/../../preprocess.js" + }, + testEnvironment: "node" +}; diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 00000000..df106ee4 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,14 @@ +module.exports = { + verbose: true, + projects: + [ + "/packages/*/jest.config.js" + ], + coverageThreshold: { + global: { + functions: 65, + lines: 75, + statements: 75 + } + } +}; diff --git a/lerna.json b/lerna.json index 2bbed37a..b3c1b0d3 100644 --- a/lerna.json +++ b/lerna.json @@ -1,12 +1,18 @@ -{ - "lerna": "2.8.0", - "packages": [ - "packages/*" - ], - "command": { - "bootstrap": { - "npmClientArgs": ["--no-package-lock"] - } - }, - "version": "independent" -} +{ + "packages": [ + "packages/*" + ], + "command": { + "version": { + "message": "chore(release): publish" + }, + "publish": { + "conventionalCommits": true, + "preid": "rc" + }, + "bootstrap": { + "npmClientArgs": ["--no-package-lock"] + } + }, + "version": "independent" +} diff --git a/package.json b/package.json index 4b426b81..9ac92128 100644 --- a/package.json +++ b/package.json @@ -1,38 +1,74 @@ { "version": "1.0.0", "scripts": { - "test": "node_modules/.bin/lerna run test", - "lint": "node_modules/.bin/lerna run lint && node_modules/.bin/eslint './gulp/**/*.{js,jsx}' --fix", - "doc": "node_modules/.bin/lerna run doc", - "audit": "node_modules/.bin/lerna run audit", - "build": "node_modules/.bin/lerna run build", - "postinstall": "node_modules/.bin/lerna bootstrap --no-ci && node_modules/.bin/lerna run build" + "commit": "git-cz", + "test": "jest --coverage --no-watchman --config=jest.config.js", + "lint": "lerna run lint && node_modules/.bin/eslint './gulp/**/*.{js,jsx}' --fix", + "doc": "lerna run doc", + "audit": "lerna run audit", + "postinstall": "lerna bootstrap --no-ci", + "release": "lerna version", + "release:publish": "lerna publish from-git --yes" }, "devDependencies": { "@babel/core": "^7.9.0", "@babel/plugin-transform-modules-commonjs": "^7.9.0", "@babel/preset-react": "^7.9.4", + "@commitlint/cli": "^8.3.5", + "@commitlint/config-conventional": "^8.3.4", + "@ima/core": "^17.6.0", + "@ima/gulp-task-loader": "^17.4.0", + "@ima/plugin-script-loader": "1.0.0", + "@rollup/plugin-babel": "^5.0.2", + "@rollup/plugin-commonjs": "^12.0.0", + "@rollup/plugin-json": "^4.0.3", + "@rollup/plugin-node-resolve": "^8.0.0", + "@rollup/plugin-replace": "^2.3.2", "babel-eslint": "^10.1.0", "babel-preset-jest": "^25.2.6", + "cz-conventional-changelog": "^3.2.0", "del": "^5.1.0", + "enzyme": "3.10.0", + "enzyme-adapter-react-16": "^1.15.1", + "enzyme-to-json": "^3.4.3", "eslint": "6.8.0", "eslint-config-prettier": "6.10.1", - "eslint-plugin-jasmine": "4.1.0", - "eslint-plugin-jest": "23.8.2", - "eslint-plugin-prettier": "3.1.2", + "eslint-plugin-jasmine": "^4.1.0", + "eslint-plugin-jest": "^23.8.2", + "eslint-plugin-prettier": "^3.1.1", "eslint-plugin-react": "7.19.0", - "gulp": "4.0.2", + "git-cz": "^4.6.0", + "gulp": "^4.0.2", "gulp-babel": "8.0.0", "gulp-cached": "^1.1.1", "gulp-change": "^1.0.2", "gulp-jsdoc3": "^3.0.0", "gulp-remember": "^1.0.1", "gulp-rename": "^2.0.0", - "@ima/gulp-task-loader": "^17.4.0", + "husky": "^4.2.5", "jest": "^25.2.7", "lerna": "^3.20.2", "prettier": "^2.0.4", + "react": "^16.13.0", + "react-dom": "^16.13.0", + "rollup": "^2.11.2", + "rollup-plugin-peer-deps-external": "^2.2.2", "to-mock": "^1.6.2" }, - "dependencies": {} + "commitlint": { + "extends": [ + "@commitlint/config-conventional" + ] + }, + "husky": { + "hooks": { + "commit-msg": "bash -c \"if [[ `git rev-parse --abbrev-ref HEAD` =~ ^(master)$ ]] ; then commitlint -E HUSKY_GIT_PARAMS ; fi\"" + } + }, + "dependencies": {}, + "config": { + "commitizen": { + "path": "./node_modules/cz-conventional-changelog" + } + } } diff --git a/packages/babel-plugin-ima-logger/.npmignore b/packages/babel-plugin-ima-logger/.npmignore index 1cc55f5f..ecc4c2be 100644 --- a/packages/babel-plugin-ima-logger/.npmignore +++ b/packages/babel-plugin-ima-logger/.npmignore @@ -1,13 +1,13 @@ -.idea/ -.vscode/ -.history/ -src/ -doc/ -coverage/ -.gitignore -gulpfile.js -jest.conf.json -preprocess.js -npm-debug.log -README.md -LICENSE.md +.idea/ +.vscode/ +.history/ +src/ +doc/ +coverage/ +.gitignore +gulpfile.js +jest.config.js +preprocess.js +npm-debug.log +README.md +LICENSE.md diff --git a/packages/babel-plugin-ima-logger/jest.conf.json b/packages/babel-plugin-ima-logger/jest.conf.json deleted file mode 100644 index 488411a2..00000000 --- a/packages/babel-plugin-ima-logger/jest.conf.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 10, - "lines": 10, - "statements": 10 - } - }, - "testEnvironment": "node", - "setupFiles": [], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/babel-plugin-ima-logger/jest.config.js b/packages/babel-plugin-ima-logger/jest.config.js new file mode 100644 index 00000000..c6f8d822 --- /dev/null +++ b/packages/babel-plugin-ima-logger/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/packages/babel-plugin-ima-logger/package.json b/packages/babel-plugin-ima-logger/package.json index d5ee6909..1e9064b0 100644 --- a/packages/babel-plugin-ima-logger/package.json +++ b/packages/babel-plugin-ima-logger/package.json @@ -4,10 +4,11 @@ "description": "The babel pluging that removes @ima/plugin-logger from source code at compilation time.", "main": "index.js", "scripts": { - "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.conf.json", + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.config.js", "lint": "../../node_modules/.bin/eslint './src/**/*.js' --fix", "doc": "../../node_modules/.bin/gulp doc", - "build": "../../node_modules/.bin/gulp build" + "prepare": "../../node_modules/.bin/rollup -c" }, "keywords": [ "IMA.js", @@ -27,9 +28,7 @@ "url": "https://github.com/seznam/IMA.js-plugins/issues" }, "license": "MIT", - "devDependencies": { - "@babel/core": "7.7.4" - }, + "devDependencies": {}, "browserify": { "transform": [ "babelify" diff --git a/packages/babel-plugin-ima-logger/rollup.config.js b/packages/babel-plugin-ima-logger/rollup.config.js new file mode 100644 index 00000000..4d00ce57 --- /dev/null +++ b/packages/babel-plugin-ima-logger/rollup.config.js @@ -0,0 +1,12 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/packages/plugin-analytic-fb-pixel/.npmignore b/packages/plugin-analytic-fb-pixel/.npmignore index 1cc55f5f..ecc4c2be 100644 --- a/packages/plugin-analytic-fb-pixel/.npmignore +++ b/packages/plugin-analytic-fb-pixel/.npmignore @@ -1,13 +1,13 @@ -.idea/ -.vscode/ -.history/ -src/ -doc/ -coverage/ -.gitignore -gulpfile.js -jest.conf.json -preprocess.js -npm-debug.log -README.md -LICENSE.md +.idea/ +.vscode/ +.history/ +src/ +doc/ +coverage/ +.gitignore +gulpfile.js +jest.config.js +preprocess.js +npm-debug.log +README.md +LICENSE.md diff --git a/packages/plugin-analytic-fb-pixel/jest.conf.json b/packages/plugin-analytic-fb-pixel/jest.conf.json deleted file mode 100644 index 488411a2..00000000 --- a/packages/plugin-analytic-fb-pixel/jest.conf.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 10, - "lines": 10, - "statements": 10 - } - }, - "testEnvironment": "node", - "setupFiles": [], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-analytic-fb-pixel/jest.config.js b/packages/plugin-analytic-fb-pixel/jest.config.js new file mode 100644 index 00000000..c6f8d822 --- /dev/null +++ b/packages/plugin-analytic-fb-pixel/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/packages/plugin-analytic-fb-pixel/package.json b/packages/plugin-analytic-fb-pixel/package.json index 387997b0..f23fa6b2 100644 --- a/packages/plugin-analytic-fb-pixel/package.json +++ b/packages/plugin-analytic-fb-pixel/package.json @@ -4,10 +4,11 @@ "description": "Seznam IMA.js analytic plugin for Facebook Pixel", "main": "index.js", "scripts": { - "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.conf.json", + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.config.js", "lint": "../../node_modules/.bin/eslint './src/**/*.js' --fix", "doc": "../../node_modules/.bin/gulp doc", - "build": "../../node_modules/.bin/gulp build" + "prepare": "../../node_modules/.bin/rollup -c" }, "keywords": [ "IMA.js", @@ -30,9 +31,7 @@ "url": "https://github.com/seznam/IMA.js-plugins/issues" }, "license": "MIT", - "devDependencies": { - "@ima/plugin-script-loader": "1.0.0" - }, + "devDependencies": {}, "dependencies": { "@ima/plugin-analytic": "^3.0.0" }, diff --git a/packages/plugin-analytic-fb-pixel/rollup.config.js b/packages/plugin-analytic-fb-pixel/rollup.config.js new file mode 100644 index 00000000..4d00ce57 --- /dev/null +++ b/packages/plugin-analytic-fb-pixel/rollup.config.js @@ -0,0 +1,12 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/packages/plugin-analytic-google/.npmignore b/packages/plugin-analytic-google/.npmignore index 1cc55f5f..ecc4c2be 100644 --- a/packages/plugin-analytic-google/.npmignore +++ b/packages/plugin-analytic-google/.npmignore @@ -1,13 +1,13 @@ -.idea/ -.vscode/ -.history/ -src/ -doc/ -coverage/ -.gitignore -gulpfile.js -jest.conf.json -preprocess.js -npm-debug.log -README.md -LICENSE.md +.idea/ +.vscode/ +.history/ +src/ +doc/ +coverage/ +.gitignore +gulpfile.js +jest.config.js +preprocess.js +npm-debug.log +README.md +LICENSE.md diff --git a/packages/plugin-analytic-google/jest.conf.json b/packages/plugin-analytic-google/jest.conf.json deleted file mode 100644 index 488411a2..00000000 --- a/packages/plugin-analytic-google/jest.conf.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 10, - "lines": 10, - "statements": 10 - } - }, - "testEnvironment": "node", - "setupFiles": [], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-analytic-google/jest.config.js b/packages/plugin-analytic-google/jest.config.js new file mode 100644 index 00000000..c6f8d822 --- /dev/null +++ b/packages/plugin-analytic-google/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/packages/plugin-analytic-google/package.json b/packages/plugin-analytic-google/package.json index 097628c3..95817329 100644 --- a/packages/plugin-analytic-google/package.json +++ b/packages/plugin-analytic-google/package.json @@ -4,10 +4,11 @@ "description": "Seznam IMA.js google analytic plugin", "main": "index.js", "scripts": { - "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.conf.json", + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.config.js", "lint": "../../node_modules/.bin/eslint './src/**/*.js' --fix", "doc": "../../node_modules/.bin/gulp doc", - "build": "../../node_modules/.bin/gulp build" + "prepare": "../../node_modules/.bin/rollup -c" }, "keywords": [ "IMA.js", @@ -29,12 +30,7 @@ "url": "https://github.com/seznam/IMA.js-plugins/issues" }, "license": "MIT", - "devDependencies": { - "@ima/core": "^17.0.0-rc.6", - "@ima/plugin-script-loader": "1.0.0", - "react": "^16.12.0", - "react-dom": "^16.12.0" - }, + "devDependencies": {}, "dependencies": { "@ima/plugin-analytic": "^3.0.0" }, diff --git a/packages/plugin-analytic-google/rollup.config.js b/packages/plugin-analytic-google/rollup.config.js new file mode 100644 index 00000000..4d00ce57 --- /dev/null +++ b/packages/plugin-analytic-google/rollup.config.js @@ -0,0 +1,12 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/packages/plugin-analytic/.npmignore b/packages/plugin-analytic/.npmignore index 1cc55f5f..ecc4c2be 100644 --- a/packages/plugin-analytic/.npmignore +++ b/packages/plugin-analytic/.npmignore @@ -1,13 +1,13 @@ -.idea/ -.vscode/ -.history/ -src/ -doc/ -coverage/ -.gitignore -gulpfile.js -jest.conf.json -preprocess.js -npm-debug.log -README.md -LICENSE.md +.idea/ +.vscode/ +.history/ +src/ +doc/ +coverage/ +.gitignore +gulpfile.js +jest.config.js +preprocess.js +npm-debug.log +README.md +LICENSE.md diff --git a/packages/plugin-analytic/jest.conf.json b/packages/plugin-analytic/jest.conf.json deleted file mode 100644 index dec57069..00000000 --- a/packages/plugin-analytic/jest.conf.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 8, - "lines": 20, - "statements": 20 - } - }, - "testEnvironment": "node", - "setupFiles": [], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-analytic/jest.config.js b/packages/plugin-analytic/jest.config.js new file mode 100644 index 00000000..c6f8d822 --- /dev/null +++ b/packages/plugin-analytic/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/packages/plugin-analytic/package.json b/packages/plugin-analytic/package.json index 3ecb902a..0db01c60 100644 --- a/packages/plugin-analytic/package.json +++ b/packages/plugin-analytic/package.json @@ -4,10 +4,11 @@ "description": "Seznam IMA.js abstract analytic plugin", "main": "index.js", "scripts": { - "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.conf.json", + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.config.js", "lint": "../../node_modules/.bin/eslint './src/**/*.js' --fix", "doc": "../../node_modules/.bin/gulp doc", - "build": "../../node_modules/.bin/gulp build" + "prepare": "../../node_modules/.bin/rollup -c" }, "keywords": [ "IMA.js", @@ -28,11 +29,7 @@ "url": "https://github.com/seznam/IMA.js-plugins/issues" }, "license": "MIT", - "devDependencies": { - "@ima/core": "^17.0.0-rc.6", - "react": "^16.12.0", - "react-dom": "^16.12.0" - }, + "devDependencies": {}, "dependencies": { "@ima/plugin-script-loader": "^1.0.0" }, diff --git a/packages/plugin-analytic/rollup.config.js b/packages/plugin-analytic/rollup.config.js new file mode 100644 index 00000000..4d00ce57 --- /dev/null +++ b/packages/plugin-analytic/rollup.config.js @@ -0,0 +1,12 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/packages/plugin-hot-reload/.npmignore b/packages/plugin-hot-reload/.npmignore index 6dd99b00..74e3395f 100644 --- a/packages/plugin-hot-reload/.npmignore +++ b/packages/plugin-hot-reload/.npmignore @@ -6,7 +6,7 @@ doc/ coverage/ .gitignore gulpfile.js -jest.conf.json +jest.config.js preprocess.js jestSetupFile.js npm-debug.log diff --git a/packages/plugin-hot-reload/jest.conf.json b/packages/plugin-hot-reload/jest.conf.json deleted file mode 100644 index 5c54a093..00000000 --- a/packages/plugin-hot-reload/jest.conf.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 15, - "lines": 20, - "statements": 30 - } - }, - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-hot-reload/jest.config.js b/packages/plugin-hot-reload/jest.config.js new file mode 100644 index 00000000..c6f8d822 --- /dev/null +++ b/packages/plugin-hot-reload/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/packages/plugin-hot-reload/package.json b/packages/plugin-hot-reload/package.json index 25a363cc..b7885532 100644 --- a/packages/plugin-hot-reload/package.json +++ b/packages/plugin-hot-reload/package.json @@ -4,10 +4,11 @@ "description": "The ima hot reload plugin", "main": "index.js", "scripts": { - "test": "node_modules/.bin/jest --coverage --no-watchman --config=jest.conf.json", - "lint": "node_modules/.bin/eslint './src/**/*.{js,jsx}' --fix", - "doc": "node_modules/.bin/gulp doc", - "build": "node_modules/.bin/gulp build" + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.config.js", + "lint": "../../node_modules/.bin/eslint './src/**/*.{js,jsx}' --fix", + "doc": "../../node_modules/.bin/gulp doc", + "prepare": "../../node_modules/.bin/rollup -c" }, "keywords": [ "IMA", @@ -31,19 +32,7 @@ }, "license": "MIT", "devDependencies": { - "@ima/core": "^17.0.0-rc.6", - "@ima/plugin-websocket": "^0.1.0", - "eslint": "^6.7.2", - "eslint-config-prettier": "^6.7.0", - "eslint-plugin-jasmine": "^4.1.0", - "eslint-plugin-jest": "^23.1.1", - "eslint-plugin-prettier": "^3.1.1", - "gulp": "^4.0.2", - "jest": "^24.9.0", - "prettier": "^1.19.1", - "react": "^16.12.0", - "react-dom": "^16.12.0", - "to-mock": "^1.5.4" + "@ima/plugin-websocket": "^0.1.0" }, "peerDependencies": { "@ima/core": "17.x", diff --git a/packages/plugin-hot-reload/rollup.config.js b/packages/plugin-hot-reload/rollup.config.js new file mode 100644 index 00000000..4d00ce57 --- /dev/null +++ b/packages/plugin-hot-reload/rollup.config.js @@ -0,0 +1,12 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/packages/plugin-less-constants/.npmignore b/packages/plugin-less-constants/.npmignore index eec94e74..ecc4c2be 100644 --- a/packages/plugin-less-constants/.npmignore +++ b/packages/plugin-less-constants/.npmignore @@ -1,13 +1,13 @@ -.idea/ -.vscode/ -.history/ -src/ -doc/ -coverage/ -.gitignore -gulpfile.js -jest.conf.json -preprocess.js -npm-debug.log -README.md -LICENSE.md \ No newline at end of file +.idea/ +.vscode/ +.history/ +src/ +doc/ +coverage/ +.gitignore +gulpfile.js +jest.config.js +preprocess.js +npm-debug.log +README.md +LICENSE.md diff --git a/packages/plugin-less-constants/jest.conf.json b/packages/plugin-less-constants/jest.conf.json deleted file mode 100644 index ea868ceb..00000000 --- a/packages/plugin-less-constants/jest.conf.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 20, - "lines": 20, - "statements": 20 - } - }, - "testEnvironment": "node", - "setupFiles": [], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-less-constants/jest.config.js b/packages/plugin-less-constants/jest.config.js new file mode 100644 index 00000000..c6f8d822 --- /dev/null +++ b/packages/plugin-less-constants/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/packages/plugin-less-constants/package.json b/packages/plugin-less-constants/package.json index 61e18071..9833052b 100644 --- a/packages/plugin-less-constants/package.json +++ b/packages/plugin-less-constants/package.json @@ -4,10 +4,11 @@ "description": "IMA.js plugin for sharing constants between JavaScript and LESS code.", "main": "tasks/gulpTask.js", "scripts": { + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", "test": "echo \"WARN: no test specified\" && exit 0", "lint": "../../node_modules/.bin/eslint './**/*.js' --fix", "doc": "echo \"WARN: no doc specified\" && exit 0", - "build": "echo \"WARN: no build specified\" && exit 0" + "prepare": "echo \"WARN: no build specified\" && exit 0" }, "repository": { "type": "git", diff --git a/packages/plugin-local-storage/.npmignore b/packages/plugin-local-storage/.npmignore index 1cc55f5f..ecc4c2be 100644 --- a/packages/plugin-local-storage/.npmignore +++ b/packages/plugin-local-storage/.npmignore @@ -1,13 +1,13 @@ -.idea/ -.vscode/ -.history/ -src/ -doc/ -coverage/ -.gitignore -gulpfile.js -jest.conf.json -preprocess.js -npm-debug.log -README.md -LICENSE.md +.idea/ +.vscode/ +.history/ +src/ +doc/ +coverage/ +.gitignore +gulpfile.js +jest.config.js +preprocess.js +npm-debug.log +README.md +LICENSE.md diff --git a/packages/plugin-local-storage/jest.conf.json b/packages/plugin-local-storage/jest.conf.json deleted file mode 100644 index 488411a2..00000000 --- a/packages/plugin-local-storage/jest.conf.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 10, - "lines": 10, - "statements": 10 - } - }, - "testEnvironment": "node", - "setupFiles": [], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-local-storage/jest.config.js b/packages/plugin-local-storage/jest.config.js new file mode 100644 index 00000000..c6f8d822 --- /dev/null +++ b/packages/plugin-local-storage/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/packages/plugin-local-storage/package.json b/packages/plugin-local-storage/package.json index 6f264d59..40eadca5 100644 --- a/packages/plugin-local-storage/package.json +++ b/packages/plugin-local-storage/package.json @@ -4,10 +4,11 @@ "description": "Seznam IMA.js local-storage plugin", "main": "index.js", "scripts": { - "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.conf.json", + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.config.js", "lint": "../../node_modules/.bin/eslint './src/**/*.js' --fix", "doc": "../../node_modules/.bin/gulp doc", - "build": "../../node_modules/.bin/gulp build" + "prepare": "../../node_modules/.bin/rollup -c" }, "keywords": [ "IMA.js", @@ -29,10 +30,9 @@ "url": "https://github.com/seznam/IMA.js-plugins/issues" }, "license": "MIT", - "devDependencies": { - "@ima/core": "^17.0.0-rc.6", - "react": "^16.12.0", - "react-dom": "^16.12.0" + "devDependencies": {}, + "peerDependencies": { + "@ima/core": "17.x" }, "browserify": { "transform": [ diff --git a/packages/plugin-local-storage/rollup.config.js b/packages/plugin-local-storage/rollup.config.js new file mode 100644 index 00000000..4d00ce57 --- /dev/null +++ b/packages/plugin-local-storage/rollup.config.js @@ -0,0 +1,12 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/packages/plugin-logger/.npmignore b/packages/plugin-logger/.npmignore index 1cc55f5f..ecc4c2be 100644 --- a/packages/plugin-logger/.npmignore +++ b/packages/plugin-logger/.npmignore @@ -1,13 +1,13 @@ -.idea/ -.vscode/ -.history/ -src/ -doc/ -coverage/ -.gitignore -gulpfile.js -jest.conf.json -preprocess.js -npm-debug.log -README.md -LICENSE.md +.idea/ +.vscode/ +.history/ +src/ +doc/ +coverage/ +.gitignore +gulpfile.js +jest.config.js +preprocess.js +npm-debug.log +README.md +LICENSE.md diff --git a/packages/plugin-logger/jest.conf.json b/packages/plugin-logger/jest.conf.json deleted file mode 100644 index 488411a2..00000000 --- a/packages/plugin-logger/jest.conf.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 10, - "lines": 10, - "statements": 10 - } - }, - "testEnvironment": "node", - "setupFiles": [], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-logger/jest.config.js b/packages/plugin-logger/jest.config.js new file mode 100644 index 00000000..c6f8d822 --- /dev/null +++ b/packages/plugin-logger/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/packages/plugin-logger/package.json b/packages/plugin-logger/package.json index 56212013..ebd7b390 100644 --- a/packages/plugin-logger/package.json +++ b/packages/plugin-logger/package.json @@ -4,10 +4,11 @@ "description": "Seznam IMA.js logger plugin", "main": "index.js", "scripts": { - "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.conf.json", + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.config.js", "lint": "../../node_modules/.bin/eslint './src/**/*.js' --fix", "doc": "../../node_modules/.bin/gulp doc", - "build": "../../node_modules/.bin/gulp build" + "prepare": "../../node_modules/.bin/rollup -c" }, "keywords": [ "IMA.js", diff --git a/packages/plugin-logger/rollup.config.js b/packages/plugin-logger/rollup.config.js new file mode 100644 index 00000000..4d00ce57 --- /dev/null +++ b/packages/plugin-logger/rollup.config.js @@ -0,0 +1,12 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/packages/plugin-resource-loader/.npmignore b/packages/plugin-resource-loader/.npmignore index 1cc55f5f..ecc4c2be 100644 --- a/packages/plugin-resource-loader/.npmignore +++ b/packages/plugin-resource-loader/.npmignore @@ -1,13 +1,13 @@ -.idea/ -.vscode/ -.history/ -src/ -doc/ -coverage/ -.gitignore -gulpfile.js -jest.conf.json -preprocess.js -npm-debug.log -README.md -LICENSE.md +.idea/ +.vscode/ +.history/ +src/ +doc/ +coverage/ +.gitignore +gulpfile.js +jest.config.js +preprocess.js +npm-debug.log +README.md +LICENSE.md diff --git a/packages/plugin-resource-loader/jest.conf.json b/packages/plugin-resource-loader/jest.conf.json deleted file mode 100644 index aaf00abc..00000000 --- a/packages/plugin-resource-loader/jest.conf.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 70, - "lines": 70, - "statements": 70 - } - }, - "testEnvironment": "node", - "setupFiles": [], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-resource-loader/jest.config.js b/packages/plugin-resource-loader/jest.config.js new file mode 100644 index 00000000..c6f8d822 --- /dev/null +++ b/packages/plugin-resource-loader/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/packages/plugin-resource-loader/package.json b/packages/plugin-resource-loader/package.json index 74b438d9..eba13866 100644 --- a/packages/plugin-resource-loader/package.json +++ b/packages/plugin-resource-loader/package.json @@ -4,10 +4,11 @@ "description": "Seznam IMA.js plugin for loading web resources", "main": "index.js", "scripts": { - "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.conf.json", + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.config.js", "lint": "../../node_modules/.bin/eslint './src/**/*.js' --fix", "doc": "../../node_modules/.bin/gulp doc", - "build": "../../node_modules/.bin/gulp build" + "prepare": "../../node_modules/.bin/rollup -c" }, "keywords": [ "IMA.js", diff --git a/packages/plugin-resource-loader/rollup.config.js b/packages/plugin-resource-loader/rollup.config.js new file mode 100644 index 00000000..4d00ce57 --- /dev/null +++ b/packages/plugin-resource-loader/rollup.config.js @@ -0,0 +1,12 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/packages/plugin-rest-client/.npmignore b/packages/plugin-rest-client/.npmignore index 1cc55f5f..b721a571 100644 --- a/packages/plugin-rest-client/.npmignore +++ b/packages/plugin-rest-client/.npmignore @@ -6,7 +6,7 @@ doc/ coverage/ .gitignore gulpfile.js -jest.conf.json +jest.config.js preprocess.js npm-debug.log README.md diff --git a/packages/plugin-rest-client/jest.conf.json b/packages/plugin-rest-client/jest.conf.json deleted file mode 100644 index f9b76819..00000000 --- a/packages/plugin-rest-client/jest.conf.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 8, - "lines": 20, - "statements": 20 - } - }, - "testEnvironment": "node", - "setupFiles": ["/jestSetup.js"], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-rest-client/jest.config.js b/packages/plugin-rest-client/jest.config.js new file mode 100644 index 00000000..ab0a482d --- /dev/null +++ b/packages/plugin-rest-client/jest.config.js @@ -0,0 +1,6 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base, + setupFiles: ["/jestSetup.js"] +}; diff --git a/packages/plugin-rest-client/package.json b/packages/plugin-rest-client/package.json index 77b2f9d7..53b2853d 100644 --- a/packages/plugin-rest-client/package.json +++ b/packages/plugin-rest-client/package.json @@ -4,10 +4,11 @@ "description": "Generic REST API client plugin for the IMA application framework.", "main": "index.js", "scripts": { - "test": "../../node_modules/.bin/jest --config=jest.conf.json", + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --config=jest.config.js", "lint": "../../node_modules/.bin/eslint './src/**/*.js' --fix", "doc": "../../node_modules/.bin/gulp doc", - "build": "../../node_modules/.bin/gulp build" + "prepare": "../../node_modules/.bin/rollup -c" }, "keywords": [ "ima", @@ -32,9 +33,7 @@ "dependencies": { "clone": "^2.1.2" }, - "devDependencies": { - "@ima/gulp-task-loader": "^17.0.1" - }, + "devDependencies": {}, "engines": { "node": ">=6", "npm": ">=4 <7" diff --git a/packages/plugin-rest-client/rollup.config.js b/packages/plugin-rest-client/rollup.config.js new file mode 100644 index 00000000..4d00ce57 --- /dev/null +++ b/packages/plugin-rest-client/rollup.config.js @@ -0,0 +1,12 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/packages/plugin-rest-client/src/Request.js b/packages/plugin-rest-client/src/Request.js index 781c246d..a0276a91 100644 --- a/packages/plugin-rest-client/src/Request.js +++ b/packages/plugin-rest-client/src/Request.js @@ -1,133 +1,133 @@ -import clone from 'clone'; -import { deepFreeze } from './utils'; - -/** - * Typed representation of a REST API request. - */ -export default class Request { - /** - * Initializes the request representation using the provided data. - * - * @param {{ - * parentEntity: *, - * resource: *, - * parameters: ?Object, - * method: string, - * url: string, - * data: *, - * headers: Object, - * options: { - * timeout: number=, - * ttl: number=, - * repeatRequest: number=, - * cache: boolean=, - * withCredentials: boolean= - * }, - * serverConfiguration: ?Object - * }} requestData The data representing this request. See the fields - * of this class for more information. - */ - constructor(requestData) { - /** - * The parent entity within which the specified resource to manipulate. - * Set to {@code null} if the request's target resource is a top-level - * resource within the REST API. - * - * @type {*} - */ - this.parentEntity = requestData.parentEntity; - - /** - * The identifier of the REST API resource to access using this - * request. - * - * @type {*} - */ - this.resource = requestData.resource; - - /** - * The request parameters that were used to generate the URL to which - * the request will be made. - * - * The parameters do not contain the resource entity id, even if one - * was provided. - * - * @type {?Object)>} - */ - this.parameters = requestData.parameters && clone(requestData.parameters); - if ($Debug) { - deepFreeze(this.parameters); - } - - /** - * The HTTP method to use to make the request. The method is specified - * in upper-case letters. - * - * @type {string} - */ - this.method = requestData.method; - - /** - * The URL to which the request should be made. - * - * @type {string} - */ - this.url = requestData.url; - - /** - * The data to send to the server as the request's body. The field is - * {@code null} if the request should not carry any data in its body. - * - * @type {*} - */ - this.data = clone(requestData.data); - if ($Debug) { - if (this.data && typeof this.data === 'object') { - deepFreeze(this.data); - } - } - - /** - * The headers to send with the HTTP request to the server. These are - * extracted from the request options into this separate field for - * conveniency. - * - * @type {Object} - */ - this.headers = Object.assign({}, requestData.headers); - if ($Debug) { - Object.freeze(this.headers); - } - - /** - * HTTP request options, without the request headers. - * - * @type {{ - * timeout: number=, - * ttl: number=, - * repeatRequest: number=, - * cache: boolean=, - * withCredentials: boolean= - * }} - */ - this.options = Object.assign({}, requestData.options); - if ($Debug) { - Object.freeze(this.options); - } - - /** - * The REST API client configuration provided by the server. The field - * is set to {@code null} if no server-provided configuration is used. - * - * @type {?Object} - */ - this.serverConfiguration = clone(requestData.serverConfiguration); - if ($Debug) { - deepFreeze(this.serverConfiguration); - } - - if ($Debug) { - Object.freeze(this); - } - } -} +import clone from 'clone'; +import { deepFreeze } from './utils'; + +/** + * Typed representation of a REST API request. + */ +export default class Request { + /** + * Initializes the request representation using the provided data. + * + * @param {{ + * parentEntity: *, + * resource: *, + * parameters: ?Object, + * method: string, + * url: string, + * data: *, + * headers: Object, + * options: { + * timeout: number=, + * ttl: number=, + * repeatRequest: number=, + * cache: boolean=, + * withCredentials: boolean= + * }, + * serverConfiguration: ?Object + * }} requestData The data representing this request. See the fields + * of this class for more information. + */ + constructor(requestData) { + /** + * The parent entity within which the specified resource to manipulate. + * Set to {@code null} if the request's target resource is a top-level + * resource within the REST API. + * + * @type {*} + */ + this.parentEntity = requestData.parentEntity; + + /** + * The identifier of the REST API resource to access using this + * request. + * + * @type {*} + */ + this.resource = requestData.resource; + + /** + * The request parameters that were used to generate the URL to which + * the request will be made. + * + * The parameters do not contain the resource entity id, even if one + * was provided. + * + * @type {?Object)>} + */ + this.parameters = requestData.parameters && clone(requestData.parameters); + if ($Debug) { + deepFreeze(this.parameters); + } + + /** + * The HTTP method to use to make the request. The method is specified + * in upper-case letters. + * + * @type {string} + */ + this.method = requestData.method; + + /** + * The URL to which the request should be made. + * + * @type {string} + */ + this.url = requestData.url; + + /** + * The data to send to the server as the request's body. The field is + * {@code null} if the request should not carry any data in its body. + * + * @type {*} + */ + this.data = clone(requestData.data); + if ($Debug) { + if (this.data && typeof this.data === 'object') { + deepFreeze(this.data); + } + } + + /** + * The headers to send with the HTTP request to the server. These are + * extracted from the request options into this separate field for + * conveniency. + * + * @type {Object} + */ + this.headers = Object.assign({}, requestData.headers); + if ($Debug) { + Object.freeze(this.headers); + } + + /** + * HTTP request options, without the request headers. + * + * @type {{ + * timeout: number=, + * ttl: number=, + * repeatRequest: number=, + * cache: boolean=, + * withCredentials: boolean= + * }} + */ + this.options = Object.assign({}, requestData.options); + if ($Debug) { + Object.freeze(this.options); + } + + /** + * The REST API client configuration provided by the server. The field + * is set to {@code null} if no server-provided configuration is used. + * + * @type {?Object} + */ + this.serverConfiguration = clone(requestData.serverConfiguration); + if ($Debug) { + deepFreeze(this.serverConfiguration); + } + + if ($Debug) { + Object.freeze(this); + } + } +} diff --git a/packages/plugin-script-loader/.npmignore b/packages/plugin-script-loader/.npmignore index 1cc55f5f..ecc4c2be 100644 --- a/packages/plugin-script-loader/.npmignore +++ b/packages/plugin-script-loader/.npmignore @@ -1,13 +1,13 @@ -.idea/ -.vscode/ -.history/ -src/ -doc/ -coverage/ -.gitignore -gulpfile.js -jest.conf.json -preprocess.js -npm-debug.log -README.md -LICENSE.md +.idea/ +.vscode/ +.history/ +src/ +doc/ +coverage/ +.gitignore +gulpfile.js +jest.config.js +preprocess.js +npm-debug.log +README.md +LICENSE.md diff --git a/packages/plugin-script-loader/jest.conf.json b/packages/plugin-script-loader/jest.conf.json deleted file mode 100644 index aaf00abc..00000000 --- a/packages/plugin-script-loader/jest.conf.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 70, - "lines": 70, - "statements": 70 - } - }, - "testEnvironment": "node", - "setupFiles": [], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-script-loader/jest.config.js b/packages/plugin-script-loader/jest.config.js new file mode 100644 index 00000000..c6f8d822 --- /dev/null +++ b/packages/plugin-script-loader/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/packages/plugin-script-loader/package.json b/packages/plugin-script-loader/package.json index 7719a2d8..d575b2e7 100644 --- a/packages/plugin-script-loader/package.json +++ b/packages/plugin-script-loader/package.json @@ -4,10 +4,11 @@ "description": "Seznam IMA.js plugin for loading script", "main": "index.js", "scripts": { - "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.conf.json", + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.config.js", "lint": "../../node_modules/.bin/eslint './src/**/*.js' --fix", "doc": "../../node_modules/.bin/gulp doc", - "build": "../../node_modules/.bin/gulp build" + "prepare": "../../node_modules/.bin/rollup -c" }, "keywords": [ "IMA.js", @@ -28,11 +29,7 @@ "url": "https://github.com/seznam/IMA.js-plugins/issues" }, "license": "MIT", - "devDependencies": { - "@ima/core": "^17.0.0-rc.6", - "react": "^16.12.0", - "react-dom": "^16.12.0" - }, + "devDependencies": {}, "dependencies": { "@ima/plugin-resource-loader": "^1.0.0" }, diff --git a/packages/plugin-script-loader/rollup.config.js b/packages/plugin-script-loader/rollup.config.js new file mode 100644 index 00000000..4d00ce57 --- /dev/null +++ b/packages/plugin-script-loader/rollup.config.js @@ -0,0 +1,12 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/packages/plugin-select/.npmignore b/packages/plugin-select/.npmignore index 6dd99b00..48049d99 100644 --- a/packages/plugin-select/.npmignore +++ b/packages/plugin-select/.npmignore @@ -1,14 +1,14 @@ -.idea/ -.vscode/ -.history/ -src/ -doc/ -coverage/ -.gitignore -gulpfile.js -jest.conf.json -preprocess.js -jestSetupFile.js -npm-debug.log -README.md -LICENSE.md +.idea/ +.vscode/ +.history/ +src/ +doc/ +coverage/ +.gitignore +gulpfile.js +jest.config.js +preprocess.js +jestSetupFile.js +npm-debug.log +README.md +LICENSE.md diff --git a/packages/plugin-select/jest.conf.json b/packages/plugin-select/jest.conf.json deleted file mode 100644 index 7e755edd..00000000 --- a/packages/plugin-select/jest.conf.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 62, - "lines": 70, - "statements": 57 - } - }, - "testEnvironment": "jsdom", - "setupFiles": [ - "/jestSetupFile.js" - ], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "snapshotSerializers": ["/node_modules/enzyme-to-json/serializer"], - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-select/jest.config.js b/packages/plugin-select/jest.config.js new file mode 100644 index 00000000..5fce2135 --- /dev/null +++ b/packages/plugin-select/jest.config.js @@ -0,0 +1,8 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base, + testEnvironment: "jsdom", + setupFiles: ["/jestSetupFile.js"], + snapshotSerializers: ["/../../node_modules/enzyme-to-json/serializer"] +}; diff --git a/packages/plugin-select/package.json b/packages/plugin-select/package.json index 589c57e7..eb1894aa 100644 --- a/packages/plugin-select/package.json +++ b/packages/plugin-select/package.json @@ -4,10 +4,11 @@ "description": "The plugin selects extra props from page state to your component.", "main": "index.js", "scripts": { - "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.conf.json", + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.config.js", "lint": "../../node_modules/.bin/eslint './src/**/*.{js,jsx}' --fix", "doc": "../../node_modules/.bin/gulp doc", - "build": "../../node_modules/.bin/gulp build" + "prepare": "../../node_modules/.bin/rollup -c" }, "keywords": [ "IMA", @@ -29,15 +30,7 @@ "url": "https://github.com/seznam/IMA.js-plugins/issues" }, "license": "MIT", - "devDependencies": { - "enzyme": "3.10.0", - "enzyme-adapter-react-16": "^1.15.1", - "enzyme-to-json": "^3.4.3", - "@ima/core": "^17.0.0-rc.6", - "react": "16.11.0", - "react-dom": "16.12.0", - "to-mock": "^1.5.4" - }, + "devDependencies": {}, "browserify": { "transform": [ "babelify" diff --git a/packages/plugin-select/rollup.config.js b/packages/plugin-select/rollup.config.js new file mode 100644 index 00000000..4d00ce57 --- /dev/null +++ b/packages/plugin-select/rollup.config.js @@ -0,0 +1,12 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/packages/plugin-self-xss/.npmignore b/packages/plugin-self-xss/.npmignore index 1cc55f5f..ecc4c2be 100644 --- a/packages/plugin-self-xss/.npmignore +++ b/packages/plugin-self-xss/.npmignore @@ -1,13 +1,13 @@ -.idea/ -.vscode/ -.history/ -src/ -doc/ -coverage/ -.gitignore -gulpfile.js -jest.conf.json -preprocess.js -npm-debug.log -README.md -LICENSE.md +.idea/ +.vscode/ +.history/ +src/ +doc/ +coverage/ +.gitignore +gulpfile.js +jest.config.js +preprocess.js +npm-debug.log +README.md +LICENSE.md diff --git a/packages/plugin-self-xss/jest.conf.json b/packages/plugin-self-xss/jest.conf.json deleted file mode 100644 index aaf00abc..00000000 --- a/packages/plugin-self-xss/jest.conf.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 70, - "lines": 70, - "statements": 70 - } - }, - "testEnvironment": "node", - "setupFiles": [], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-self-xss/jest.config.js b/packages/plugin-self-xss/jest.config.js new file mode 100644 index 00000000..c6f8d822 --- /dev/null +++ b/packages/plugin-self-xss/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/packages/plugin-self-xss/package.json b/packages/plugin-self-xss/package.json index 6e7fc1ce..6c8449e1 100644 --- a/packages/plugin-self-xss/package.json +++ b/packages/plugin-self-xss/package.json @@ -4,10 +4,11 @@ "description": "The plugin is trying to mitigate Self-XSS security attack by sending simple message into console", "main": "index.js", "scripts": { - "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.conf.json", + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.config.js", "lint": "../../node_modules/.bin/eslint './src/**/*.js' --fix", "doc": "../../node_modules/.bin/gulp doc", - "build": "../../node_modules/.bin/gulp build" + "prepare": "../../node_modules/.bin/rollup -c" }, "keywords": [ "IMA", @@ -28,11 +29,7 @@ "url": "https://github.com/seznam/IMA.js-plugins/issues" }, "license": "MIT", - "devDependencies": { - "@ima/core": "^17.0.0-rc.6", - "react": "16.12.0", - "react-dom": "16.12.0" - }, + "devDependencies": {}, "browserify": { "transform": [ "babelify" diff --git a/packages/plugin-self-xss/rollup.config.js b/packages/plugin-self-xss/rollup.config.js new file mode 100644 index 00000000..4d00ce57 --- /dev/null +++ b/packages/plugin-self-xss/rollup.config.js @@ -0,0 +1,12 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/packages/plugin-shared-cache/.npmignore b/packages/plugin-shared-cache/.npmignore index eec94e74..b721a571 100755 --- a/packages/plugin-shared-cache/.npmignore +++ b/packages/plugin-shared-cache/.npmignore @@ -6,8 +6,8 @@ doc/ coverage/ .gitignore gulpfile.js -jest.conf.json +jest.config.js preprocess.js npm-debug.log README.md -LICENSE.md \ No newline at end of file +LICENSE.md diff --git a/packages/plugin-shared-cache/jest.conf.json b/packages/plugin-shared-cache/jest.conf.json deleted file mode 100755 index ea868ceb..00000000 --- a/packages/plugin-shared-cache/jest.conf.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 20, - "lines": 20, - "statements": 20 - } - }, - "testEnvironment": "node", - "setupFiles": [], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-shared-cache/jest.config.js b/packages/plugin-shared-cache/jest.config.js new file mode 100644 index 00000000..c6f8d822 --- /dev/null +++ b/packages/plugin-shared-cache/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/packages/plugin-shared-cache/package.json b/packages/plugin-shared-cache/package.json index f1d1df62..6ff7c4d8 100755 --- a/packages/plugin-shared-cache/package.json +++ b/packages/plugin-shared-cache/package.json @@ -4,10 +4,11 @@ "description": "A utility for creating caches that are shared between requests by all IMA.js application instances within the same node.js process.", "main": "index.js", "scripts": { - "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.conf.json", + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.config.js", "lint": "../../node_modules/.bin/eslint './src/**/*.js' --fix", "doc": "../../node_modules/.bin/gulp doc", - "build": "../../node_modules/.bin/gulp build" + "prepare": "../../node_modules/.bin/rollup -c" }, "repository": { "type": "git", @@ -29,9 +30,7 @@ "dependencies": { "clone": "^2.1.2" }, - "devDependencies": { - "@ima/gulp-task-loader": "^17.0.1" - }, + "devDependencies": {}, "engines": { "node": ">=6", "npm": ">=4 <7" diff --git a/packages/plugin-shared-cache/rollup.config.js b/packages/plugin-shared-cache/rollup.config.js new file mode 100644 index 00000000..4d00ce57 --- /dev/null +++ b/packages/plugin-shared-cache/rollup.config.js @@ -0,0 +1,12 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/packages/plugin-style-loader/.npmignore b/packages/plugin-style-loader/.npmignore index 1cc55f5f..ecc4c2be 100644 --- a/packages/plugin-style-loader/.npmignore +++ b/packages/plugin-style-loader/.npmignore @@ -1,13 +1,13 @@ -.idea/ -.vscode/ -.history/ -src/ -doc/ -coverage/ -.gitignore -gulpfile.js -jest.conf.json -preprocess.js -npm-debug.log -README.md -LICENSE.md +.idea/ +.vscode/ +.history/ +src/ +doc/ +coverage/ +.gitignore +gulpfile.js +jest.config.js +preprocess.js +npm-debug.log +README.md +LICENSE.md diff --git a/packages/plugin-style-loader/jest.conf.json b/packages/plugin-style-loader/jest.conf.json deleted file mode 100644 index aaf00abc..00000000 --- a/packages/plugin-style-loader/jest.conf.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 70, - "lines": 70, - "statements": 70 - } - }, - "testEnvironment": "node", - "setupFiles": [], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-style-loader/jest.config.js b/packages/plugin-style-loader/jest.config.js new file mode 100644 index 00000000..c6f8d822 --- /dev/null +++ b/packages/plugin-style-loader/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/packages/plugin-style-loader/package.json b/packages/plugin-style-loader/package.json index 011d682b..f688b607 100644 --- a/packages/plugin-style-loader/package.json +++ b/packages/plugin-style-loader/package.json @@ -4,10 +4,11 @@ "description": "Seznam IMA.js plugin for loading style", "main": "index.js", "scripts": { - "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.conf.json", + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.config.js", "lint": "../../node_modules/.bin/eslint './src/**/*.js' --fix", "doc": "../../node_modules/.bin/gulp doc", - "build": "../../node_modules/.bin/gulp build" + "prepare": "../../node_modules/.bin/rollup -c" }, "keywords": [ "IMA.js", @@ -34,11 +35,7 @@ "url": "https://github.com/seznam/IMA.js-plugins/issues" }, "license": "MIT", - "devDependencies": { - "@ima/core": "^17.0.0-rc.6", - "react": "^16.12.0", - "react-dom": "^16.12.0" - }, + "devDependencies": {}, "dependencies": { "@ima/plugin-resource-loader": "^1.0.0" }, diff --git a/packages/plugin-style-loader/rollup.config.js b/packages/plugin-style-loader/rollup.config.js new file mode 100644 index 00000000..4d00ce57 --- /dev/null +++ b/packages/plugin-style-loader/rollup.config.js @@ -0,0 +1,12 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/packages/plugin-testing-integration/.npmignore b/packages/plugin-testing-integration/.npmignore index 1cc55f5f..ecc4c2be 100644 --- a/packages/plugin-testing-integration/.npmignore +++ b/packages/plugin-testing-integration/.npmignore @@ -1,13 +1,13 @@ -.idea/ -.vscode/ -.history/ -src/ -doc/ -coverage/ -.gitignore -gulpfile.js -jest.conf.json -preprocess.js -npm-debug.log -README.md -LICENSE.md +.idea/ +.vscode/ +.history/ +src/ +doc/ +coverage/ +.gitignore +gulpfile.js +jest.config.js +preprocess.js +npm-debug.log +README.md +LICENSE.md diff --git a/packages/plugin-testing-integration/jest.conf.json b/packages/plugin-testing-integration/jest.conf.json deleted file mode 100644 index dec57069..00000000 --- a/packages/plugin-testing-integration/jest.conf.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 8, - "lines": 20, - "statements": 20 - } - }, - "testEnvironment": "node", - "setupFiles": [], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-testing-integration/jest.config.js b/packages/plugin-testing-integration/jest.config.js new file mode 100644 index 00000000..c6f8d822 --- /dev/null +++ b/packages/plugin-testing-integration/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/packages/plugin-testing-integration/package.json b/packages/plugin-testing-integration/package.json index c13b107d..2ddaa223 100644 --- a/packages/plugin-testing-integration/package.json +++ b/packages/plugin-testing-integration/package.json @@ -4,10 +4,11 @@ "description": "IMA.js plugin for integration testing", "main": "index.js", "scripts": { - "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.conf.json", + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.config.js", "lint": "../../node_modules/.bin/eslint 'src/**/*.js' *.js --fix", "doc": "../../node_modules/.bin/gulp doc", - "build": "../../node_modules/.bin/gulp build" + "prepare": "../../node_modules/.bin/rollup -c" }, "keywords": [ "IMA.js", @@ -35,11 +36,7 @@ "url": "https://github.com/seznam/IMA.js-plugins/issues" }, "license": "MIT", - "devDependencies": { - "@ima/core": "^17.0.1", - "react": "^16.13.0", - "react-dom": "^16.13.0" - }, + "devDependencies": {}, "engines": { "node": ">=6", "npm": ">=4 <7" diff --git a/packages/plugin-testing-integration/rollup.config.js b/packages/plugin-testing-integration/rollup.config.js new file mode 100644 index 00000000..6fb97049 --- /dev/null +++ b/packages/plugin-testing-integration/rollup.config.js @@ -0,0 +1,15 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + external: [ + 'path' + ], + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/packages/plugin-useragent/.npmignore b/packages/plugin-useragent/.npmignore index eec94e74..ecc4c2be 100644 --- a/packages/plugin-useragent/.npmignore +++ b/packages/plugin-useragent/.npmignore @@ -1,13 +1,13 @@ -.idea/ -.vscode/ -.history/ -src/ -doc/ -coverage/ -.gitignore -gulpfile.js -jest.conf.json -preprocess.js -npm-debug.log -README.md -LICENSE.md \ No newline at end of file +.idea/ +.vscode/ +.history/ +src/ +doc/ +coverage/ +.gitignore +gulpfile.js +jest.config.js +preprocess.js +npm-debug.log +README.md +LICENSE.md diff --git a/packages/plugin-useragent/jest.conf.json b/packages/plugin-useragent/jest.conf.json deleted file mode 100644 index ea868ceb..00000000 --- a/packages/plugin-useragent/jest.conf.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 20, - "lines": 20, - "statements": 20 - } - }, - "testEnvironment": "node", - "setupFiles": [], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-useragent/jest.config.js b/packages/plugin-useragent/jest.config.js new file mode 100644 index 00000000..c6f8d822 --- /dev/null +++ b/packages/plugin-useragent/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/packages/plugin-useragent/package.json b/packages/plugin-useragent/package.json index 9744268e..58b2897f 100644 --- a/packages/plugin-useragent/package.json +++ b/packages/plugin-useragent/package.json @@ -4,10 +4,11 @@ "description": "Seznam IMA.js plugin user-agent", "main": "index.js", "scripts": { - "test": "../../node_modules/.bin/jest --config=jest.conf.json", + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --config=jest.config.js", "lint": "../../node_modules/.bin/eslint './src/**/*.js' --fix", "doc": "../../node_modules/.bin/gulp doc", - "build": "../../node_modules/.bin/gulp build" + "prepare": "../../node_modules/.bin/rollup -c" }, "keywords": [ "IMA.js", diff --git a/packages/plugin-useragent/rollup.config.js b/packages/plugin-useragent/rollup.config.js new file mode 100644 index 00000000..4d00ce57 --- /dev/null +++ b/packages/plugin-useragent/rollup.config.js @@ -0,0 +1,12 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/packages/plugin-websocket/.npmignore b/packages/plugin-websocket/.npmignore index 6dd99b00..74e3395f 100644 --- a/packages/plugin-websocket/.npmignore +++ b/packages/plugin-websocket/.npmignore @@ -6,7 +6,7 @@ doc/ coverage/ .gitignore gulpfile.js -jest.conf.json +jest.config.js preprocess.js jestSetupFile.js npm-debug.log diff --git a/packages/plugin-websocket/jest.conf.json b/packages/plugin-websocket/jest.conf.json deleted file mode 100644 index 13a5eea7..00000000 --- a/packages/plugin-websocket/jest.conf.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 30, - "lines": 40, - "statements": 40 - } - }, - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-websocket/jest.config.js b/packages/plugin-websocket/jest.config.js new file mode 100644 index 00000000..c6f8d822 --- /dev/null +++ b/packages/plugin-websocket/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/packages/plugin-websocket/package.json b/packages/plugin-websocket/package.json index 71c322dd..d5ea36be 100644 --- a/packages/plugin-websocket/package.json +++ b/packages/plugin-websocket/package.json @@ -4,10 +4,11 @@ "description": "Simple WebSocket server and client for IMA.js", "main": "index.js", "scripts": { - "test": "node_modules/.bin/jest --coverage --no-watchman --config=jest.conf.json", - "lint": "node_modules/.bin/eslint './src/**/*.{js,jsx}' --fix", - "doc": "node_modules/.bin/gulp doc", - "build": "node_modules/.bin/gulp build" + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.config.js", + "lint": "../../node_modules/.bin/eslint './src/**/*.{js,jsx}' --fix", + "doc": "../../node_modules/.bin/gulp doc", + "prepare": "../../node_modules/.bin/rollup -c" }, "keywords": [ "websocket", @@ -29,20 +30,7 @@ "url": "https://github.com/seznam/IMA.js-plugins/issues" }, "license": "MIT", - "devDependencies": { - "@ima/core": "^17.0.0-rc.6", - "eslint": "^6.7.2", - "eslint-config-prettier": "^6.7.0", - "eslint-plugin-jasmine": "^4.1.0", - "eslint-plugin-jest": "^23.1.1", - "eslint-plugin-prettier": "^3.1.1", - "gulp": "^4.0.2", - "jest": "^24.9.0", - "prettier": "^1.19.1", - "react": "^16.12.0", - "react-dom": "^16.12.0", - "to-mock": "^1.5.4" - }, + "devDependencies": {}, "dependencies": { "ws": "^7.2.0" }, diff --git a/packages/plugin-websocket/rollup.config.js b/packages/plugin-websocket/rollup.config.js new file mode 100644 index 00000000..4d00ce57 --- /dev/null +++ b/packages/plugin-websocket/rollup.config.js @@ -0,0 +1,12 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/packages/plugin-xhr/.npmignore b/packages/plugin-xhr/.npmignore index 1cc55f5f..ecc4c2be 100644 --- a/packages/plugin-xhr/.npmignore +++ b/packages/plugin-xhr/.npmignore @@ -1,13 +1,13 @@ -.idea/ -.vscode/ -.history/ -src/ -doc/ -coverage/ -.gitignore -gulpfile.js -jest.conf.json -preprocess.js -npm-debug.log -README.md -LICENSE.md +.idea/ +.vscode/ +.history/ +src/ +doc/ +coverage/ +.gitignore +gulpfile.js +jest.config.js +preprocess.js +npm-debug.log +README.md +LICENSE.md diff --git a/packages/plugin-xhr/jest.conf.json b/packages/plugin-xhr/jest.conf.json deleted file mode 100644 index cd878b21..00000000 --- a/packages/plugin-xhr/jest.conf.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "bail": true, - "verbose": true, - "coverageThreshold": { - "global": { - "functions": 5, - "lines": 5, - "statements": 5 - } - }, - "testEnvironment": "node", - "setupFiles": [], - "modulePaths": [ - "/" - ], - "transform": { - "\\.jsx?": "/../../preprocess.js" - }, - "testPathIgnorePatterns": ["__snapshots__", "/node_modules/"], - "testRegex": "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$" -} diff --git a/packages/plugin-xhr/jest.config.js b/packages/plugin-xhr/jest.config.js new file mode 100644 index 00000000..c6f8d822 --- /dev/null +++ b/packages/plugin-xhr/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base +}; diff --git a/packages/plugin-xhr/package.json b/packages/plugin-xhr/package.json index 797f0f26..979eecbb 100644 --- a/packages/plugin-xhr/package.json +++ b/packages/plugin-xhr/package.json @@ -4,10 +4,11 @@ "description": "Helper plugin simplifying the usage of the XMLHttpRequest API.", "main": "index.js", "scripts": { - "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.conf.json", + "build": "echo \"Release process is supported only via lerna command. See README.md for more info.\"; exit 1", + "test": "../../node_modules/.bin/jest --coverage --no-watchman --config=jest.config.js", "lint": "../../node_modules/.bin/eslint './src/**/*.js' --fix", "doc": "../../node_modules/.bin/gulp doc", - "build": "../../node_modules/.bin/gulp build" + "prepare": "../../node_modules/.bin/rollup -c" }, "repository": { "type": "git", @@ -36,11 +37,7 @@ "access": "public" }, "homepage": "https://github.com/seznam/IMA.js-plugins#readme", - "devDependencies": { - "@ima/core": "^17.0.0-rc.6", - "react": "^16.12.0", - "react-dom": "^16.12.0" - }, + "devDependencies": {}, "dependencies": {}, "peerDependencies": { "@ima/core": "*" diff --git a/packages/plugin-xhr/rollup.config.js b/packages/plugin-xhr/rollup.config.js new file mode 100644 index 00000000..4d00ce57 --- /dev/null +++ b/packages/plugin-xhr/rollup.config.js @@ -0,0 +1,12 @@ +import common from '../../rollup.config.common'; + +export default Object.assign( + {}, + common, + { + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + } + }); diff --git a/rollup.config.common.js b/rollup.config.common.js new file mode 100644 index 00000000..679e41c4 --- /dev/null +++ b/rollup.config.common.js @@ -0,0 +1,48 @@ +import resolve from '@rollup/plugin-node-resolve'; +import commonjs from '@rollup/plugin-commonjs'; +import json from '@rollup/plugin-json'; +import babel from '@rollup/plugin-babel'; +import peerDepsExternal from 'rollup-plugin-peer-deps-external'; + +const onwarn = warning => { + // Silence circular dependency warning for moment package + if ( + warning.code === 'CIRCULAR_DEPENDENCY' + ) { + return + } + + console.warn(`(!) ${warning.message}`) +} + +export default { + cache: true, + input: 'src/main.js', + onwarn, + output: { + file: 'dist/main.js', + format: 'cjs', + exports: 'named' + }, + treeshake: true, + plugins: [ + peerDepsExternal({ + includeDependencies: true + }), + resolve({ + extensions: ['.mjs', '.js', '.jsx', '.json'], + preferBuiltins: true + }), + babel({ + babelHelpers: 'bundled', + moduleIds: true, + presets: ['@babel/preset-react'], + }), + json({ + preferConst: true, // Default: false + compact: true, // Default: false + namedExports: true, // Default: true + }), + commonjs() + ], +}