* add Patch CSP option * show style version, size, and update age in manager * add scope selector to style search in manager * keep scroll position and selections in tab's session * directly install usercss from raw github links * ditch localStorage, use on-demand SessionStore proxy * simplify localization * allow <code> tag in i18n-html * keep   nodes in HTML templates * API.getAllStyles is actually faster with code untouched * fix fitToContent when applies-to is taller than window * dedupe linter.enableForEditor calls * prioritize visible CMs in refreshOnViewListener * don't scroll to last style on editing a new one * delay colorview for invisible CMs * eslint comma-dangle error + autofix files * styleViaXhr: also toggle for disableAll pref * styleViaXhr: allow cookies for sandbox CSP * simplify notes in options * simplify getStylesViaXhr * oldUI fixups: * remove separator before 1st applies-to * center name bubbles * fix updateToc focus on a newly added section * fix fitToContent when cloning section * remove CSS `contain` as it makes no difference * replace overrides with declarative CSS + code cosmetics * simplify adjustWidth and make it work in FF
		
			
				
	
	
		
			69 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			69 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| #!/usr/bin/env node
 | |
| 'use strict';
 | |
| 
 | |
| const fs = require('fs');
 | |
| const archiver = require('archiver');
 | |
| const manifest = require('../manifest.json');
 | |
| 
 | |
| function createZip({isFirefox} = {}) {
 | |
|   const fileName = `stylus${isFirefox ? '-firefox' : ''}.zip`;
 | |
|   const ignore = [
 | |
|     '.*', // dot files/folders (glob, not regexp)
 | |
|     'vendor/codemirror/lib/**', // get unmodified copy from node_modules
 | |
|     'node_modules/**',
 | |
|     'tools/**',
 | |
|     'package.json',
 | |
|     'package-lock.json',
 | |
|     'yarn.lock',
 | |
|     '*.zip',
 | |
|     '*.map',
 | |
|   ];
 | |
| 
 | |
|   const file = fs.createWriteStream(fileName);
 | |
|   const archive = archiver('zip');
 | |
|   return new Promise((resolve, reject) => {
 | |
|     archive.on('finish', () => {
 | |
|       resolve();
 | |
|     });
 | |
|     archive.on('warning', err => {
 | |
|       if (err.code === 'ENOENT') {
 | |
|         console.log('\x1b[33m%s\x1b[0m', 'Warning', err.message);
 | |
|       } else {
 | |
|         reject();
 | |
|         throw err;
 | |
|       }
 | |
|     });
 | |
|     archive.on('error', err => {
 | |
|       reject();
 | |
|       throw err;
 | |
|     });
 | |
| 
 | |
|     archive.pipe(file);
 | |
|     if (isFirefox) {
 | |
|       const name = 'manifest.json';
 | |
|       const keyOpt = 'optional_permissions';
 | |
|       ignore.unshift(name);
 | |
|       manifest[keyOpt] = manifest[keyOpt].filter(p => p !== 'declarativeContent');
 | |
|       if (!manifest[keyOpt].length) {
 | |
|         delete manifest[keyOpt];
 | |
|       }
 | |
|       archive.append(JSON.stringify(manifest, null, '  '), {name, stats: fs.lstatSync(name)});
 | |
|     }
 | |
|     archive.glob('**', {ignore});
 | |
|     // Don't use modified codemirror.js (see "update-libraries.js")
 | |
|     archive.directory('node_modules/codemirror/lib', 'vendor/codemirror/lib');
 | |
|     archive.finalize();
 | |
|   });
 | |
| }
 | |
| 
 | |
| (async () => {
 | |
|   try {
 | |
|     await createZip();
 | |
|     await createZip({isFirefox: true});
 | |
|     console.log('\x1b[32m%s\x1b[0m', 'Stylus zip complete');
 | |
|   } catch (err) {
 | |
|     console.error(err);
 | |
|     process.exit(1);
 | |
|   }
 | |
| })();
 |