Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// utils
import fs from 'fs';
import rc from 'rc';
import defaults from '../.htmplarrc.json';
const { defaultCss } = rc('htmplar', defaults);
const getDefaultStyles = () => fs.readFileSync(`${ __dirname }/base.css`);
const getTemplateDefaultStyles = () => {
if (defaultCss && defaultCss !== 'false') {
return fs.readFileSync(defaultCss);
}
return '';
};
const getBaseStyles = () => {
const defaultStyles = getDefaultStyles();
const templateStyles = getTemplateDefaultStyles();
return {
load( defaults, file ) {
if ( undefined === file ) {
file = 'yoprofile';
}
// Parse the stored config
let config = rc( file );
let profile;
if ( undefined !== config.profile ) {
// The profile is explicitly set
profile = config.profile;
} else if ( undefined !== config.default ) {
profile = config.default;
}
// If we're specifying a profile, fetch that profile
if ( undefined !== profile && undefined !== config[ profile ] ) {
_.extend( defaults, config[ profile ] );
}
this._props = defaults;
// htmplar-serve utils
import rc from 'rc';
import defaults from '../.htmplarrc.json';
export const cfg = rc('htmplar', defaults);
To do this, you will need to provide following informations:
* the name of the API in slug format. For example "rick-and-morty" to call the API on http://localhost/rick-and-morty
* the real basic url of the API. For example, https://rickandmortyapi.com/api (without final slash)
Optionally, if the API needs an authentication token
* the name of the http header to add
* the possible prefix to add to the token
`;
clearWn();
signale.log(boxen(help, { padding: 1 }));
};
clearWn();
const globalConfiguration = rc('webmyna');
if (!globalConfiguration.config) {
const run = async () => {
const configurationLocation = await questions.askConfigurationLocation();
displayApiHelp();
let apis = [];
let configureApi = true;
while (configureApi) {
if (apis.length) {
signale.log(`You already have ${apis.length} api.s configured`);
}
const apiConfiguration = await questions.askApiConfiguration();
apis.push(omit(apiConfiguration, ['continue']));
configureApi = apiConfiguration.continue;
}
function registryUrl(scope = ''): string {
const result = rc('npm', { registry: 'https://registry.npmjs.org/' })
return result[`${scope}:registry`] || result.config_registry || result.registry
}
loadSettings() {
const startingSettings = JSON.parse(JSON.stringify(this.defaultSettings));
this.settings = rc('blueprint', startingSettings, this.args, this.myParse);
}
import rc from 'rc'
export default rc('david', {
brains: {
cacheTime: 86400000
},
github: {
api: {
version: '3.0.0',
protocol: 'https',
host: 'api.github.com',
pathPrefix: null,
timeout: 5000,
caFile: null
},
protocol: 'https',
host: 'github.com',
oauth: {
clientId: null,
export const getOptions = (): FullNodeCreateOptions['options'] => {
let options = rc('neo-one', DEFAULT_OPTIONS) as FullNodeCreateOptions['options'];
const { blockchain } = options;
if ((typeof blockchain as any) === 'string') {
options = {
...options,
blockchain: serializeSettings((blockchain as any) === 'test' ? createTest() : createMain()) as any,
};
}
options = {
...options,
blockchain: deserializeSettings(options.blockchain),
};
return options;
};