├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitattributes ├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── .huskyrc.json ├── .nvmrc ├── .prettierrc.json ├── .yarnrc ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── babel.config.js ├── babel.server.config.js ├── bin └── voltran.js ├── browserslist ├── changelog-template.hbs ├── config ├── string.js └── styles.js ├── fileMock.js ├── jest.config.js ├── jsconfig.json ├── lib ├── cli.js ├── config.js ├── os.js └── tools │ └── prom.js ├── package.json ├── postcss.config.js ├── setupTests.js ├── src ├── api │ └── controllers │ │ └── index.js ├── assets │ ├── .gitkeep │ ├── hepsiburada.png │ ├── hepsitech.png │ └── voltran-logo.png ├── client │ └── client.js ├── index.js ├── main.js ├── metrics.js ├── public │ └── .gitkeep ├── render.js ├── renderMultiple.js ├── server.js ├── tools │ ├── bundle.js │ ├── clean.js │ ├── lib │ │ └── fs.js │ ├── run.js │ ├── start.js │ └── task.js └── universal │ ├── common │ └── network │ │ └── apiUtils.js │ ├── components │ ├── App.js │ ├── ClientApp.js │ ├── Html.js │ ├── Preview.js │ ├── PureHtml.js │ └── route │ │ └── HbRoute.js │ ├── core │ ├── api │ │ ├── ApiManager.js │ │ ├── ClientApiManager.js │ │ ├── ClientApiManagerCache.js │ │ ├── ServerApiManager.js │ │ └── ServerApiManagerCache.js │ ├── cache │ │ ├── cacheManager.js │ │ └── cacheUtils.js │ ├── react │ │ └── ReactRenderContext.js │ └── route │ │ ├── routeConstants.js │ │ ├── routeUtils.js │ │ └── routesWithComponents.js │ ├── model │ ├── Component.js │ ├── Renderer.js │ └── Request.js │ ├── partials │ ├── Welcome │ │ ├── PartialList.js │ │ ├── Welcome.js │ │ ├── index.js │ │ ├── partials.js │ │ └── styled.js │ └── withBaseComponent.js │ ├── requests │ └── .gitkeep │ ├── routes │ └── routes.js │ ├── service │ └── RenderService.js │ ├── tools │ └── newrelic │ │ └── newrelic.js │ └── utils │ ├── baseRenderHtml.js │ ├── constants.js │ ├── helper.js │ ├── logger.js │ └── struct.js ├── webpack.client.config.js ├── webpack.common.config.js └── webpack.server.config.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # http://editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | 9 | # Change these settings to your own preference 10 | indent_style = space 11 | indent_size = 2 12 | 13 | # We recommend you to keep these unchanged 14 | end_of_line = lf 15 | charset = utf-8 16 | trim_trailing_whitespace = true 17 | insert_final_newline = true 18 | 19 | # editorconfig-tools is unable to ignore longs strings or urls 20 | max_line_length = null 21 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | src/public 3 | src/tools 4 | webpack.client.config.js 5 | webpack.common.config.js 6 | webpack.server.config.js 7 | babel.config.js 8 | babel.server.config.js 9 | postcss.config.js 10 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parser: 'babel-eslint', 3 | extends: ['airbnb', 'prettier'], 4 | globals: { 5 | hwindow: true, 6 | document: true, 7 | window: true, 8 | hepsiBus: true, 9 | global: true, 10 | jest: true, 11 | }, 12 | parserOptions: { 13 | ecmaFeatures: { 14 | jsx: true 15 | }, 16 | ecmaVersion: 2018, 17 | sourceType: 'module' 18 | }, 19 | plugins: ['react', 'prettier'], 20 | rules: { 21 | 'prettier/prettier': ['error'], 22 | 'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }], 23 | 'react/jsx-props-no-spreading': 'off', 24 | 'react/no-array-index-key': 'off', 25 | 'jsx-a11y/control-has-associated-label': 'off', 26 | 'jsx-a11y/anchor-has-content': 'off', 27 | 'jsx-a11y/anchor-is-valid': 'off', 28 | 'jsx-a11y/label-has-associated-control': 'off', 29 | 'jsx-a11y/no-noninteractive-element-interactions': 'off', 30 | 'class-methods-use-this': 'warn', 31 | 'import/no-extraneous-dependencies': ['off'], 32 | 'import/no-unresolved': ['off'], 33 | 'import/extensions': ['off'], 34 | 'import/order': ['off'], 35 | 'jsx-a11y/click-events-have-key-events': 'off', 36 | 'react/no-children-prop': 'off', 37 | 'react/no-unescaped-entities': 'off', 38 | 'react/require-default-props': 'off', 39 | 'react/forbid-prop-types': 'off', 40 | 'react/prop-types': 'off', 41 | 'react/jsx-one-expression-per-line': 'off', 42 | 'jsx-a11y/no-static-element-interactions': 'off', 43 | 'no-shadow': 'off', 44 | 'no-use-before-define': 'off', 45 | 'no-unused-expressions': 'off', 46 | 'no-nested-ternary': 'off', 47 | 'no-underscore-dangle': 'off', 48 | 'consistent-return': 'off', 49 | 'array-callback-return': 'off' 50 | }, 51 | env: { 52 | jest: true, 53 | browser: true, 54 | node: true, 55 | es6: true 56 | } 57 | }; 58 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Automatically normalize line endings for all text-based files 2 | # http://git-scm.com/docs/gitattributes#_end_of_line_conversion 3 | * text=auto 4 | 5 | # For the following file types, normalize line endings to LF on 6 | # checkin and prevent conversion to CRLF when they are checked out 7 | # (this is required in order to prevent newline related issues like, 8 | # for example, after the build script is run) 9 | .* text eol=lf 10 | *.html text eol=lf 11 | *.css text eol=lf 12 | *.less text eol=lf 13 | *.styl text eol=lf 14 | *.scss text eol=lf 15 | *.sass text eol=lf 16 | *.sss text eol=lf 17 | *.js text eol=lf 18 | *.jsx text eol=lf 19 | *.json text eol=lf 20 | *.md text eol=lf 21 | *.mjs text eol=lf 22 | *.sh text eol=lf 23 | *.svg text eol=lf 24 | *.txt text eol=lf 25 | *.xml text eol=lf 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | node_modules/ 3 | # Compiled output 4 | build 5 | 6 | # Runtime data 7 | database.sqlite 8 | 9 | # Test coverage 10 | coverage 11 | 12 | # Logs 13 | npm-debug.log* 14 | yarn-debug.log* 15 | yarn-error.log* 16 | 17 | # Editors and IDEs 18 | .idea 19 | .vscode/* 20 | !.vscode/settings.json 21 | !.vscode/tasks.json 22 | !.vscode/launch.json 23 | !.vscode/extensions.json 24 | 25 | # Misc 26 | .DS_Store 27 | 28 | src/universal/assets.json 29 | src/universal/appConfig.js 30 | 31 | package-lock.json 32 | yarn.lock 33 | demo 34 | voltran.config.js -------------------------------------------------------------------------------- /.huskyrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "hooks": { 3 | "pre-push": "yarn run" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | v14.7.0 2 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 100, 3 | "singleQuote": true 4 | } 5 | -------------------------------------------------------------------------------- /.yarnrc: -------------------------------------------------------------------------------- 1 | registry "https://registry.npmjs.com/" 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.1.10](https://github.com/hepsiburada/VoltranJS/compare/1.1.6...1.1.10) 4 | 5 | ### Commits 6 | 7 | - feat: cors policy added [`b00e710`](https://github.com/hepsiburada/VoltranJS/commit/b00e710a4dea603ccf017da0cf9c18910c6a9e9d) 8 | - feat: preview mode env control [`0999ad8`](https://github.com/hepsiburada/VoltranJS/commit/0999ad8d279f697a3ccf556ad5fe255ec89fadb7) 9 | - feat: update version [`d631a88`](https://github.com/hepsiburada/VoltranJS/commit/d631a885957fb5e0b481b53e42e3a878316be717) 10 | - feat: change cors policy [`216a339`](https://github.com/hepsiburada/VoltranJS/commit/216a339308b05ab25df70f62e6f12c1295c457ca) 11 | 12 | ## [1.1.6](https://github.com/hepsiburada/VoltranJS/compare/1.1.5...1.1.6) - 2023-10-17 13 | 14 | ### Merged 15 | 16 | - feat: update node-sass version [`#53`](https://github.com/hepsiburada/VoltranJS/pull/53) 17 | 18 | ### Commits 19 | 20 | - chore: update changelog [`3211ddf`](https://github.com/hepsiburada/VoltranJS/commit/3211ddfd561c0830e33667ea1f5ab6fff7aa0a7d) 21 | 22 | ## [1.1.5](https://github.com/hepsiburada/VoltranJS/compare/v1.1.5...1.1.5) - 2022-10-13 23 | 24 | ### Commits 25 | 26 | - updated changelog [`b65ad82`](https://github.com/hepsiburada/VoltranJS/commit/b65ad827c15e8e88bc9a05f1c16b5f6cc86bc9ee) 27 | 28 | ## [v1.1.5](https://github.com/hepsiburada/VoltranJS/compare/1.1.4...v1.1.5) - 2022-10-13 29 | 30 | ### Merged 31 | 32 | - feat: some package version updates for vulnerabilities [`#51`](https://github.com/hepsiburada/VoltranJS/pull/51) 33 | 34 | ## [1.1.4](https://github.com/hepsiburada/VoltranJS/compare/v1.1.4...1.1.4) - 2022-10-06 35 | 36 | ### Commits 37 | 38 | - chore: update changelog [`ab5a7b0`](https://github.com/hepsiburada/VoltranJS/commit/ab5a7b0094231bb6a562f9a45e9bd71494d18581) 39 | 40 | ## [v1.1.4](https://github.com/hepsiburada/VoltranJS/compare/1.1.3...v1.1.4) - 2022-10-06 41 | 42 | ### Merged 43 | 44 | - feat(newrelic): version upgrade [`#50`](https://github.com/hepsiburada/VoltranJS/pull/50) 45 | 46 | ## [1.1.3](https://github.com/hepsiburada/VoltranJS/compare/1.1.2...1.1.3) - 2022-07-07 47 | 48 | ### Merged 49 | 50 | - fixed bundle analyze automatically open report in default browser [`#48`](https://github.com/hepsiburada/VoltranJS/pull/48) 51 | 52 | ### Commits 53 | 54 | - chore: update changelog [`41856aa`](https://github.com/hepsiburada/VoltranJS/commit/41856aabc95630a2929482170e3a5e2e599c25fc) 55 | 56 | ## [1.1.2](https://github.com/hepsiburada/VoltranJS/compare/1.1.1...1.1.2) - 2022-06-29 57 | 58 | ### Merged 59 | 60 | - webpack budnle analyze static file added [`#47`](https://github.com/hepsiburada/VoltranJS/pull/47) 61 | 62 | ### Commits 63 | 64 | - chore: update changelog [`41300a5`](https://github.com/hepsiburada/VoltranJS/commit/41300a543d216914e9debe2148b205c5bebbd47f) 65 | 66 | ## [1.1.1](https://github.com/hepsiburada/VoltranJS/compare/1.0.29...1.1.1) - 2022-06-28 67 | 68 | ### Merged 69 | 70 | - Feature/upgrade to webpack5 [`#46`](https://github.com/hepsiburada/VoltranJS/pull/46) 71 | 72 | ### Commits 73 | 74 | - string-replace-loader upgraded to last version [`2840d9e`](https://github.com/hepsiburada/VoltranJS/commit/2840d9ec27b4925d39eb2dfe23d6fda0d163578f) 75 | - Upgrade webpack 5, [`5f4ca9d`](https://github.com/hepsiburada/VoltranJS/commit/5f4ca9dd08e6e116d0c3bd5fdea554edb6acd7aa) 76 | 77 | ## [1.0.29](https://github.com/hepsiburada/VoltranJS/compare/1.0.27...1.0.29) - 2022-04-21 78 | 79 | ### Merged 80 | 81 | - Newrelic transaction for all routes [`#45`](https://github.com/hepsiburada/VoltranJS/pull/45) 82 | 83 | ## [1.0.27](https://github.com/hepsiburada/VoltranJS/compare/1.0.26...1.0.27) - 2022-04-13 84 | 85 | ### Commits 86 | 87 | - Add description of new relic integration on README. Fix importing function problem about newrelic on server.js [`ab7c472`](https://github.com/hepsiburada/VoltranJS/commit/ab7c4720a8c20439afeb7180c1bc10fd73daeab1) 88 | - Update version to 1.0.28 [`38ec211`](https://github.com/hepsiburada/VoltranJS/commit/38ec21196d824e8462a83a38481fd9534ce99aee) 89 | - Fix changelog issue. [`ec94706`](https://github.com/hepsiburada/VoltranJS/commit/ec947068aee79476a7265c405c811651c3ae54f8) 90 | 91 | ## [1.0.26](https://github.com/hepsiburada/VoltranJS/compare/1.0.25...1.0.26) - 2022-04-12 92 | 93 | ### Merged 94 | 95 | - Add error message attribute on newrelic errors. [`#44`](https://github.com/hepsiburada/VoltranJS/pull/44) 96 | - feat: remove headers message on rendered html [`#43`](https://github.com/hepsiburada/VoltranJS/pull/43) 97 | - Reduced the size of the 'Client.js' file [`#39`](https://github.com/hepsiburada/VoltranJS/pull/39) 98 | 99 | ### Commits 100 | 101 | - Add json option on error messages for newrelic [`54416a9`](https://github.com/hepsiburada/VoltranJS/commit/54416a955a498aea74574ce03fd435ea63b6c7fc) 102 | - Update changelog for 1.0.27 version [`969958e`](https://github.com/hepsiburada/VoltranJS/commit/969958e531ab99fa4d9722eee48773aa89054dd4) 103 | 104 | ## [1.0.25](https://github.com/hepsiburada/VoltranJS/compare/1.0.24...1.0.25) - 2022-02-11 105 | 106 | ### Merged 107 | 108 | - feat: added criticalCss query params feature [`#38`](https://github.com/hepsiburada/VoltranJS/pull/38) 109 | 110 | ## [1.0.24](https://github.com/hepsiburada/VoltranJS/compare/1.0.23...1.0.24) - 2022-02-07 111 | 112 | ### Merged 113 | 114 | - Fix: Lodash dep. removed and replaced with native functions [`#36`](https://github.com/hepsiburada/VoltranJS/pull/36) 115 | 116 | ### Commits 117 | 118 | - - Lodash changed with native functions. [`3f12087`](https://github.com/hepsiburada/VoltranJS/commit/3f12087204c109b5da74661ad1d62bda74b312b7) 119 | - chore: update changelog [`15d0b1e`](https://github.com/hepsiburada/VoltranJS/commit/15d0b1ec8a6132d61cbdbac276c6a753ac489123) 120 | - version upgrade [`2049fd5`](https://github.com/hepsiburada/VoltranJS/commit/2049fd58b9a71c6fdf87c728db5fd950d689ece2) 121 | 122 | ## [1.0.23](https://github.com/hepsiburada/VoltranJS/compare/1.0.22...1.0.23) - 2022-01-04 123 | 124 | ### Merged 125 | 126 | - Css files with array for react lazy and suspense usage [`#34`](https://github.com/hepsiburada/VoltranJS/pull/34) 127 | 128 | ### Commits 129 | 130 | - Code refactor [`416b52b`](https://github.com/hepsiburada/VoltranJS/commit/416b52bf320737d4de854d694e658a4db3c253cb) 131 | - Css files with array [`1c60f25`](https://github.com/hepsiburada/VoltranJS/commit/1c60f250f025b6cea774d83077819f5255c960aa) 132 | - Version upgrade [`6699d87`](https://github.com/hepsiburada/VoltranJS/commit/6699d8745305493df5eb543deb1d122c4b4f3169) 133 | 134 | ## [1.0.22](https://github.com/hepsiburada/VoltranJS/compare/1.0.21...1.0.22) - 2021-11-16 135 | 136 | ### Merged 137 | 138 | - fix: welcome page reverted [`#31`](https://github.com/hepsiburada/VoltranJS/pull/31) 139 | 140 | ## [1.0.21](https://github.com/hepsiburada/VoltranJS/compare/1.0.20...1.0.21) - 2021-11-11 141 | 142 | ### Merged 143 | 144 | - feat: removed user agent on initial state [`#30`](https://github.com/hepsiburada/VoltranJS/pull/30) 145 | 146 | ### Commits 147 | 148 | - feat: updated voltran version [`a44c5e3`](https://github.com/hepsiburada/VoltranJS/commit/a44c5e31d129913b40a545e513c0b060fc25275c) 149 | 150 | ## [1.0.20](https://github.com/hepsiburada/VoltranJS/compare/1.0.19...1.0.20) - 2021-11-11 151 | 152 | ### Merged 153 | 154 | - feat: removed user agent on initial state [`#30`](https://github.com/hepsiburada/VoltranJS/pull/30) 155 | 156 | ## [1.0.19](https://github.com/hepsiburada/VoltranJS/compare/1.0.18...1.0.19) - 2021-10-27 157 | 158 | ### Merged 159 | 160 | - feat:welcome page is hidden in production environment [`#28`](https://github.com/hepsiburada/VoltranJS/pull/28) 161 | 162 | ### Commits 163 | 164 | - chore: version updated [`70cf0ed`](https://github.com/hepsiburada/VoltranJS/commit/70cf0ed1f87bd6cdfefad7de3d52aa2df397b72b) 165 | 166 | ## [1.0.18](https://github.com/hepsiburada/VoltranJS/compare/1.0.17...1.0.18) - 2021-09-08 167 | 168 | ### Merged 169 | 170 | - fixed regenerator-runtime [`#26`](https://github.com/hepsiburada/VoltranJS/pull/26) 171 | 172 | ### Commits 173 | 174 | - chore: update changelog [`4b1cd93`](https://github.com/hepsiburada/VoltranJS/commit/4b1cd93bf29c0c1ec831b435599f3bb5bb15c8ff) 175 | 176 | ## [1.0.17](https://github.com/hepsiburada/VoltranJS/compare/1.0.16...1.0.17) - 2021-09-06 177 | 178 | ### Merged 179 | 180 | - pass headers in fragments [`#27`](https://github.com/hepsiburada/VoltranJS/pull/27) 181 | 182 | ### Commits 183 | 184 | - chore: update changelog [`3a6f319`](https://github.com/hepsiburada/VoltranJS/commit/3a6f3196100385e25b8d08085b4f5e034564db56) 185 | 186 | ## [1.0.16](https://github.com/hepsiburada/VoltranJS/compare/v1.0.16...1.0.16) - 2021-08-23 187 | 188 | ### Commits 189 | 190 | - Update changelog [`717c909`](https://github.com/hepsiburada/VoltranJS/commit/717c9090983e84d29346a43ccdaf4d3fdc6c858d) 191 | 192 | ## [v1.0.16](https://github.com/hepsiburada/VoltranJS/compare/1.0.13...v1.0.16) - 2021-08-23 193 | 194 | ### Merged 195 | 196 | - set-cookie header imported to cookies [`#25`](https://github.com/hepsiburada/VoltranJS/pull/25) 197 | - Undefined SassResources bug [`#23`](https://github.com/hepsiburada/VoltranJS/pull/23) 198 | 199 | ### Commits 200 | 201 | - voltranConfig.sassResources undefined bug fixed. [`acb50ef`](https://github.com/hepsiburada/VoltranJS/commit/acb50efb72227a759663eef15be48afc4b26e132) 202 | - chore: update changelog [`f3501ad`](https://github.com/hepsiburada/VoltranJS/commit/f3501ad944fe8f186acdce498e82ec131e09ff51) 203 | - Version upgrade [`b4aad6f`](https://github.com/hepsiburada/VoltranJS/commit/b4aad6f1cbc30c22c547529e9f86bd267f0559b1) 204 | 205 | ## [1.0.13](https://github.com/hepsiburada/VoltranJS/compare/v1.0.13...1.0.13) - 2021-08-03 206 | 207 | ### Commits 208 | 209 | - chore: update changelog [`94a3f7a`](https://github.com/hepsiburada/VoltranJS/commit/94a3f7a0e76363fd6fc7fb22bd80dd5f34b228d9) 210 | 211 | ## [v1.0.13](https://github.com/hepsiburada/VoltranJS/compare/1.0.12...v1.0.13) - 2021-08-03 212 | 213 | ### Merged 214 | 215 | - sass-resources-loader implementation. [`#22`](https://github.com/hepsiburada/VoltranJS/pull/22) 216 | 217 | ### Commits 218 | 219 | - sass-resource-loader implementation is done. Updated read me according to new config. [`cc97ef5`](https://github.com/hepsiburada/VoltranJS/commit/cc97ef506b03be4db82c0044b12301a22eb97085) 220 | 221 | ## [1.0.12](https://github.com/hepsiburada/VoltranJS/compare/1.0.11...1.0.12) - 2021-07-30 222 | 223 | ### Merged 224 | 225 | - VoltranJS serverConfig file fixed. [`#21`](https://github.com/hepsiburada/VoltranJS/pull/21) 226 | 227 | ### Commits 228 | 229 | - chore: update changelog [`19134e7`](https://github.com/hepsiburada/VoltranJS/commit/19134e71989fe79328c8157b7ceb46bbc9afb7ef) 230 | 231 | ## [1.0.11](https://github.com/hepsiburada/VoltranJS/compare/1.0.10...1.0.11) - 2021-06-08 232 | 233 | ### Merged 234 | 235 | - feature: added without state parameter [`#20`](https://github.com/hepsiburada/VoltranJS/pull/20) 236 | - feat: jest library setup [`#19`](https://github.com/hepsiburada/VoltranJS/pull/19) 237 | 238 | ### Commits 239 | 240 | - Create CODE_OF_CONDUCT.md [`6da53eb`](https://github.com/hepsiburada/VoltranJS/commit/6da53ebcf849a8460619e77173cda485b6267c89) 241 | - Update issue templates [`6d1d122`](https://github.com/hepsiburada/VoltranJS/commit/6d1d122c790a1a1fe5f66f6c1f2c337ced793e16) 242 | - chore: update changelog [`05955c3`](https://github.com/hepsiburada/VoltranJS/commit/05955c343471d27e797c472c09811410d56fdb7d) 243 | 244 | ## [1.0.10](https://github.com/hepsiburada/VoltranJS/compare/1.0.9...1.0.10) - 2021-05-27 245 | 246 | ### Merged 247 | 248 | - feat: add changelog generator service [`#18`](https://github.com/hepsiburada/VoltranJS/pull/18) 249 | - use @babel/polyfill/noConflict instead @babel/polyfill [`#16`](https://github.com/hepsiburada/VoltranJS/pull/16) 250 | 251 | ### Commits 252 | 253 | - chore: add changelog [`b8662b0`](https://github.com/hepsiburada/VoltranJS/commit/b8662b05673537883ba45576cf1e2d357bb0e5e0) 254 | 255 | ## [1.0.9](https://github.com/hepsiburada/VoltranJS/compare/1.0.8...1.0.9) - 2021-04-29 256 | 257 | ## [1.0.8](https://github.com/hepsiburada/VoltranJS/compare/1.0.7...1.0.8) - 2021-04-29 258 | 259 | ### Merged 260 | 261 | - Promise catch chain fixed [`#15`](https://github.com/hepsiburada/VoltranJS/pull/15) 262 | 263 | ## [1.0.7](https://github.com/hepsiburada/VoltranJS/compare/1.0.6...1.0.7) - 2021-04-28 264 | 265 | ### Merged 266 | 267 | - Partial content server response feature [`#14`](https://github.com/hepsiburada/VoltranJS/pull/14) 268 | 269 | ## [1.0.6](https://github.com/hepsiburada/VoltranJS/compare/1.0.5...1.0.6) - 2021-04-26 270 | 271 | ### Merged 272 | 273 | - Internal cache remove endpoint created, [`#13`](https://github.com/hepsiburada/VoltranJS/pull/13) 274 | 275 | ### Commits 276 | 277 | - Version upgrade 1.0.6 [`6642d19`](https://github.com/hepsiburada/VoltranJS/commit/6642d19e99a8d772d8dff1325e8078c653fc7d29) 278 | 279 | ## [1.0.5](https://github.com/hepsiburada/VoltranJS/compare/1.0.4...1.0.5) - 2021-04-26 280 | 281 | ### Merged 282 | 283 | - Update README.md [`#12`](https://github.com/hepsiburada/VoltranJS/pull/12) 284 | - feat: esbuild loader integration [`#10`](https://github.com/hepsiburada/VoltranJS/pull/10) 285 | 286 | ### Commits 287 | 288 | - fix: conflict resolved [`b7d3893`](https://github.com/hepsiburada/VoltranJS/commit/b7d3893f4cdf5281ed443f49a61ab5eb378fa8ee) 289 | - fix: unintelligible code deleted [`d7bdb80`](https://github.com/hepsiburada/VoltranJS/commit/d7bdb800f378d1aa24d91262ca8add0305b0217d) 290 | - added new project logo [`ff89d80`](https://github.com/hepsiburada/VoltranJS/commit/ff89d80c17b6a159f22f4565c26716b043ac7c80) 291 | 292 | ## [1.0.4](https://github.com/hepsiburada/VoltranJS/compare/1.0.3...1.0.4) - 2021-04-15 293 | 294 | ### Merged 295 | 296 | - fix: client.css passing value problem [`#11`](https://github.com/hepsiburada/VoltranJS/pull/11) 297 | - feat: add close html preview condition to production mode [`#8`](https://github.com/hepsiburada/VoltranJS/pull/8) 298 | - Configured to pass webpack config, from main project [`#9`](https://github.com/hepsiburada/VoltranJS/pull/9) 299 | 300 | ### Commits 301 | 302 | - feat: add comp based isPreview xodndition [`dad29c3`](https://github.com/hepsiburada/VoltranJS/commit/dad29c3b1c6edb6d07af7e697c983be34f3c025e) 303 | - Added parameter for Preview mode. And Fixed some css bugs [`04dec7c`](https://github.com/hepsiburada/VoltranJS/commit/04dec7c4529130400612c4fd1f17292381f48fc1) 304 | 305 | ## [1.0.3](https://github.com/hepsiburada/VoltranJS/compare/1.0.2...1.0.3) - 2021-04-05 306 | 307 | ### Commits 308 | 309 | - Configured to pass webpack config, from main project [`8f6ce41`](https://github.com/hepsiburada/VoltranJS/commit/8f6ce414035fcb1d850a3417f10bacf46735b691) 310 | 311 | ## [1.0.2](https://github.com/hepsiburada/VoltranJS/compare/1.0.1...1.0.2) - 2021-01-20 312 | 313 | ### Merged 314 | 315 | - Eslint fixes [`#6`](https://github.com/hepsiburada/VoltranJS/pull/6) 316 | - Update README [`#1`](https://github.com/hepsiburada/VoltranJS/pull/1) 317 | 318 | ### Commits 319 | 320 | - Add type-hint [`f8838e4`](https://github.com/hepsiburada/VoltranJS/commit/f8838e422e3c08ac563bafe7064937c089c0cb4c) 321 | - Minor typos [`1976fce`](https://github.com/hepsiburada/VoltranJS/commit/1976fce2766cb7c2055c6af56dbd3d4a4dafecd1) 322 | - update version 1.0.2 [`81bee9b`](https://github.com/hepsiburada/VoltranJS/commit/81bee9b1865fbf2c8f1926bd8617c180d0995d14) 323 | 324 | ## [1.0.1](https://github.com/hepsiburada/VoltranJS/compare/1.0.0...1.0.1) - 2021-01-04 325 | 326 | ### Merged 327 | 328 | - Create LICENSE [`#4`](https://github.com/hepsiburada/VoltranJS/pull/4) 329 | 330 | ### Commits 331 | 332 | - Voltran JS 1.0.0 version [`c156f25`](https://github.com/hepsiburada/VoltranJS/commit/c156f254b92cb218a44fad9f0b00cc55213f8096) 333 | - update package json [`afb8d18`](https://github.com/hepsiburada/VoltranJS/commit/afb8d18d540fa9de751bc2ecdcbce5fc7681e7f3) 334 | 335 | ## 1.0.0 - 2020-12-29 336 | 337 | ### Commits 338 | 339 | - Voltran JS 1.0.0 version [`fedab7a`](https://github.com/hepsiburada/VoltranJS/commit/fedab7a0f70772f91278c2cb752e7c91ee09a7e9) 340 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | . 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 hepsiburada 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
21 | Key Features • 22 | Installation • 23 | Usage • 24 | Configs • 25 | Technology • 26 | Contributing 27 |
28 | 29 | ### Key Features 30 | 31 | You can use Voltran if you need a micro frontend framework that provides following features: 32 | 33 | - Lightweight and fast API 34 | - Serves single and multiple components 35 | - Preview (to visualize components) 36 | - SEO friendly (if needed) 37 | - CSS & SCSS support 38 | - Supports only React (for now) 39 | 40 | ## Installation 41 | 42 | Voltran requires [Node.js](https://nodejs.org/) v10.15.0+ to run. 43 | 44 | Install the Voltran. 45 | 46 | #### Yarn 47 | 48 | ```sh 49 | $ yarn add voltranjs 50 | ``` 51 | 52 | #### Npm 53 | 54 | ```sh 55 | $ npm install voltranjs 56 | ``` 57 | 58 | ## Usage 59 | 60 | This is an example component. 61 | 62 | First of all, you should import `@voltran/core`. 63 | 64 | After that we can write the component's code. 65 | 66 | **HelloWorld.js** 67 | 68 | ```jsx 69 | const voltran = require('@voltran/core'); 70 | 71 | import React from 'react'; 72 | 73 | const ROUTE_PATHS = { 74 | HELLOWORLDPAGE: '/HelloWorld' 75 | }; 76 | 77 | const HelloWorld = ({ initialState }) => { 78 | return <>Hello World!>; 79 | }; 80 | 81 | const component = voltran.default.withBaseComponent(HelloWorld, ROUTE_PATHS.HELLOWORLDPAGE); 82 | 83 | export default component; 84 | ``` 85 | 86 | If you want to fetch data from server side, you should add `getInitialState`. 87 | 88 | **./conf/local.config.js** 89 | 90 | ```js 91 | const port = 3578; 92 | 93 | module.exports = { 94 | port: port, 95 | baseUrl: `http://localhost:${port}`, 96 | mediaUrl: '', 97 | services: { 98 | voltranapi: { 99 | clientUrl: 'http://voltran-api.qa.hepsiburada.com', 100 | serverUrl: 'http://voltran-api.qa.hepsiburada.com' 101 | } 102 | }, 103 | timeouts: { 104 | clientApiManager: 20 * 1000, 105 | serverApiManager: 20 * 1000 106 | } 107 | }; 108 | ``` 109 | 110 | **HelloWorld.js** 111 | 112 | ```jsx 113 | 114 | const voltran = require('@voltran/core'); 115 | 116 | import React from 'react'; 117 | import appConfig from '../appConfig'; 118 | 119 | const ROUTE_PATHS = { 120 | HELLOWORLDPAGE: '/HelloWorld', 121 | }; 122 | 123 | const HelloWorld = ({initialState}) => { 124 | HelloWorld.services = [appConfig.services.voltranApi]; 125 | 126 | HelloWorld.getInitialState = (voltranApiClientManager, context) => { 127 | const config = { headers: context.headers }; 128 | const params = {...}; 129 | 130 | return getName({ params }, voltranApiClientManager, config); 131 | }; 132 | 133 | return ( 134 | <> 135 | Hello World. My name is {initialState.name}! 136 | > 137 | ); 138 | }; 139 | 140 | const component = voltran.default.withBaseComponent(HelloWorld, ROUTE_PATHS.HELLOWORLDPAGE); 141 | 142 | export default component; 143 | 144 | ``` 145 | 146 | **Output For Preview** 147 | 148 | ``` 149 | Hello World. My Name is Volkan! 150 | ``` 151 | 152 | **Output For Api** 153 | 154 | ``` 155 | { 156 | html: ..., 157 | scripts: [...], 158 | style: [...], 159 | activeComponent: { 160 | resultPath: "/HelloWorld", 161 | componentName: "HelloWorld", 162 | url: "/HelloWorld" 163 | }, 164 | } 165 | ``` 166 | 167 | ## Configs 168 | 169 | Voltran requires following configurations: 170 | 171 | | **Config** | **Type** | 172 | | --------------------------------------------- | -------------------- | 173 | | [appConfigFile](#appConfigFile) | Object | 174 | | [dev](#dev) | Boolean | 175 | | [distFolder](#distFolder) | String | 176 | | [publicDistFolder](#publicDistFolder) | String | 177 | | [inputFolder](#inputFolder) | String \* `required` | 178 | | [monitoring](#monitoring) | Object | 179 | | [port](#port) | Number - String | 180 | | [prefix](#prefix) | String \* `required` | 181 | | [ssr](#ssr) | String | 182 | | [styles](#styles) | Array | 183 | | [output](#output) | Object | 184 | | [staticProps](#staticProps) | Array | 185 | | [routing](#routing) | Object | 186 | | [webpackConfiguration](#webpackConfiguration) | Object | 187 | | [sassResources](#sassResources) | Array | 188 | | [criticalCssDisabled](#criticalCssDisabled) | Boolean | 189 | 190 | #### appConfigFile 191 | 192 | It should contain environment specific configurations (test, production ...). 193 | 194 | ``` 195 | appConfigFile: { 196 | entry: path.resolve(__dirname, './yourConfigFolder/'), 197 | output: { 198 | path: path.resolve(__dirname, './yourOutputFolder/'), 199 | name: 'yourFileName', 200 | } 201 | } 202 | ``` 203 | 204 | #### dev 205 | 206 | Development mode. Set to `true` if you need to debug. 207 | 208 | `Default`: `false` 209 | 210 | #### distFolder 211 | 212 | The path to the folder where bundled scripts will be placed after the build. 213 | 214 | `Default`: `./dist` 215 | 216 | #### publicDistFolder 217 | 218 | The path to the folder where asset files will be placed after the build. 219 | 220 | `Default`: `./dist/assets` 221 | 222 | #### inputFolder 223 | 224 | The path to the folder that contains script files. It's required. 225 | 226 | Passes this config to Babel Loader where it reads all js files under this folder. 227 | 228 | 'Voltran' converts your files to the appropriate format and optimizes them. 229 | 230 | #### monitoring 231 | 232 | For now, only prometheus is supported. 233 | 234 | ``` 235 | monitoring: { 236 | prometheus: false 237 | } 238 | ``` 239 | 240 | > or you can set your custom js file. 241 | 242 | ``` 243 | monitoring: { 244 | prometheus: path.resolve(__dirname, './src/tools/prometheus.js') 245 | } 246 | ``` 247 | 248 | #### port 249 | 250 | `Default`: `3578` 251 | 252 | > If you want to change the port 253 | > you may need to change the port in appConfigFiles 254 | 255 | #### prefix 256 | 257 | `It is required.` 258 | 259 | There may be different components owned by different teams using voltrans on the same page. Voltran needs to use a prefix in order to avoid conflicts issues. 260 | This prefix is prepended to initial states and CSS class names. 261 | 262 | > We recommend that each team use their own acronyms/prefixes. 263 | 264 | #### ssr 265 | 266 | `Default`: `true` 267 | Voltran supports server side rendering. 268 | Applications that need 'SEO' features needs to set this parameter to `true`. 269 | 270 | #### styles 271 | 272 | This field's value should be an array of strings. Array values should be the paths to the global CSS files. 273 | 274 | ``` 275 | styles: [ 276 | path.resolve(__dirname, './some-css-file.scss'), 277 | path.resolve(__dirname, './node_modules/carousel/carousel.css') 278 | ] 279 | ``` 280 | 281 | ### output 282 | 283 | ``` 284 | output: { 285 | client: { 286 | path: path.resolve(__dirname, './build/public/project/assets'), 287 | publicPath: path.resolve(__dirname, './src/assets'), 288 | filename: '[name]-[contenthash].js', 289 | chunkFilename: '[name]-[chunkhash].js' 290 | }, 291 | server: { 292 | path: path.resolve(__dirname, './build/server'), 293 | filename: '[name].js' 294 | }, 295 | }, 296 | ``` 297 | 298 | #### staticProps 299 | 300 | You can pass static props to all components at the same time. 301 | 302 | ``` 303 | staticProps: [ 304 | {'key': value} 305 | ] 306 | ``` 307 | 308 | #### routing 309 | 310 | Voltran need two files to set routing. 311 | 312 | ``` 313 | routing: { 314 | components: path.resolve(__dirname, './src/appRoute/components.js'), 315 | dictionary: path.resolve(__dirname, './src/appRoute/dictionary.js') 316 | } 317 | ``` 318 | 319 | #### criticalCssDisabled 320 | 321 | Set to `false` if don't need to critical styles. 322 | 323 | `Default`: `true` 324 | 325 | ### Example files can be found here: 326 | 327 | - [components.js](https://github.com/hepsiburada/VoltranJS-Starter-Kit/blob/master/src/appRoute/components.js) 328 | - [dictionary.js](https://github.com/hepsiburada/VoltranJS-Starter-Kit/blob/master/src/appRoute/dictionary.js) 329 | 330 | #### webpackConfiguration 331 | 332 | You can add your webpack configuration. They will be merged with the voltran configs. 333 | 334 | You can access the starter kit we created from the [link](https://github.com/hepsiburada/VoltranJS-Starter-Kit). 335 | 336 | #### sassResources 337 | 338 | You can add sass resources to this field as string array. sass-resource-loader gonna inject those files in every sass files so you won't need to import them. 339 | 340 | You can check [sass-resource-loader](https://github.com/shakacode/sass-resources-loader) for usage. 341 | 342 | ## New Relic Integration 343 | 344 | Add `newrelicEnabled: true` on your config. 345 | 346 | If you throw an error like `throw new Error({message: "Service error", code: 500})` from your fragments, Voltran detects the fields and sends each field to New Relic as a custom attribute. These fields appear with `_a` prefix to place in the first of rows on your new relic. 347 | 348 | ## Tech 349 | 350 | Voltran uses a number of open source projects to work properly: 351 | 352 | - [ReactJS] - A JavaScript library for building user interfaces! 353 | - [Webpack] - Module bundler 354 | - [babel] - The compiler for next generation JavaScript. 355 | - [node.js] - evented I/O for the backend 356 | - [hiddie] - fast node.js network app framework (friendly fork of [middie](https://github.com/fastify/middie)) 357 | - [Yarn] - the streaming build system 358 | 359 | ## Contributing 360 | 361 | 1. Fork it! 362 | 2. Create your feature branch: `git checkout -b my-new-feature` 363 | 3. Commit your changes: `git commit -m 'Add some feature'` 364 | 4. Push to the branch: `git push origin my-new-feature` 365 | 5. Submit a pull request 366 | 367 | 370 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = api => { 2 | const env = api.env(); 3 | 4 | const basePlugins = [ 5 | 'babel-plugin-styled-components', 6 | '@babel/syntax-dynamic-import', 7 | '@babel/plugin-syntax-jsx', 8 | '@babel/plugin-proposal-class-properties', 9 | '@babel/plugin-transform-runtime', 10 | '@babel/plugin-proposal-optional-chaining', 11 | '@babel/plugin-proposal-numeric-separator', 12 | '@babel/plugin-proposal-throw-expressions' 13 | ]; 14 | 15 | const basePresets = []; 16 | const presets = [...basePresets]; 17 | const plugins = [...basePlugins]; 18 | 19 | if (env === 'test') { 20 | presets.push([ 21 | '@babel/preset-env', 22 | { 23 | useBuiltIns: 'entry', 24 | corejs: '3.20.2' 25 | } 26 | ]); 27 | } else { 28 | if (env === 'production') { 29 | plugins.push([ 30 | 'transform-react-remove-prop-types', 31 | { 32 | mode: 'remove', 33 | removeImport: true, 34 | additionalLibraries: ['react-immutable-proptypes'] 35 | } 36 | ]); 37 | } else { 38 | plugins.push('react-hot-loader/babel'); 39 | } 40 | 41 | presets.push([ 42 | '@babel/preset-env', 43 | { 44 | useBuiltIns: 'entry', 45 | corejs: '3.20.2', 46 | targets: { 47 | esmodules: true, 48 | ie: '11', 49 | node: 'current' 50 | } 51 | } 52 | ]); 53 | } 54 | 55 | presets.push('@babel/preset-react'); 56 | 57 | return { 58 | presets, 59 | plugins 60 | }; 61 | }; 62 | -------------------------------------------------------------------------------- /babel.server.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | const basePlugins = [ 3 | 'babel-plugin-styled-components', 4 | '@babel/plugin-syntax-jsx', 5 | '@babel/plugin-proposal-class-properties', 6 | '@babel/plugin-transform-runtime', 7 | '@babel/plugin-proposal-numeric-separator', 8 | '@babel/plugin-proposal-throw-expressions', 9 | '@babel/plugin-proposal-optional-chaining' 10 | ]; 11 | 12 | const basePresets = ['@babel/preset-react']; 13 | 14 | const presets = [...basePresets]; 15 | const plugins = [...basePlugins]; 16 | 17 | return { 18 | presets, 19 | plugins 20 | }; 21 | }; 22 | -------------------------------------------------------------------------------- /bin/voltran.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require = require('esm')(module /*, options*/); 4 | require('../lib/cli').cli(process.argv); -------------------------------------------------------------------------------- /browserslist: -------------------------------------------------------------------------------- 1 | >1% 2 | last 4 versions 3 | Firefox ESR 4 | not ie < 9 5 | -------------------------------------------------------------------------------- /changelog-template.hbs: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | {{#each releases}} 4 | {{#if href}} 5 | ## [{{title}}]({{href}}){{#if tag}} - {{isoDate}}{{/if}} 6 | {{else}} 7 | ## {{title}}{{#if tag}} - {{isoDate}}{{/if}} 8 | {{/if}} 9 | 10 | {{#if summary}} 11 | {{summary}} 12 | {{/if}} 13 | 14 | {{#if merges}} 15 | ### Merged 16 | 17 | {{#each merges}} 18 | - {{#if commit.breaking}}**Breaking change:** {{/if}}{{message}} {{#if href}}[`#{{id}}`]({{href}}){{/if}} 19 | {{/each}} 20 | {{/if}} 21 | 22 | {{#if fixes}} 23 | ### Fixed 24 | 25 | {{#each fixes}} 26 | - {{#if commit.breaking}}**Breaking change:** {{/if}}{{commit.subject}}{{#each fixes}} {{#if href}}[`#{{id}}`]({{href}}){{/if}}{{/each}} 27 | {{/each}} 28 | {{/if}} 29 | 30 | {{#commit-list commits heading='### Commits'}} 31 | - {{#if breaking}}**Breaking change:** {{/if}}{{subject}} {{#if href}}[`{{shorthash}}`]({{href}}){{/if}} 32 | {{/commit-list}} 33 | 34 | {{/each}} 35 | -------------------------------------------------------------------------------- /config/string.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | const normalizeUrl = require('../lib/os.js'); 4 | const getStyles = require('./styles.js'); 5 | 6 | const voltranConfig = require('../voltran.config'); 7 | 8 | const prometheusFile = voltranConfig.monitoring.prometheus; 9 | 10 | function replaceString() { 11 | const data = [ 12 | { 13 | search: '__V_COMPONENTS__', 14 | replace: normalizeUrl(voltranConfig.routing.components), 15 | flags: 'g' 16 | }, 17 | { 18 | search: '__APP_CONFIG__', 19 | replace: normalizeUrl(`${voltranConfig.appConfigFile.output.path}/${voltranConfig.appConfigFile.output.name}.js`), 20 | flags: 'g' 21 | }, 22 | { 23 | search: '__ASSETS_FILE_PATH__', 24 | replace: normalizeUrl(`${voltranConfig.inputFolder}/assets.json`), 25 | flags: 'g' 26 | }, 27 | { 28 | search: '__V_DICTIONARY__', 29 | replace: normalizeUrl(voltranConfig.routing.dictionary), 30 | flags: 'g' 31 | }, 32 | { 33 | search: '@voltran/core', 34 | replace: normalizeUrl(path.resolve(__dirname, '../src/index')), 35 | flags: 'g' 36 | }, 37 | { 38 | search: '"__V_styles__"', 39 | replace: getStyles() 40 | } 41 | ]; 42 | 43 | data.push({ 44 | search: '__V_PROMETHEUS__', 45 | replace: normalizeUrl(prometheusFile || '../lib/tools/prom.js'), 46 | flags: 'g' 47 | }); 48 | 49 | return data; 50 | } 51 | 52 | module.exports = replaceString; 53 | -------------------------------------------------------------------------------- /config/styles.js: -------------------------------------------------------------------------------- 1 | const normalizeUrl = require('../lib/os.js'); 2 | const voltranConfig = require('../voltran.config'); 3 | 4 | function getStyles () { 5 | let styles = ''; 6 | 7 | for(var i = 0; i < voltranConfig.styles.length; i++) { 8 | const style = normalizeUrl(voltranConfig.styles[i]); 9 | 10 | styles += `require('${style}');`; 11 | } 12 | 13 | return styles; 14 | } 15 | 16 | module.exports = getStyles; -------------------------------------------------------------------------------- /fileMock.js: -------------------------------------------------------------------------------- 1 | module.exports = 'test-file-stub'; 2 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | // Jest configuration 2 | // https://facebook.github.io/jest/docs/en/configuration.html 3 | module.exports = { 4 | verbose: true, 5 | automock: false, 6 | bail: true, 7 | collectCoverageFrom: [ 8 | 'src/**/*.{js,jsx}', 9 | '!**/node_modules/**', 10 | '!**/vendor/**', 11 | '!src/public/**', 12 | '!src/tools/**' 13 | ], 14 | coverageDirectory: '