@str-public/installer 0.3.0 → 0.4.0
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/dist/cli.js +42 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -48,7 +48,8 @@ async function main() {
|
|
|
48
48
|
message: 'What would you like to install?',
|
|
49
49
|
options: [
|
|
50
50
|
{ value: 'theme-switcher', label: 'Theme Switcher', hint: 'Quiet Light / Monokai Dimmed' },
|
|
51
|
-
{ value: 'basic-cursor-settings', label: 'Basic Cursor Settings', hint: 'Workspace folders and AI agent rules' }
|
|
51
|
+
{ value: 'basic-cursor-settings', label: 'Basic Cursor Settings', hint: 'Workspace folders and AI agent rules' },
|
|
52
|
+
{ value: 'development-standards', label: 'Development Standards', hint: 'TypeScript & Next.js strict rules (.mdc)' }
|
|
52
53
|
],
|
|
53
54
|
required: true
|
|
54
55
|
});
|
|
@@ -171,6 +172,46 @@ async function main() {
|
|
|
171
172
|
}
|
|
172
173
|
}
|
|
173
174
|
}
|
|
175
|
+
if (selectedTools.includes('development-standards')) {
|
|
176
|
+
s.message('Installing Development Standards...');
|
|
177
|
+
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'str-installer-dev-standards-'));
|
|
178
|
+
try {
|
|
179
|
+
execSync(`npm pack @str-public/development-standards@${tag} --pack-destination "${tmpDir}"`, { stdio: 'ignore' });
|
|
180
|
+
const tgzFile = fs.readdirSync(tmpDir).find(f => f.endsWith('.tgz'));
|
|
181
|
+
if (!tgzFile)
|
|
182
|
+
throw new Error('Failed to download development-standards package.');
|
|
183
|
+
execSync(`tar -xzf ${tgzFile}`, { cwd: tmpDir, stdio: 'ignore' });
|
|
184
|
+
const targetDir = process.cwd();
|
|
185
|
+
const rulesDir = path.join(targetDir, '.cursor', 'rules');
|
|
186
|
+
if (!fs.existsSync(rulesDir)) {
|
|
187
|
+
fs.mkdirSync(rulesDir, { recursive: true });
|
|
188
|
+
}
|
|
189
|
+
const sourceRulePath = path.join(tmpDir, 'package', 'templates', 'development-standards.mdc');
|
|
190
|
+
const targetRulePath = path.join(rulesDir, 'development-standards.mdc');
|
|
191
|
+
if (fs.existsSync(sourceRulePath)) {
|
|
192
|
+
if (fs.existsSync(targetRulePath)) {
|
|
193
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
194
|
+
const backupPath = path.join(rulesDir, `development-standards.${timestamp}.backup.mdc`);
|
|
195
|
+
fs.renameSync(targetRulePath, backupPath);
|
|
196
|
+
}
|
|
197
|
+
fs.copyFileSync(sourceRulePath, targetRulePath);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
throw new Error('development-standards.mdc template not found in the downloaded package.');
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
catch (e) {
|
|
204
|
+
throw new Error(`Development Standards installation failed: ${e.message || String(e)}`);
|
|
205
|
+
}
|
|
206
|
+
finally {
|
|
207
|
+
try {
|
|
208
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
209
|
+
}
|
|
210
|
+
catch (e) {
|
|
211
|
+
// Ignore cleanup errors
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
174
215
|
s.stop('Installation complete!');
|
|
175
216
|
outro(pc.green('✔ All selected tools have been installed successfully. Please restart your IDE(s).'));
|
|
176
217
|
}
|