Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nx-ignore

Package Overview
Dependencies
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nx-ignore - npm Package Compare versions

Comparing version 0.0.14 to 1.0.0-beta.1

15

package.json
{
"name": "nx-ignore",
"version": "0.0.14",
"bin": {
"nx-ignore": "./src/index.js"
"version": "1.0.0-beta.1",
"type": "commonjs",
"dependencies": {
"nx": "^14.1.9",
"typescript": "^4.6.2"
},
"type": "commonjs",
"main": "./src/index.js",
"typings": "./src/index.d.ts",
"dependencies": {
"nx": "14.1.9",
"typescript": "4.3.5"
}
"typings": "./src/index.d.ts"
}

12

README.md
# nx-ignore
This library was generated with [Nx](https://nx.dev).
This package is used on Vercel to ignore builds if a project is not affected.
## Building
Usage:
Run `nx build nx-ignore` to build the library.
## Running unit tests
Run `nx test nx-ignore` to execute the unit tests via [Jest](https://jestjs.io).
```bash
npx nx-ignore <project-name>
```
#!/usr/bin/env node
"use strict";
var _childProcess = require("child_process");
var swcHelpers = require("@swc/helpers");
var _findWorkspaceRoot = require("nx/src/utils/find-workspace-root");
console.log('≫ Using Nx to determine if this project is affected by the commit...');
const project = process.argv[2];
if (!project) {
console.log('≫ No project passed to nx-ignore script');
}
console.log(`≫ Using Nx to determine if this project (${project}) is affected by the commit...`);
const root = (0, _findWorkspaceRoot).findWorkspaceRoot(process.cwd());
if (!root) {
console.log('>> Could not find Nx root');
process.exit(1);
console.log('≫ Could not find Nx root');
process.exit(1);
}
console.log('>>> root', root);
const resolved = require.resolve('nx/src/command-line/affected');
const project = process.argv[2];
console.log('>>> resolve', resolved);
const { affected } = require('nx/src/command-line/affected');
console.log('>>> affected fn', affected);
main();
function main() {
return _main.apply(this, arguments);
}
function _main() {
_main = swcHelpers.asyncToGenerator(function*() {
// Since Nx currently looks for "nx" package under workspace root, the CLI doesn't work on Vercel.
const { affected } = yield Promise.resolve().then(function() {
return require('nx/src/command-line/affected');
});
let result = null;
const _log = console.log;
try {
let output = '';
console.log = (x)=>{
output = x;
};
yield affected('print-affected', {
_: '',
base: 'HEAD^'
});
result = JSON.parse(output);
} catch (e) {
console.error(e);
process.exit(1);
} finally{
console.log = _log;
}
if (result.projects.includes(project)) {
console.log(`≫ ✅ - Build can proceed since ${project} is affected`);
process.exit(1); // this tells vercel to not ignore
} else {
console.log(`≫ 🛑 - Build cancelled since ${project} is not affected`);
}
});
return _main.apply(this, arguments);
}
async function main() {
// hijack conosle.log for now
let result = null;
const _log = console.log;
try {
let output = '';
console.log = x => {
_log('>>> got', x)
output = x;
};
await affected('print-affected', {
_: '',
base: 'HEAD^'
})
// reset
console.log = _log;
result = JSON.parse(output);
} catch (e) {
console.log = _log;
console.error(e);;
process.exit(1);
}
if (result.projects.includes(project)) {
console.log(`>>> ✅ - Build can proceed since ${project} is affected`);
process.exit(1);
} else {
console.log(`>>> 🛑 - Build cancelled since ${project} is not affected`);
process.exit(0);
}
}
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc