0
Fork 0
mirror of https://github.com/penpot/penpot-plugins.git synced 2025-01-09 00:10:12 -05:00
penpot-plugins/tools/plugins/init-plugin.ts
2024-05-31 09:24:15 +02:00

30 lines
757 B
TypeScript

import { CreateNodes } from '@nx/devkit';
import { dirname } from 'path';
export const createNodes: CreateNodes = [
'**/tsconfig.plugin.json',
async (configFilePath) => {
const projectRoot = dirname(configFilePath);
const projectName = projectRoot.split('/').pop();
if (!projectName) {
throw new Error('Could not determine project name');
}
return {
projects: {
[projectRoot]: {
root: projectRoot,
targets: {
init: {
executor: 'nx:run-commands',
options: {
command: `nx run-many --parallel --targets=buildPlugin,serve --projects=${projectName} --watch`,
},
},
},
},
},
};
},
];