diff --git a/package.json b/package.json index 58ad6ce..892d904 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "description": "add/remove/create CLI plug-ins" } }, - "commands": "./lib/commands", + "commands": "./lib/sfdxcommands", "plugins": [ "@oclif/plugin-help", "@oclif/plugin-warn-if-update-available", diff --git a/src/generators/app.ts b/src/generators/app.ts index 9a2e92d..d49e3e5 100644 --- a/src/generators/app.ts +++ b/src/generators/app.ts @@ -292,8 +292,6 @@ class App extends Generator { this.pjson.files.push('/npm-shrinkwrap.json') if (this.type === 'sfdx-plugin') { this.pjson.files.push('/messages') - this.pjson.scripts.prepare = this.pjson.scripts.prepack - delete this.pjson.scripts.prepack } } if (this.type === 'plugin' && hasYarn) { @@ -464,18 +462,17 @@ class App extends Generator { break case 'sfdx-plugin': dependencies.push( - '@oclif/command@1', - '@oclif/config@1', - '@oclif/errors@1', - '@salesforce/command@^1.0.1', - '@salesforce/core@^1.0.1' + '@oclif/command@^1', + '@oclif/config@^1', + '@oclif/errors@^1', + '@salesforce/command@^1.4.1', + '@salesforce/core@^1.3.2' ) devDependencies.push( '@oclif/dev-cli@^1', '@oclif/plugin-help@^2', 'globby@^8', - '@salesforce/dev-config@^1.1.4', - 'sinon@5', + '@salesforce/dev-config@1.4.1' ) break case 'multi': @@ -501,7 +498,7 @@ class App extends Generator { } if (this.ts) { dependencies.push( - 'tslib@1', + 'tslib@^1', ) devDependencies.push( '@types/node@^10', @@ -516,7 +513,6 @@ class App extends Generator { } if (this.tslint) { devDependencies.push( - '@oclif/tslint@^3', 'tslint@^5', ) } diff --git a/src/commands/plugins/generate.ts b/src/sfdxcommands/plugins/generate.ts similarity index 100% rename from src/commands/plugins/generate.ts rename to src/sfdxcommands/plugins/generate.ts diff --git a/templates/src/sfdxCommand.ts.ejs b/templates/src/sfdxCommand.ts.ejs index a0afc1e..6cff073 100644 --- a/templates/src/sfdxCommand.ts.ejs +++ b/templates/src/sfdxCommand.ts.ejs @@ -1,13 +1,14 @@ -import {core, flags, SfdxCommand} from '@salesforce/command'; -import {AnyJson} from '@salesforce/ts-types'; +import { flags, SfdxCommand } from '@salesforce/command'; +import { Messages, SfdxError } from '@salesforce/core'; +import { AnyJson } from '@salesforce/ts-types'; <%_ const klass = _.upperFirst(_.camelCase(commandName)) _%> // Initialize Messages with the current plugin directory -core.Messages.importMessagesDirectory(__dirname); +Messages.importMessagesDirectory(__dirname); // Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core, // or any library that is using the messages framework can also be loaded this way. -const messages = core.Messages.loadMessages('<%- pluginName %>', '<%- commandName %>'); +const messages = Messages.loadMessages('<%- pluginName %>', '<%- commandName %>'); export default class <%- klass %> extends SfdxCommand { @@ -59,7 +60,7 @@ export default class <%- klass %> extends SfdxCommand { // Organization will always return one result, but this is an example of throwing an error // The output and --json will automatically be handled for you. if (!result.records || result.records.length <= 0) { - throw new core.SfdxError(messages.getMessage('errorNoOrgResults', [this.org.getOrgId()])); + throw new SfdxError(messages.getMessage('errorNoOrgResults', [this.org.getOrgId()])); } // Organization always only returns one result