0
Fork 0
mirror of https://github.com/penpot/penpot-plugins.git synced 2025-01-09 08:22:09 -05:00
penpot-plugins/tools/plugins/init-plugin.ts

31 lines
757 B
TypeScript
Raw Normal View History

2024-05-30 08:02:56 -05:00
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`,
},
},
},
},
},
};
},
];