push all website files

This commit is contained in:
Jacob Levine
2019-01-06 13:14:45 -06:00
parent d7301e26c3
commit d2d5d4c04e
15662 changed files with 2166516 additions and 0 deletions

View File

@@ -0,0 +1,94 @@
import { EntryItem } from '../types/entries';
import { Pattern } from '../types/patterns';
export declare type TransformFunction<T> = (entry: EntryItem) => T;
export interface IOptions<T = EntryItem> {
/**
* The current working directory in which to search.
*/
cwd: string;
/**
* The deep option can be set to true to traverse the entire directory structure,
* or it can be set to a number to only traverse that many levels deep.
*/
deep: number | boolean;
/**
* Add an array of glob patterns to exclude matches.
*/
ignore: Pattern[];
/**
* Allow patterns to match filenames starting with a period (files & directories),
* even if the pattern does not explicitly have a period in that spot.
*/
dot: boolean;
/**
* Return `fs.Stats` with `path` property instead of file path.
*/
stats: boolean;
/**
* Return only files.
*/
onlyFiles: boolean;
/**
* Return only directories.
*/
onlyDirectories: boolean;
/**
* Follow symlinked directories when expanding `**` patterns.
*/
followSymlinkedDirectories: boolean;
/**
* Prevent duplicate results.
*/
unique: boolean;
/**
* Add a `/` character to directory entries.
*/
markDirectories: boolean;
/**
* Return absolute paths for matched entries.
*/
absolute: boolean;
/**
* Disable expansion of brace patterns.
*/
nobrace: boolean;
/**
* Enable expansion of brace patterns.
*/
brace: boolean;
/**
* Disable matching with globstars (`**`).
*/
noglobstar: boolean;
/**
* Enable matching with globstars (`**`).
*/
globstar: boolean;
/**
* Disable extglob support, so that extglobs are regarded as literal characters.
*/
noext: boolean;
/**
* Enable extglob support, so that extglobs are regarded as literal characters.
*/
extension: boolean;
/**
* Disable a case-insensitive regex for matching files.
*/
nocase: boolean;
/**
* Enable a case-insensitive regex for matching files.
*/
case: boolean;
/**
* Allow glob patterns without slashes to match a file path based on its basename.
* For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.
*/
matchBase: boolean;
/**
* Allows you to transform a path or `fs.Stats` object before sending to the array.
*/
transform: TransformFunction<T> | null;
}
export declare type IPartialOptions<T = EntryItem> = Partial<IOptions<T>>;
export declare function prepare(options?: IPartialOptions): IOptions;

View File

@@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function prepare(options) {
var opts = Object.assign({
cwd: process.cwd(),
deep: true,
ignore: [],
dot: false,
stats: false,
onlyFiles: true,
onlyDirectories: false,
followSymlinkedDirectories: true,
unique: true,
markDirectories: false,
absolute: false,
nobrace: false,
brace: true,
noglobstar: false,
globstar: true,
noext: false,
extension: true,
nocase: false,
case: true,
matchBase: false,
transform: null
}, options);
if (opts.onlyDirectories) {
opts.onlyFiles = false;
}
opts.brace = !opts.nobrace;
opts.globstar = !opts.noglobstar;
opts.extension = !opts.noext;
opts.case = !opts.nocase;
if (options) {
opts.brace = ('brace' in options ? options.brace : opts.brace);
opts.globstar = ('globstar' in options ? options.globstar : opts.globstar);
opts.extension = ('extension' in options ? options.extension : opts.extension);
opts.case = ('case' in options ? options.case : opts.case);
}
return opts;
}
exports.prepare = prepare;

View File

@@ -0,0 +1,37 @@
import { Pattern, PatternsGroup } from '../types/patterns';
import { IOptions } from './options';
export interface ITask {
base: string;
dynamic: boolean;
patterns: Pattern[];
positive: Pattern[];
negative: Pattern[];
}
/**
* Generate tasks based on parent directory of each pattern.
*/
export declare function generate(patterns: Pattern[], options: IOptions): ITask[];
/**
* Convert patterns to tasks based on parent directory of each pattern.
*/
export declare function convertPatternsToTasks(positive: Pattern[], negative: Pattern[], dynamic: boolean): ITask[];
/**
* Return only positive patterns.
*/
export declare function getPositivePatterns(patterns: Pattern[]): Pattern[];
/**
* Return only negative patterns.
*/
export declare function getNegativePatternsAsPositive(patterns: Pattern[], ignore: Pattern[]): Pattern[];
/**
* Group patterns by base directory of each pattern.
*/
export declare function groupPatternsByBaseDirectory(patterns: Pattern[]): PatternsGroup;
/**
* Convert group of patterns to tasks.
*/
export declare function convertPatternGroupsToTasks(positive: PatternsGroup, negative: Pattern[], dynamic: boolean): ITask[];
/**
* Create a task for positive and negative patterns.
*/
export declare function convertPatternGroupToTask(base: string, positive: Pattern[], negative: Pattern[], dynamic: boolean): ITask;

View File

@@ -0,0 +1,86 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var patternUtils = require("../utils/pattern");
/**
* Generate tasks based on parent directory of each pattern.
*/
function generate(patterns, options) {
var unixPatterns = patterns.map(patternUtils.unixifyPattern);
var unixIgnore = options.ignore.map(patternUtils.unixifyPattern);
var positivePatterns = getPositivePatterns(unixPatterns);
var negativePatterns = getNegativePatternsAsPositive(unixPatterns, unixIgnore);
var staticPatterns = positivePatterns.filter(patternUtils.isStaticPattern);
var dynamicPatterns = positivePatterns.filter(patternUtils.isDynamicPattern);
var staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false);
var dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true);
return staticTasks.concat(dynamicTasks);
}
exports.generate = generate;
/**
* Convert patterns to tasks based on parent directory of each pattern.
*/
function convertPatternsToTasks(positive, negative, dynamic) {
var positivePatternsGroup = groupPatternsByBaseDirectory(positive);
// When we have a global group there is no reason to divide the patterns into independent tasks.
// In this case, the global task covers the rest.
if ('.' in positivePatternsGroup) {
var task = convertPatternGroupToTask('.', positive, negative, dynamic);
return [task];
}
return convertPatternGroupsToTasks(positivePatternsGroup, negative, dynamic);
}
exports.convertPatternsToTasks = convertPatternsToTasks;
/**
* Return only positive patterns.
*/
function getPositivePatterns(patterns) {
return patternUtils.getPositivePatterns(patterns);
}
exports.getPositivePatterns = getPositivePatterns;
/**
* Return only negative patterns.
*/
function getNegativePatternsAsPositive(patterns, ignore) {
var negative = patternUtils.getNegativePatterns(patterns).concat(ignore);
var positive = negative.map(patternUtils.convertToPositivePattern);
return positive;
}
exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
/**
* Group patterns by base directory of each pattern.
*/
function groupPatternsByBaseDirectory(patterns) {
return patterns.reduce(function (collection, pattern) {
var base = patternUtils.getBaseDirectory(pattern);
if (base in collection) {
collection[base].push(pattern);
}
else {
collection[base] = [pattern];
}
return collection;
}, {});
}
exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
/**
* Convert group of patterns to tasks.
*/
function convertPatternGroupsToTasks(positive, negative, dynamic) {
return Object.keys(positive).map(function (base) {
return convertPatternGroupToTask(base, positive[base], negative, dynamic);
});
}
exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
/**
* Create a task for positive and negative patterns.
*/
function convertPatternGroupToTask(base, positive, negative, dynamic) {
return {
base: base,
dynamic: dynamic,
patterns: [].concat(positive, negative.map(patternUtils.convertToNegativePattern)),
positive: positive,
negative: negative
};
}
exports.convertPatternGroupToTask = convertPatternGroupToTask;