Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit d1e9740

Browse files
authored
feat(pnp): compatible with yarn2 pnp (#23)
* feat(pnp): compatible with yarn2 pnp * refactor(example): move example * feat(example): pnp example * fix: ts-jest 27+ requires jest 27+
1 parent c66a396 commit d1e9740

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+62884
-1257
lines changed

example/pnp/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.yarn/*
2+
!.yarn/patches
3+
!.yarn/releases
4+
!.yarn/plugins
5+
!.yarn/sdks
6+
!.yarn/versions
7+
.pnp.*
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["arcanis.vscode-zipfs", "esbenp.prettier-vscode"]
3+
}

example/pnp/.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"search.exclude": {
3+
"**/.yarn": true,
4+
"**/.pnp.*": true
5+
},
6+
"typescript.tsdk": ".yarn/sdks/typescript/lib",
7+
"typescript.enablePromptUseWorkspaceTsdk": true,
8+
"prettier.prettierPath": ".yarn/sdks/prettier/index.js"
9+
}

example/pnp/.yarn/releases/yarn-berry.cjs

Lines changed: 59015 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file is automatically generated by PnPify.
2+
# Manual changes will be lost!
3+
4+
integrations:
5+
- vscode
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env node
2+
3+
const { existsSync } = require(`fs`);
4+
const { createRequire, createRequireFromPath } = require(`module`);
5+
const { resolve } = require(`path`);
6+
7+
const relPnpApiPath = '../../../.pnp.js';
8+
9+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10+
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
11+
12+
if (existsSync(absPnpApiPath)) {
13+
if (!process.versions.pnp) {
14+
// Setup the environment to be able to require prettier/index.js
15+
require(absPnpApiPath).setup();
16+
}
17+
}
18+
19+
// Defer to the real prettier/index.js your application uses
20+
module.exports = absRequire(`prettier/index.js`);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "prettier",
3+
"version": "2.3.1-pnpify",
4+
"main": "./index.js",
5+
"type": "commonjs"
6+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env node
2+
3+
const { existsSync } = require(`fs`);
4+
const { createRequire, createRequireFromPath } = require(`module`);
5+
const { resolve } = require(`path`);
6+
7+
const relPnpApiPath = '../../../../.pnp.js';
8+
9+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10+
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
11+
12+
if (existsSync(absPnpApiPath)) {
13+
if (!process.versions.pnp) {
14+
// Setup the environment to be able to require typescript/bin/tsc
15+
require(absPnpApiPath).setup();
16+
}
17+
}
18+
19+
// Defer to the real typescript/bin/tsc your application uses
20+
module.exports = absRequire(`typescript/bin/tsc`);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env node
2+
3+
const { existsSync } = require(`fs`);
4+
const { createRequire, createRequireFromPath } = require(`module`);
5+
const { resolve } = require(`path`);
6+
7+
const relPnpApiPath = '../../../../.pnp.js';
8+
9+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10+
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
11+
12+
if (existsSync(absPnpApiPath)) {
13+
if (!process.versions.pnp) {
14+
// Setup the environment to be able to require typescript/bin/tsserver
15+
require(absPnpApiPath).setup();
16+
}
17+
}
18+
19+
// Defer to the real typescript/bin/tsserver your application uses
20+
module.exports = absRequire(`typescript/bin/tsserver`);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env node
2+
3+
const { existsSync } = require(`fs`);
4+
const { createRequire, createRequireFromPath } = require(`module`);
5+
const { resolve } = require(`path`);
6+
7+
const relPnpApiPath = '../../../../.pnp.js';
8+
9+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10+
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
11+
12+
if (existsSync(absPnpApiPath)) {
13+
if (!process.versions.pnp) {
14+
// Setup the environment to be able to require typescript/lib/tsc.js
15+
require(absPnpApiPath).setup();
16+
}
17+
}
18+
19+
// Defer to the real typescript/lib/tsc.js your application uses
20+
module.exports = absRequire(`typescript/lib/tsc.js`);

0 commit comments

Comments
 (0)