Skip to content

Commit

Permalink
Merge pull request #17 from netglue/renovate/lock-file-maintenance
Browse files Browse the repository at this point in the history
Lock file maintenance
  • Loading branch information
gsteel committed Jul 15, 2023
2 parents 99e2dbc + 06569ad commit b8bf0b3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
9 changes: 9 additions & 0 deletions .markdownlint.json
@@ -0,0 +1,9 @@
{
"default": true,
"MD013": false,
"MD014": false,
"MD024": false,
"MD028": false,
"MD031": { "list_items": false },
"MD034": false
}
9 changes: 5 additions & 4 deletions README.md
Expand Up @@ -5,6 +5,7 @@
Probably re-inventing the wheel here, but I wanted to be able to rev front-end resource file names in a predictable way with options to automatically delete old revisions keeping either none of them or a specific number of the most recent ones. There are javascript tools that do this but at the time of writing, I couldn't find anything I liked in JS land that you could just fire off from an npm package script easily. There's plenty for Grunt and Gulp if you're using those.

The main use-case for this lib is to be triggered by a script in your `package.json` something like this:

```json
{
"scripts": {
Expand All @@ -13,10 +14,12 @@ The main use-case for this lib is to be triggered by a script in your `package.j
}
```

## Install with composer:
## Install with composer

```bash
composer require netglue/revs
```

In order to use the tools, make sure that you've `require`d composers `vendor/autoload.php`, or [use the shipped binary](#symfony-command) in `vendor/bin/rev`

## Operation
Expand All @@ -37,6 +40,7 @@ var_dump($result->destination()); // Yields the full path and filename of the co
```

The options object can be fed an array like this:

```php
use Netglue\Revs\RevverOptions;
$options = RevverOptions::fromArray([
Expand Down Expand Up @@ -80,7 +84,6 @@ $resultingString = Replacer::replaceInString($someString, $result, $count);
Assuming you have somehow received notification that your JS is built to a file located in `/build/index.js` and you want that copied to `/public/assets` with a revved file name and all the html files in `/public` to be updated with the new file name:

```php

$options = RevverOptions::fromArray([
'destinationDirectory' => '/public/assets',
'cleanUp' => true,
Expand All @@ -100,7 +103,6 @@ foreach ($files as $html) {
$count += Replacer::replaceInFile(sprintf('/public/%s', $html), $info);
}
printf('Replaced %d references over %d files', $count, count($files));

```

## Symfony Command
Expand All @@ -120,7 +122,6 @@ PR's are welcomed. Please write tests for new features.
You're welcome to file issues, but please understand that finding the time to answer support requests is very limited
so there might be a long wait for an answer.


## About

[Netglue makes websites and apps in Devon, England](https://netglue.uk).
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b8bf0b3

Please sign in to comment.