Code Monkey home page Code Monkey logo

Comments (6)

ayushmanchhabra avatar ayushmanchhabra commented on May 27, 2024

I only need every file in srcDir to be copied into outDir and not any folder within

Sample source dir:

/dir/file1
/dir/dir/file2
/file3

Sample out dir:

/file1
/file2
/file3

Without knowing too much about your application, I'm assuming you want this^ type of file structure. The thing is that other people might have different use cases where they do need nested folders.

I actually don't understand the importance of using the .nw folder

https://nwjs.readthedocs.io/en/latest/For%20Users/Package%20and%20Distribute/#package-your-app

from nw-builder.

williamwang96 avatar williamwang96 commented on May 27, 2024

You are correct in what I need. Understood, but I think the production code still has an issue in line 47, since splice(2) is assuming that srcDir lives in the home directory, which is usually two levels down from root dir. If I understand correctly, the expected behavior here is to preserve the folder structure in srcDir and copy recursively to package.nw in outDir. I should be able to find a way to do that.

Thanks for the pointer regarding the .nw folder! The only file that I need to copy into the NW.js binaries folder is package.json so I never paid much attention to that section of the doc.

from nw-builder.

ayushmanchhabra avatar ayushmanchhabra commented on May 27, 2024

Understood, but I think the production code still has an issue in line 47, since splice(2) is assuming that srcDir lives in the home directory, which is usually two levels down from root dir.

I think you are right. I made a small change (available in v4.1.1) but I think that is also incorrect.

from nw-builder.

ayushmanchhabra avatar ayushmanchhabra commented on May 27, 2024

@williamwang96 the linked PR should fix the issue. The changelog would be the best place to see what has changed.

from nw-builder.

williamwang96 avatar williamwang96 commented on May 27, 2024

Thanks for the work. However, I think the issue still exists.

log.debug(`Copy files in srcDir to ${outDir} directory`);
for (let file of files) {
log.debug(`Copy ${file} file to ${outDir} directory`);
await cp(
file,
resolve(
outDir,
platform !== "osx"
? "package.nw"
: "nwjs.app/Contents/Resources/app.nw",
file,
),
);
}

This works for srcDir that's located in root dir, but not other cases. Since files in line 40 are from srcDir, it would copy each file with its absolute path to outDir.

For example, if

  • srcDir is /home/users/williamwang96/project/desktop/installer
  • ourDir is /home/users/williamwang96/project/desktop/installer/build-output

Then the package.json in srcDir will be copied to /home/users/williamwang96/project/desktop/installer/build-output/home/users/williamwang96/project/desktop/installer/package.json.

I believe what we need in line 49 is the relative path of file to srcDir.

from nw-builder.

ayushmanchhabra avatar ayushmanchhabra commented on May 27, 2024

I believe what we need in line 49 is the relative path of file to srcDir.

Open to PR

from nw-builder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.