Comments (8)
@erisu I only wanted to give examples of some major changes that I know are wanted in an upcoming releases, and that I think should not be blocked by removing superspawn
(#16). I suspect that #16 could be a major effort to implement and test on all of the various Cordova packages.
I hope this is clear now. Please feel free to ask if it is still not clear.
from cordova.
I've added a dependency graph to make it easier to determine the correct order of doing this.
from cordova.
Should anyone want to tackle this for some repo, here's some of the "tools" I've been using:
List of Q instance methods:
passByCopy
join
tap
thenResolve
thenReject
isPending
isFulfilled
isRejected
spread
dispatch
get
set
del
mapply
post
send
mcall
invoke
fapply
fcall
fbind
keys
any
allResolved
allSettled
fail
progress
fin
done
timeout
delay
nfapply
nfcall
nfbind
denodeify
nbind
nmapply
npost
nsend
nmcall
ninvoke
nodeify
bash scripts that read from above list and search for usage of these methods (uses ripgrep):
# List all matches
while read -u 10 m; do
rg "\.${m}\(";
done 10< q-methods.txt
# Print statistics on the usage count of the different methods
while read -u 10 m; do
printf "$m: ";
(rg -c "\.${m}\(" || echo 'x:0') | cut -d: -f2 | paste -s -d+ | bc;
done 10< q-methods.txt | grep -v ' 0$'| sort -n -k2
Naturally this is nowhere near being an automatic process as RegExs aren't powerful enough to parse JS and the code probably has a lot of .join(
that has nothing to do with Q
😉
But much is solvable by simple search and replace.
from cordova.
Too bad nobody wrote an automated code transformation based on jscodeshift for migrating from Q to native Promises.
from cordova.
Another thing is that I think we should get rid of superspawn
as discussed in #16, rather than fixing superspawn
to drop use of q
. The rationale is that superspawn
seems to return a non-standard Promise-like object that can also notify the listener of stdout
and stderr
data. I think it would be better to cleanly factor superspawn
out of the Cordova packages, in a major release.
While it would be ideal to do this in the next major release, it would likely block some other desired changes such as dropping support for Node.js 6 and eventually Node.js 8.
from cordova.
@brodybits Can you elaborate on this?
it would likely block some other desired changes such as dropping support for Node.js 6 and eventually Node.js 8.
To drop Node.js 6 and 8 in the next major as planned, we only remove it from the CI testing configurations and bump the node engine in package.json
. There shouldn't be much effort to this.
from cordova.
Thank you @brodybits that cleared up my confusion.
from cordova.
I wrote an ESLint config that should highlight all instances of Q-API usage:
const qInstanceMethodsConfig = `
allResolved allSettled del delay denodeify dispatch done fail fapply fbind
fcall fin invoke isFulfilled isPending isRejected mapply mcall nbind
nfapply nfbind nfcall ninvoke nmapply nmcall nodeify npost nsend passByCopy
post progress spread tap thenReject thenResolve timeout
`.trim().split(/\s+/).map(property => ({ property }));
const restrictedSyntaxConfig = [
{
selector: `
CallExpression[arguments.length=1][arguments.0.value!=/^(,? ?|\\n)$/]
> MemberExpression[property.name="join"][object.name!="path"][callee.object.type!="ArrayExpression"]
`.replace(/\n/g, ''),
message: 'possible usage of `Q.prototype.join`',
},
{
selector: 'CallExpression[arguments.length=1] > MemberExpression[property.name="get"]',
message: 'possible usage of `Q.prototype.get`',
},
{
selector: 'CallExpression[arguments.length=2] > MemberExpression[property.name="set"]',
message: 'possible usage of `Q.prototype.set`',
},
{
selector: 'CallExpression > MemberExpression[property.name="any"][object.name!="jasmine"]',
message: 'possible usage of `Q.prototype.any`',
},
{
selector: 'CallExpression > MemberExpression[property.name="keys"][object.name!="Object"]',
message: 'possible usage of `Q.prototype.keys`',
},
{
selector: 'CallExpression[callee.property.name="send"]',
message: 'possible usage of `Q.prototype.send`',
},
]
module.exports = {
rules: {
'no-restricted-modules': ['error', 'q'],
'no-restricted-properties': [
'error', { object: 'Q' }, { object: 'q' }, ...qInstanceMethodsConfig
],
'no-restricted-syntax': ['warn', ...restrictedSyntaxConfig],
}
};
from cordova.
Related Issues (20)
- SameSite=none is not added in the request HOT 1
- Cordova create testProject on smb volume HOT 5
- Add Tauri platform HOT 5
- Better accessability support HOT 6
- Could not find org.apache.cordova:framework:7.0.0 HOT 1
- In cordova website version drop down not yet updated HOT 2
- Video files (native HTML 5 video element) within iframe will not go into full screen when user taps the full screen icon HOT 1
- Push Notifications are not coming to real device where as working in simulator
- Test issue HOT 1
- cordova plugin add: "Unexpected end of JSON input" HOT 6
- How to open system browser from link in the inappbrowser
- Trying to build app on a vps
- HarmonyOS Next Platform support HOT 3
- Cannot fint module 'serialport' on build with cordova-electron HOT 1
- Embedded Cordova in Apple's VisionOS App (VisionOS Platform)
- Undefined symbols on Xcode HOT 1
- Unable to locate DeviceSupport directory with suffix 'DeveloperDiskImage.dmg' - Xcode15.2 - Physical device 17.2 HOT 1
- live reload HOT 1
- TextKi
- Combine multiple projects in one
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova.