Skip to content

Commit

Permalink
fix: update demo domains clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Apr 23, 2023
1 parent 83a39e7 commit aafd70d
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 45 deletions.
8 changes: 2 additions & 6 deletions src/commands/fs/automated.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
let glob = require("glob");
let fs = require('fs');
const prettier = require("prettier");
const path = require("path")

function globUpdater(er, files) {
Expand All @@ -20,7 +19,6 @@ function globUpdater(er, files) {


function update(YmlPath) {
// component name
let name = path.basename(path.resolve(path.dirname(YmlPath), '../..')).substring(9);
let fileContent = `name: Automated Workflow
'on':
Expand Down Expand Up @@ -108,12 +106,10 @@ jobs:
uses: CoCreate-app/CoCreate-docs@master
`;
let formated = prettier.format(fileContent, { semi: false, parser: "yaml" });
// console.log(fileContent);
// process.exit()
if (fs.existsSync(YmlPath))
fs.unlinkSync(YmlPath)
fs.writeFileSync(YmlPath, formated)
fs.unlinkSync(YmlPath)
fs.writeFileSync(YmlPath, fileContent)

}

Expand Down
9 changes: 3 additions & 6 deletions src/commands/fs/bump.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

let fs = require('fs');
const prettier = require("prettier");
let list = require('../../../repositories.js');
const path = require("path")

Expand Down Expand Up @@ -62,16 +61,14 @@ function bumpVersion(filePath, name) {
}
}

let str = JSON.stringify(object)
let formated = prettier.format(str, { semi: false, parser: "json" });
let fileContent = JSON.stringify(object, null, 4)

filePath = filePath.replace('/package.json', '')
let Path = path.resolve(filePath, 'package.json')
if (fs.existsSync(Path)){
if (fs.existsSync(Path))
fs.unlinkSync(Path)
}

fs.writeFileSync(Path, formated)
fs.writeFileSync(Path, fileContent)
}
}

Expand Down
1 change: 0 additions & 1 deletion src/commands/fs/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
let glob = require("glob");
let fs = require('fs');
const prettier = require("prettier");
const path = require("path");

function globUpdater(er, files) {
Expand Down
4 changes: 0 additions & 4 deletions src/commands/fs/contribution.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
let fs = require('fs');
const prettier = require("prettier");
const path = require("path")
const { promisify } = require('util');
const exec = promisify(require('child_process').exec)
let list = require('../repositories.js');


Expand Down Expand Up @@ -35,13 +33,11 @@ let metaYarnLink = list.map(meta => {
(async() => {
for (let meta of metaYarnLink) {
await update(meta)
// await updateYarnLink(metaYarnLink[0])
}
})();


function update(param) {
// component name
if (!param) return;
let { packageObj, absolutePath } = param;
let { name, description } = packageObj;
Expand Down
15 changes: 4 additions & 11 deletions src/commands/fs/gitignore.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
let glob = require("glob");
let fs = require('fs');
const prettier = require("prettier");
const path = require("path")

function globUpdater(er, files) {
Expand All @@ -13,22 +12,16 @@ function globUpdater(er, files) {



function update(YmlPath) {
// component name
let name = path.basename(path.resolve(path.dirname(YmlPath), '../..')).substring(9);
function update(Path) {
let fileContent = `# ignore
node_modules
dist
.npmrc
`;
let formated = prettier.format(fileContent, { semi: false, parser: "yaml" });
// console.log(fileContent);
// process.exit()
if (fs.existsSync(YmlPath))
fs.unlinkSync(YmlPath)
fs.writeFileSync(YmlPath, formated)

if (fs.existsSync(Path))
fs.unlinkSync(Path)
fs.writeFileSync(Path, fileContent)

}

Expand Down
16 changes: 7 additions & 9 deletions src/commands/fs/manual.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
let glob = require("glob");
let fs = require('fs');
const prettier = require("prettier");
const path = require("path")

function globUpdater(er, files) {
Expand All @@ -19,9 +18,9 @@ function globUpdater(er, files) {



function update(YmlPath) {
function update(Path) {
// component name
let name = path.basename(path.resolve(path.dirname(YmlPath), '../..')).substring(9);
let name = path.basename(path.resolve(path.dirname(Path), '../..')).substring(9);
let fileContent = `name: Manual Workflow
on:
workflow_dispatch:
Expand Down Expand Up @@ -68,12 +67,11 @@ jobs:
invalidations: \${{ github.event.inputs.invalidations }}
`;
let formated = prettier.format(fileContent, { semi: false, parser: "yaml" });
// console.log(fileContent);
// process.exit()
if (fs.existsSync(YmlPath))
fs.unlinkSync(YmlPath)
fs.writeFileSync(YmlPath, formated)


if (fs.existsSync(Path))
fs.unlinkSync(Path)
fs.writeFileSync(Path, fileContent)

}

Expand Down
1 change: 0 additions & 1 deletion src/commands/fs/readme.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ let fs = require('fs');
const prettier = require("prettier");
const path = require("path")
const { promisify } = require('util');
const exec = promisify(require('child_process').exec)
let list = require('../repositories.js');


Expand Down
2 changes: 0 additions & 2 deletions src/commands/fs/remove.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
let glob = require("glob");
let fs = require('fs');
const prettier = require("prettier");
const path = require("path")

function globUpdater(er, files) {
if (er)
Expand Down
1 change: 0 additions & 1 deletion src/commands/fs/replace.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
let glob = require("glob");
let fs = require('fs');
const prettier = require("prettier");
const path = require("path")

function globUpdater(er, files) {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/fs/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ function update(webpackPath) {
let entry;

if (fs.existsSync( path.resolve(dir, './src/index.js') ))
entry = "./src/index.js";
entry = "./src/index.js";
else
entry = './src/' + name + '.js';
entry = './src/' + name + '.js';

// get component name in came case "cocreate" less
let componentName = toCamelCase(name);
Expand Down
4 changes: 2 additions & 2 deletions src/commands/other/nginxConfigManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async function deleteServer(hosts) {
return response
}

// createServer(['cocreate.app', 'cocreate.ai'])
// deleteServer(['cocreate.com'])
// createServer(['cocreate.app'])
// deleteServer(['cocreate.app'])

module.exports = {createServer, deleteServer}

0 comments on commit aafd70d

Please sign in to comment.