Compare commits

...

8 Commits

Author SHA1 Message Date
Jan Prochazka
831b06bbea Merge branch 'master' into mjs 2024-05-20 20:02:44 +02:00
Jan Prochazka
e925afff71 package type moduke 2024-05-20 16:49:50 +02:00
Jan Prochazka
8c3865f8b7 fix 2024-05-20 16:38:13 +02:00
Jan Prochazka
24904a3b33 add js ext 2024-05-20 16:36:04 +02:00
Jan Prochazka
6439423ef1 convert api using 5to6-codemod 2024-05-20 16:32:38 +02:00
Jan Prochazka
92452d77ef added convert packages 2024-05-20 16:19:44 +02:00
Jan Prochazka
76fadd5aa9 fix 2024-05-20 16:17:25 +02:00
Jan Prochazka
a1cc9f7258 convert:api script 2024-05-20 16:16:50 +02:00
4 changed files with 1084 additions and 29 deletions

16
add-js-ext.js Normal file
View File

@@ -0,0 +1,16 @@
module.exports = function (fileInfo, api) {
const j = api.jscodeshift;
const root = j(fileInfo.source);
// Find all import declarations
root.find(j.ImportDeclaration).forEach(path => {
const importPath = path.node.source.value;
// If the import path doesn't end with .js, add it
if (!importPath.endsWith('.js') && importPath.startsWith('.')) {
path.node.source = j.literal(importPath + '.js');
}
});
return root.toSource();
};

View File

@@ -55,7 +55,8 @@
"ts:web": "yarn workspace dbgate-web ts",
"ts": "yarn ts:api && yarn ts:web",
"postinstall": "yarn resetPackagedPlugins && yarn build:lib && patch-package && yarn fillNativeModules && yarn build:plugins:frontend",
"dbgate-serve": "node packages/dbgate/bin/dbgate-serve.js"
"dbgate-serve": "node packages/dbgate/bin/dbgate-serve.js",
"convert:api": "jscodeshift -t node_modules/5to6-codemod/transforms/cjs.js packages/api/src && jscodeshift -t node_modules/5to6-codemod/transforms/exports.js packages/api/src && jscodeshift -t ./add-js-ext.js packages/api/src"
},
"dependencies": {
"concurrently": "^5.1.0",
@@ -63,8 +64,12 @@
"pino-pretty": "^9.1.1"
},
"devDependencies": {
"5to6-codemod": "^1.8.0",
"ast-types": "^0.14.2",
"copyfiles": "^2.2.0",
"jscodeshift": "^0.15.2",
"prettier": "^2.2.1",
"recast": "^0.23.7",
"workspaces-run": "^1.0.1"
}
}

View File

@@ -9,6 +9,7 @@
},
"author": "Jan Prochazka",
"license": "MIT",
"type": "module",
"keywords": [
"sql",
"json",

1089
yarn.lock

File diff suppressed because it is too large Load Diff