@ovipakla/gm-cli 1.0.2 → 1.0.3

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.
package/GMFileWatcher.js CHANGED
@@ -28,7 +28,7 @@ class GMModule {
28
28
  watcher: chokidar.watch(entry.dir, hook)
29
29
  }));
30
30
 
31
- console.log(`♻️ Watching [${dir}] for changes...`);
31
+ console.log(`🔍️ Watching [${dir}] for changes...`);
32
32
  }
33
33
 
34
34
  createWatcher(subdir, hook) {
@@ -299,7 +299,7 @@ class GMFileWatcher {
299
299
  const existing = fs.readFileSync(dst, 'utf8');
300
300
  if (existing !== script.content) {
301
301
  const result = removeZeroFields(diffStats(existing.split('\n'), script.content.split('\n')))
302
- console.log(`➡️ Save ${script.name}.${extension}:`, result);
302
+ console.log(`📝 Save ${script.name}.${extension}:`, result);
303
303
  fs.writeFileSync(dst, script.content, { encoding: 'utf8', flag: 'w' });
304
304
  }
305
305
 
package/app.js CHANGED
@@ -77,40 +77,47 @@ program.command('sync')
77
77
  });
78
78
  program.command('install')
79
79
  .description('Install dependencies listed in package-gm.json to gm_modules folder')
80
+ .option('-c, --clean', 'remove existing gm_modules')
80
81
  .action(function() {
82
+ const options = this.opts();
83
+ const clean = options.clean !== undefined;
81
84
  const packageJsonPath = 'package-gm.json';
82
85
  const modulesDir = 'gm_modules';
83
86
 
84
87
  if (!fs.existsSync(modulesDir)) {
85
88
  fs.mkdirSync(modulesDir);
89
+ } else if (clean) {
90
+ fs.rmdirSync(modulesDir, { recursive: true });
91
+ fs.mkdirSync(modulesDir);
86
92
  }
87
93
 
88
94
  const packageData = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
89
95
  const dependencies = packageData.dependencies;
90
96
  Object.entries(dependencies).forEach(([key, dependency]) => {
97
+ console.log(`\n📦️ Install ${key}\n===========${"=".repeat(key.length)}`)
91
98
  const modulePath = path.join(modulesDir, key);
92
99
  if (fs.existsSync(modulePath)) {
93
100
  try {
94
101
  execSync('git rev-parse --is-inside-work-tree', { cwd: modulePath, stdio: 'ignore' });
95
- console.log(`Syncing ${modulePath} to revision ${dependency.revision}`);
102
+ console.log(`🌐 Syncing ${modulePath} to revision ${dependency.revision}`);
96
103
  execSync('git reset --hard HEAD', { cwd: modulePath, stdio: 'inherit' });
97
104
  execSync('git clean -fdx -e', { cwd: modulePath, stdio: 'inherit' });
98
105
  execSync(`git checkout ${dependency.revision}`, { cwd: modulePath, stdio: 'inherit' });
99
106
  } catch (error) {
100
- console.log(`Removing ${modulePath} because it's not a git repository`);
107
+ console.log(`🗑️ Removing ${modulePath} because it's not a git repository`);
101
108
  fs.rmSync(modulePath, { recursive: true, force: true });
102
- console.log(`Initializing ${modulePath} to revision ${dependency.revision}`);
109
+ console.log(`🔧 Initializing ${modulePath} to revision ${dependency.revision}`);
103
110
  execSync(`git clone ${dependency.remote} ${modulePath}`, { stdio: 'inherit' });
104
111
  execSync(`git checkout ${dependency.revision}`, { cwd: modulePath, stdio: 'inherit' });
105
112
  }
106
113
  } else {
107
- console.log(`Initializing ${modulePath} to revision ${dependency.revision}`);
114
+ console.log(`🔧 Initializing ${modulePath} to revision ${dependency.revision}`);
108
115
  execSync(`git clone ${dependency.remote} ${modulePath}`, { stdio: 'inherit' });
109
116
  execSync(`git checkout ${dependency.revision}`, { cwd: modulePath, stdio: 'inherit' });
110
117
  }
111
118
  });
112
119
 
113
- console.log('All dependencies processed.');
120
+ console.log('\n\n✅ All dependencies processed.');
114
121
  process.exit(0);
115
122
  })
116
123
  program.command('run')
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.0.2",
6
+ "version": "1.0.3",
7
7
  "description": "Gamemaker CLI toolkit. Watch & sync gml sources with yyp project.",
8
8
  "main": "app.js",
9
9
  "scripts": {},