Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (dep.url === '.') {
// Look up the parent plugin's fetch metadata and determine the correct URL.
var fetchdata = require('./util/metadata').get_fetch_metadata(install.plugins_dir, install.top_plugin_id);
if (!fetchdata || !(fetchdata.source && fetchdata.source.type)) {
relativePath = dep.subdir || dep.id;
events.emit('warn', 'No fetch metadata found for plugin ' + install.top_plugin_id + '. checking for ' + relativePath + ' in ' + options.searchpath.join(','));
return Promise.resolve(relativePath);
}
// Now there are two cases here: local directory, and git URL.
if (fetchdata.source.type === 'local') {
dep.url = fetchdata.source.path;
return execa.command('git rev-parse --show-toplevel', { cwd: dep.url })
.catch(err => {
if (err.exitCode === 128) {
throw new Error('Plugin ' + dep.id + ' is not in git repository. All plugins must be in a git repository.');
} else {
throw new Error('Failed to locate git repository for ' + dep.id + ' plugin.');
}
})
.then(({ stdout: git_repo }) => {
// Clear out the subdir since the url now contains it
var url = path.join(git_repo, dep.subdir);
dep.subdir = '';
return Promise.resolve(url);
}).catch(function () {
return Promise.resolve(dep.url);
});
} else if (fetchdata.source.type === 'git') {
task('ts', async () => {
await execa.command('eslint ./ts --max-warnings 0 --ext .js,.jsx,.ts,.tsx', {
preferLocal: true,
stdout: process.stdout,
stderr: process.stderr
});
await execa.command('tsc --project ./ts/tsconfig.json --module ES2015 --noEmit false --outDir ./dist --declaration true', {
preferLocal: true,
stdout: process.stdout,
stderr: process.stderr
});
// Add .js extension to all imports.
// Technically TypeScript already resolves .js to .ts, but it's a hack.
await Promise.all((await fg(['dist/**/*.js'])).map(async path => {
const content = await jetpack.readAsync(path);
const replaced = content.replace(/from '(\.[^']+)';/g, "from '$1.js';");
async function gitBranchName() {
try {
const { stdout } = await execa.command('git rev-parse --abbrev-ref HEAD')
return stdout.trim()
} catch (e) {
console.log(`gitBranchName Error`, e)
}
}
deleteSmokeTag() {
return execa.command(`git tag -d ${this.name}@${this.version}`, {
shell: true,
});
}
installDepsSpinner.fail(
`Something went wrong. Couldn't install the dependencies!`,
);
throw err;
}
installDepsSpinner.succeed(`You're all set`);
if (templateDir === 'server' && projectTemplate === 'Nuxt-js')
process.chdir('server');
const launchSpinner = new Spinner(
'The default browser will open up in a while',
);
launchSpinner.start();
Promise.all([execa.command('npm run dev'), open(`${rootPath}:${port}`)]);
launchSpinner.info(`Available on ${rootPath}:${port}`);
};
const runCommand = function(command, options) {
const optionsA = { ...DEFAULT_OPTIONS, ...options }
const childProcess = execa.command(command, optionsA)
redirectOutput(childProcess, optionsA)
return childProcess
}
_modules.map((pck) =>
execa
.command(
`lerna list -alp --include-filtered-dependencies --json --scope="${pck.name}"`,
{ shell: true },
)
.then(({ stdout }) => {
const dependents = JSON.parse(stdout).filter(
(p) => p.name !== pck.name,
);
return Object.assign(pck, { dependents });
}),
),
async startup() {
await execa.command('wp-scripts env start');
return 'Started!';
},
async function isYarnInstalled(): Promise {
try {
const result = await execa.command(`yarn --version`, { stdio: `ignore` })
debug('result', result)
return true
} catch (err) {
debug('failed', err)
return false
}
}
async function migrate() {
await ensureFile(path);
await execa.command('npm run up');
migrated = true;
}