Skip to content

Commit

Permalink
Merge pull request #2 from the-t-in-rtf/FLUID-6524
Browse files Browse the repository at this point in the history
Self-merging by agreement with reviewer.
  • Loading branch information
the-t-in-rtf authored Jul 7, 2020
2 parents ed0c913 + 9aa17d6 commit 3d5bec6
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 123 deletions.
25 changes: 0 additions & 25 deletions .vagrant.yml

This file was deleted.

8 changes: 4 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env node */
"use strict";
var fluid = require("infusion");
var gpii = fluid.registerNamespace("gpii");

require("./");

module.exports = function (grunt) {
Expand All @@ -14,10 +14,10 @@ module.exports = function (grunt) {
};

// We manually resolve our globs to raw paths to ensure that our code is used rather than
// the copy of ourselves we inherit from gpii-grunt-lint-all. In regular usage, you should
// the copy of ourselves we inherit from fluid-grunt-lint-all. In regular usage, you should
// simply pass the globs themselves.
var fullPathSources = fluid.transform(globbedSources, function (globbedPaths) {
return gpii.glob.findFiles("%gpii-glob", globbedPaths, [], {dot: true});
return fluid.glob.findFiles("%fluid-glob", globbedPaths, [], {dot: true});
});

grunt.initConfig({
Expand All @@ -27,6 +27,6 @@ module.exports = function (grunt) {
}
});

grunt.loadNpmTasks("gpii-grunt-lint-all");
grunt.loadNpmTasks("fluid-grunt-lint-all");
grunt.registerTask("lint", "Perform all standard lint checks.", ["lint-all"]);
};
30 changes: 13 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# gpii-glob
# fluid-glob

This library provides a means of determining a list of relevant files from a given location based on one or more
"globbed" patterns. Its API consists of a single static function (see below).
Expand All @@ -12,7 +12,7 @@ testing, this strategy seems to result in linting runs that take around a tenth
To achieve this, this package disallows overly broad patterns like '**/*.js' and some of the more advanced features of
the underlying library, such as regular expressions. See below for full details.

## `gpii.glob.findFiles(rootPath, includes, [excludes], [minimatchOptions])`
## `fluid.glob.findFiles(rootPath, includes, [excludes], [minimatchOptions])`

* `rootPath`: A full or package-relative directory to scan for matching files.
* `includes`: An `Array` of glob patterns that should be included in the results.
Expand Down Expand Up @@ -68,18 +68,17 @@ Let's start by demonstrating includes. Content can only be brought into scope b
```javascript
"use strict";
var fluid = require("infusion");
var gpii = fluid.registerNamespace("gpii");

require("gpii-glob");
require("fluid-glob");

// Let's assume that `fluid.module.resolvePath("%my-package")` resolves to `/source/my-package` for the purposes of
// these examples.
fluid.require("%my-package");

gpii.glob.findFiles("%my-package", [], [], {});
fluid.glob.findFiles("%my-package", [], [], {});
// Returns: An empty array, as there are no includes.

gpii.glob.findFiles("%my-package", ["./src/**/*.js"], [], {});
fluid.glob.findFiles("%my-package", ["./src/**/*.js"], [], {});
// Returns: ["/source/my-package/src/js/index.js", "/source/my-package/src/lib/forked-deps.js"]
```

Expand All @@ -93,19 +92,18 @@ Negated includes and excludes take precedence over includes, i.e. they remove ma
```javascript
"use strict";
var fluid = require("infusion");
var gpii = fluid.registerNamespace("gpii");

require("gpii-glob");
require("fluid-glob");

// Let's assume that `fluid.module.resolvePath("%my-package")` resolves to `/source/my-package` for the purposes of
// these examples.
fluid.require("%my-package");

gpii.glob.findFiles("%my-package", ["./src/**/*.js", "!./src/lib/**/*.js"], [], {});
fluid.glob.findFiles("%my-package", ["./src/**/*.js", "!./src/lib/**/*.js"], [], {});
// Returns: ["/source/my-package/src/js/index.js"]

// A negated include is basically the same as an exclude.
gpii.glob.findFiles("%my-package", ["./src/**/*.js"], ["./src/lib/**/*.js"], {});
fluid.glob.findFiles("%my-package", ["./src/**/*.js"], ["./src/lib/**/*.js"], {});
// Also returns: ["/source/my-package/src/js/index.js"]
```

Expand All @@ -114,16 +112,15 @@ A negated exclude takes precedence over both negated includes and regular exclud
```javascript
"use strict";
var fluid = require("infusion");
var gpii = fluid.registerNamespace("gpii");

require("gpii-glob");
require("fluid-glob");

// Let's assume that `fluid.module.resolvePath("%my-package")` resolves to `/source/my-package` for the purposes of
// these examples.
fluid.require("%my-package");

// A negated exclude takes precedence over both negated includes and regular excludes.
gpii.glob.findFiles("%my-package", ["./tests/**/*.js"], ["./tests/js/**/*.js", "!./tests/js/test1.js"], {});
fluid.glob.findFiles("%my-package", ["./tests/**/*.js"], ["./tests/js/**/*.js", "!./tests/js/test1.js"], {});
// Returns: [
// "/source/my-package/tests/all-tests.js",
// "/source/my-package/tests/js/test1.js",
Expand All @@ -138,20 +135,19 @@ to the underlying "minimatch" library, you can change this behaviour as shown he
```javascript
"use strict";
var fluid = require("infusion");
var gpii = fluid.registerNamespace("gpii");

require("gpii-glob");
require("fluid-glob");

// Let's assume that `fluid.module.resolvePath("%my-package")` resolves to `/source/my-package` for the purposes of
// these examples.
fluid.require("%my-package");

// A filename wildcard search with the default minimatch options.
gpii.glob.findFiles("%my-package", ["./*.json"], [], {});
fluid.glob.findFiles("%my-package", ["./*.json"], [], {});
// Returns: ["/source/my-package/package.json"]

// A filename wildcard search with custom minimatch options.
gpii.glob.findFiles("%my-package", ["./*.json"], [], { dot: true });
fluid.glob.findFiles("%my-package", ["./*.json"], [], { dot: true });
// Returns: ["/source/my-package/.eslintrc.json", "/source/my-package/package.json"]
```

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-env node */
"use strict";
var fluid = require("infusion");
fluid.module.register("gpii-glob", __dirname, require);
fluid.module.register("fluid-glob", __dirname, require);

require("./src/js/glob.js");
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"name": "gpii-glob",
"version": "1.0.1",
"description": "A library to standardise resolving \"globbed\" file patterns within GPII projects.",
"name": "fluid-glob",
"version": "1.0.2",
"description": "A library to standardise resolving \"globbed\" file patterns within Fluid projects.",
"main": "index.js",
"scripts": {
"pretest": "node node_modules/rimraf/bin.js coverage/* reports/*",
"test": "node node_modules/nyc/bin/nyc.js node tests/all-tests.js"
},
"repository": "https://github.com/GPII/gpii-glob.git",
"repository": "https://github.com/fluid-project/fluid-glob.git",
"author": "Tony Atkins <[email protected]>",
"license": "BSD-3-Clause",
"homepage": "https://github.com/GPII/gpii-glob#readme",
"homepage": "https://github.com/fluid-project/fluid-glob#readme",
"dependencies": {
"infusion": "3.0.0-dev.20180801T212157Z.09bf3d438",
"infusion": "3.0.0-dev.20200326T173810Z.24ddb2718",
"minimatch": "3.0.4"
},
"devDependencies": {
"eslint": "5.1.0",
"eslint-config-fluid": "1.3.0",
"gpii-grunt-lint-all": "1.0.1-dev.20180706T153657Z.4cbbd61",
"grunt": "1.0.3",
"mkdirp": "0.5.1",
"eslint": "7.4.0",
"eslint-config-fluid": "1.4.0",
"fluid-grunt-lint-all": "1.0.8-dev.20200707T084514Z.e9e8d1d.FLUID-6524",
"grunt": "1.2.0",
"mkdirp": "1.0.4",
"node-jqunit": "1.1.8",
"nyc": "13.0.1",
"rimraf": "2.6.2"
"nyc": "15.1.0",
"rimraf": "3.0.2"
}
}
Loading

0 comments on commit 3d5bec6

Please sign in to comment.