File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
packages/create-figma-plugin/src Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 11import { log } from '@create-figma-plugin/common'
22import fs from 'fs-extra'
3- import { join } from 'path'
3+ import { join , resolve } from 'path'
44
55import { copyTemplateAsync } from './utilities/copy-template-async.js'
66import { installDependenciesAsync } from './utilities/install-dependencies-async.js'
@@ -19,6 +19,17 @@ export async function createFigmaPluginAsync(options: {
1919 if ( typeof name !== 'undefined' ) {
2020 await throwIfDirectoryExistsAsync ( join ( process . cwd ( ) , name ) )
2121 }
22+ if ( typeof template !== 'undefined' ) {
23+ const templateDirectory = resolve (
24+ __dirname ,
25+ '..' ,
26+ 'plugin-templates' ,
27+ template
28+ )
29+ if ( ( await fs . pathExists ( templateDirectory ) ) === false ) {
30+ throw new Error ( `Invalid template: ${ template } ` )
31+ }
32+ }
2233 log . info ( 'Scaffolding a new plugin...' )
2334 const settings = useDefaults
2435 ? createDefaultSettings ( { name, template } )
You can’t perform that action at this time.
0 commit comments