Open jy95 opened 2 years ago
I've never tried JSCodeshift for JSON files... Which parser are you using? Please link to an ASTExplorer.net repro.
For JSON, wouldn't it be easier to just use JSON.parse
and manipulate it that way?
@Daniel15 I was using json-estree-ast, a litle wrapper around json-to-ast
If I was able to deal with .d.ts
files, why not the JSON files ?
When using another parser wrapper I created (momoa-estree-ast using this time @humanwhocodes/momoa ), I saw that JSCodeShift is doing weird stuff : dependencies isn't replaced and is broken, explaining why the other parser also failed :
{
"name":"keycloak-capacitor",
"version":"19.0.1",
"description":"Keycloak adapter for Ionicframework with Capacitor support.",
"main":"dist/keycloak.js",
"module":"dist/keycloak.mjs",
"types":"dist/keycloak.d.ts",
"files":[
"dist"
],
"scripts":{
"build":"rollup --config --configPlugin typescript",
"prepublishOnly":"npm run build",
"test":"npx jest"
},
"repository":{
"type":"git",
"url":"git+https://github.com/jy95/keycloak-capacitor.git"
},
"keywords":[
"capacitor",
"adapter",
"auth",
"authentication",
"oauth2",
"openid",
"keycloak"
],
"devDependencies":{
"es6-promise":"^4.2.8",
"jest":"^28.1.3",
"jscodeshift":"^0.13.1",
"tslib":"^2.4.0",
"typescript":"^4.5.5"
},
"dependencies":{
"base64-js":"^1.5.1","^1.5.1"
"js-sha256":"^0.9.0""^4.2.0"
},
"author":"jy95",
"license":"Apache-2.0",
"bugs":{
"url":"https://github.com/jy95/keycloak-capacitor/issues"
},
"homepage":"https://github.com/jy95/keycloak-capacitor#readme"
}
Hello,
I am using JScodeshift to make some changes in json with my keycloak-capacitor project.
However, it doesn't seem to work when toSource is invoked :
If
node.properties = newProperties;
is put on comments, then I got no error but not the behavior I am expecting.Steps to reproduce :
Kind regards,