Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
indent_style = space

[*.js.snap]
trim_trailing_whitespace = false
36 changes: 36 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: mix-replacer
on: [push]
jobs:
Jest-Tests:
runs-on: ${{ matrix.os }}

strategy:
matrix:
args:
- LARAVEL_MIX_VERSION: ^5.0.4
- LARAVEL_MIX_VERSION: ^6.0.25
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [12.x, 13.x, 14.x]
steps:
- uses: actions/checkout@v2

- name: Cache node modules
uses: actions/cache@v2
env:
cache_name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ matrix.args.LARAVEL_MIX_VERSION }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm install laravel-mix@${{matrix.args.LARAVEL_MIX_VERSION}} -f
- run: npm run test:ci
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v.2.0.0

- Required minimal Node engine version 12.x
- Required minimal `laravel-mix` version 6.0.25
- Remove `lodash` dependecie

## v1.3.2

- Fix typos in `README.md`.
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
[![codecov](https://codecov.io/gh/soufyakoub/mix-replacer/branch/master/graph/badge.svg)](https://codecov.io/gh/soufyakoub/mix-replacer)
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/soufyakoub/mix-replacer/blob/master/LICENSE)

# Last versions

**[email protected]** work from **laravel-mix@^5.0.4** to **[email protected]**, but if you using **Node 10.x**, just **laravel-mix@^5.0.4** work because, the minimal Node version for **[email protected]** is **12.x**.

# mix-replacer

> A [laravel-mix](https://laravel-mix.com/docs/5.0/versioning) extension to copy files
> A [laravel-mix](https://laravel-mix.com/docs/versioning) extension to copy files
> and append hash queries to public urls.

## Installation
Expand Down Expand Up @@ -103,9 +107,6 @@ Running tests is as simple as typing `npm run test` in a terminal from the proje

Coverage reports are generated to `tests/coverage`.

| :warning: make sure your node.js version is `>= 10.14.2`, [here's why](https://github.com/facebook/jest/issues/9538)|
|---|

## Contributing

Please feel free to submit issues and pull requests.
Expand Down
10 changes: 9 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@

const { execSync } = require("child_process");
const path = require("path");
const IS_UNIX = path.sep === "/";
const SEP = path.sep;
const ROOT = IS_UNIX ? "/" : "C:\\";
const ROOT = IS_UNIX ? "/" : getWindowsRoot();
const CWD = path.resolve();

function getWindowsRoot(){
// In Github Actions environment the hard drive is D:\
// this should get correct path.
return execSync("chdir").toString().split("\\")[0] + "\\";
}

module.exports = {
verbose: true,
collectCoverage: true,
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "mix-replacer",
"version": "1.3.2",
"version": "2.0.0",
"description": "A laravel-mix extension to copy files append hash queries to public urls.",
"main": "src/index.js",
"scripts": {
"test": "jest"
"test": "jest",
"test:ci": "jest --runInBand --ci"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -35,21 +36,20 @@
"src"
],
"engines": {
"node": ">= 10.12.0"
"node": ">= 12.0.0"
},
"devDependencies": {
"laravel-mix": "^5.0.4",
"@types/jest": "^26.0.0",
"glob": "^7.1.6",
"uuid": "^8.1.0",
"jest": "^26.0.1",
"@types/jest": "^26.0.0"
"jest": "^27.0.6",
"laravel-mix": "^6.0.25",
"uuid": "^8.1.0"
},
"peerDependencies": {
"laravel-mix": "^5.0.0",
"glob": "^7.0.0"
"glob": "^7.0.0",
"laravel-mix": "^6.0.25"
},
"dependencies": {
"lodash": "^4.17.19",
"validate": "^5.1.0"
}
}
7 changes: 7 additions & 0 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ function escapeRegExp(string) {
return string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&");
}

function merge(defaultOptions, overrideOptions) {
for (let key in overrideOptions) {
defaultOptions[key] = overrideOptions[key];
}
}

module.exports = {
escapeRegExp,
merge
};
4 changes: 2 additions & 2 deletions src/options.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const _ = require("lodash");
const Schema = require("validate");
const {merge: mergeOptions} = require("./helpers");

const schema = new Schema({
delimiters: {
Expand Down Expand Up @@ -36,7 +36,7 @@ function merge(new_options) {
throw errors[0];
}

_.merge(options, new_options);
mergeOptions(options, new_options);
}

module.exports = {
Expand Down