chore(providence-analytics): add match-import example content
This commit is contained in:
parent
12b6608516
commit
b781160919
3 changed files with 37 additions and 12 deletions
|
|
@ -20,6 +20,7 @@
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dashboard": "node ./dashboard/src/server.js --serve-from-package-root",
|
"dashboard": "node ./dashboard/src/server.js --serve-from-package-root",
|
||||||
|
"match-lion-imports": "npm run providence analyze match-imports --search-target-collection @lion-targets --reference-collection @lion-references",
|
||||||
"providence": "node --max-old-space-size=8192 ./src/cli/index.js",
|
"providence": "node --max-old-space-size=8192 ./src/cli/index.js",
|
||||||
"test:node": "mocha './test-node/**/*.test.js'",
|
"test:node": "mocha './test-node/**/*.test.js'",
|
||||||
"test:node:e2e": "mocha './test-node/program/**/*.e2e.js' --timeout 60000",
|
"test:node:e2e": "mocha './test-node/program/**/*.e2e.js' --timeout 60000",
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,41 @@
|
||||||
|
const pathLib = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
// This file is read by dashboard and cli and needs to be present under process.cwd()
|
// This file is read by dashboard and cli and needs to be present under process.cwd()
|
||||||
// It mainly serves as an example and it allows to run the dashboard locally
|
// It mainly serves as an example and it allows to run the dashboard locally
|
||||||
// from within this repo.
|
// from within this repo.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {string[]}
|
||||||
|
*/
|
||||||
|
function getAllLionScopedPackagePaths() {
|
||||||
|
const rootPath = pathLib.resolve(__dirname, '../../packages');
|
||||||
|
const filesAndDirs = fs.readdirSync(rootPath);
|
||||||
|
const packages = filesAndDirs.filter(f => {
|
||||||
|
const filePath = pathLib.join(rootPath, f);
|
||||||
|
if (fs.lstatSync(filePath).isDirectory()) {
|
||||||
|
let pkgJson;
|
||||||
|
try {
|
||||||
|
pkgJson = JSON.parse(fs.readFileSync(pathLib.resolve(filePath, './package.json')));
|
||||||
|
// eslint-disable-next-line no-empty
|
||||||
|
} catch (_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return pkgJson.name && pkgJson.name.startsWith('@lion/');
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
return packages.map(p => pathLib.join(rootPath, p));
|
||||||
|
}
|
||||||
|
|
||||||
|
const lionScopedPackagePaths = getAllLionScopedPackagePaths();
|
||||||
|
|
||||||
const providenceConfig = {
|
const providenceConfig = {
|
||||||
metaConfig: {
|
metaConfig: {
|
||||||
categoryConfig: [
|
categoryConfig: [
|
||||||
{
|
{
|
||||||
// This is the name found in package.json
|
// This is the name found in package.json
|
||||||
project: 'lion-based-ui',
|
project: '@lion/overlays',
|
||||||
majorVersion: 1,
|
majorVersion: 1,
|
||||||
// These conditions will be run on overy filePath
|
// These conditions will be run on overy filePath
|
||||||
categories: {
|
categories: {
|
||||||
|
|
@ -25,20 +53,16 @@ const providenceConfig = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
// By predefening groups, we can do a query for programs/collections...
|
// By predefening groups, we can do a query for programs/collections...
|
||||||
// Select via " providence analyze -t 'exampleCollection' "
|
// Select via " providence analyze --search-target-collection 'exampleCollection' "
|
||||||
searchTargetCollections: {
|
searchTargetCollections: {
|
||||||
exampleCollection: [
|
'@lion-targets': lionScopedPackagePaths,
|
||||||
'./providence-input-data/search-targets/example-project-a',
|
|
||||||
'./providence-input-data/search-targets/example-project-b',
|
|
||||||
],
|
|
||||||
// ...
|
// ...
|
||||||
},
|
},
|
||||||
referenceCollections: {
|
referenceCollections: {
|
||||||
// Our products
|
// Usually the references are different from the targets.
|
||||||
'lion-based-ui': [
|
// In this demo file, we test @lion usage amongst itself
|
||||||
'./providence-input-data/references/lion-based-ui',
|
// Select via " providence analyze --reference-collection 'exampleCollection' "
|
||||||
'./providence-input-data/references/lion-based-ui-labs',
|
'@lion-references': lionScopedPackagePaths,
|
||||||
],
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,7 @@ class InputDataService {
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line import/no-dynamic-require, global-require
|
// eslint-disable-next-line import/no-dynamic-require, global-require
|
||||||
return require(`${process.cwd()}/providence.conf.js`);
|
return require(`${process.cwd()}/providence.conf.js`);
|
||||||
} catch (_) {
|
} catch (e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue