Skip to content

Commit

Permalink
remove unused scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKylinGithub committed May 28, 2024
1 parent fa25402 commit 048d703
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 191 deletions.
95 changes: 0 additions & 95 deletions scripts/command-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,99 +81,4 @@ function writeFileSync(fullPath, data) {
resolve(true);
});
});
}

export const replaceAPIDOCbyUrl = async (directoryPath, url) => {
let files = await readDirSync(directoryPath);
if (!files) {
return false;
}

for (let i = 0; i < files.length; ++i) {
let file = files[i];
const fullPath = path.join(directoryPath, file.name);
if (file.isDirectory()) {
let ret = await replaceAPIDOCbyUrl(fullPath, url);
if (!ret) {
return false;
}
}
else if (fullPath.indexOf('.js') != -1 || fullPath.indexOf('.html') != -1) {
let data = await readFileSync(fullPath);
if (!data) {
console.log(fullPath);
return false;
}

data = data.toString();
let dirty = false;
let KEY = './__APIDOC__';
while (true) {
let index = data.indexOf(KEY);
if (index == -1) {
break;
}
data = data.replace(KEY, url);
dirty = true;
}

if (dirty) {
console.log(`File: ${fullPath}`);
let ret = await writeFileSync(fullPath, data);
if (!ret) {
return false;
}
}
}
}
return true;
}

export const formatAPIDOC = async (directoryPath) => {
let files = await readDirSync(directoryPath);
if (!files) {
return false;
}
for (let i = 0; i < files.length; ++i) {
let file = files[i];
const fullPath = path.join(directoryPath, file.name);
if (file.isDirectory()) {
let ret = await formatAPIDOC(fullPath);
if (!ret) {
return false;
}
}
else if (fullPath.indexOf('.md') != -1 ) {
let data = await readFileSync(fullPath);
if (!data) {
console.log('can not read',fullPath);
break;
}

data = data.toString();
let dirty = false;
let KEY = '__APIDOC__';
let lines = data.split('\n');
for(let i = 0; i < lines.length; ++i){
let line = lines[i];
let index = line.indexOf(KEY);
if (index != -1 && line[index -1] == '(') {
line = line.replace(KEY, '%__APIDOC__%');
lines[i] = line;
dirty = true;
}
}

if (dirty) {
console.log(`File: ${fullPath}`);
data = lines.join('\n');
let ret = await writeFileSync(fullPath, data);
if (!ret) {
console.log('write failed:',fullPath);
return false;
}
}
}
}
return true;
}
38 changes: 0 additions & 38 deletions scripts/format-apidoc.js

This file was deleted.

3 changes: 0 additions & 3 deletions scripts/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ async function publishTargetVersion(targetVersion) {
await spawnCommand(`node ./scripts/create-sidebar.js ${targetVersion}/zh/SUMMARY.md`, targetVersion);
console.log('Generating SUMMARY.md -> summary.json Complete', targetVersion);
await spawnCommand(`npx vitepress build ${targetVersion}`, targetVersion);

//let version = targetVersion.split('/')[1];
//await replaceAPIDOCbyUrl(`${targetVersion}/.vitepress/dist` ,`https://docs.cocos.com/creator/${version}/api/en/`);
}

(async () => {
Expand Down
55 changes: 0 additions & 55 deletions scripts/removehref.js

This file was deleted.

0 comments on commit 048d703

Please sign in to comment.