Skip to content

Commit

Permalink
Drafting a few changes (yarnpkg#737)
Browse files Browse the repository at this point in the history
* wip

* Fixes manifest fields

* Running yarn install

* Update tsconfig.json

* Adds versions

* Adds more redirects

* Adds more versions
  • Loading branch information
arcanis authored Jan 23, 2020
1 parent b296d7b commit 441a5e9
Show file tree
Hide file tree
Showing 27 changed files with 264 additions and 220 deletions.
368 changes: 184 additions & 184 deletions .pnp.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions .yarn/versions/2b78be1e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
releases:
"@yarnpkg/builder": prerelease
"@yarnpkg/cli": prerelease
"@yarnpkg/doctor": prerelease
"@yarnpkg/libzip": prerelease
"@yarnpkg/plugin-interactive-tools": prerelease
"@yarnpkg/plugin-pack": prerelease

declined:
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-exec"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-node-modules"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- vscode-zipfs
- "@yarnpkg/core"
- "@yarnpkg/fslib"
- "@yarnpkg/pnp"
2 changes: 1 addition & 1 deletion packages/gatsby/content/advanced/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Yarn doesn't support Node 8 anymore, as it's reached its end of life in December

### Run the doctor

Run `npx @yarnpkg/check .` (or `yarn dlx @yarnpkg/check .`) in your project to quickly get an overview of potential issues found in your codebase. For example here's what `webpack-dev-server` would reveal:
Run `npx @yarnpkg/doctor .` (or `yarn dlx @yarnpkg/doctor .`) in your project to quickly get an overview of potential issues found in your codebase. For example here's what `webpack-dev-server` would reveal:

```
➤ YN0000: Found 1 package(s) to process
Expand Down
20 changes: 18 additions & 2 deletions packages/gatsby/src/pages/configuration/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,36 @@ const PackageJsonDoc = () => <>
Defines the package access level to use when publishing packages to the npm registry. Valid values are <code>public</code> and <code>restricted</code>, but <code>restricted</code> usually requires to register for a paid plan (this is up to the registry you use).
</>}
/>
<JsonScalarProperty
name={`bin`}
anchor={`publishConfig.bin`}
placeholder={`./build/bin.js`}
description={<>
If present, the top-level <code>bin</code> field from the manifest will be set to this new value before the package is packed to be shipped to remote registries. This won't modify the real manifest, just the one stored within the tarball.
</>}
/>
<JsonScalarProperty
name={`browser`}
anchor={`publishConfig.browser`}
placeholder={`./build/browser.js`}
description={<>
Same principle as the <code>publishConfig.bin</code> property; this value will be used instead of the top-level <code>browser</code> field when generating the workspace tarball.
</>}
/>
<JsonScalarProperty
name={`main`}
anchor={`publishConfig.main`}
placeholder={`./build/index.js`}
description={<>
If present, the top-level <code>main</code> field from the manifest will be set to this new value before the package is packed to be shipped to remote registries. This won't modified the actual file, just the one in the tarball.
Same principle as the <code>publishConfig.bin</code> property; this value will be used instead of the top-level <code>main</code> field when generating the workspace tarball.
</>}
/>
<JsonScalarProperty
name={`module`}
anchor={`publishConfig.module`}
placeholder={`./build/index.mjs`}
description={<>
Same principle as the <code>publishConfig.main</code> property; this value will be used instead of the top-level <code>module</code> field when generating the workspace tarball.
Same principle as the <code>publishConfig.bin</code> property; this value will be used instead of the top-level <code>module</code> field when generating the workspace tarball.
</>}
/>
<JsonScalarProperty
Expand Down
4 changes: 3 additions & 1 deletion packages/gatsby/static/_redirects
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/latest-version https://legacy.yarnpkg.com/latest-version 301
/latest-rc-version https://legacy.yarnpkg.com/latest-rc-version 301

/latest.tar.gz https://legacy.yarnpkg.com/latest.tar.gz 301
/latest.tar.gz.asc https://legacy.yarnpkg.com/latest.tar.gz.asc 301
/latest.msi https://legacy.yarnpkg.com/latest.msi 301
Expand Down Expand Up @@ -42,4 +45,3 @@

/lang/zh-Hant/* https://legacy.yarnpkg.com/lang/zh-Hant/:splat 301
/zh-Hant/* https://legacy.yarnpkg.com/lang/zh-Hant/:splat 301

Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export default class UpgradeInteractiveCommand extends BaseCommand {
<Box textWrap={`wrap`} marginBottom={1}>
The following packages are direct dependencies of your project. Select those you want to upgrade, then press enter. Press ctrl-C to abort at any time:
</Box>
<ScrollableItems size={10} children={sortedDependencies.map(descriptor => {
<ScrollableItems radius={10} children={sortedDependencies.map(descriptor => {
return <UpgradeEntry key={descriptor.descriptorHash} active={false} descriptor={descriptor} />;
})} />
</Box>
Expand Down
3 changes: 3 additions & 0 deletions packages/plugin-pack/sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const beforeWorkspacePacking = (workspace: Workspace, rawManifest: any) => {
if (rawManifest.publishConfig.main)
rawManifest.main = rawManifest.publishConfig.main;

if (rawManifest.publishConfig.browser)
rawManifest.browser = rawManifest.publishConfig.browser;

if (rawManifest.publishConfig.module)
rawManifest.module = rawManifest.publishConfig.module;

Expand Down
6 changes: 1 addition & 5 deletions packages/yarnpkg-builder/sources/tools/makeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@ export const makeConfig = (config: webpack.Configuration) => merge({
},

resolve: {
alias: {
[`supports-color`]: `supports-color/index`,
[`agentkeepalive`]: `agentkeepalive/index`,
},
extensions: [`.js`, `.ts`, `.tsx`, `.json`],
mainFields: [`browser`, `module`, `main`],
mainFields: [`main`],
plugins: [PnpWebpackPlugin],
},

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# @yarnpkg/check
# @yarnpkg/doctor

A cli tool to help package maintainers support pnp.

## Usage

To check your package run:

`yarn dlx @yarnpkg/check ./package-dir`
`yarn dlx @yarnpkg/doctor ./package-dir`

You'll get a pretty output with all the warnings.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@yarnpkg/check",
"name": "@yarnpkg/doctor",
"version": "2.0.0-rc.12",
"bin": "./sources/boot-cli-dev.js",
"dependencies": {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ class EntryCommand extends Command {
}
}

const cli = new Cli({binaryName: `yarn dlx @yarnpkg/check`});
const cli = new Cli({binaryName: `yarn dlx @yarnpkg/doctor`});
cli.register(EntryCommand);
cli.runExit(process.argv.slice(2), {
stdin: process.stdin,
Expand Down
5 changes: 3 additions & 2 deletions packages/yarnpkg-libzip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
"name": "@yarnpkg/libzip",
"version": "2.0.0-rc.8",
"main": "./sources/sync.ts",
"browser": "./sources/async.ts",
"scripts": {
"build:libzip:wasm": "cd ./artifacts && ./build.sh",
"postpack": "rm -rf lib",
"prepack": "run build:compile \"$(pwd)\"",
"release": "yarn npm publish"
},
"publishConfig": {
"main": "./lib/index.js",
"typings": "./lib/index.d.ts"
"main": "./lib/sync.js",
"browser": "./lib/async.js"
},
"files": [
"/lib/**/*"
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
},
"exclude": [
"packages/*/lib",
"packages/yarnpkg-check/fixtures"
"packages/yarnpkg-doctor/fixtures"
]
}
38 changes: 19 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4773,25 +4773,6 @@ __metadata:
languageName: unknown
linkType: soft

"@yarnpkg/check@workspace:packages/yarnpkg-check":
version: 0.0.0-use.local
resolution: "@yarnpkg/check@workspace:packages/yarnpkg-check"
dependencies:
"@types/micromatch": ^3.1.0
"@yarnpkg/cli": "workspace:^2.0.0-rc.25"
"@yarnpkg/core": "workspace:^2.0.0-rc.20"
"@yarnpkg/fslib": "workspace:^2.0.0-rc.15"
"@yarnpkg/monorepo": "workspace:0.0.0"
clipanion: ^2.1.5
globby: ^10.0.1
micromatch: ^4.0.2
p-limit: ^2.2.0
typescript: ^3.7.4
bin:
check: ./sources/boot-cli-dev.js
languageName: unknown
linkType: soft

"@yarnpkg/cli@workspace:^2.0.0-rc.25, @yarnpkg/cli@workspace:packages/yarnpkg-cli":
version: 0.0.0-use.local
resolution: "@yarnpkg/cli@workspace:packages/yarnpkg-cli"
Expand Down Expand Up @@ -4879,6 +4860,25 @@ __metadata:
languageName: unknown
linkType: soft

"@yarnpkg/doctor@workspace:packages/yarnpkg-doctor":
version: 0.0.0-use.local
resolution: "@yarnpkg/doctor@workspace:packages/yarnpkg-doctor"
dependencies:
"@types/micromatch": ^3.1.0
"@yarnpkg/cli": "workspace:^2.0.0-rc.25"
"@yarnpkg/core": "workspace:^2.0.0-rc.20"
"@yarnpkg/fslib": "workspace:^2.0.0-rc.15"
"@yarnpkg/monorepo": "workspace:0.0.0"
clipanion: ^2.1.5
globby: ^10.0.1
micromatch: ^4.0.2
p-limit: ^2.2.0
typescript: ^3.7.4
bin:
doctor: ./sources/boot-cli-dev.js
languageName: unknown
linkType: soft

"@yarnpkg/fslib@workspace:^2.0.0-rc.15, @yarnpkg/fslib@workspace:packages/yarnpkg-fslib":
version: 0.0.0-use.local
resolution: "@yarnpkg/fslib@workspace:packages/yarnpkg-fslib"
Expand Down

0 comments on commit 441a5e9

Please sign in to comment.