From 32176a459632e1ceb70cac7fe932bf4cf21fb2a3 Mon Sep 17 00:00:00 2001 From: Jozef Izso Date: Sun, 29 Dec 2024 17:33:07 +0100 Subject: [PATCH] Generate `package.json` with correct path to the `main` entry file Fixes #246 Wrong main entry in the generated package.json --- __tests__/app.js | 4 +++- app/index.js | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/__tests__/app.js b/__tests__/app.js index 08aa371..32c86fd 100644 --- a/__tests__/app.js +++ b/__tests__/app.js @@ -53,7 +53,9 @@ describe('generator:app', () => { 'yeoman-test': generatorGeneratorPkg.devDependencies['yeoman-test'], 'yeoman-assert': generatorGeneratorPkg.devDependencies['yeoman-assert'] }, - keywords: ['yeoman-generator'] + keywords: ['yeoman-generator'], + main: 'generators/app/index.js', + files: ['generators/app'] }); }); diff --git a/app/index.js b/app/index.js index b561a2b..4b96192 100644 --- a/app/index.js +++ b/app/index.js @@ -1,4 +1,3 @@ - const path = require('path'); const Generator = require('yeoman-generator'); const askName = require('inquirer-npm-name'); @@ -66,7 +65,7 @@ module.exports = class extends Generator { this.composeWith(require.resolve('generator-node/generators/app'), { boilerplate: false, name: this.props.name, - projectRoot: 'generators', + projectRoot: 'generators/app', skipInstall: this.options.skipInstall, readme: readmeTpl({ generatorName: this.props.name,