Skip to content

Commit

Permalink
chore(auto-install): add some logging
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Jul 28, 2020
1 parent 659a675 commit f48e3e0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions packages/auto-install/src/index.ts
Expand Up @@ -55,6 +55,7 @@ export default function autoInstall(opts: RollupAutoInstallOptions = {}): Plugin
const isExternalPackage =
importee[0] !== '.' && importee[0] !== '\0' && !path.isAbsolute(importee);

console.log('importee', importee, isExternalPackage);
if (isExternalPackage) {
// we have a bare import — check it's installed
const parts = importee.split('/');
Expand All @@ -65,6 +66,7 @@ export default function autoInstall(opts: RollupAutoInstallOptions = {}): Plugin
// eslint-disable-next-line no-console
console.log(`installing ${name}...`);
await execAsync(`${cmd} ${name}`);
console.log('Installed', name);
}
}

Expand Down
5 changes: 4 additions & 1 deletion packages/auto-install/test/npm-bare.js
Expand Up @@ -14,7 +14,9 @@ const input = join(cwd, '../input.js');

process.chdir(cwd);

test.serial('npm, bare', async (t) => {
test('npm, bare', async (t) => {
t.timeout(20000);
console.log('BEFORE npm bare');
await rollup({
input,
output: {
Expand All @@ -23,6 +25,7 @@ test.serial('npm, bare', async (t) => {
},
plugins: [autoInstall(), nodeResolve()]
});
console.log('AFTER npm bare');
t.snapshot(readFileSync('package.json', 'utf-8'));
t.snapshot(readFileSync('package-lock.json', 'utf-8'));
});
Expand Down
4 changes: 2 additions & 2 deletions packages/auto-install/test/npm.js
Expand Up @@ -16,7 +16,7 @@ const pkgFile = join(cwd, 'package.json');

process.chdir(cwd);

test.serial('invalid manager', (t) => {
test('invalid manager', (t) => {
const error = t.throws(
() =>
rollup({
Expand All @@ -34,7 +34,7 @@ test.serial('invalid manager', (t) => {
t.snapshot(error.message);
});

test.serial('npm', async (t) => {
test('npm', async (t) => {
await rollup({
input,
output: {
Expand Down
2 changes: 1 addition & 1 deletion packages/auto-install/test/yarn-bare.js
Expand Up @@ -14,7 +14,7 @@ const input = join(cwd, '../input.js');

process.chdir(cwd);

test.serial('yarn, bare', async (t) => {
test('yarn, bare', async (t) => {
await rollup({
input,
output: {
Expand Down
2 changes: 1 addition & 1 deletion packages/auto-install/test/yarn.js
Expand Up @@ -14,7 +14,7 @@ const input = join(cwd, '../input.js');

process.chdir(cwd);

test.serial('yarn', async (t) => {
test('yarn', async (t) => {
await rollup({
input,
output: {
Expand Down

0 comments on commit f48e3e0

Please sign in to comment.