Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cordova browserify/rollup conflict #3180

Merged
merged 1 commit into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
53 changes: 0 additions & 53 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ const del = require('del');
const NwBuilder = require('nw-builder');
const innoSetup = require('@quanle94/innosetup');
const deb = require('gulp-debian');
const conffiles = './test/configs';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added in #3155 - need to check if linux debian file is still being created.

UPDATE: Seems to be there. So all good.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This literally does nothing. Do you mean

conffiles: './test/configs/opt/etc/dummy.cfg',
is needed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes according the example in the updated library

const buildRpm = require('rpm-builder');
const commandExistsSync = require('command-exists').sync;
const targz = require('targz');

const gulp = require('gulp');
const rollup = require('rollup');
const concat = require('gulp-concat');
const yarn = require("gulp-yarn");
const rename = require('gulp-rename');
const replace = require('gulp-replace');
Expand All @@ -34,9 +32,6 @@ const sourcemaps = require('gulp-sourcemaps');

const cordova = require("cordova-lib").cordova;

const browserify = require('browserify');
const glob = require('glob');

const DIST_DIR = './dist/';
const APPS_DIR = './apps/';
const DEBUG_DIR = './debug/';
Expand Down Expand Up @@ -91,8 +86,6 @@ gulp.task('clean-cache', clean_cache);

gulp.task('clean-cordova', clean_cordova);

gulp.task('test-cordova', cordova_browserify);


// Function definitions are processed before function calls.

Expand Down Expand Up @@ -968,7 +961,6 @@ function cordova_dist() {
distTasks.push(cordova_manifestjson);
distTasks.push(cordova_configxml);
distTasks.push(cordova_rename_build_json);
distTasks.push(cordova_browserify);
distTasks.push(cordova_depedencies);
if (cordovaDependencies) {
distTasks.push(cordova_platforms);
Expand Down Expand Up @@ -1088,51 +1080,6 @@ function cordova_rename_build_json() {
.pipe(gulp.dest(CORDOVA_DIST_DIR));
}

function cordova_browserify(done) {
const readFile = function(file) {
return new Promise(function(resolve) {
if (!file.includes("node_modules")) {
fs.readFile(file, 'utf8', async function (err,data) {
if (data.match('require\\(.*\\)')) {
await cordova_execbrowserify(file);
}
resolve();
});
} else {
resolve();
}
});
};
glob(`${CORDOVA_DIST_DIR}www/**/*.js`, {}, function (err, files) {
const readLoop = function() {
if (files.length === 0) {
done();
} else {
const file = files.pop();
readFile(file).then(function() {
readLoop();
});
}
};
readLoop();
});
}

function cordova_execbrowserify(file) {
const filename = file.split('/').pop();
const destpath = file.replace(filename, '');
console.log(`Include required modules in ${file}`);
return browserify(file, { ignoreMissing: true })
.transform("babelify", {
presets: ["@babel/preset-env"],
sourceMaps: false,
global:true,
ignore: [/\/node_modules\/(?!md5.js\/)/] })
.bundle()
.pipe(source(filename))
.pipe(gulp.dest(destpath));
}

function cordova_depedencies() {
process.chdir(CORDOVA_DIST_DIR);
return gulp.src(['./package.json', './yarn.lock'])
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
"@storybook/vue": "^6.5.12",
"babel-loader": "^8.2.5",
"babelify": "^10.0.0",
"browserify": "^17.0.0",
"chai": "^4.3.6",
"command-exists": "^1.2.9",
"cordova-lib": "^11.0.0",
Expand All @@ -106,7 +105,6 @@
"fs-extra": "^10.1.0",
"glob": "^8.0.3",
"gulp": "^4.0.2",
"gulp-concat": "~2.6.1",
"gulp-debian": "^0.3.2",
"gulp-json-editor": "^2.5.6",
"gulp-less": "^5.0.0",
Expand Down