chore(extension): apply code formatting and add changeset
- Format all extension files according to project standards - Add changeset for VS Code extension implementation - Update package-lock.json dependencies
This commit is contained in:
@@ -11,84 +11,102 @@ const packageDir = path.resolve(__dirname, 'vsix-build');
|
||||
// --- End Configuration ---
|
||||
|
||||
try {
|
||||
console.log('🚀 Starting packaging process...');
|
||||
console.log('🚀 Starting packaging process...');
|
||||
|
||||
// 1. Build Project
|
||||
console.log('\nBuilding JavaScript...');
|
||||
execSync('pnpm run build:js', { stdio: 'inherit' });
|
||||
console.log('\nBuilding CSS...');
|
||||
execSync('pnpm run build:css', { stdio: 'inherit' });
|
||||
// 1. Build Project
|
||||
console.log('\nBuilding JavaScript...');
|
||||
execSync('pnpm run build:js', { stdio: 'inherit' });
|
||||
console.log('\nBuilding CSS...');
|
||||
execSync('pnpm run build:css', { stdio: 'inherit' });
|
||||
|
||||
// 2. Prepare Clean Directory
|
||||
console.log(`\nPreparing clean directory at: ${packageDir}`);
|
||||
fs.emptyDirSync(packageDir);
|
||||
// 2. Prepare Clean Directory
|
||||
console.log(`\nPreparing clean directory at: ${packageDir}`);
|
||||
fs.emptyDirSync(packageDir);
|
||||
|
||||
// 3. Copy Build Artifacts (excluding source maps)
|
||||
console.log('Copying build artifacts...');
|
||||
const distDir = path.resolve(__dirname, 'dist');
|
||||
const targetDistDir = path.resolve(packageDir, 'dist');
|
||||
fs.ensureDirSync(targetDistDir);
|
||||
|
||||
// Only copy the files we need (exclude .map files)
|
||||
const filesToCopy = ['extension.js', 'index.js', 'index.css'];
|
||||
for (const file of filesToCopy) {
|
||||
const srcFile = path.resolve(distDir, file);
|
||||
const destFile = path.resolve(targetDistDir, file);
|
||||
if (fs.existsSync(srcFile)) {
|
||||
fs.copySync(srcFile, destFile);
|
||||
console.log(` - Copied dist/${file}`);
|
||||
}
|
||||
}
|
||||
// 3. Copy Build Artifacts (excluding source maps)
|
||||
console.log('Copying build artifacts...');
|
||||
const distDir = path.resolve(__dirname, 'dist');
|
||||
const targetDistDir = path.resolve(packageDir, 'dist');
|
||||
fs.ensureDirSync(targetDistDir);
|
||||
|
||||
// 4. Copy additional files
|
||||
const additionalFiles = ['README.md', 'CHANGELOG.md', 'AGENTS.md'];
|
||||
for (const file of additionalFiles) {
|
||||
if (fs.existsSync(path.resolve(__dirname, file))) {
|
||||
fs.copySync(path.resolve(__dirname, file), path.resolve(packageDir, file));
|
||||
console.log(` - Copied ${file}`);
|
||||
}
|
||||
}
|
||||
// Only copy the files we need (exclude .map files)
|
||||
const filesToCopy = ['extension.js', 'index.js', 'index.css'];
|
||||
for (const file of filesToCopy) {
|
||||
const srcFile = path.resolve(distDir, file);
|
||||
const destFile = path.resolve(targetDistDir, file);
|
||||
if (fs.existsSync(srcFile)) {
|
||||
fs.copySync(srcFile, destFile);
|
||||
console.log(` - Copied dist/${file}`);
|
||||
}
|
||||
}
|
||||
|
||||
// 5. Copy and RENAME the clean manifest
|
||||
console.log('Copying and preparing the final package.json...');
|
||||
fs.copySync(path.resolve(__dirname, 'package.publish.json'), path.resolve(packageDir, 'package.json'));
|
||||
console.log(' - Copied package.publish.json as package.json');
|
||||
// 4. Copy additional files
|
||||
const additionalFiles = ['README.md', 'CHANGELOG.md', 'AGENTS.md'];
|
||||
for (const file of additionalFiles) {
|
||||
if (fs.existsSync(path.resolve(__dirname, file))) {
|
||||
fs.copySync(
|
||||
path.resolve(__dirname, file),
|
||||
path.resolve(packageDir, file)
|
||||
);
|
||||
console.log(` - Copied ${file}`);
|
||||
}
|
||||
}
|
||||
|
||||
// 6. Copy .vscodeignore if it exists
|
||||
if (fs.existsSync(path.resolve(__dirname, '.vscodeignore'))) {
|
||||
fs.copySync(path.resolve(__dirname, '.vscodeignore'), path.resolve(packageDir, '.vscodeignore'));
|
||||
console.log(' - Copied .vscodeignore');
|
||||
}
|
||||
// 5. Copy and RENAME the clean manifest
|
||||
console.log('Copying and preparing the final package.json...');
|
||||
fs.copySync(
|
||||
path.resolve(__dirname, 'package.publish.json'),
|
||||
path.resolve(packageDir, 'package.json')
|
||||
);
|
||||
console.log(' - Copied package.publish.json as package.json');
|
||||
|
||||
// 7. Copy LICENSE if it exists
|
||||
if (fs.existsSync(path.resolve(__dirname, 'LICENSE'))) {
|
||||
fs.copySync(path.resolve(__dirname, 'LICENSE'), path.resolve(packageDir, 'LICENSE'));
|
||||
console.log(' - Copied LICENSE');
|
||||
}
|
||||
// 6. Copy .vscodeignore if it exists
|
||||
if (fs.existsSync(path.resolve(__dirname, '.vscodeignore'))) {
|
||||
fs.copySync(
|
||||
path.resolve(__dirname, '.vscodeignore'),
|
||||
path.resolve(packageDir, '.vscodeignore')
|
||||
);
|
||||
console.log(' - Copied .vscodeignore');
|
||||
}
|
||||
|
||||
// 7a. Copy assets directory if it exists
|
||||
const assetsDir = path.resolve(__dirname, 'assets');
|
||||
if (fs.existsSync(assetsDir)) {
|
||||
const targetAssetsDir = path.resolve(packageDir, 'assets');
|
||||
fs.copySync(assetsDir, targetAssetsDir);
|
||||
console.log(' - Copied assets directory');
|
||||
}
|
||||
// 7. Copy LICENSE if it exists
|
||||
if (fs.existsSync(path.resolve(__dirname, 'LICENSE'))) {
|
||||
fs.copySync(
|
||||
path.resolve(__dirname, 'LICENSE'),
|
||||
path.resolve(packageDir, 'LICENSE')
|
||||
);
|
||||
console.log(' - Copied LICENSE');
|
||||
}
|
||||
|
||||
// Small delay to ensure file system operations complete
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
// 7a. Copy assets directory if it exists
|
||||
const assetsDir = path.resolve(__dirname, 'assets');
|
||||
if (fs.existsSync(assetsDir)) {
|
||||
const targetAssetsDir = path.resolve(packageDir, 'assets');
|
||||
fs.copySync(assetsDir, targetAssetsDir);
|
||||
console.log(' - Copied assets directory');
|
||||
}
|
||||
|
||||
// 8. Final step - manual packaging
|
||||
console.log('\n✅ Build preparation complete!');
|
||||
console.log('\nTo create the VSIX package, run:');
|
||||
console.log('\x1b[36m%s\x1b[0m', `cd vsix-build && pnpm exec vsce package --no-dependencies`);
|
||||
// Small delay to ensure file system operations complete
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
|
||||
// Read version from package.publish.json
|
||||
const publishPackage = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'package.publish.json'), 'utf8'));
|
||||
const version = publishPackage.version;
|
||||
console.log(`\nYour extension will be packaged to: vsix-build/taskr-${version}.vsix`);
|
||||
// 8. Final step - manual packaging
|
||||
console.log('\n✅ Build preparation complete!');
|
||||
console.log('\nTo create the VSIX package, run:');
|
||||
console.log(
|
||||
'\x1b[36m%s\x1b[0m',
|
||||
`cd vsix-build && pnpm exec vsce package --no-dependencies`
|
||||
);
|
||||
|
||||
// Read version from package.publish.json
|
||||
const publishPackage = JSON.parse(
|
||||
fs.readFileSync(path.resolve(__dirname, 'package.publish.json'), 'utf8')
|
||||
);
|
||||
const version = publishPackage.version;
|
||||
console.log(
|
||||
`\nYour extension will be packaged to: vsix-build/taskr-${version}.vsix`
|
||||
);
|
||||
} catch (error) {
|
||||
console.error('\n❌ Packaging failed!');
|
||||
console.error(error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
console.error('\n❌ Packaging failed!');
|
||||
console.error(error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user