Build Atom with preselected packages


#1

Hi,

in our private environment we have a set of packages that are not hosted on github.
We are trying to build atom with the set of private packages.

neither the deb package nor the Windows Setup.exe/msi and atom-windows.zip builds
include the packages placed in the dot-atom folder (sources).

If the own builds are started for the first time, the .atom folder is created upon first execution.
Also the storage folder is created but no sign of the packages folder.

If though, the atom-x64-windows.zip release is downloaded from github, unziped and started
for the first time, the .atom folder is created including the packges folder containing a README.md.

Somehow it must be possible to include packages in the builds. Can someone give me a hint?

thank you for your help

Ben


Building Atom with different packages
#2

There is a packageDependencies section in the Atom package.json, but it will only pull packages from https://atom.io. If you want to include packages in the build from some other source, you’ll need to devise your own way to do so.


#3

Okay, then i might have to change the src.
What i still dont understand is, why if build by me
all the dot-atom files https://github.com/atom/atom/tree/master/dot-atom are not placed in the .atom folder at first execution.
Why having this folder in the source at the first place?

Also, the config module “src/config.coffee” contains a method “initializeConfigDirectory”

initializeConfigDirectory: (done) ->
    return if fs.existsSync(@configDirPath) or @shouldNotAccessFileSystem()

    fs.makeTreeSync(@configDirPath)

    queue = async.queue ({sourcePath, destinationPath}, callback) ->
      fs.copy(sourcePath, destinationPath, callback)
    queue.drain = done

    templateConfigDirPath = fs.resolve(@resourcePath, 'dot-atom')
    onConfigDirFile = (sourcePath) =>
      relativePath = sourcePath.substring(templateConfigDirPath.length + 1)
      destinationPath = path.join(@configDirPath, relativePath)
      queue.push({sourcePath, destinationPath})
    fs.traverseTree(templateConfigDirPath, onConfigDirFile, ((path) -> true), (->))

This method is supposed the take the bundled dot-atom folder und unpack it if it not exists.


#4

I’m not sure what you’re asking. Can you be more specific?


#5

To me there seems to be a bug in the creation of C:\Users\USERNAME.atom .
But i haven’t figured out where something goes wrong.

If i download an official atom atom-x64-windows.zip releas and start it for the first time,
the folder C:\Users\USERNAME.atom\packages
and the files init.coffee, keymap,cson, snippets.cson, style.less
are created. This is not the case for the atom-windows.zip (32bit build).
Also, if i build atom manually and start the editor i dont have the init.coffee, keymap.cson etc…

So the question is, why are the files init.coffeee, keymap.cson, snippets.cson, style.less and the folder packages are not create upon first startup?


#6

Did you delete the contents inside the .atom directory? Or did you delete the entire directory? It looks like the code checks to see if the directory exists. If it doesn’t, then it creates the directory and its contents. If you delete the contents but leave the directory there … then the contents aren’t added. (I haven’t tested this but it makes sense given what you’re describing.)


#7

I deleted the entire .atom directory before the execution.
Furthermore i added print commands to see if "fs.existsSync(@configDirPath)"
returned true. Strangely during the startup of the editor the .atom folder was created
before the execution of this function. Either that or somehow the synchronous check
if the folder exists is not synchronous.

The unittest in config-spec.coffee will not be run on a 32 bit system.
Currently i have this behaviour on windows 8 (64bit) running on a virtual machine.
I try to reproduce it on a PC, windows 10 (64bit). Is it possible that, due to previous installations,
a cached states is synced and the folder is created before the “initializedConfigDirectory()” is called?

describe ".initializeConfigDirectory()", ->
  beforeEach ->
    if fs.existsSync(dotAtomPath)
      fs.removeSync(dotAtomPath)

    atom.config.configDirPath = dotAtomPath

  afterEach ->
    fs.removeSync(dotAtomPath)

  describe "when the configDirPath doesn't exist", ->
    it "copies the contents of dot-atom to ~/.atom", ->
      return if process.platform is 'win32' # Flakey test on Win32
      initializationDone = false
      jasmine.unspy(window, "setTimeout")
      atom.config.initializeConfigDirectory ->
        initializationDone = true

      waitsFor -> initializationDone

      runs ->
        expect(fs.existsSync(atom.config.configDirPath)).toBeTruthy()
        expect(fs.existsSync(path.join(atom.config.configDirPath, 'packages'))).toBeTruthy()
        expect(fs.isFileSync(path.join(atom.config.configDirPath, 'snippets.cson'))).toBeTruthy()
        expect(fs.isFileSync(path.join(atom.config.configDirPath, 'init.coffee'))).toBeTruthy()
        expect(fs.isFileSync(path.join(atom.config.configDirPath, 'styles.less'))).toBeTruthy()