Skip to content

Instantly share code, notes, and snippets.

🎃
Writing the open-source software that you may be using everyday

Maël Nison arcanis

🎃
Writing the open-source software that you may be using everyday
Block or report user

Report or block arcanis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View antd.yml.diff
diff --git a/yarn.lock b/yarn.lock
index 391dbc4..7204d18 100644
--- a/yarn.lock
+++ b/yarn.lock
"rc-align@npm:^2.4.0, rc-align@npm:^2.4.1":
version: 2.4.5
resolution: "rc-align@npm:2.4.5"
dependencies:
babel-runtime: "npm:^6.26.0"
dom-align: "npm:^1.7.0"
View findDependents.ts
const locator = structUtils.makeLocator(`debug`, `npm:1.0.0`);
for (const pkg of project.storedPackages) {
const dependencies = Array.from(pkg.dependencies.values());
const isDependent = dependencies.some(dependency => {
const resolution = project.storedResolutions.get(dependency.descriptorHash)!;
return resolution === locator.locatorHash;
});
View my-plugin.js
module.exports = {
name: `berry-plugin-is-yarn`,
factory: () => ({
default: {
hooks: {
setupScriptEnvironment(project, env, makePathWrapper) {
env.IS_YARN = `1`;
},
},
},
View foo.js
resolveModuleNames: (moduleNames, containingFile) => {
try {
const pnpModuleNames = moduleNames.map(moduleName => {
const [, prefix, rest] = moduleName.match(/^((?:!.*!)?)(.*)/);
const unqualified = require('pnpapi').resolveToUnqualified(rest, containingFile);
return unqualified !== null ? prefix + unqualified : moduleName;
});
const tsResolutions = resolveModuleNames(resolveSync, moduleResolutionHost, appendTsSuffixTo, appendTsxSuffixTo, scriptRegex, instance, pnpModuleNames, containingFile, getResolutionStrategy);
for (let t = 0; t < tsResolutions.length; ++t)
View getting-started.md

Getting Started With Plug'n'Play

If you use create-react-app, #5136 (released with the 2.0) implements a --use-pnp option that allows you to easily create a new project using PnP! In this case, just use create-react-app --use-pnp together with Yarn 1.12, and you're good to go! 👍

Plug'n'Play is a new initiative from Yarn that aims to remove the need for node_modules. It's already available, and has proved being effective even on large-scale infrastructures. This document describes in a few steps how to quickly get started with it. Spoiler alert: it's quite easy 🙂

First, download a package manager that supports it. Yarn 1.12 already does, so that's what we're going to use! To install it, just follow the instructions on our website: https://yarnpkg.com/en/docs/install

If everything is ok, running yarn --version should give you v1.12.1 or higher. If you don't get this result maybe a

View test.js
class EfficientPrinter {
constructor() {
this.lines = null;
}
render(text) {
View requestIdle.js
let refCount = 0;
let resolvers = [];
function resolveAll() {
for (let resolve of resolvers)
resolve();
resolvers = [];
View test.js
if (a)
if (b)
if (c) // wrong indent
; // wrong indent
View example.js
for (let type in types)
doSomething(type); // should be indented
for (let type of types)
doSomething(type); // should be indented
You can’t perform that action at this time.