Skip to content

Commit

Permalink
Merge pull request #273 from HubSpot/js/fix-module-create
Browse files Browse the repository at this point in the history
Fix module creation
  • Loading branch information
jsines authored Sep 25, 2024
2 parents 8364953 + 794a68e commit dc705fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/lib/commands/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ExtensionContext, commands } from 'vscode';
import { COMMANDS, TRACKED_EVENTS } from '../constants';
import { onClickCreateFolder } from '../fileHelpers';
import { trackEvent } from '../tracking';
const path = require('path');

const { createModule } = require('@hubspot/local-dev-lib/cms/modules');

Expand All @@ -10,14 +11,16 @@ export const registerCommands = (context: ExtensionContext) => {
commands.registerCommand(
COMMANDS.CREATE.MODULE,
onClickCreateFolder('module', async (folderPath: string) => {
const { dir, base } = path.parse(folderPath);
await createModule(
{
moduleLabel: '',
contentTypes: [],
global: false,
},
'',
folderPath,
base,
dir,
false,
{ allowExistingDir: true }
);
trackEvent(TRACKED_EVENTS.CREATE.MODULE);
Expand Down

0 comments on commit dc705fb

Please sign in to comment.