Skip to content

Commit

Permalink
chore: different formatting for function declaration and execution
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushmanchhabra committed Apr 7, 2024
1 parent 0fcf2ff commit e3bbece
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
let originalManifestIndentation = 2;
let originalManifestEOL = '\n';

async function fileExists(file) {
async function fileExists (file) {
let exists = true;
try {
await fs.promises.stat(file);
Expand All @@ -22,7 +22,7 @@ async function fileExists(file) {
return exists;
}

function getVersions() {
function getVersions () {
return new Promise((resolve, reject) => {
const request = https.get('https://nwjs.io/versions.json', (response) => {
response.setEncoding('utf8');
Expand All @@ -48,7 +48,7 @@ function getVersions() {
});
}

function getLocalNwManifestPath() {
function getLocalNwManifestPath () {
return new Promise(async (resolve, reject) => {
const nwManifestRelativeToCwd = path.resolve(process.cwd(), 'node_modules', 'nw', 'package.json');
const nwManifestRelativeToHere = path.resolve(__dirname, '..', 'nw', 'package.json');
Expand All @@ -64,7 +64,7 @@ function getLocalNwManifestPath() {
});
}

function getLocalNwManifest() {
function getLocalNwManifest () {
return new Promise(async (resolve, reject) => {
try {
const nwManifest = await getLocalNwManifestPath();
Expand All @@ -77,7 +77,7 @@ function getLocalNwManifest() {
});
}

function getLocalNWVersion() {
function getLocalNWVersion () {
return new Promise(async (resolve, reject) => {
const nwManifest = await getLocalNwManifest();
let localNwVersion = nwManifest?.version || '';
Expand All @@ -95,7 +95,7 @@ function getLocalNWVersion() {
});
}

function getCorrectNodeVersion() {
function getCorrectNodeVersion () {
return new Promise(async (resolve, reject) => {
try {
const localNwVersion = await getLocalNWVersion();
Expand All @@ -120,7 +120,7 @@ function getCorrectNodeVersion() {
});
}

function determineOriginalManifestIndentation(data) {
function determineOriginalManifestIndentation (data) {
data = data.trim();
data = data.replaceAll('\r\n', '\n');

Expand All @@ -142,15 +142,15 @@ function determineOriginalManifestIndentation(data) {
}
}

function determinOriginalEOL(data) {
function determinOriginalEOL (data) {
if (data.includes('\r\n')) {
originalManifestEOL = '\r\n';
} else {
originalManifestEOL = '\n';
}
}

function getManifestPath() {
function getManifestPath () {
return new Promise(async (resolve, reject) => {
const manifestRelativeToCwd = path.resolve(process.cwd(), 'package.json');
const manifestRelativeToHere = path.resolve(__dirname, '..', '..', 'package.json');
Expand All @@ -166,7 +166,7 @@ function getManifestPath() {
});
}

function getManifest() {
function getManifest () {
return new Promise(async (resolve, reject) => {
try {
const manifest = await getManifestPath();
Expand All @@ -181,7 +181,7 @@ function getManifest() {
});
}

function getManifestWithUpdatedVoltaObject() {
function getManifestWithUpdatedVoltaObject () {
return new Promise(async (resolve, reject) => {
try {
const manifest = await getManifest();
Expand All @@ -195,7 +195,7 @@ function getManifestWithUpdatedVoltaObject() {
});
}

async function run() {
async function run () {
try {
const manifestPath = await getManifestPath();

Expand Down

0 comments on commit e3bbece

Please sign in to comment.