This repository has been archived by the owner on Jun 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finish Client Migration / API Update (#395)
* in progress * More Migrations * Upgrade Packages, Vite Server, etc. * force localhost for vue-dev * Fix File Cleaning Bug
- Loading branch information
Showing
143 changed files
with
3,989 additions
and
4,875 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import path from 'path'; | ||
import glob from 'glob'; | ||
import fs from 'fs'; | ||
|
||
const startTime = Date.now(); | ||
const resourcePath = path.join(process.cwd(), 'resources/core/**/*.js').replace(/\\/gm, '/'); | ||
const filePaths = glob.sync(resourcePath); | ||
|
||
const funcsToIgnore = [ | ||
// | ||
'export function', | ||
'export const', | ||
'export let', | ||
'export async function', | ||
'=>', | ||
]; | ||
|
||
let count = 0; | ||
for (let filePath of filePaths) { | ||
const fileContents = fs.readFileSync(filePath, { encoding: 'utf-8' }); | ||
const splitContents = fileContents.split(/\r?\n/); | ||
|
||
const filePathing = filePath.split('/'); | ||
filePathing.pop(); | ||
const directoryPath = filePathing.join('/'); | ||
|
||
let wasModified = false; | ||
for (let i = 0; i < splitContents.length; i++) { | ||
if (!splitContents[i].includes('import') && !splitContents[i].includes('export')) { | ||
continue; | ||
} | ||
|
||
let shouldSkip = false; | ||
for (let funcToIgnore of funcsToIgnore) { | ||
if (splitContents[i].includes(funcToIgnore)) { | ||
shouldSkip = true; | ||
break; | ||
} | ||
} | ||
|
||
if (shouldSkip) { | ||
continue; | ||
} | ||
|
||
const filePathReg = new RegExp(/('|").*.('|")/g); | ||
const extractions = splitContents[i].match(filePathReg); | ||
if (extractions === null || !extractions) { | ||
continue; | ||
} | ||
|
||
const relativeFilePath = extractions[0].replace(/'/gm, '').replace(/"/gm, ''); | ||
if (relativeFilePath.charAt(0) !== '.' && relativeFilePath.charAt(0) !== '/') { | ||
continue; | ||
} | ||
|
||
const actualFilePath = path.join(directoryPath, relativeFilePath).replace(/\\/gm, '/'); | ||
if (fs.existsSync(actualFilePath)) { | ||
const barrelFileTest = fs.statSync(actualFilePath); | ||
if (barrelFileTest.isDirectory()) { | ||
splitContents[i] = splitContents[i].replace(relativeFilePath, `${relativeFilePath}/index.js`); | ||
wasModified = true; | ||
continue; | ||
} | ||
} | ||
|
||
if (!splitContents[i].includes('.js')) { | ||
splitContents[i] = splitContents[i].replace(relativeFilePath, `${relativeFilePath}.js`); | ||
wasModified = true; | ||
} | ||
} | ||
|
||
if (!wasModified) { | ||
continue; | ||
} | ||
|
||
const finalFile = splitContents.join('\r\n'); | ||
fs.writeFileSync(filePath, finalFile, { encoding: 'utf-8' }); | ||
count += 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.