Skip to content

Commit 92a4cc9

Browse files
authored
Drop support for node 16 (#135)
1 parent b652ee7 commit 92a4cc9

File tree

6 files changed

+171
-143
lines changed

6 files changed

+171
-143
lines changed

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
14-
- name: Use Node.js/16
14+
- name: Use Node.js/18
1515
uses: actions/setup-node@v3
1616
with:
17-
node-version: 16
17+
node-version: 18
1818
- name: Get yarn cache directory path
1919
id: yarn-cache-dir-path
2020
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
@@ -28,4 +28,4 @@ jobs:
2828
- name: Install dependencies
2929
run: yarn
3030
- name: Lint
31-
run: yarn lint
31+
run: yarn lint

.github/workflows/publish.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: Publish
32
on:
43
release:
@@ -10,8 +9,8 @@ jobs:
109
- uses: actions/checkout@v3
1110
- uses: actions/setup-node@v3
1211
with:
13-
node-version: '16.x'
14-
registry-url: 'https://registry.npmjs.org'
12+
node-version: "18.x"
13+
registry-url: "https://registry.npmjs.org"
1514
- run: yarn
1615
- run: yarn publish
1716
env:

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
14-
- name: Use Node.js/16
14+
- name: Use Node.js/18
1515
uses: actions/setup-node@v3
1616
with:
17-
node-version: 16
17+
node-version: 18
1818
- name: Get yarn cache directory path
1919
id: yarn-cache-dir-path
2020
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
@@ -28,4 +28,4 @@ jobs:
2828
- name: Install dependencies
2929
run: yarn
3030
- name: Test
31-
run: yarn test
31+
run: yarn test

README.md

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
<img style="width: 100%; height: auto;" src="public/preview.png" alt="UI preview" />
2020
</div>
2121

22-
A plugin for [Strapi Headless CMS](https://github.com/strapi/strapi) that provides an integration with powerful
23-
[mathjs](https://mathjs.org/) library.
22+
A plugin for [Strapi Headless CMS](https://github.com/strapi/strapi) that provides an integration with powerful
23+
[mathjs](https://mathjs.org/) library.
2424

2525
## Table of Contents
2626

@@ -35,12 +35,13 @@ A plugin for [Strapi Headless CMS](https://github.com/strapi/strapi) that provid
3535
- [💕Special Thanks](#-special-thanks)
3636

3737
## ✨ Features
38+
3839
- [Strapi Custom Field](https://docs.strapi.io/dev-docs/custom-fields) for calculating the provided formula.
3940
- [mathjs](https://mathjs.org/) integration.
40-
- Supports numbers, big numbers, complex numbers, fractions, units, strings, arrays, and matrices.
41-
- Is compatible with JavaScript’s built-in Math library.
42-
- Contains a flexible expression parser.
43-
- Does symbolic computation.
41+
- Supports numbers, big numbers, complex numbers, fractions, units, strings, arrays, and matrices.
42+
- Is compatible with JavaScript’s built-in Math library.
43+
- Contains a flexible expression parser.
44+
- Does symbolic computation.
4445
- Comes with a large set of built-in functions and constants.
4546
- Calculating the `formula` with the provided `scope` using the powerful `mathjs.evaluate` method. [Read More.](https://mathjs.org/docs/expressions/parsing.html#evaluate)
4647

@@ -52,63 +53,73 @@ Complete installation requirements are exact the same as for Strapi itself and c
5253
documentation](https://docs.strapi.io/dev-docs/quick-start).
5354

5455
> Before installing Strapi, the following requirements must be installed on your computer:
55-
> - Node.js: Only Maintenance and LTS versions are supported (v16, v18, and v20).
56+
>
57+
> - Node.js: Only Maintenance and LTS versions are supported (v18, and v20).
5658
> - Node v18.x is recommended for Strapi v4.3.9 and above
57-
> - Node v16.x is recommended for Strapi v4.0.x to v4.3.8.
5859
> - Your preferred Node.js package manager:
5960
> - npm (v6 and above)
6061
> - yarn
6162
6263
## 🦾 Installation
64+
6365
```shell
6466
yarn add strapi-plugin-field-formula@latest
6567
```
68+
6669
**OR**
70+
6771
```shell
6872
npm install strapi-plugin-field-formula@latest
6973
```
74+
7075
After successful installation you could re-build the Strapi instance. You could use the next commands (default) inside
7176
your Strapi project:
77+
7278
```shell
7379
yarn build
7480
yarn develop
7581
```
7682

7783
## ⚙️ Configuration
84+
7885
As a next step you must configure the plugin following the [official Strapi documentation](https://docs.strapi.io/dev-docs/plugins/documentation#configuration).
7986

80-
We need to enable the plugin by adding it to the Strapi plugin config file located in `./config/plugins.js` of your Strapi
87+
We need to enable the plugin by adding it to the Strapi plugin config file located in `./config/plugins.js` of your Strapi
8188
project. If this file does not exist yer, you have to create it manually.
8289

8390
Copy and paste the following config into you `./config/plugins.js` file:
91+
8492
```javascript
8593
// ./config/plugins.js`
8694
module.exports = {
8795
// ...
88-
'field-formula': {
89-
enabled: true
96+
"field-formula": {
97+
enabled: true,
9098
},
91-
//...
92-
}
99+
//...
100+
};
93101
```
102+
94103
My congratulation 😄! You have successfully installed and configured the **Strapi Plugin Field Formula**.
95104

96105
## ♾️ Usage
97-
> Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support
98-
for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated
99-
solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.
100-
Powerful and easy to use.
101106

102-
Here is some examples, but to use this plugin on the full 100%, you have to read the official [Mathjs](https://mathjs.org/examples/index.html)
103-
documentation, and especially the [expressions](https://mathjs.org/examples/expressions.js.html) part as `formula` is
107+
> Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support
108+
> for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated
109+
> solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.
110+
> Powerful and easy to use.
111+
112+
Here is some examples, but to use this plugin on the full 100%, you have to read the official [Mathjs](https://mathjs.org/examples/index.html)
113+
documentation, and especially the [expressions](https://mathjs.org/examples/expressions.js.html) part as `formula` is
104114
the same thing as `mathjs.evaluate` method 🤫
105115

106116
> Function `evaluate` accepts a single **(in our case)** `expression` or an array with expressions as the first argument
107-
and has an optional second argument containing a `scope` with variables and functions. The scope can be a regular
108-
JavaScript Object, or Map **(JSON in our case)**. The scope will be used to resolve symbols, and to write assigned
109-
variables or function.
117+
> and has an optional second argument containing a `scope` with variables and functions. The scope can be a regular
118+
> JavaScript Object, or Map **(JSON in our case)**. The scope will be used to resolve symbols, and to write assigned
119+
> variables or function.
110120
111121
### Example 1
122+
112123
```
113124
formula: sqrt(x^y + r^k)
114125
scope: {
@@ -121,26 +132,27 @@ result: 32.12475680841802
121132
```
122133

123134
### Example 2
135+
124136
```
125137
formula: cos(x deg)
126138
scope: { "x": 45 }
127139
result: 0.7071067811865476
128140
```
129141

130142
## 🛠️ Contributing
131-
See the [CONTRIBUTING.md](https://github.com/BorysShulyak/strapi-plugin-field-formula/blob/main/CONTRIBUTING.md)
143+
144+
See the [CONTRIBUTING.md](https://github.com/BorysShulyak/strapi-plugin-field-formula/blob/main/CONTRIBUTING.md)
132145
document.
133146

134147
## 🗺️ Roadmap
148+
135149
- Object response to unleash more difficult expressions.
136150

137151
## ❤️ Support or Donate
138-
If you are enjoying this plugin and feel extra appreciative, you could [buy me a book](https://bmc.link/borisshulyak)
152+
153+
If you are enjoying this plugin and feel extra appreciative, you could [buy me a book](https://bmc.link/borisshulyak)
139154
📖 or 3 📖📖📖.
140155

141156
## 💕 Special Thanks
142-
- I want to say thank you to **my wife Diana** for her love, daily support, motivation and inspiration.
143-
144-
145-
146157

158+
- I want to say thank you to **my wife Diana** for her love, daily support, motivation and inspiration.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
"test": "jest --testPathPattern='\\/__tests__\\/.*\\.(?:test|spec)\\.js$' --ci 2>&1"
1717
},
1818
"dependencies": {
19-
"@strapi/design-system": "^1.6.3",
20-
"@strapi/helper-plugin": "^4.12.5",
21-
"@strapi/icons": "^1.11.0",
22-
"prop-types": "^15.7.2",
19+
"@strapi/design-system": "^1.14.1",
20+
"@strapi/helper-plugin": "^4.20.0",
21+
"@strapi/icons": "^1.14.1",
22+
"prop-types": "^15.8.1",
2323
"axios": "1.6.0",
2424
"mathjs": "11.11.1"
2525
},
@@ -49,14 +49,14 @@
4949
"styled-components": "^5.3.6"
5050
},
5151
"peerDependencies": {
52-
"@strapi/strapi": "^4.4.0",
52+
"@strapi/strapi": "^4.20.0",
5353
"react": "^18.2.0",
5454
"react-dom": "^18.2.0",
5555
"react-router-dom": "^5.3.4",
5656
"styled-components": "^5.3.6"
5757
},
5858
"engines": {
59-
"node": ">=14.19.1 <=18.x.x",
59+
"node": ">=18.0.0 <=20.x.x",
6060
"npm": ">=6.0.0"
6161
},
6262
"repository": {

0 commit comments

Comments
 (0)