Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let options = {
populateWithDummy: false,
env: { DENALI_ENV: 'development' }
};
// Generate a nested addon graph: my-denali-app -> my-denali-addon -> my-nested-denali-addon
let app = new CommandAcceptanceTest('new my-denali-app --use-npm', options);
let addon = new CommandAcceptanceTest('addon my-denali-addon --use-npm', options);
let nestedAddon = new CommandAcceptanceTest('addon my-nested-denali-addon --use-npm', options);
let appPath = path.join(app.dir, 'my-denali-app');
let addonPath = path.join(addon.dir, 'my-denali-addon');
let nestedAddonPath = path.join(nestedAddon.dir, 'my-nested-denali-addon');
await Promise.all([ app.run(), addon.run(), nestedAddon.run() ]);
// Symlink this version of denali into each
let denaliPath = path.dirname(path.dirname(findup('package.json')));
linkDependency(appPath, 'denali', denaliPath);
linkDependency(addonPath, 'denali', denaliPath);
linkDependency(nestedAddonPath, 'denali', denaliPath);
// Symlink the generated addons into a dependency graph, a la npm link
addDependency(appPath, 'my-denali-addon', '*');
linkDependency(appPath, 'my-denali-addon', addonPath);
addDependency(addonPath, 'my-nested-denali-addon', '*');
linkDependency(addonPath, 'my-nested-denali-addon', nestedAddonPath);
// Add our signal flag, an initializer that just logs something out
fs.writeFileSync(path.join(addonPath, 'config', 'initializers', 'my-initializer.js'), `
export default {
name: 'my-initializer',
initialize() {
console.log('shallow');
}
}
export = function loadBrocfile(options: LoadBrocfileOptions = {}) {
let brocfilePath;
if (options.brocfilePath) {
brocfilePath = path.resolve(options.brocfilePath);
} else {
brocfilePath = findup('Brocfile.{ts,js}', {
nocase: true,
});
}
if (!brocfilePath) {
throw new Error('Brocfile.[js|ts] not found');
}
const baseDir = options.cwd || path.dirname(brocfilePath);
// The chdir should perhaps live somewhere else and not be a side effect of
// this function, or go away entirely
process.chdir(baseDir);
const brocfile = requireBrocfile(brocfilePath);
import findKey from 'lodash/findKey';
import forIn from 'lodash/forIn';
import AddonCommand from './addon';
import BuildCommand from './build';
import ConsoleCommand from './console';
import RoutesCommand from './routes';
import RootCommand from './root';
import DestroyCommand from './destroy';
import GenerateCommand from './generate';
import InstallCommand from './install';
import NewCommand from './new';
import ServerCommand from './server';
import TestCommand from './test';
let projectPkgPath = findup('package.json');
let isDenaliPkg = false;
let projectPkg;
if (projectPkgPath) {
projectPkg = require(path.resolve(projectPkgPath));
isDenaliPkg = projectPkg.keywords && (projectPkg.keywords.includes('denali-addon') || projectPkg.dependencies.denali);
}
let commands = {};
if (isDenaliPkg) {
// Load the available addon commands by recusring through the dependency graph
// and loading the 'commands.js' file for each addon
let addons = discoverAddons(process.cwd());
addons = topsort(addons, { valueKey: 'value' });
// Merge the depedency graph so that later addons take precedence over earlier
const getConfig = (altPath, fileName = '.sgcrc') => {
const pathString = findup(fileName, { cwd: altPath || cwd });
const localeConfigJS = safeRequire(findup('sgc.config.js', { cwd }));
const localeConfig = json.readToObjSync(pathString);
const globalConfigJS = safeRequire(path.join(homedir, 'sgc.config.js'));
const globalConfig = json.readToObjSync(path.join(homedir, '.sgcrc'));
const packageConfig = json.readToObjSync(findup('package.json', { cwd })).sgc;
const sgcrcDefaultConfig = json.readToObjSync(path.join(__dirname, '..', '.sgcrc'));
const sgcrcTestDefaultConfig = json.readToObjSync(path.join(__dirname, '..', '.sgcrc_default'));
const sgcrcDefault = sgcrcDefaultConfig || sgcrcTestDefaultConfig;
// priority order (1. highest priority):
// 1. local config
// - 1. sgc.config.js
// - 2. .sgcrc
// - 3. (package.json).sgc
// 2. global config
findup(glob, options = {}, fullPath = true) {
let f = findup(glob, options)
if (f && fullPath) {
return path.resolve(f)
}
else {
return f
}
}
throw new Error(`Task ${t} is listed more than once. This is probably a typo.`)
}
foundTasks[t] = true
}
if (isArray) {
if (t.length === 0) {
throw new Error(`An empty array was provided as a task set`)
}
this.verifyTaskSets(t, true, foundTasks)
}
}
}
}
const node_modules$1 = findup('node_modules')
const Default$7 = {
debug: false,
presetType: 'javascripts',
task: {
name: 'rollup:es'
},
watch: {
glob: '**/*.js',
options: {
//cwd: ** resolved from preset **
}
},
//source: { }, ** resolved from preset **
export const getHammerConfigPath = (): string => {
const configPath = findUp(HAMMER_CONFIG_FILE)
if (!configPath) {
throw new Error(
`Could not find a "${HAMMER_CONFIG_FILE}" file, are you in a hammer project?`
)
}
return configPath
}
function readConfig(): LagoonConfig | null {
const configPath = findup('.lagoon.yml');
if (configPath == null) {
return null;
}
const yamlContent = fs.readFileSync(configPath);
return parseConfig(yamlContent.toString());
}
export default function(manifest) {
const packagePath = findupSync('package.json')
const packageConfig = fs.readJSONSync(packagePath)
const { name, description, version } = packageConfig
manifest = {
name,
description,
version,
...manifest
}
return {manifest}
}
findup(glob, options = {}, fullPath = true) {
let f = findup(glob, options)
if(this.config.debug) {
this.debug(`findup-sync(${glob}, ${this.dump(options)}): ${this.dump(f)}`)
}
if (f && fullPath) {
return path.resolve(f)
}
else {
return f
}
}