wordup-dev / wordup-cli

Wordup is a fully integrated development platform for WordPress. Develop plugins and themes locally. Preview in the cloud. Automatic updates in WP.
GNU General Public License v3.0
118 stars 16 forks source link

After creating second plugin, wordup export hangs #3

Closed jjwilliams42 closed 5 years ago

jjwilliams42 commented 5 years ago

I was the one that opened https://github.com/wordup-dev/wordup-cli/issues/2

After creating my second plugin, the wordup export installation command seems to just hang at Write wordup-archive.json for WP-Version: 5.2.

It never exits back to the console or finishes.

OS: Windows

Console:

C:\Projects\Personal\techlyplugins\techly-tech-specs [master ≡ +0 ~0 -2 | +0 ~1 -0 !]> wordup export installation
Starting techly-tech-specs_db_1 ... done
Starting techly-tech-specs_wordpress_1 ... done
Parsed wordup package.json with slug: techly-tech-specs/techly-tech-specs.php
Success: Exported to '/tmp/wordup-installation/db-snapshot-1558328264.sql'.
Write wordup-archive.json for WP-Version: 5.2

And now it's been sitting there for 5 minutes. Any ideas why this might be?

shry commented 5 years ago

If I understand you right: You set up 2 different wordup projects. And the installation export of the second project is not working?

Some follow up questions:

What you could try also:

jjwilliams42 commented 5 years ago

Correct

Followup answers:

It's as if node isn't letting go of the process. I'll try your other recommendations later when I have time.

jjwilliams42 commented 5 years ago

I did some more digging, cloned the project and attempted to run the tests. It seems export is failing for me:

 1) export
       Test final shell.exec which runs docker compose:
     TypeError: Cannot read property 'listeningOnPort' of undefined
      at ExportCommand.run (src\commands\export.js:1:4521)
      at ExportCommand._run (node_modules\@oclif\command\lib\command.js:35:31)
      at <anonymous>

I npm install -g'd from my folder and dropped a console.log at line 21 of export.js:

console.log(project.config);
project.prepareDockerComposeUp(project.config.listeningOnPort)

Which confuses me because it appears to be there:

{ name: 'techly-tech-specs',
  slugName: 'techly-tech-specs',
  path: 'C:\\Projects\\Personal\\techlyplugins\\techly-tech-specs',
  installedOnPort: '8000',
  listeningOnPort: '8000',
  scaffoldOnInstall: false,
  created: 1558319161 
}

Digging even more:

// ----- IT HANGS HERE ------
WP_CLI::log('Write wordup-archive.json for WP-Version: '.$wp_version);

//Move src back to destination, if available 
WP_CLI::launch('unlink '.$project_tmp_path);
WP_CLI::launch('mkdir '.$project_tmp_path);
WP_CLI::launch('cp -a /src/. '.$project_tmp_path);

Is there supposed to be a dot (.) at 'cp -a /src/. ' <-- a dot inside the single quotes?

shry commented 5 years ago

Thank you very much for your help. I also did some investigation. For sure the bug is in the wordup-wp-cli. If the export command doesn't finish correctly, for whatever reason -> The file structure in the docker container is corrupted. But i think i can solve this problem. Have you tried to reinstall the whole installation with: wordup stop --delete ?

jjwilliams42 commented 5 years ago

I did try that method but it didn't work

On Wed, May 22, 2019, 12:39 PM shry notifications@github.com wrote:

Thank you very much for your help. I also did some investigation. For sure the bug is in the wordup-wp-cli https://github.com/wordup-dev/wordup-wp-cli. If the export command doesn't finish correctly, for whatever reason -> The file structure in the docker container is corrupted. But i think i can solve this problem. Have you tried to reinstall the whole installation with: wordup stop --delete ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wordup-dev/wordup-cli/issues/3?email_source=notifications&email_token=AANKIX4ME3FKKV4NVQDNCWTPWWANBA5CNFSM4HN6PY3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV7Y7IA#issuecomment-494899104, or mute the thread https://github.com/notifications/unsubscribe-auth/AANKIX3VQ5OIQWMAQAXIQ6LPWWANBANCNFSM4HN6PY3A .

shry commented 5 years ago

Ok, this makes it a little bit more complicated ;-)

Is there supposed to be a dot (.) at 'cp -a /src/. ' <-- a dot inside the single quotes?

The dot is correct, it copies the content of a folder, without the folder itself.

Furthermore I think it's a windows specific bug, because i cannot reproduce this issue on my system.

shry commented 5 years ago

I have released a new version , which should prevent some export failures. I don't know if your issue will be solved, but it's worth a try.

jjwilliams42 commented 5 years ago

Thanks @shry, I will give it a go

jjwilliams42 commented 5 years ago

Thanks, I tried again but it still didn't work. On a good note: Creating a new wordup instance, without modifying anything, exported fine.

I've got a private repo (techly-tech-specs), that I've invited you to. If you want to see my projects layout. I thought it may have something to do with my structure or added dependencies. I use a webpack / babel friendly build process, so I can use all the ES6 goodness.

jjwilliams42 commented 5 years ago

I think I may see whats happening. It's trying to copy my 500MB node_modules from my src folder in this command:

WP_CLI::launch('cp -a /src/. /tmp/'.$project_folder_name);

shry commented 5 years ago

That is the issue, for sure!!! Because this kind of big file size in a zip file makes always problems.

But this should only be valid for wordup export installation.

The export for wordup export src should be ignoring node_modules. Because all files in .distignore will be ignored. But you said that this doesn't work either. Am i right? I guess, i have to tweak it also a little bit. EDIT: I have checked the code, it also copies the file, i will rewrite that also.

Your code looks good, i don't see a problem there.

I will change the export installation function so that it will also ignore the .distignore files, that should solve the problem.

shry commented 5 years ago

I have released a new version. I have deleted the file copying and node_modules will not be exported if it's in .distignore. Although i have tested it with a big node_modules folder it will take longer. This is because im using the official dist-archive wp-cli command, which seems to perform poorly. Perhaps i will rewrite this function in the near feature.

EDIT: After changing dist-archive to export to targz the performance increased dramatically. I think now it's working really well.