Skip to content

Commit e69825c

Browse files
mittalyashuKaKi87
andauthored
NodeGit + SQLite (#3585)
* Initialize Git repository (nodegit) (#3509) * Install NodeGit package * Fix nodegit package installation (#3512) * Change node_version to 10.16.0 * Define node & electron engines in package.json * FIX: Add comma after node version engine * Switch back to latest version of Node@10 * Split script command yarn and yarn build:window * Update "postinstall" script command to install electron app deps * Install electron app native deps * Merge yarn && yarn postinstall && yarn build:linux command * Test windows pipeline with npm * Upgrade nodegit & electron-builder package * Run pipeline in npm * Run audit fix * Run install && audit fix * install & audit fix & postinstall & build:window * Update build description * Move yarn to npm * Update echo command * Remove electron from engines * Update npm registry url * Initialize repo using nodegit * Use promise instead of async * git status (nodegit) * fix: switchRepository mutation to toggle modal * Remove remote refs & validate git repository Remove function for getting remote url on adding repository and only validate git repository. * Add getBranchName function using nodegit * Add source column to db table Source column tells the source of repository (local or remote repo) * git status and get file status type Getting repository git status along with each file type, symbol, and color. * Query repository data on route (enter & update) * Clear repositoryData on routeLeave * Update projectId to repositoryId (route params) * Add repositoryData state, getters, and mutation * Show branch name and working changes * Move to next page after database data * Show staged files in workspace * Query repository & repositorySettings features data * Remove refs from workspace * Move to status-list component Remove fileChangesSkeleton and use status-list component * Create status item component * Remove branchName parmas from workspace route * Pass branchName as props to commit-message * NodeGit + SQLite migration : implement clone feature (#3589) * Use nodegit * Use database * Add cloning progress * Run ESLint * Remove workspace vuex store * Emit stagedFile to statusList component Storing all the statusList component inside stagedFile local data property. * Change projectId to repositoryId Repository ID is unique ID assigned to each repository from SQLite database. * Show repo path in switch repo modal * Set default branchName to "master" * Remove getFeatureValue computed property * Get repository data using mixin Using repositoryData.js as mixin to get data from repository.js vuex store as repositoryData computed property. * Git remote functions Add these 3 remote functions * getRemoteListNames * getRemoteUrl * addRemoteUrl * Remove branchName as route props * Query remoteUrl from db Fetch remote url from database on entering repository route * Save remote url to db on adding repository * Update add remote url with nodegit * store filePreview value locally data property filePreview is a local data property stored in `workspace.vue` to toggle view for diff preview component with blankSlate component * adjust workspace files width * Remove file diff preview method * refactor: remove unused code * Remove spacingProps, import repositoryData * Update repositoryData computed property data * Update to repositoryId & remove branchName params * Remove event.preventDefault() * Remove repositoryDataMixin import from settings.vue * Update remoteUrl on saveSettings method Update remoteUrl to database on running the saveSettings() method * Git fetch functions * pullRemoteBranch function * Add gitFetch method to navbar * Update directoryPath arguments (openTerminal & openFileExplorer) * Update gitPull method with nodegit * Remove branchName as route params * Update repositoryData import * Toggle commit-message component in workspace view * Query repositoryName on enter repository route * Change Git module to Clone in clone.js * Remove console statement * Format the code * Update openCmdTerminal() method * Initialize repository (nodegit) (#3592) * Use nodegit and database instead of simple-git for initialize repository feature * Disable git features for non-initialized repositories * Add initialize repository feature from homepage This commit includes an anti-pattern because of mutating this.isGit prop inside component but this can't be avoided without making some major changes. * Settings to auto initialize non-git repository (#3596) * Get & set settings to localStorage Using if/else statement in beforeCreate lifecycle hook insted of using in vuex store mutation * Add AutoInit settings to experimental page * typo: initialize spellings * Dispatch update to settings store (in single line) * fix: autoInit undefined value in settings store #3596 (comment) * Remove console.log statement in setSettings * Fix PR #3598 : Auto init non-git repository (part 2) (#3599) * auto initialize non-git repository * Update repositoryItem.vue after `npm run lint:fix` * Do not initialize new repository on create * Fix blocking error on new repository creation when folder does not exist Co-authored-by: Yashu Mittal <[email protected]> * addRepositoryToDatabase based closing modal Incase error event a message can be shown inside the modal. Reference: #3599 (comment) * update isGit value in repository store Creating a updateIsGitStatus mutation to update isGit value inside repository vuex store. Database is updated with the required changes with vuex is unaware of the changes which causes is bug to show repository as `isGit: false`. Reference: #3599 (comment) * Update .electron-vue files replace package-lock.json with yarn.lock * change node engine v14 * ci: run pipeline with node v14 & v16 * ci: change npm to yarn * set node engine v14 or v16 * ci: yarn postinstall deps Co-authored-by: KaKi87 <[email protected]>
1 parent 543e910 commit e69825c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3498
-2871
lines changed

.electron-vue/build.js

Lines changed: 95 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,100 @@
1-
"use strict"
1+
"use strict";
22

3-
process.env.NODE_ENV = "production"
3+
process.env.NODE_ENV = "production";
44

5-
const { say } = require("cfonts")
6-
const chalk = require("chalk")
7-
const del = require("del")
8-
const { spawn } = require("child_process")
9-
const webpack = require("webpack")
10-
const Multispinner = require("multispinner")
5+
const { say } = require("cfonts");
6+
const chalk = require("chalk");
7+
const del = require("del");
8+
const { spawn } = require("child_process");
9+
const webpack = require("webpack");
10+
const Listr = require("listr");
1111

12-
const mainConfig = require("./webpack.main.config")
13-
const rendererConfig = require("./webpack.renderer.config")
14-
const webConfig = require("./webpack.web.config")
12+
const mainConfig = require("./webpack.main.config");
13+
const rendererConfig = require("./webpack.renderer.config");
14+
const webConfig = require("./webpack.web.config");
1515

16-
const doneLog = chalk.bgGreen.white(" DONE ") + " "
17-
const errorLog = chalk.bgRed.white(" ERROR ") + " "
18-
const okayLog = chalk.bgBlue.white(" OKAY ") + " "
19-
const isCI = process.env.CI || false
16+
const doneLog = chalk.bgGreen.white(" DONE ") + " ";
17+
const errorLog = chalk.bgRed.white(" ERROR ") + " ";
18+
const okayLog = chalk.bgBlue.white(" OKAY ") + " ";
19+
const isCI = process.env.CI || false;
2020

21-
if (process.env.BUILD_TARGET === "clean") clean()
22-
else if (process.env.BUILD_TARGET === "web") web()
23-
else build()
21+
if (process.env.BUILD_TARGET === "clean") clean();
22+
else if (process.env.BUILD_TARGET === "web") web();
23+
else build();
2424

2525
function clean() {
26-
del.sync(["build/*", "!build/icons", "!build/icons/icon.*"])
27-
console.log(`\n${doneLog}\n`)
28-
process.exit()
26+
del.sync(["build/*", "!build/icons", "!build/icons/icon.*"]);
27+
console.log(`\n${doneLog}\n`);
28+
process.exit();
2929
}
3030

31-
function build() {
32-
greeting()
31+
async function build() {
32+
greeting();
3333

34-
del.sync(["dist/electron/*", "!.gitkeep"])
34+
del.sync(["dist/electron/*", "!.gitkeep"]);
3535

36-
const tasks = ["main", "renderer"]
36+
const tasks = ["main", "renderer"];
3737
const m = new Multispinner(tasks, {
3838
preText: "building",
3939
postText: "process"
40-
})
41-
42-
let results = ""
43-
44-
m.on("success", () => {
45-
process.stdout.write("\x1B[2J\x1B[0f")
46-
console.log(`\n\n${results}`)
47-
console.log(
48-
`${okayLog}take it away ${chalk.yellow("`electron-builder`")}\n`
49-
)
50-
process.exit()
51-
})
52-
53-
pack(mainConfig)
54-
.then(result => {
55-
results += result + "\n\n"
56-
m.success("main")
57-
})
58-
.catch(err => {
59-
m.error("main")
60-
console.log(`\n ${errorLog}failed to build main process`)
61-
console.error(`\n${err}\n`)
62-
process.exit(1)
63-
})
64-
65-
pack(rendererConfig)
66-
.then(result => {
67-
results += result + "\n\n"
68-
m.success("renderer")
40+
});
41+
42+
let results = "";
43+
44+
const tasks = new Listr(
45+
[
46+
{
47+
title: "building master process",
48+
task: async () => {
49+
await pack(mainConfig)
50+
.then(result => {
51+
results += result + "\n\n";
52+
})
53+
.catch(err => {
54+
console.log(`\n ${errorLog}failed to build main process`);
55+
console.error(`\n${err}\n`);
56+
});
57+
}
58+
},
59+
{
60+
title: "building renderer process",
61+
task: async () => {
62+
await pack(rendererConfig)
63+
.then(result => {
64+
results += result + "\n\n";
65+
})
66+
.catch(err => {
67+
console.log(`\n ${errorLog}failed to build renderer process`);
68+
console.error(`\n${err}\n`);
69+
});
70+
}
71+
}
72+
],
73+
{ concurrent: 2 }
74+
);
75+
76+
await tasks
77+
.run()
78+
.then(() => {
79+
process.stdout.write("\x1B[2J\x1B[0f");
80+
console.log(`\n\n${results}`);
81+
console.log(
82+
`${okayLog}take it away ${chalk.yellow("`electron-builder`")}\n`
83+
);
84+
process.exit();
6985
})
7086
.catch(err => {
71-
m.error("renderer")
72-
console.log(`\n ${errorLog}failed to build renderer process`)
73-
console.error(`\n${err}\n`)
74-
process.exit(1)
75-
})
87+
process.exit(1);
88+
});
7689
}
7790

7891
function pack(config) {
7992
return new Promise((resolve, reject) => {
80-
config.mode = "production"
93+
config.mode = "production";
8194
webpack(config, (err, stats) => {
82-
if (err) reject(err.stack || err)
95+
if (err) reject(err.stack || err);
8396
else if (stats.hasErrors()) {
84-
let err = ""
97+
let err = "";
8598

8699
stats
87100
.toString({
@@ -90,53 +103,53 @@ function pack(config) {
90103
})
91104
.split(/\r?\n/)
92105
.forEach(line => {
93-
err += ` ${line}\n`
94-
})
106+
err += ` ${line}\n`;
107+
});
95108

96-
reject(err)
109+
reject(err);
97110
} else {
98111
resolve(
99112
stats.toString({
100113
chunks: false,
101114
colors: true
102115
})
103-
)
116+
);
104117
}
105-
})
106-
})
118+
});
119+
});
107120
}
108121

109122
function web() {
110-
del.sync(["dist/web/*", "!.gitkeep"])
111-
webConfig.mode = "production"
123+
del.sync(["dist/web/*", "!.gitkeep"]);
124+
webConfig.mode = "production";
112125
webpack(webConfig, (err, stats) => {
113-
if (err || stats.hasErrors()) console.log(err)
126+
if (err || stats.hasErrors()) console.log(err);
114127

115128
console.log(
116129
stats.toString({
117130
chunks: false,
118131
colors: true
119132
})
120-
)
133+
);
121134

122-
process.exit()
123-
})
135+
process.exit();
136+
});
124137
}
125138

126139
function greeting() {
127-
const cols = process.stdout.columns
128-
let text = ""
140+
const cols = process.stdout.columns;
141+
let text = "";
129142

130-
if (cols > 85) text = "lets-build"
131-
else if (cols > 60) text = "lets-|build"
132-
else text = false
143+
if (cols > 85) text = "lets-build";
144+
else if (cols > 60) text = "lets-|build";
145+
else text = false;
133146

134147
if (text && !isCI) {
135148
say(text, {
136149
colors: ["yellow"],
137150
font: "simple3d",
138151
space: false
139-
})
140-
} else console.log(chalk.yellow.bold("\n lets-build"))
141-
console.log()
152+
});
153+
} else console.log(chalk.yellow.bold("\n lets-build"));
154+
console.log();
142155
}

.electron-vue/dev-client.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const hotClient = require("webpack-hot-middleware/client?noInfo=true&reload=true")
1+
const hotClient = require("webpack-hot-middleware/client?noInfo=true&reload=true");
22

33
hotClient.subscribe(event => {
44
/**
@@ -35,6 +35,6 @@ hotClient.subscribe(event => {
3535
<div id="dev-client">
3636
Compiling Main Process...
3737
</div>
38-
`
38+
`;
3939
}
40-
})
40+
});

0 commit comments

Comments
 (0)