Skip to content

Commit

Permalink
Merge pull request #492 from salesforcecli/ew/generate-lib-updates
Browse files Browse the repository at this point in the history
Update generate library command
  • Loading branch information
iowillhoit authored Mar 15, 2024
2 parents cc8e175 + 0ccd896 commit 8391dab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/commands/dev/generate/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/


import { Messages } from '@salesforce/core';
import { SfCommand } from '@salesforce/sf-plugins-core';
import { generate } from '../../../util.js';

Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@salesforce/plugin-dev', 'dev.generate.library');

export default class GenerateLibrary extends SfCommand<void> {
public static enableJsonFlag = false;
public static readonly hidden = true;
public static readonly summary = messages.getMessage('summary');
public static readonly description = messages.getMessage('description');
public static readonly examples = messages.getMessages('examples');
Expand Down
8 changes: 8 additions & 0 deletions src/generators/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,18 @@ export default class Library extends Generator {
repository: `${this.answers.org}/${this.answers.name}`,
homepage: `https://github.com/${this.answers.org}/${this.answers.name}`,
description: this.answers.description,
bugs: { url: `https://github.com/${this.answers.org}/${this.answers.name}/issues` },
};
const final = Object.assign({}, pjson, updated);
this.fs.writeJSON(this.destinationPath('./package.json'), final);

// Replace the message import
replace.sync({
files: `${this.env.cwd}/src/hello.ts`,
from: /@salesforce\/library-template/g,
to: `${this.answers.scope}/${this.answers.name}`,
});

replace.sync({
files: `${this.env.cwd}/**/*`,
from: /library-template/g,
Expand Down

0 comments on commit 8391dab

Please sign in to comment.