Skip to content

Commit

Permalink
chore(auto-install): update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Jul 30, 2020
1 parent b3b8efd commit adb97d0
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 39 deletions.
18 changes: 10 additions & 8 deletions packages/auto-install/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
"homepage": "https://github.com/rollup/plugins/tree/master/packages/auto-install/#readme",
"bugs": "https://github.com/rollup/plugins/issues",
"main": "dist/index.js",
"module": "dist/index.es.js",
"scripts": {
"build": "rollup -c",
"ci:coverage": "nyc pnpm run test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:lint": "pnpm run build && pnpm run lint",
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}",
"ci:test": "pnpm run test -- --verbose",
"lint": "pnpm run lint:js && pnpm run lint:docs && pnpm run lint:package",
"lint:docs": "prettier --single-quote --write README.md",
"lint:docs": "prettier --single-quote --arrow-parens avoid --write README.md",
"lint:js": "eslint --fix --cache src test --ext .js,.ts",
"lint:package": "prettier --write package.json --plugin=prettier-plugin-package",
"prebuild": "del-cli dist",
Expand All @@ -45,14 +46,17 @@
"rollup": "^1.20.0||^2.0.0"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^7.0.0",
"@rollup/plugin-typescript": "^3.0.0",
"@rollup/plugin-node-resolve": "^8.4.0",
"@rollup/plugin-typescript": "^5.0.2",
"del": "^5.1.0",
"node-noop": "^1.0.0",
"rollup": "^2.0.0"
"rollup": "^2.23.0"
},
"types": "types/index.d.ts",
"ava": {
"compileEnhancements": false,
"babel": {
"compileEnhancements": false
},
"extensions": [
"ts"
],
Expand All @@ -66,7 +70,5 @@
"!**/recipes/**",
"!**/types.ts"
]
},
"module": "dist/index.es.js",
"types": "types/index.d.ts"
}
}
4 changes: 2 additions & 2 deletions packages/auto-install/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import pkg from './package.json';

export default {
input: 'src/index.ts',
plugins: [typescript()],
plugins: [typescript({ sourceMap: false })],
external: ['path', 'fs', 'child_process', 'module', 'util'],
output: [
{ format: 'cjs', file: pkg.main },
{ format: 'cjs', file: pkg.main, exports: 'auto' },
{ format: 'esm', file: pkg.module }
]
};
2 changes: 1 addition & 1 deletion packages/auto-install/test/fixtures/input.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import noop from 'node-noop'; // eslint-disable-line
import 'node-noop'; // eslint-disable-line
5 changes: 3 additions & 2 deletions packages/auto-install/test/npm-bare.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { join } = require('path');

const test = require('ava');
const del = require('del');
const resolve = require('@rollup/plugin-node-resolve');
const { nodeResolve } = require('@rollup/plugin-node-resolve');
const { rollup } = require('rollup');

const autoInstall = require('..');
Expand All @@ -15,13 +15,14 @@ const input = join(cwd, '../input.js');
process.chdir(cwd);

test('npm, bare', async (t) => {
t.timeout(30000);
await rollup({
input,
output: {
file,
format: 'cjs'
},
plugins: [autoInstall(), resolve()]
plugins: [autoInstall(), nodeResolve()]
});
t.snapshot(readFileSync('package.json', 'utf-8'));
t.snapshot(readFileSync('package-lock.json', 'utf-8'));
Expand Down
12 changes: 8 additions & 4 deletions packages/auto-install/test/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { join } = require('path');

const test = require('ava');
const del = require('del');
const resolve = require('@rollup/plugin-node-resolve');
const { nodeResolve } = require('@rollup/plugin-node-resolve');
const { rollup } = require('rollup');

const autoInstall = require('..');
Expand All @@ -17,6 +17,7 @@ const pkgFile = join(cwd, 'package.json');
process.chdir(cwd);

test('invalid manager', (t) => {
t.timeout(30000);
const error = t.throws(
() =>
rollup({
Expand All @@ -25,21 +26,24 @@ test('invalid manager', (t) => {
file,
format: 'cjs'
},
plugins: [autoInstall({ pkgFile, manager: 'foo' }), resolve()]
plugins: [autoInstall({ pkgFile, manager: 'foo' }), nodeResolve()]
}),
RangeError
{
instanceOf: RangeError
}
);
t.snapshot(error.message);
});

test('npm', async (t) => {
t.timeout(30000);
await rollup({
input,
output: {
file,
format: 'cjs'
},
plugins: [autoInstall({ pkgFile, manager }), resolve()]
plugins: [autoInstall({ pkgFile, manager }), nodeResolve()]
});
t.snapshot(readFileSync('package-lock.json', 'utf-8'));
});
Expand Down
5 changes: 3 additions & 2 deletions packages/auto-install/test/yarn-bare.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { join } = require('path');

const test = require('ava');
const del = require('del');
const resolve = require('@rollup/plugin-node-resolve');
const { nodeResolve } = require('@rollup/plugin-node-resolve');
const { rollup } = require('rollup');

const autoInstall = require('..');
Expand All @@ -15,6 +15,7 @@ const input = join(cwd, '../input.js');
process.chdir(cwd);

test('yarn, bare', async (t) => {
t.timeout(30000);
await rollup({
input,
output: {
Expand All @@ -24,7 +25,7 @@ test('yarn, bare', async (t) => {
plugins: [
// mock the call to yarn here. yarn has had consistent issues in this test env
autoInstall({ manager: 'yarn', commands: { yarn: 'echo yarn.bare > yarn.lock' } }),
resolve()
nodeResolve()
]
});
const lockFile = readFileSync('yarn.lock', 'utf-8');
Expand Down
5 changes: 3 additions & 2 deletions packages/auto-install/test/yarn.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { join } = require('path');

const test = require('ava');
const del = require('del');
const resolve = require('@rollup/plugin-node-resolve');
const { nodeResolve } = require('@rollup/plugin-node-resolve');
const { rollup } = require('rollup');

const autoInstall = require('..');
Expand All @@ -15,14 +15,15 @@ const input = join(cwd, '../input.js');
process.chdir(cwd);

test('yarn', async (t) => {
t.timeout(30000);
await rollup({
input,
output: {
file,
format: 'cjs'
},
// mock the call to yarn here. yarn has had consistent issues in this test env
plugins: [autoInstall({ commands: { yarn: 'echo yarn > yarn.lock' } }), resolve()]
plugins: [autoInstall({ commands: { yarn: 'echo yarn > yarn.lock' } }), nodeResolve()]
});
const lockFile = readFileSync('yarn.lock', 'utf-8');
// snapshots for this are a nightmare cross-platform
Expand Down
24 changes: 12 additions & 12 deletions packages/auto-install/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { Plugin } from 'rollup';

export interface RollupAutoInstallOptions {
/**
* Specifies the location on disk of the target `package.json` file.
* If the file doesn't exist, it will be created by the plugin,
* as package managers need to populate the `dependencies` property.
* @default '{cwd}/package.json'
*/
pkgFile?: string;
/**
* Specifies the location on disk of the target `package.json` file.
* If the file doesn't exist, it will be created by the plugin,
* as package managers need to populate the `dependencies` property.
* @default '{cwd}/package.json'
*/
pkgFile?: string;

/**
* Specifies the package manager to use; `npm` or `yarn`.
* If not specified, the plugin will default to `yarn` if `yarn.lock` exists, or `npm` otherwise.
*/
manager?: 'npm' | 'yarn';
/**
* Specifies the package manager to use; `npm` or `yarn`.
* If not specified, the plugin will default to `yarn` if `yarn.lock` exists, or `npm` otherwise.
*/
manager?: 'npm' | 'yarn';
}

/**
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit adb97d0

Please sign in to comment.