Skip to content

Commit

Permalink
feat(repo): migrate to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav committed Apr 13, 2023
1 parent 7cff8dc commit 78ab5f3
Show file tree
Hide file tree
Showing 23 changed files with 32,720 additions and 174,272 deletions.
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
strict-peer-dependencies=false
auto-install-peers=true
node-linker=hoisted # this is unfortunately required for now, because of the error in register.ts
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ tmp
/build
node_modules
/package.json
/pnpm-lock.yaml
packages/workspace/src/generators/**/files/**/*.json
packages/angular/src/schematics/**/files/**/*.json
packages/angular/src/migrations/**/files/**/*.json
Expand Down
147,529 changes: 0 additions & 147,529 deletions .yarn/releases/yarn-1.22.19.cjs

This file was deleted.

2 changes: 0 additions & 2 deletions .yarnrc

This file was deleted.

20 changes: 16 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"e2e-build-package-publish": "ts-node -P ./scripts/tsconfig.e2e.json ./scripts/e2e-build-package-publish.ts",
"nx-release": "ts-node -P ./scripts/tsconfig.release.json ./scripts/nx-release",
"prepublishOnly": "node ./scripts/update-package-group.js",
"version": "npx prettier lerna.json --write",
"version": "pnpm prettier lerna.json --write",
"depcheck": "ts-node -P ./scripts/tsconfig.scripts.json ./scripts/depcheck",
"local-registry": "./scripts/local-registry.sh",
"documentation": "ts-node -P scripts/tsconfig.scripts.json ./scripts/documentation/generators/main.ts && yarn check-documentation-map",
Expand Down Expand Up @@ -45,6 +45,9 @@
"@babel/preset-typescript": "^7.15.0",
"@cypress/react": "^6.0.0",
"@floating-ui/react": "0.19.2",
"@jest/reporters": "^29.4.3",
"@jest/test-result": "^29.4.3",
"@jest/types": "^29.4.3",
"@monodon/rust": "1.1.1",
"@napi-rs/cli": "2.14.0",
"@nestjs/cli": "^9.0.0",
Expand Down Expand Up @@ -134,10 +137,12 @@
"browserslist": "^4.21.4",
"chalk": "^4.1.0",
"chokidar": "^3.5.1",
"cli-cursor": "3.1.0",
"cli-spinners": "2.6.1",
"confusing-browser-globals": "^1.0.9",
"conventional-changelog-cli": "^2.0.23",
"copy-webpack-plugin": "^10.2.4",
"core-js": "^3.6.5",
"core-js": "^3.23.3",
"css-minimizer-webpack-plugin": "^3.4.1",
"cypress": "^12.2.0",
"cytoscape": "^3.18.2",
Expand All @@ -161,8 +166,10 @@
"eslint-plugin-react-hooks": "4.6.0",
"express": "^4.18.1",
"fast-xml-parser": "^4.0.9",
"figures": "3.2.0",
"file-loader": "^6.2.0",
"file-type": "^16.2.0",
"find-cache-dir": "^3.3.2",
"flat": "^5.0.2",
"fork-ts-checker-webpack-plugin": "7.2.13",
"fs-extra": "^11.1.0",
Expand All @@ -180,7 +187,11 @@
"jasmine-marbles": "~0.8.4",
"jasmine-spec-reporter": "~4.2.1",
"jest": "29.4.3",
"jest-config": "^29.4.3",
"jest-environment-jsdom": "29.4.3",
"jest-resolve": "^29.4.3",
"jest-util": "^29.4.3",
"js-tokens": "^4.0.0",
"js-yaml": "4.1.0",
"jsonc-eslint-parser": "^2.1.0",
"jsonc-parser": "3.2.0",
Expand All @@ -189,6 +200,7 @@
"less": "4.1.3",
"less-loader": "11.1.0",
"license-webpack-plugin": "^4.0.2",
"lines-and-columns": "~2.0.3",
"loader-utils": "2.0.3",
"lockfile-lint": "^4.7.6",
"magic-string": "~0.26.2",
Expand Down Expand Up @@ -219,6 +231,7 @@
"react-router-dom": "6.4.3",
"react-test-renderer": "18.2.0",
"regenerator-runtime": "0.13.7",
"resolve.exports": "^2.0.0",
"rollup": "^2.56.2",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-peer-deps-external": "^2.2.4",
Expand Down Expand Up @@ -254,6 +267,7 @@
"typescript": "~4.9.5",
"unzipper": "^0.10.11",
"url-loader": "^4.1.1",
"use-sync-external-store": "^1.0.0",
"verdaccio": "^5.0.4",
"vite": "^4.0.1",
"webpack": "^5.75.0",
Expand Down Expand Up @@ -292,7 +306,6 @@
"axios": "1.0.0",
"classnames": "^2.3.1",
"cliui": "^7.0.2",
"core-js": "^3.6.5",
"enquirer": "~2.3.6",
"fast-glob": "3.2.7",
"framer-motion": "^4.1.17",
Expand Down Expand Up @@ -320,7 +333,6 @@
"weak-napi": "^2.0.2"
},
"resolutions": {
"**/xmlhttprequest-ssl": "~1.6.2",
"minimist": "^1.2.6",
"underscore": "^1.12.1"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { Tree } from '@nrwl/devkit';
import { joinPathFragments } from '@nrwl/devkit';
import type { Ignore } from 'ignore';
import ignore from 'ignore';

export function getAllFilesRecursivelyFromDir(
Expand All @@ -26,7 +25,7 @@ export function getAllFilesRecursivelyFromDir(
}

function isPathIgnored(tree: Tree, path: string): boolean {
let ig: Ignore;
let ig: ReturnType<typeof ignore>;
if (tree.exists('.gitignore')) {
ig = ignore();
ig.add(tree.read('.gitignore', 'utf-8'));
Expand Down
4 changes: 2 additions & 2 deletions packages/devkit/src/generators/visit-not-ignored-files.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Tree } from 'nx/src/generators/tree';
import ignore, { Ignore } from 'ignore';
import ignore from 'ignore';
import { join, relative, sep } from 'path';

/**
Expand All @@ -10,7 +10,7 @@ export function visitNotIgnoredFiles(
dirPath: string = tree.root,
visitor: (path: string) => void
): void {
let ig: Ignore;
let ig: ReturnType<typeof ignore>;
if (tree.exists('.gitignore')) {
ig = ignore();
ig.add(tree.read('.gitignore', 'utf-8'));
Expand Down
4 changes: 2 additions & 2 deletions packages/js/src/utils/assets/copy-assets-handler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as minimatch from 'minimatch';
import * as path from 'path';
import * as fse from 'fs-extra';
import ignore, { Ignore } from 'ignore';
import ignore from 'ignore';
import * as fg from 'fast-glob';
import { AssetGlob } from './assets';
import { logger } from '@nrwl/devkit';
Expand Down Expand Up @@ -52,7 +52,7 @@ export class CopyAssetsHandler {
private readonly rootDir: string;
private readonly outputDir: string;
private readonly assetGlobs: AssetEntry[];
private readonly ignore: Ignore;
private readonly ignore: ReturnType<typeof ignore>;
private readonly callback: (events: FileEvent[]) => void;

constructor(opts: CopyAssetHandlerOptions) {
Expand Down
4 changes: 2 additions & 2 deletions packages/js/src/utils/generate-globs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { dirname, join, relative, resolve } from 'path';
import { readCachedProjectGraph } from 'nx/src/project-graph/project-graph';
import { getSourceDirOfDependentProjects } from 'nx/src/utils/project-graph-utils';
import { existsSync, lstatSync, readdirSync, readFileSync } from 'fs';
import ignore, { Ignore } from 'ignore';
import ignore from 'ignore';
import {
createProjectRootMappings,
findProjectForPath,
} from 'nx/src/project-graph/utils/find-project-for-path';

function configureIgnore() {
let ig: Ignore;
let ig: ReturnType<typeof ignore>;
const pathToGitIgnore = join(workspaceRoot, '.gitignore');
if (existsSync(pathToGitIgnore)) {
ig = ignore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const getGlobalEsLintConfiguration = (
unitTestRunner?: string,
rootProject?: boolean
) => {
const config: ESLint.ConfigData = {
const config: LinterType.Config = {
root: true,
ignorePatterns: rootProject ? ['!**/*'] : ['**/*'],
plugins: ['@nrwl/nx'],
Expand Down
6 changes: 3 additions & 3 deletions packages/nx/src/hasher/node-based-file-hasher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { workspaceRoot } from '../utils/workspace-root';
import { performance } from 'perf_hooks';
import { FileData } from '../config/project-graph';
import { join, relative } from 'path';
import { existsSync, readdirSync, readFileSync, statSync } from 'fs';
import { readdirSync, statSync } from 'fs';
import { FileHasherBase } from './file-hasher-base';
import { stripIndents } from '../utils/strip-indents';
import ignore from 'ignore';
import { normalizePath } from '../utils/path';
import { getIgnoreObject } from '../utils/ignore';

export class NodeBasedFileHasher extends FileHasherBase {
ignoredGlobs = getIgnoredGlobs();
ignoredGlobs: ReturnType<typeof ignore> = getIgnoredGlobs();

async init() {
performance.mark('init hashing:start');
Expand Down Expand Up @@ -71,7 +71,7 @@ function getIgnoredGlobs() {
node_modules
tmp
dist
build
build
`);
return ig;
}
2 changes: 1 addition & 1 deletion packages/nx/src/project-graph/file-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function calculateFileChanges(
f: string,
r: void | string
) => string = defaultReadFileAtRevision,
ignore = getIgnoreObject()
ignore = getIgnoreObject() as ReturnType<typeof ignore>
): FileChange[] {
files = files.filter((f) => !ignore.ignores(f));

Expand Down
4 changes: 3 additions & 1 deletion packages/nx/src/utils/ignore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export function getAlwaysIgnore(root?: string) {
return root ? paths.map((x) => joinPathFragments(root, x)) : paths;
}

export function getIgnoreObject(root: string = workspaceRoot) {
export function getIgnoreObject(
root: string = workspaceRoot
): ReturnType<typeof ignore> {
const ig = ignore();
ig.add(readFileIfExisting(`${root}/.gitignore`));
ig.add(readFileIfExisting(`${root}/.nxignore`));
Expand Down
4 changes: 3 additions & 1 deletion packages/nx/src/utils/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ export function registerTranspiler(

const preferTsNode = process.env.NX_PREFER_TS_NODE === 'true';

console.log('AÀasfasfasfasfasfasf');

if (swcNodeInstalled && !preferTsNode) {
// These are requires to prevent it from registering when it shouldn't
const { register } =
require('@swc-node/register/register') as typeof import('@swc-node/register/register');

registerTranspiler = () => register(compilerOptions);
registerTranspiler = () => () => register(compilerOptions);
} else {
// We can fall back on ts-node if it's available

Expand Down
4 changes: 2 additions & 2 deletions packages/workspace/src/utils/rules/visit-not-ignored-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SchematicContext,
Tree,
} from '@angular-devkit/schematics';
import ignore, { Ignore } from 'ignore';
import ignore from 'ignore';

/**
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nrwl/devkit. This function can be replaced with 'visitNotIgnoredFiles' from @nrwl/devkit.
Expand All @@ -15,7 +15,7 @@ export function visitNotIgnoredFiles(
dir: Path = normalize('')
): Rule {
return (host, context) => {
let ig: Ignore | undefined;
let ig: ReturnType<typeof ignore> | undefined;
if (host.exists('.gitignore')) {
ig = ignore();
ig.add(host.read('.gitignore').toString());
Expand Down
Loading

0 comments on commit 78ab5f3

Please sign in to comment.