Skip to content

Commit

Permalink
Fix a merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
shalithasuranga committed May 7, 2024
2 parents 7afd726 + 2a6d21c commit 73fd8c0
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 62 deletions.
155 changes: 111 additions & 44 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 30 additions & 17 deletions src/modules/bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,39 @@ async function createAsarFile() {
const resourcesDir = utils.trimPath(configObj.cli.resourcesPath);
const extensionsDir = utils.trimPath(configObj.cli.extensionsPath);
const clientLibrary = configObj.cli.clientLibrary ? utils.trimPath(configObj.cli.clientLibrary)
: null;
: null;
const icon = utils.trimPath(configObj.modes.window.icon);
const binaryName = configObj.cli.binaryName;
const buildDir = configObj.cli.distributionPath ? utils.trimPath(configObj.cli.distributionPath) : 'dist';

fs.mkdirSync(`.tmp`, { recursive: true });
await fse.copy(`./${resourcesDir}`, `.tmp/${resourcesDir}`, {overwrite: true});
await fse.copy(`./${resourcesDir}`, `.tmp/${resourcesDir}`, {
overwrite: true,
filter: configObj.cli.resourcesExclude
&& ((src) =>
(!new RegExp(configObj.cli.resourcesExclude).test(src))
)
});

if(extensionsDir && fs.existsSync(extensionsDir)) {
await fse.copy(`./${extensionsDir}`, `${buildDir}/${binaryName}/${extensionsDir}`, {overwrite: true});
if (extensionsDir && fs.existsSync(extensionsDir)) {
await fse.copy(`./${extensionsDir}`, `${buildDir}/${binaryName}/${extensionsDir}`, {
overwrite: true,
filter: configObj.cli.extensionsExclude
&& ((src) =>
(!new RegExp(configObj.cli.extensionsExclude).test(src))
)
});
}

await fse.copy(`${constants.files.configFile}`, `.tmp/${constants.files.configFile}`, {overwrite: true});
if(clientLibrary) {
await fse.copy(`${constants.files.configFile}`, `.tmp/${constants.files.configFile}`, { overwrite: true });
if (clientLibrary) {
let typesFile = clientLibrary.replace(/.js$/, '.d.ts');
await fse.copy(`./${clientLibrary}`, `.tmp/${clientLibrary}`, {overwrite: true});
if(fs.existsSync(`.tmp/${typesFile}`)) {
await fse.copy(`./${clientLibrary}`, `.tmp/${clientLibrary}`, { overwrite: true });
if (fs.existsSync(`.tmp/${typesFile}`)) {
fse.removeSync(`.tmp/${typesFile}`);
}
}

if(icon) {
await fse.copy(`./${icon}`, `.tmp/${icon}`, {overwrite: true});
}
Expand All @@ -46,33 +59,33 @@ module.exports.bundleApp = async (isRelease, copyStorage) => {
const buildDir = configObj.cli.distributionPath ? utils.trimPath(configObj.cli.distributionPath) : 'dist';

try {
if(frontendlib.containsFrontendLibApp()) {
if (frontendlib.containsFrontendLibApp()) {
await frontendlib.runCommand('buildCommand');
}

await createAsarFile();
utils.log('Copying binaries...');

for(let platform in constants.files.binaries) {
for(let arch in constants.files.binaries[platform]) {
for (let platform in constants.files.binaries) {
for (let arch in constants.files.binaries[platform]) {
let originalBinaryFile = constants.files.binaries[platform][arch];
let destinationBinaryFile = originalBinaryFile.replace('neutralino', binaryName);
if(fse.existsSync(`bin/${originalBinaryFile}`)) {
if (fse.existsSync(`bin/${originalBinaryFile}`)) {
fse.copySync(`bin/${originalBinaryFile}`, `${buildDir}/${binaryName}/${destinationBinaryFile}`);
}
}
}

for(let dependency of constants.files.dependencies) {
fse.copySync(`bin/${dependency}`,`${buildDir}/${binaryName}/${dependency}`);
for (let dependency of constants.files.dependencies) {
fse.copySync(`bin/${dependency}`, `${buildDir}/${binaryName}/${dependency}`);
}

if(copyStorage) {
if (copyStorage) {
utils.log('Copying storage data...');
try {
fse.copySync('.storage',`${buildDir}/${binaryName}/.storage`);
fse.copySync('.storage', `${buildDir}/${binaryName}/.storage`);
}
catch(err) {
catch (err) {
utils.error('Unable to copy storage data from the .storage directory. Please check if the directory exists');
process.exit(1);
}
Expand Down
10 changes: 9 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ let getVersionTag = (version) => {
return version != 'nightly' ? 'v' + version : version;
}

let filterFiles = (src, pattern) => {
if(!Array.isArray(pattern)) pattern = [pattern];
const regex = new RegExp(pattern.join('|'));
const found = src.match(regex);
return !found;
}

module.exports = {
error,
isNeutralinojsProject,
Expand All @@ -73,5 +80,6 @@ module.exports = {
warn,
trimPath,
getVersionTag,
clearDirectory
clearDirectory,
filterFiles
}

0 comments on commit 73fd8c0

Please sign in to comment.