Skip to content

Commit

Permalink
feat: 🎸 Unified build and release process via rollup and lerna
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasPan committed Jun 8, 2020
1 parent 8e64790 commit df277ce
Show file tree
Hide file tree
Showing 107 changed files with 920 additions and 917 deletions.
24 changes: 19 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion _templates/plugin/create/.npmignore.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ doc/
coverage/
.gitignore
gulpfile.js
jest.conf.json
jest.config.js
preprocess.js
jestSetupFile.js
npm-debug.log
Expand Down
24 changes: 0 additions & 24 deletions _templates/plugin/create/jest.conf.json.t

This file was deleted.

8 changes: 8 additions & 0 deletions _templates/plugin/create/jest.config.js.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
to: packages/<%= h.changeCase.paramCase(name) %>/jest.config.js
---
const base = require("../../jest.config.base.js");

module.exports = {
...base
};
5 changes: 3 additions & 2 deletions _templates/plugin/create/package.json.t
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 16 additions & 0 deletions _templates/plugin/create/rollup.config.js.t
Original file line number Diff line number Diff line change
@@ -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'
}
});
12 changes: 12 additions & 0 deletions jest.config.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
bail: true,
verbose: true,
testRegex: "(/src(/?[^/]*){0,5}/__tests__/).*Spec\\.jsx?$",
modulePaths: [
"<rootDir>/"
],
transform: {
"\\.jsx?": "<rootDir>/../../preprocess.js"
},
testEnvironment: "node"
};
14 changes: 14 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
verbose: true,
projects:
[
"<rootDir>/packages/*/jest.config.js"
],
coverageThreshold: {
global: {
functions: 65,
lines: 75,
statements: 75
}
}
};
30 changes: 18 additions & 12 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -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"
}
60 changes: 48 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
26 changes: 13 additions & 13 deletions packages/babel-plugin-ima-logger/.npmignore
Original file line number Diff line number Diff line change
@@ -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
21 changes: 0 additions & 21 deletions packages/babel-plugin-ima-logger/jest.conf.json

This file was deleted.

5 changes: 5 additions & 0 deletions packages/babel-plugin-ima-logger/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const base = require("../../jest.config.base.js");

module.exports = {
...base
};
9 changes: 4 additions & 5 deletions packages/babel-plugin-ima-logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down
12 changes: 12 additions & 0 deletions packages/babel-plugin-ima-logger/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import common from '../../rollup.config.common';

export default Object.assign(
{},
common,
{
output: {
file: 'dist/main.js',
format: 'cjs',
exports: 'named'
}
});
26 changes: 13 additions & 13 deletions packages/plugin-analytic-fb-pixel/.npmignore
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit df277ce

Please sign in to comment.