Skip to content

Commit 63d8edd

Browse files
author
Alexander
authored
Merge pull request #18 from yukal/dev
Use native nodejs test and assert modules
2 parents f7485d8 + 47f1d10 commit 63d8edd

File tree

7 files changed

+2483
-2411
lines changed

7 files changed

+2483
-2411
lines changed

.github/workflows/node.js.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [12.x, 14.x, 16.x]
19+
node-version: [18, 20]
2020

2121
steps:
2222
- uses: actions/checkout@v2

CHANGELOG.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
## [v1.2.1](https://github.com/yukal/slim-validator/compare/f7485d8fa2a84bc3ab4a2156ef62add21f8ae615...a6ca46f363d6f343b1941d5b25eaa31a0529542d) – 2024-01-16
2+
3+
### Refactors
4+
5+
* update tests ([da00c2ad](https://github.com/yukal/gulp-json-loader/commit/da00c2ad5e2d1e292c8150e8818a4b4173f0fbaa))
6+
7+
### Chores
8+
9+
* **readme:** update and fix typos and grammar ([19e0dbb7](https://github.com/yukal/gulp-json-loader/commit/19e0dbb7d40ee335ce156f1cc0b8541dfd3f47d0))
10+
* **package:** update package within dependencies ([2a825757](https://github.com/yukal/gulp-json-loader/commit/2a825757948e66895ad8ddd67a9adb99e8795b8f))
11+
12+
### Continuous Integration
13+
14+
- **action:** use latest stable nodejs ([bf570a7a](https://github.com/yukal/gulp-json-loader/commit/bf570a7a3cb03f555916c05ec4faf83817627ba6))
15+
- **action:** update node matrix ([a6ca46f3](https://github.com/yukal/gulp-json-loader/commit/a6ca46f363d6f343b1941d5b25eaa31a0529542d))
16+
17+
## [v1.2.1](https://github.com/yukal/slim-validator/compare/v1.2.1...f7485d8fa2a84bc3ab4a2156ef62add21f8ae615)
18+
19+
### Build System / Dependencies
20+
21+
- **deps-dev:** bump chai from 4.3.8 to 4.3.10 ([a0f02551](https://github.com/yukal/gulp-json-loader/commit/a0f02551bddefad86d2864cf1e42527d6ebbed0f))
22+
- **deps-dev:** bump chai from 4.3.7 to 4.3.8 ([e5d80951](https://github.com/yukal/gulp-json-loader/commit/e5d80951f8f1245879924bd71db2b621e5409d91))
23+
- **deps-dev:** bump mocha from 10.1.0 to 10.2.0 ([367897bb](https://github.com/yukal/gulp-json-loader/commit/367897bb4ed1b9812edc867a8c1fc18ffa92d974))
24+
- **deps:** bump decode-uri-component from 0.2.0 to 0.2.2 ([4252fa92](https://github.com/yukal/gulp-json-loader/commit/4252fa92d0e6f31d0d31d22a4e23c4b6fc4b3fdf))
25+
26+
### Other Changes
27+
28+
* codestyle ([515d18d4](https://github.com/yukal/gulp-json-loader/commit/515d18d40e607e7157a646eb27b5c10e83720b5f))
29+
30+
## v1.1.0
31+
- Updated core
32+
- Imposed restrictions on accessing external directories.
33+
- There is no need to pass the config data to GulpJsonLoader, now it's optional
34+
and defined from defaults. But if you want to change them, you might tune it in
35+
both ways: using an old-style passing an object with options to GulpJsonLoader
36+
factory or just pass the settings into a package.json. See package.json.
37+
38+
- Updated dependencies
39+
- gulp-load-plugins: ^2.0.7
40+
- gulp-pug: ^5.0.0
41+
42+
- Improvement of variables names
43+
- To distinguish variables from stylistic PAG syntax it is preferable to name
44+
variables in a different way as opposed to decoration text. That's why I name
45+
variables with a capital letter and a dollar sign at the beginning.
46+
See PUG files to find out more about it.
47+
48+
- The entry name of the Data loaded from the JSON file is defined in a global
49+
space as a "data" entry, now you can change this name as you like.
50+
See package.json and PUG files to find out more about it.
51+
52+
- Implemented data caching
53+
- The data that has already been loaded will be getting from the cache
54+
55+
- Added tests

README.md

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# gulp-json-loader
2-
A little tool for the [gulp-data](https://www.npmjs.com/package/gulp-data) plugin.
3-
It useful for automatically data loading in the development including the PUG files.
2+
A little tool for the [gulp-data](https://www.npmjs.com/package/gulp-data) plugin. It useful for automatically data loading in the development including the PUG files.
43

54
### What for
6-
I tried to find any simple solution to assign my variables to a current PUG file in a building
7-
process, but some of the solutions are the same with solutions between the 2014th and 2019th
8-
years and, actually do not satisfy my needs as I want. And the most popular solution I have
9-
found looks like:
5+
I've tried to find a simple solution for assigning my variables into PUG files in a building process. Some of them have similar examples between the 2014th and 2019th years and don't satisfy my technical needs. The most popular solution I have found looks like this:
106

117
```javascript
128
// Somewhere in gulp task
@@ -16,34 +12,14 @@ found looks like:
1612
.pipe(data(() => require('data.json') ))
1713
```
1814

19-
After a while, in search of the solution I have found one more way in solving this decision
20-
in a [detailed article](https://tusharghate.com/rendering-pug-templates-with-multiple-data-files),
21-
but still not satisfied.
22-
23-
So, what's wrong with these solutions?
24-
First of all, any time, when the queue reaches to Html part, it starts the merging process of all
25-
the JSON files. Each any Html file, Carl! It means that sometimes the process is performing
26-
unnecessary actions. What if you don't need to include the data in some of the Html file, it still
27-
will run enforced actions, any time, again and again, merge... merge... merge. Yes, you can solve
28-
it by running a once merge, and then always include it as a combined object from the JSON file, as
29-
the solution in an article above. But it still not a good solution to including the JSON file there
30-
where you should not include.
31-
32-
And I decided to fix this problem in my vision.
15+
What's wrong with these examples?
16+
First of all, each time when the queue reaches the HTML part, it starts the merging process of all the JSON files. It means that sometimes the process is performing unnecessary actions. What if we don't need to include the data for some of the HTML files? Well, it still runs enforced actions at any time. We can solve it by once running merge and then always including it as a combined object from the JSON file. But it is still not a good idea to include the JSON file there where we shouldn't.
3317

3418
### How does it work
35-
When the build process's queue reaches Html, it automatically searches the JSON file with the same
36-
name as in the directory with Html files, or PUG files (it depends on how you set up your project).
19+
When the build process queue reaches HTML, it automatically searches the JSON file with the same name as in the directory with kinds of PUG files (it depends on how you set up your project).
3720

3821
### Structure
39-
To automatically asigning data to the pages, you must be following the canonical paths. The
40-
structure of directory with the JSON files should contains with two required folders inside:
41-
**pages** and **imports**. The **pages** directory structure must be exactly the same structure as
42-
the directory with PUG files. Here in example the PUG files located in **html** directory. The
43-
**imports** directory is provided for the JSON files which you can include as a partial data.
44-
If you missed any of the JSON files in the data/pages directory, the loading of the JSON files will
45-
not happen and the error will not rise except one thing - It would not happen if you will not try
46-
to get the data variable from current context while the building process is running.
22+
To assign some data inside your pages, you have to follow canonical paths. The directory structure with JSON files must contain two necessary folders inside pages and imports. The "pages" directory structure must have the same structure as the directory with the pug files. In the example below, pug files are placed inside the "html" directory. The "imports" directory is provided for the JSON files, which you can include as partial data. If you've missed any JSON file inside the data/pages directory, the loading of the JSON files will not happen, and the error will not rise except, It will not rise if you do not try to get the data variable from the current context while the building process is running.
4723

4824
```bash
4925
src src

changes.txt

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)