Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Jordan-Hall/fb5f5d1e09ebc5d90c67cf1d745e05c8 to your computer and use it in GitHub Desktop.
Save Jordan-Hall/fb5f5d1e09ebc5d90c67cf1d745e05c8 to your computer and use it in GitHub Desktop.
test bun.lockb
import { CreateDependenciesContext, joinPathFragments } from '@nx/devkit';
import { execSync } from 'child_process';
import { hashArray } from 'nx/src/hasher/file-hasher';
import {getYarnLockfileDependencies, getYarnLockfileNodes} from 'nx/src/plugins/js/lock-file/yarn-parser'
const lockFilePath = process.cwd() + '/bun.lockb';
let lockFileContents = execSync(`bun ${lockFilePath}`, {maxBuffer: 1024 * 1024 * 10 }).toString();
const hashed = hashArray(['19.1.0-beta.5', lockFileContents]);
console.log('hashed',hashed);
const packageJson = require(joinPathFragments(
__dirname,
'/package.json'
));
const ctx: CreateDependenciesContext = {
projects: {},
externalNodes: getYarnLockfileNodes(lockFileContents, hashed, packageJson),
fileMap: {
nonProjectFiles: [],
projectFileMap: {},
},
filesToProcess: {
nonProjectFiles: [],
projectFileMap: {},
},
nxJsonConfiguration: null as any,
workspaceRoot: '/virtual',
};
const yarnResult = getYarnLockfileDependencies(lockFileContents, hashed, ctx)
console.log(yarnResult);
debugger;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment