@ovipakla/gm-cli 1.0.3 → 1.0.4

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.
Files changed (2) hide show
  1. package/app.js +6 -3
  2. package/package.json +1 -1
package/app.js CHANGED
@@ -78,9 +78,11 @@ program.command('sync')
78
78
  program.command('install')
79
79
  .description('Install dependencies listed in package-gm.json to gm_modules folder')
80
80
  .option('-c, --clean', 'remove existing gm_modules')
81
+ .option('-s, --shallow', 'git clone will use depth=1 branch=REVISION')
81
82
  .action(function() {
82
83
  const options = this.opts();
83
84
  const clean = options.clean !== undefined;
85
+ const shallow = options.shallow !== undefined;
84
86
  const packageJsonPath = 'package-gm.json';
85
87
  const modulesDir = 'gm_modules';
86
88
 
@@ -96,23 +98,24 @@ program.command('install')
96
98
  Object.entries(dependencies).forEach(([key, dependency]) => {
97
99
  console.log(`\nšŸ“¦ļø Install ${key}\n===========${"=".repeat(key.length)}`)
98
100
  const modulePath = path.join(modulesDir, key);
101
+ const cloneOptions = shallow ? `--depth 1 --branch ${dependency.revision}` : ''
99
102
  if (fs.existsSync(modulePath)) {
100
103
  try {
101
104
  execSync('git rev-parse --is-inside-work-tree', { cwd: modulePath, stdio: 'ignore' });
102
105
  console.log(`🌐 Syncing ${modulePath} to revision ${dependency.revision}`);
103
106
  execSync('git reset --hard HEAD', { cwd: modulePath, stdio: 'inherit' });
104
- execSync('git clean -fdx -e', { cwd: modulePath, stdio: 'inherit' });
107
+ execSync('git clean -fdx', { cwd: modulePath, stdio: 'inherit' });
105
108
  execSync(`git checkout ${dependency.revision}`, { cwd: modulePath, stdio: 'inherit' });
106
109
  } catch (error) {
107
110
  console.log(`šŸ—‘ļø Removing ${modulePath} because it's not a git repository`);
108
111
  fs.rmSync(modulePath, { recursive: true, force: true });
109
112
  console.log(`šŸ”§ Initializing ${modulePath} to revision ${dependency.revision}`);
110
- execSync(`git clone ${dependency.remote} ${modulePath}`, { stdio: 'inherit' });
113
+ execSync(`git clone ${cloneOptions} ${dependency.remote} ${modulePath}`, { stdio: 'inherit' });
111
114
  execSync(`git checkout ${dependency.revision}`, { cwd: modulePath, stdio: 'inherit' });
112
115
  }
113
116
  } else {
114
117
  console.log(`šŸ”§ Initializing ${modulePath} to revision ${dependency.revision}`);
115
- execSync(`git clone ${dependency.remote} ${modulePath}`, { stdio: 'inherit' });
118
+ execSync(`git clone ${cloneOptions} ${dependency.remote} ${modulePath}`, { stdio: 'inherit' });
116
119
  execSync(`git checkout ${dependency.revision}`, { cwd: modulePath, stdio: 'inherit' });
117
120
  }
118
121
  });
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.0.3",
6
+ "version": "1.0.4",
7
7
  "description": "Gamemaker CLI toolkit. Watch & sync gml sources with yyp project.",
8
8
  "main": "app.js",
9
9
  "scripts": {},