-
-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(auto-install): support pnpm (#1012)
* feat(auto-install): support pnpm * chore: update test * test: do not snap package-lock.json
- Loading branch information
Showing
13 changed files
with
92 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{} | ||
{} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const { readFileSync } = require('fs'); | ||
const { join } = require('path'); | ||
|
||
const test = require('ava'); | ||
const del = require('del'); | ||
const { nodeResolve } = require('@rollup/plugin-node-resolve'); | ||
const { rollup } = require('rollup'); | ||
|
||
const autoInstall = require('..'); | ||
|
||
const cwd = join(__dirname, 'fixtures/pnpm-bare'); | ||
const file = join(cwd, 'output/bundle.js'); | ||
const input = join(cwd, '../input.js'); | ||
|
||
process.chdir(cwd); | ||
|
||
test('pnpm, bare', async (t) => { | ||
t.timeout(50000); | ||
await rollup({ | ||
input, | ||
output: { | ||
file, | ||
format: 'cjs' | ||
}, | ||
plugins: [autoInstall({ manager: 'pnpm' }), nodeResolve()] | ||
}); | ||
const json = JSON.parse(readFileSync('package.json', 'utf-8')); | ||
// snapshots for this are a nightmare cross-platform | ||
t.truthy('node-noop' in json.dependencies); | ||
}); | ||
|
||
test.after(async () => { | ||
await del(['node_modules', 'package.json', 'pnpm-lock.yaml']); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const { readFileSync, writeFileSync } = require('fs'); | ||
const { join } = require('path'); | ||
|
||
const test = require('ava'); | ||
const del = require('del'); | ||
const { nodeResolve } = require('@rollup/plugin-node-resolve'); | ||
const { rollup } = require('rollup'); | ||
|
||
const autoInstall = require('..'); | ||
|
||
const cwd = join(__dirname, 'fixtures/pnpm'); | ||
const file = join(cwd, 'output/bundle.js'); | ||
const input = join(cwd, '../input.js'); | ||
|
||
process.chdir(cwd); | ||
|
||
test('pnpm', async (t) => { | ||
t.timeout(50000); | ||
await rollup({ | ||
input, | ||
output: { | ||
file, | ||
format: 'cjs' | ||
}, | ||
plugins: [autoInstall(), nodeResolve()] | ||
}); | ||
|
||
const json = JSON.parse(readFileSync('package.json', 'utf-8')); | ||
// snapshots for this are a nightmare cross-platform | ||
t.truthy('node-noop' in json.dependencies); | ||
}); | ||
|
||
test.after(async () => { | ||
await del(['node_modules', 'package.json']); | ||
writeFileSync('pnpm-lock.yaml', ''); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.