cloud-ide-cide 2.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,40 @@
1
+ const { execSync } = require('child_process');
2
+ const { readFileSync } = require('fs');
3
+
4
+ async function watchLinkProject() {
5
+ const cide = JSON.parse(readFileSync('./cide.json', { encoding: 'utf8' }));
6
+ // check if cide.json is present or not
7
+ if (cide) {
8
+ // ckeck if templete is react or node or angular
9
+ if (cide?.template === 'angular') {
10
+ // lets check if cide?.build_path is present or not in cide.json
11
+ console.log('Detected an Angular project. Watching for changes and linking the project...');
12
+ try {
13
+ console.log('Starting the Angular project...', process?.argv);
14
+ execSync(`npm run watch ${process?.argv?.[4]}`, { stdio: 'inherit' }, (error, stdout, stderr) => {
15
+ console.log('Starting the Angular project...');
16
+ if (error) {
17
+ console.error('Error starting project:', error);
18
+ }
19
+
20
+ if (stdout) {
21
+ console.log("done");
22
+ }
23
+
24
+ if (stderr) {
25
+ console.log("done 2");
26
+ }
27
+ });
28
+ } catch (error) {
29
+ console.error('An error occurred while watching and building the Angular project:', error?.message);
30
+ }
31
+ } else {
32
+ console.warn('template is not found, please use template to watch and link the project');
33
+ }
34
+ } else {
35
+ console.warn('cide.json file is missing, please create it and try again');
36
+ }
37
+
38
+ }
39
+
40
+ module.exports = watchLinkProject;