Skip to content

Commit

Permalink
Bump yarn berry, log bin, bump deps (#1125)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacogr authored Dec 18, 2023
1 parent f624cea commit e2f45fc
Show file tree
Hide file tree
Showing 32 changed files with 3,523 additions and 4,312 deletions.
363 changes: 0 additions & 363 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

550 changes: 0 additions & 550 deletions .yarn/plugins/@yarnpkg/plugin-version.cjs

This file was deleted.

785 changes: 0 additions & 785 deletions .yarn/releases/yarn-3.2.0.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.2.cjs

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
compressionLevel: mixed

enableGlobalCache: false

enableImmutableInstalls: false

enableProgressBars: false

logFilters:
# Discard any "cannot be found in cache" messages
- code: YN0013
level: discard

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"

yarnPath: .yarn/releases/yarn-3.2.0.cjs
yarnPath: .yarn/releases/yarn-4.0.2.cjs
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## master

- Update internal scripts to dedupe git & yarn commands
- Update to latest yarn berry 4.0.2


## 0.77.1

- Drop support for Node 16
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"homepage": "https://github.com/polkadot-js/dev#readme",
"license": "Apache-2.0",
"packageManager": "yarn@3.2.0",
"packageManager": "yarn@4.0.2",
"private": true,
"repository": {
"type": "git",
Expand Down
4 changes: 4 additions & 0 deletions packages/dev-test/src/env/suite.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ describe('it()', () => {
expect(it.todo).toBeDefined();
});

it('allows promises', async () => {
expect(await Promise.resolve(true)).toBe(true);
});

describe('.only', () => {
// eslint-disable-next-line jest/no-focused-tests
it.only('runs this test when .only is used', () => {
Expand Down
6 changes: 2 additions & 4 deletions packages/dev-test/src/env/suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface WrapOpts {
todo?: boolean;
}

type WrapFn = (name: string, options: { only?: boolean; skip?: boolean; timeout?: number; todo?: boolean; }, fn: () => void | Promise<void>) => void;
type WrapFn = (name: string, options: { only?: boolean; skip?: boolean; timeout?: number; todo?: boolean; }, fn: () => void | Promise<void>) => void | Promise<void>;

const MINUTE = 60 * 1000;

Expand All @@ -24,7 +24,7 @@ const MINUTE = 60 * 1000;
* @param {} fn
*/
function createWrapper <T extends WrapFn> (fn: T, defaultTimeout: number) {
const wrap = (opts: WrapOpts) => (name: string, exec: () => void | Promise<void>, timeout?: number) => fn(name, { ...opts, timeout: (timeout || defaultTimeout) }, exec);
const wrap = (opts: WrapOpts) => (name: string, exec: () => void | Promise<void>, timeout?: number) => fn(name, { ...opts, timeout: (timeout || defaultTimeout) }, exec) as unknown as void;

// Ensure that we have consistent helpers on the function. These are not consistently
// applied accross all node:test versions, latest has all, so always apply ours.
Expand All @@ -42,9 +42,7 @@ function createWrapper <T extends WrapFn> (fn: T, defaultTimeout: number) {
**/
export function suite () {
return {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
describe: createWrapper(describe, 60 * MINUTE),
// eslint-disable-next-line @typescript-eslint/no-misused-promises
it: createWrapper(it, 2 * MINUTE)
};
}
2 changes: 1 addition & 1 deletion packages/dev-test/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/dev-test authors & contributors
// SPDX-License-Identifier: Apache-2.0

throw new Error('Use node --require @polkadot/dev-test/{node, browser} depending on required environment');
throw new Error('Use node --require @polkadot/dev-test/{node, browser} depending on the required environment');
11 changes: 2 additions & 9 deletions packages/dev-ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,11 @@

// Adapted from: https://nodejs.org/api/esm.html#esm_transpiler_loader
//
// NOTE: This assumes the new loader specification, so it would most-probably
// need a version of Node.js >= 18 (where the new specification has been
// introduced. It seems introduced at Node 16.12...)
//
// This is a bit of a pain since in dev mode we now need latest-ish Node
// versions, but at the same time we don't want to build against multiple APIs)
// NOTE: This assumes the loader implementation for Node.js >= 18

import { loaderOptions } from './common.js';

const url = new URL(import.meta.url);

loaderOptions.isCached = url.searchParams.get('isCached') === 'true';
loaderOptions.isCached = new URL(import.meta.url).searchParams.get('isCached') === 'true';

export { load } from './loader.js';
export { resolve } from './resolver.js';
4 changes: 2 additions & 2 deletions packages/dev-ts/src/tsconfig.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/dev-ts authors & contributors
// SPDX-License-Identifier: Apache-2.0

import type { Alias } from './types.js';
import type { TsAlias } from './types.js';

import JSON5 from 'json5';
import fs from 'node:fs';
Expand Down Expand Up @@ -88,7 +88,7 @@ function readConfigFile (currentPath = CWD_PATH, tsconfig = 'tsconfig.json', fro
*
* Retrieves all TS aliases definitions
**/
function extractAliases (): Alias[] {
function extractAliases (): TsAlias[] {
const { paths, url = CWD_URL } = readConfigFile();

return Object
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-ts/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/dev-ts authors & contributors
// SPDX-License-Identifier: Apache-2.0

export interface Alias {
export interface TsAlias {
filter: string[];
isWildcard?: boolean;
path: string;
Expand Down
16 changes: 8 additions & 8 deletions packages/dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,25 @@
"./rootJs/testJson.json": "./src/rootJs/testJson.json"
},
"dependencies": {
"@eslint/js": "^8.55.0",
"@eslint/js": "^8.56.0",
"@polkadot/dev-test": "^0.77.3",
"@polkadot/dev-ts": "^0.77.3",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-dynamic-import-vars": "^2.1.2",
"@rollup/plugin-inject": "^5.0.5",
"@rollup/plugin-json": "^6.0.1",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@tsconfig/strictest": "^2.0.2",
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@typescript-eslint/parser": "^6.14.0",
"eslint": "^8.55.0",
"eslint": "^8.56.0",
"eslint-config-standard": "^17.1.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-deprecation": "^2.0.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-import-newlines": "^1.3.4",
"eslint-plugin-jest": "^27.6.0",
"eslint-plugin-n": "^16.4.0",
Expand All @@ -82,7 +82,7 @@
"globals": "^13.24.0",
"json5": "^2.2.3",
"madge": "^6.1.0",
"rollup": "^4.8.0",
"rollup": "^4.9.1",
"rollup-plugin-cleanup": "^3.2.1",
"tslib": "^2.6.2",
"typescript": "^5.3.3",
Expand All @@ -95,9 +95,9 @@
},
"devDependencies": {
"@testing-library/react": "^14.1.2",
"@types/node": "^20.10.4",
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",
"@types/node": "^20.10.5",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"@types/yargs": "^17.0.32",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
34 changes: 7 additions & 27 deletions packages/dev/scripts/polkadot-ci-ghact-build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import path from 'node:path';
import process from 'node:process';
import yargs from 'yargs';

import { copyDirSync, copyFileSync, denoCreateDir, execGit, execPm, execSync, exitFatal, GITHUB_REPO, GITHUB_TOKEN_URL, gitSetup, mkdirpSync, rimrafSync } from './util.mjs';
import { copyDirSync, copyFileSync, denoCreateDir, execGit, execPm, execSync, exitFatal, GITHUB_REPO, GITHUB_TOKEN_URL, gitSetup, logBin, mkdirpSync, rimrafSync } from './util.mjs';

/** @typedef {Record<string, any>} ChangelogMap */

console.log('$ polkadot-ci-ghact-build', process.argv.slice(2).join(' '));
logBin('polkadot-ci-ghact-build');

const DENO_REPO = 'polkadot-js/build-deno.land';
const BUND_REPO = 'polkadot-js/build-bundle';
Expand Down Expand Up @@ -42,26 +42,6 @@ const argv = await yargs(process.argv.slice(2))
.strict()
.argv;

/** Runs the clean command */
function runClean () {
execPm('polkadot-dev-clean-build');
}

/** Runs the lint command */
function runLint () {
execPm('lint');
}

/** Runs the test command */
function runTest () {
execPm('test');
}

/** Runs the build command */
function runBuild () {
execPm('build');
}

/**
* Removes a specific file, returning true if found, false otherwise
*
Expand Down Expand Up @@ -539,11 +519,11 @@ npmSetup();
getFlags();
verBump();

// perform the actual CI ops
runClean();
runLint();
runTest();
runBuild();
// perform the actual CI build
execPm('polkadot-dev-clean-build');
execPm('lint');
execPm('test');
execPm('build');

// publish to all GH repos
gitPush();
Expand Down
4 changes: 2 additions & 2 deletions packages/dev/scripts/polkadot-ci-ghact-docs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Copyright 2017-2023 @polkadot/dev authors & contributors
// SPDX-License-Identifier: Apache-2.0

import { execPm, GITHUB_REPO, GITHUB_TOKEN_URL, gitSetup } from './util.mjs';
import { execPm, GITHUB_REPO, GITHUB_TOKEN_URL, gitSetup, logBin } from './util.mjs';

const repo = `${GITHUB_TOKEN_URL}/${GITHUB_REPO}.git`;

console.log('$ polkadot-ci-ghact-docs', process.argv.slice(2).join(' '));
logBin('polkadot-ci-ghact-docs');

gitSetup();

Expand Down
4 changes: 2 additions & 2 deletions packages/dev/scripts/polkadot-ci-ghpages-force.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import fs from 'node:fs';

import { execGit } from './util.mjs';
import { execGit, logBin } from './util.mjs';

console.log('$ polkadot-ci-ghpages-force', process.argv.slice(2).join(' '));
logBin('polkadot-ci-ghpages-force');

// ensure we are on master
execGit('checkout master');
Expand Down
4 changes: 2 additions & 2 deletions packages/dev/scripts/polkadot-dev-build-docs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import fs from 'node:fs';
import path from 'node:path';

import { copyDirSync, rimrafSync } from './util.mjs';
import { copyDirSync, logBin, rimrafSync } from './util.mjs';

console.log('$ polkadot-dev-build-docs', process.argv.slice(2).join(' '));
logBin('polkadot-dev-build-docs');

let docRoot = path.join(process.cwd(), 'docs');

Expand Down
12 changes: 8 additions & 4 deletions packages/dev/scripts/polkadot-dev-build-ts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import path from 'node:path';
import process from 'node:process';
import ts from 'typescript';

import { copyDirSync, copyFileSync, DENO_EXT_PRE, DENO_LND_PRE, DENO_POL_PRE, engineVersionCmp, execPm, exitFatal, exitFatalEngine, mkdirpSync, PATHS_BUILD, readdirSync, rimrafSync } from './util.mjs';
import { copyDirSync, copyFileSync, DENO_EXT_PRE, DENO_LND_PRE, DENO_POL_PRE, engineVersionCmp, execPm, exitFatal, exitFatalEngine, logBin, mkdirpSync, PATHS_BUILD, readdirSync, rimrafSync } from './util.mjs';

/** @typedef {'babel' | 'esbuild' | 'swc' | 'tsc'} CompileType */
/** @typedef {{ bin?: Record<string, string>; browser?: string; bugs?: string; deno?: string; denoDependencies?: Record<string, string>; dependencies?: Record<string, string>; devDependencies?: Record<string, string>; electron?: string; engines?: { node?: string }; exports?: Record<string, unknown>; license?: string; homepage?: string; main?: string; module?: string; name?: string; optionalDependencies?: Record<string, string>; peerDependencies?: Record<string, string>; repository?: { directory?: string; type: 'git'; url: string; }; 'react-native'?: string; resolutions?: Record<string, string>; sideEffects?: boolean | string[]; scripts?: Record<string, string>; type?: 'module' | 'commonjs'; types?: string; version?: string; }} PkgJson */

const WP_CONFIGS = ['js', 'cjs'].map((e) => `webpack.config.${e}`);
const RL_CONFIGS = ['js', 'mjs', 'cjs'].map((e) => `rollup.config.${e}`);

console.log('$ polkadot-dev-build-ts', process.argv.slice(2).join(' '));
logBin('polkadot-dev-build-ts');

exitFatalEngine();

Expand Down Expand Up @@ -1036,8 +1036,12 @@ function lintOutput (dir) {
function lintInput (dir) {
throwOnErrors(
loopFiles(['.ts', '.tsx'], dir, 'src', (full, l, n) => {
// Sadly, we have people copying and just changing all the headers without giving attribution -
// we certainly like forks, contributions, building on stuff, but doing this rebrand is not cool
// Sadly, we have people copying and just changing all the headers without
// giving attribution - we certainly like forks, contributions, building on
// stuff, but doing this type of rebrand is not cool
//
// This does have negative effects - proper forks that add their own source
// file will also be caught in the net, i.e. we expect all files to conform
if (n === 0 && (
!/\/\/ Copyright .* @polkadot\//.test(l) &&
!/\/\/ Auto-generated via `/.test(l) &&
Expand Down
4 changes: 2 additions & 2 deletions packages/dev/scripts/polkadot-dev-circular.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
// @ts-expect-error For scripts we don't include @types/* definitions
import madge from 'madge';

import { exitFatal } from './util.mjs';
import { exitFatal, logBin } from './util.mjs';

console.log('$ polkadot-dev-circular', process.argv.slice(2).join(' '));
logBin('polkadot-dev-circular');

const res = await madge('./', { fileExtensions: ['ts', 'tsx'] });

Expand Down
4 changes: 2 additions & 2 deletions packages/dev/scripts/polkadot-dev-clean-build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import fs from 'node:fs';
import path from 'node:path';

import { PATHS_BUILD, rimrafSync } from './util.mjs';
import { logBin, PATHS_BUILD, rimrafSync } from './util.mjs';

const PKGS = path.join(process.cwd(), 'packages');
const DIRS = PATHS_BUILD.map((d) => `build${d}`);

console.log('$ polkadot-dev-clean-build', process.argv.slice(2).join(' '));
logBin('polkadot-dev-clean-build');

/**
* @internal
Expand Down
4 changes: 2 additions & 2 deletions packages/dev/scripts/polkadot-dev-contrib.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

import fs from 'node:fs';

import { execGit, mkdirpSync } from './util.mjs';
import { execGit, logBin, mkdirpSync } from './util.mjs';

const tmpDir = 'packages/build';
const tmpFile = `${tmpDir}/CONTRIBUTORS`;

console.log('$ polkadot-dev-contrib', process.argv.slice(2).join(' '));
logBin('polkadot-dev-contrib');

mkdirpSync(tmpDir);
execGit(`shortlog master -e -n -s > ${tmpFile}`);
Expand Down
4 changes: 2 additions & 2 deletions packages/dev/scripts/polkadot-dev-copy-dir.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright 2017-2023 @polkadot/dev authors & contributors
// SPDX-License-Identifier: Apache-2.0

import { copyDirSync, exitFatal } from './util.mjs';
import { copyDirSync, exitFatal, logBin } from './util.mjs';

const argv = process.argv.slice(2);
const args = [];
Expand All @@ -26,7 +26,7 @@ for (let i = 0; i < argv.length; i++) {
const sources = args.slice(0, args.length - 1);
const dest = args[args.length - 1];

console.log('$ polkadot-dev-copy-dir', args.join(' '));
logBin('polkadot-dev-copy-dir');

if (!sources || !dest) {
exitFatal('Expected at least one <source>... and one <destination> argument');
Expand Down
4 changes: 2 additions & 2 deletions packages/dev/scripts/polkadot-dev-copy-to.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import fs from 'node:fs';
import path from 'node:path';

import { copyDirSync, execPm, exitFatal, mkdirpSync, rimrafSync } from './util.mjs';
import { copyDirSync, execPm, exitFatal, logBin, mkdirpSync, rimrafSync } from './util.mjs';

const args = process.argv.slice(2);

console.log('$ polkadot-dev-copy-to', args.join(' '));
logBin('polkadot-dev-copy-to');

if (args.length !== 1) {
exitFatal('Expected one <destination> argument');
Expand Down
Loading

0 comments on commit e2f45fc

Please sign in to comment.