-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2786 from ever-co/develop
Release
- Loading branch information
Showing
53 changed files
with
1,114 additions
and
420 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,43 @@ | ||
{ | ||
"importSorter.generalConfiguration.sortOnBeforeSave": false, | ||
"importSorter.sortConfiguration.joinImportPaths": false, | ||
"cSpell.userWords": [], | ||
"cSpell.enabled": true, | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"typescript.enablePromptUseWorkspaceTsdk": true, | ||
"npm.packageManager": "yarn", | ||
"prettier.trailingComma": "none", | ||
"prettier.singleQuote": true, | ||
"editor.formatOnSave": true, | ||
"eslint.format.enable": true, | ||
"editor.tabSize": 4, | ||
"files.insertFinalNewline": true, | ||
"files.trimFinalNewlines": true, | ||
"files.trimTrailingWhitespace": true, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": "explicit", | ||
"source.organizeImports": "never", | ||
"source.sortMembers": "never", | ||
"organizeImports": "never" | ||
}, | ||
"vsicons.presets.angular": true, | ||
"deepscan.enable": true, | ||
"cSpell.words": [], | ||
"files.exclude": { | ||
"**/.git": true, | ||
"**/.DS_Store": true, | ||
"**/node_modules": false, | ||
"**/public/**/*.png": false, | ||
"**/public/**/*.jpg": false, | ||
"**/public/**/*.pdf": true | ||
}, | ||
"search.exclude": { | ||
"**/node_modules": true, | ||
"**/.idea": true, | ||
"**/.idea/**/*.{xml,iml}": true, | ||
"**/.iml": true, | ||
"**/.yarn": true, | ||
"**/yarn.lock": true | ||
}, | ||
"docwriter.style": "Auto-detect" | ||
"importSorter.generalConfiguration.sortOnBeforeSave": false, | ||
"importSorter.sortConfiguration.joinImportPaths": false, | ||
"cSpell.userWords": [], | ||
"cSpell.enabled": true, | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"typescript.enablePromptUseWorkspaceTsdk": true, | ||
"npm.packageManager": "yarn", | ||
"prettier.trailingComma": "none", | ||
"prettier.singleQuote": true, | ||
"editor.formatOnSave": true, | ||
"eslint.format.enable": true, | ||
"editor.tabSize": 4, | ||
"files.insertFinalNewline": true, | ||
"files.trimFinalNewlines": true, | ||
"files.trimTrailingWhitespace": true, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": "explicit", | ||
"source.organizeImports": "never", | ||
"source.sortMembers": "never", | ||
"organizeImports": "never" | ||
}, | ||
"vsicons.presets.angular": true, | ||
"deepscan.enable": true, | ||
"cSpell.words": ["Timepicker"], | ||
"files.exclude": { | ||
"**/.git": true, | ||
"**/.DS_Store": true, | ||
"**/node_modules": false, | ||
"**/public/**/*.png": false, | ||
"**/public/**/*.jpg": false, | ||
"**/public/**/*.pdf": true | ||
}, | ||
"search.exclude": { | ||
"**/node_modules": true, | ||
"**/.idea": true, | ||
"**/.idea/**/*.{xml,iml}": true, | ||
"**/.iml": true, | ||
"**/.yarn": true, | ||
"**/yarn.lock": true | ||
}, | ||
"docwriter.style": "Auto-detect" | ||
} |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './create-window' | ||
export * from './create-window'; | ||
export * from './replace-config'; |
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,44 @@ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import fg from 'fast-glob'; | ||
import os from 'os'; | ||
|
||
type EnvOptions = { | ||
before: { | ||
NEXT_PUBLIC_GAUZY_API_SERVER_URL?: string | ||
}, | ||
after: { | ||
NEXT_PUBLIC_GAUZY_API_SERVER_URL?: string | ||
} | ||
} | ||
|
||
const scanAllFiles = async (files: string[], oldConfig: string, newConfig: string) => { | ||
files.forEach((file) => { | ||
if (path.extname(file) === '.js') { | ||
try { | ||
const data = fs.readFileSync(file, 'utf-8'); | ||
const result = data.replace(new RegExp(oldConfig, 'g'), newConfig); | ||
fs.writeFileSync(file, result, 'utf8'); | ||
} catch (error) { | ||
console.log('error replace', error); | ||
} | ||
} | ||
}); | ||
} | ||
export const replaceConfig = async (folderPath: string, envOptions: EnvOptions) => { | ||
try { | ||
console.log('all files path', folderPath); | ||
if (os.platform() === 'win32') { | ||
folderPath = folderPath.replace(/\\/g, '/'); | ||
} | ||
console.log('final path', folderPath); | ||
const NEXT_PUBLIC_GAUZY_API_SERVER_URL_BEFORE = `"NEXT_PUBLIC_GAUZY_API_SERVER_URL","${envOptions.before.NEXT_PUBLIC_GAUZY_API_SERVER_URL}"`; | ||
const NEXT_PUBLIC_GAUZY_API_SERVER_URL_AFTER = `"NEXT_PUBLIC_GAUZY_API_SERVER_URL","${envOptions.after.NEXT_PUBLIC_GAUZY_API_SERVER_URL}"`; | ||
const NEXT_PUBLIC_GAUZY_API_SERVER_URL_DEFAULT = `"NEXT_PUBLIC_GAUZY_API_SERVER_URL","https://api.ever.team"`; | ||
const files = await fg(`${folderPath}/**/*`, { onlyFiles: true }); | ||
await scanAllFiles(files, NEXT_PUBLIC_GAUZY_API_SERVER_URL_BEFORE, NEXT_PUBLIC_GAUZY_API_SERVER_URL_AFTER); | ||
await scanAllFiles(files, NEXT_PUBLIC_GAUZY_API_SERVER_URL_DEFAULT, NEXT_PUBLIC_GAUZY_API_SERVER_URL_AFTER); | ||
} catch (error) { | ||
console.log('error on replacing file', error); | ||
} | ||
} |
Oops, something went wrong.