Creating ascii-art tutorial package; what am I doing wrong?


#1

I hope there’s an obvious answer for this one, I’m stuck and it feels like it’s something stupid.

I’ve followed the first example from the guide: https://atom.io/docs/v0.80.0/your-first-package

The command is listed, but when I try and execute it I get the error:

Cannot read property ‘command’ of undefined

The stack trace is:
ypeError: Cannot read property ‘command’ of undefined at Object.module.exports.activate (/C:/Users/Donutttt/github/my-package/lib/my-package.coffee:4:32) at Package.module.exports.Package.activateNow (C:\Users\Donutttt\AppData\Local\atom\app-1.0.7\resources\app.asar\src\package.js:243:19) at C:\Users\Donutttt\AppData\Local\atom\app-1.0.7\resources\app.asar\src\package.js:836:25 at Emitter.module.exports.Emitter.emit (C:\Users\Donutttt\AppData\Local\atom\app-1.0.7\resources\app.asar\node_modules\event-kit\lib\emitter.js:82:11) at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\Donutttt\AppData\Local\atom\app-1.0.7\resources\app.asar\src\command-registry.js:222:20) at C:\Users\Donutttt\AppData\Local\atom\app-1.0.7\resources\app.asar\src\command-registry.js:3:61 at CommandPaletteView.module.exports.CommandPaletteView.confirmed (C:\Users\Donutttt\AppData\Local\atom\app-1.0.7\resources\app.asar\node_modules\command-palette\lib\command-palette-view.js:159:32) at CommandPaletteView.module.exports.SelectListView.confirmSelection (C:\Users\Donutttt\AppData\Local\atom\app-1.0.7\resources\app.asar\node_modules\atom-space-pen-views\lib\select-list-view.js:338:21) at space-pen-li. (C:\Users\Donutttt\AppData\Local\atom\app-1.0.7\resources\app.asar\node_modules\atom-space-pen-views\lib\select-list-view.js:139:19) at HTMLOListElement.jQuery.event.dispatch (C:\Users\Donutttt\AppData\Local\atom\app-1.0.7\resources\app.asar\node_modules\jquery\dist\jquery.js:4435:9)

Can anyone tell me how I’m being stupid?


#2

Can you show your code?


#3

You’re not being stupid. You are using a way outdated version of the documentation, v0.80.0. Atom is at v1.0.7 now. The documentation you’re pointing to is at least a year old. This is the updated documentation:

https://atom.io/docs/latest/hacking-atom-tools-of-the-trade

There are also two package tutorials now instead of the one. So I just pointed you to the beginning of the chapter.


#4

I was following the part of the tutorial where it gave the code:

module.exports =  activate: ->
    atom.workspaceView.command "ascii-art:convert", => @convert()

After a bit of searching I found that the workspaceView.command wasn’t working anymore…

I switched over to using atom.commands.add instead, which seemed to work, for now.


#5

Ah ok, thanks. I shouldn’t have been so trusting of search results :stuck_out_tongue: I’ll have a read through of the guide you mention and see where that gets me.