nx-ignore
Advanced tools
Comparing version 0.0.14 to 1.0.0-beta.1
{ | ||
"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" | ||
} |
# 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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
53
0
5164
10
+ Added@nrwl/cli@14.8.9(transitive)
+ Added@nrwl/tao@14.8.9(transitive)
+ Added@yarnpkg/lockfile@1.1.0(transitive)
+ Added@yarnpkg/parsers@3.0.2(transitive)
+ Added@zkochan/js-yaml@0.0.6(transitive)
+ Addedargparse@1.0.102.0.1(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@1.7.7(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedduplexer@0.1.2(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedjs-yaml@3.14.14.1.0(transitive)
+ Addedjsonc-parser@3.2.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedminimatch@3.0.5(transitive)
+ Addednx@14.8.9(transitive)
+ Addedproxy-from-env@1.1.0(transitive)
+ Addedsprintf-js@1.0.3(transitive)
+ Addedstrong-log-transformer@2.1.0(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedtypescript@4.9.5(transitive)
- Removed@emnapi/core@1.3.1(transitive)
- Removed@emnapi/runtime@1.3.1(transitive)
- Removed@emnapi/wasi-threads@1.0.1(transitive)
- Removed@napi-rs/wasm-runtime@0.2.5(transitive)
- Removed@nrwl/cli@14.1.9(transitive)
- Removed@nrwl/tao@14.1.9(transitive)
- Removed@oxc-resolver/binding-darwin-arm64@1.12.0(transitive)
- Removed@oxc-resolver/binding-darwin-x64@1.12.0(transitive)
- Removed@oxc-resolver/binding-freebsd-x64@1.12.0(transitive)
- Removed@oxc-resolver/binding-linux-arm-gnueabihf@1.12.0(transitive)
- Removed@oxc-resolver/binding-linux-arm64-gnu@1.12.0(transitive)
- Removed@oxc-resolver/binding-linux-arm64-musl@1.12.0(transitive)
- Removed@oxc-resolver/binding-linux-x64-gnu@1.12.0(transitive)
- Removed@oxc-resolver/binding-linux-x64-musl@1.12.0(transitive)
- Removed@oxc-resolver/binding-wasm32-wasi@1.12.0(transitive)
- Removed@oxc-resolver/binding-win32-arm64-msvc@1.12.0(transitive)
- Removed@oxc-resolver/binding-win32-x64-msvc@1.12.0(transitive)
- Removed@swc-node/core@1.13.3(transitive)
- Removed@swc-node/register@1.10.9(transitive)
- Removed@swc-node/sourcemap-support@0.5.1(transitive)
- Removed@swc/core@1.9.2(transitive)
- Removed@swc/core-darwin-arm64@1.9.2(transitive)
- Removed@swc/core-darwin-x64@1.9.2(transitive)
- Removed@swc/core-linux-arm-gnueabihf@1.9.2(transitive)
- Removed@swc/core-linux-arm64-gnu@1.9.2(transitive)
- Removed@swc/core-linux-arm64-musl@1.9.2(transitive)
- Removed@swc/core-linux-x64-gnu@1.9.2(transitive)
- Removed@swc/core-linux-x64-musl@1.9.2(transitive)
- Removed@swc/core-win32-arm64-msvc@1.9.2(transitive)
- Removed@swc/core-win32-ia32-msvc@1.9.2(transitive)
- Removed@swc/core-win32-x64-msvc@1.9.2(transitive)
- Removed@swc/counter@0.1.3(transitive)
- Removed@swc/types@0.1.15(transitive)
- Removed@tybys/wasm-util@0.9.0(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedcolorette@2.0.20(transitive)
- Removeddebug@4.3.7(transitive)
- Removedjsonc-parser@3.0.0(transitive)
- Removedminimatch@3.0.4(transitive)
- Removedms@2.1.3(transitive)
- Removednx@14.1.9(transitive)
- Removedoxc-resolver@1.12.0(transitive)
- Removedpirates@4.0.6(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedsource-map-support@0.5.21(transitive)
- Removedtypescript@4.3.5(transitive)
Updatednx@^14.1.9
Updatedtypescript@^4.6.2