Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
│ You may obtain a copy of the License at │
│ │
│ http://www.apache.org/licenses/LICENSE-2.0 │
│ │
│ Unless required by applicable law or agreed to in writing, software │
│ distributed under the License is distributed on an "AS IS" BASIS, │
│ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. │
│ See the License for the specific language governing permissions and │
│ limitations under the License. │
\*───────────────────────────────────────────────────────────────────────────*/
import minimist from 'minimist';
import debuglog from 'debuglog';
import Common from './common.js';
const debug = debuglog('confit');
export default {
argv() {
let result = {};
let args = minimist(process.argv.slice(2));
for (let key of Object.keys(args)) {
if (key === '_') {
// Since the '_' args are standalone,
// just set keys with null values.
for (let prop of args._) {
result[prop] = null;
}
} else {
result[key] = args[key];
import debuglog from 'debuglog';
import fs from 'fs-promise';
import path from 'path';
import logError from './log_error';
import File from 'vinyl';
import through2 from 'through2';
const debug = debuglog('dr-frankenstyle');
export default function() {
let concatenatedCss = '';
return through2.obj(
async function(file, encoding, callback) {
debug(`Processing css: ${file.path}`);
const assetFilesToAdd = [];
const cssWithUpdatedPaths = file.contents.toString().replace(/url\(\s*(['"]?)(.*?)([#?].*?)?\1\s*\)/g, (_, quote, url, query) => {
assetFilesToAdd.push({
readPath: path.join(path.dirname(file.path), url),
namespacedPath: path.join(file.packageName, path.basename(url))
});
return `url('${file.packageName}/${path.basename(url)}${query || ''}')`;
});
│ distributed under the License is distributed on an "AS IS" BASIS, │
│ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. │
│ See the License for the specific language governing permissions and │
│ limitations under the License. │
\*───────────────────────────────────────────────────────────────────────────*/
import Path from 'path';
import loadJsonicSync from 'load-jsonic-sync';
import debuglog from 'debuglog';
import Thing from 'core-util-is';
import Config from './config';
import Common from './common';
import Handlers from './handlers';
import Provider from './provider';
const debug = debuglog('confit');
export default class Factory {
constructor({ basedir, protocols = {}, defaults = 'config.json', envignore = []}) {
this.envignore = envignore.push('env');
this.basedir = basedir;
this.protocols = protocols;
this.promise = Promise.resolve({})
.then(store => Common.merge(Provider.convenience(), store))
.then(Factory.conditional(store => {
let file = Path.join(this.basedir, defaults);
return Handlers.resolveImport(loadJsonicSync(file), this.basedir)
.then(data => Common.merge(data, store));
}))
.then(Factory.conditional(store => {
let file = Path.join(this.basedir, `${store.env.env}.json`);