2021-10-27 21:21:07 +08:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
2021-11-08 20:18:14 +08:00
|
|
|
const {existsSync} = require(`fs`);
|
2022-09-09 23:17:58 +08:00
|
|
|
const {createRequire} = require(`module`);
|
2021-11-08 20:18:14 +08:00
|
|
|
const {resolve} = require(`path`);
|
2021-10-27 21:21:07 +08:00
|
|
|
|
2021-11-08 20:18:14 +08:00
|
|
|
const relPnpApiPath = "../../../../.pnp.cjs";
|
2021-10-27 21:21:07 +08:00
|
|
|
|
|
|
|
|
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
2022-09-09 23:17:58 +08:00
|
|
|
const absRequire = createRequire(absPnpApiPath);
|
2021-10-27 21:21:07 +08:00
|
|
|
|
|
|
|
|
if (existsSync(absPnpApiPath)) {
|
|
|
|
|
if (!process.versions.pnp) {
|
2021-12-08 21:40:24 +08:00
|
|
|
// Setup the environment to be able to require eslint
|
2021-10-27 21:21:07 +08:00
|
|
|
require(absPnpApiPath).setup();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-08 21:40:24 +08:00
|
|
|
// Defer to the real eslint your application uses
|
|
|
|
|
module.exports = absRequire(`eslint`);
|