compile-less-cli
Advanced tools
Comparing version 1.8.9 to 1.8.10
@@ -10,1 +10,2 @@ import { IOutputFile } from './executeLess'; | ||
export declare function outputFile(data: IOutputFile, inputDir: string, outputDir: string): Promise<void>; | ||
export declare function log(output: string, input?: string): Promise<void>; |
@@ -1,32 +0,86 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.outputFile = void 0; | ||
var tslib_1 = require("tslib"); | ||
var path_1 = (0, tslib_1.__importDefault)(require("path")); | ||
var fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra")); | ||
var read_pkg_up_1 = (0, tslib_1.__importDefault)(require("read-pkg-up")); | ||
var getLessFiles_1 = require("./getLessFiles"); | ||
var executeLess_1 = require("./executeLess"); | ||
function compile(dir, option) { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
import path from 'path'; | ||
import fs from 'fs-extra'; | ||
import readPkgUp from 'read-pkg-up'; | ||
import { getLessFiles } from './getLessFiles'; | ||
import { executeLess } from './executeLess'; | ||
export default function compile(dir, option) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, excludeCss, rmGlobal, combine, out, otherOpts, inputDir, pkg, projectName, files, lessSource, outputCssFile, cssStr, outputDir_1, error_1; | ||
var _this = this; | ||
return (0, tslib_1.__generator)(this, function (_b) { | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = option || {}, excludeCss = _a.excludeCss, rmGlobal = _a.rmGlobal, combine = _a.combine, out = _a.out, otherOpts = (0, tslib_1.__rest)(_a, ["excludeCss", "rmGlobal", "combine", "out"]); | ||
inputDir = path_1.default.join(process.cwd(), dir); | ||
_a = option || {}, excludeCss = _a.excludeCss, rmGlobal = _a.rmGlobal, combine = _a.combine, out = _a.out, otherOpts = __rest(_a, ["excludeCss", "rmGlobal", "combine", "out"]); | ||
inputDir = path.join(process.cwd(), dir); | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 12, , 13]); | ||
return [4 /*yield*/, (0, read_pkg_up_1.default)()]; | ||
return [4 /*yield*/, readPkgUp()]; | ||
case 2: | ||
pkg = _b.sent(); | ||
projectName = pkg ? pkg === null || pkg === void 0 ? void 0 : pkg.packageJson.name : ''; | ||
return [4 /*yield*/, (0, getLessFiles_1.getLessFiles)(inputDir, excludeCss ? /\.(less)$/ : undefined)]; | ||
return [4 /*yield*/, getLessFiles(inputDir, excludeCss ? /\.(less)$/ : undefined)]; | ||
case 3: | ||
files = _b.sent(); | ||
return [4 /*yield*/, Promise.all(files.map(function (lessPath) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () { | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return [2 /*return*/, (0, executeLess_1.executeLess)(lessPath, (0, tslib_1.__assign)({ rmGlobal: rmGlobal }, otherOpts))]; | ||
return [4 /*yield*/, Promise.all(files.map(function (lessPath) { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, executeLess(lessPath, __assign({ rmGlobal: rmGlobal }, otherOpts))]; | ||
}); | ||
@@ -37,9 +91,9 @@ }); }))]; | ||
if (!combine) return [3 /*break*/, 9]; | ||
outputCssFile = path_1.default.join(process.cwd(), combine); | ||
outputCssFile = path.join(process.cwd(), combine); | ||
cssStr = lessSource.map(function (item) { return item.css; }); | ||
if (!!!cssStr.join('').trim()) return [3 /*break*/, 7]; | ||
return [4 /*yield*/, fs_extra_1.default.outputFile(outputCssFile, cssStr.join(''))]; | ||
return [4 /*yield*/, fs.outputFile(outputCssFile, cssStr.join(''))]; | ||
case 5: | ||
_b.sent(); | ||
return [4 /*yield*/, log(path_1.default.relative(process.cwd(), outputCssFile))]; | ||
return [4 /*yield*/, log(path.relative(process.cwd(), outputCssFile))]; | ||
case 6: | ||
@@ -49,9 +103,9 @@ _b.sent(); | ||
case 7: | ||
console.log("\uD83D\uDEA7 \u001B[35m" + projectName + "\u001B[0m =>\u001B[33m No content is output.\u001B[0m"); | ||
console.log("\uD83D\uDEA7 \u001B[35m".concat(projectName, "\u001B[0m =>\u001B[33m No content is output.\u001B[0m")); | ||
_b.label = 8; | ||
case 8: return [3 /*break*/, 11]; | ||
case 9: | ||
outputDir_1 = path_1.default.join(process.cwd(), out); | ||
return [4 /*yield*/, Promise.all(lessSource.map(function (item) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () { | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
outputDir_1 = path.join(process.cwd(), out); | ||
return [4 /*yield*/, Promise.all(lessSource.map(function (item) { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, outputFile(item, inputDir, outputDir_1)]; | ||
@@ -73,17 +127,16 @@ }); | ||
} | ||
exports.default = compile; | ||
function outputFile(data, inputDir, outputDir) { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
export function outputFile(data, inputDir, outputDir) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var logPathIn, logPathOut, error_2; | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 3, , 4]); | ||
logPathIn = path_1.default.relative(process.cwd(), data.path); | ||
logPathIn = path.relative(process.cwd(), data.path); | ||
data.path = data.path.replace(inputDir, outputDir).replace(/.less$/, '.css'); | ||
logPathOut = path_1.default.relative(process.cwd(), data.path); | ||
logPathOut = path.relative(process.cwd(), data.path); | ||
return [4 /*yield*/, log(logPathOut, logPathIn)]; | ||
case 1: | ||
_a.sent(); | ||
return [4 /*yield*/, fs_extra_1.default.outputFile(data.path, data.css)]; | ||
return [4 /*yield*/, fs.outputFile(data.path, data.css)]; | ||
case 2: | ||
@@ -103,9 +156,8 @@ _a.sent(); | ||
} | ||
exports.outputFile = outputFile; | ||
function log(output, input) { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
export function log(output, input) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var pkg, projectName; | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, (0, read_pkg_up_1.default)()]; | ||
case 0: return [4 /*yield*/, readPkgUp()]; | ||
case 1: | ||
@@ -115,6 +167,6 @@ pkg = _a.sent(); | ||
if (input) { | ||
console.log("\u267B\uFE0F \u001B[32m " + projectName + "\u001B[0m:", input, '┈>', output); | ||
console.log("\u267B\uFE0F \u001B[32m ".concat(projectName, "\u001B[0m: ").concat(input, " \u2508> ").concat(output)); | ||
} | ||
else { | ||
console.log("\u267B\uFE0F \u001B[32m " + projectName + "\u001B[0m:", 'Output one file: ┈>', output); | ||
console.log("\u267B\uFE0F \u001B[32m ".concat(projectName, "\u001B[0m: Output one file: \u2508> ").concat(output)); | ||
} | ||
@@ -121,0 +173,0 @@ return [2 /*return*/]; |
@@ -1,11 +0,29 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.executeLess = exports.execute = void 0; | ||
var tslib_1 = require("tslib"); | ||
var fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra")); | ||
var less_1 = (0, tslib_1.__importDefault)(require("less")); | ||
var child_process_1 = require("child_process"); | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
import fs from 'fs-extra'; | ||
import less from 'less'; | ||
import { spawn } from 'child_process'; | ||
// @ts-ignore | ||
var less_plugin_autoprefix_1 = (0, tslib_1.__importDefault)(require("less-plugin-autoprefix")); | ||
var autoprefixPlugin = new less_plugin_autoprefix_1.default({ | ||
import LessPluginAutoPrefix from 'less-plugin-autoprefix'; | ||
var autoprefixPlugin = new LessPluginAutoPrefix({ | ||
browsers: [ | ||
@@ -18,5 +36,5 @@ ">0.2%", | ||
}); | ||
function execute(command) { | ||
export function execute(command) { | ||
return new Promise(function (resolve, reject) { | ||
var subProcess = (0, child_process_1.spawn)('bash'); | ||
var subProcess = spawn('bash'); | ||
function onData(data) { | ||
@@ -26,3 +44,3 @@ process.stdout.write(data); | ||
subProcess.on('error', function (error) { | ||
reject(new Error("command failed: " + command + "; " + (error.message ? error.message : ''))); | ||
reject(new Error("command failed: ".concat(command, "; ").concat(error.message ? error.message : ''))); | ||
}); | ||
@@ -34,12 +52,11 @@ subProcess.stdout.on('data', onData); | ||
}); | ||
subProcess.stdin.write(command + " \n"); | ||
subProcess.stdin.write("".concat(command, " \n")); | ||
subProcess.stdin.end(); | ||
}); | ||
} | ||
exports.execute = execute; | ||
function executeLess(lessPath, options) { | ||
var lessStr = fs_extra_1.default.readFileSync(lessPath); | ||
var _a = options || {}, rmGlobal = _a.rmGlobal, other = (0, tslib_1.__rest)(_a, ["rmGlobal"]); | ||
export function executeLess(lessPath, options) { | ||
var lessStr = fs.readFileSync(lessPath); | ||
var _a = options || {}, rmGlobal = _a.rmGlobal, other = __rest(_a, ["rmGlobal"]); | ||
return new Promise(function (resolve, reject) { | ||
var options = (0, tslib_1.__assign)((0, tslib_1.__assign)({ depends: false, compress: false, lint: false, plugins: [autoprefixPlugin] }, other), { filename: lessPath }); | ||
var options = __assign(__assign({ depends: false, compress: false, lint: false, plugins: [autoprefixPlugin] }, other), { filename: lessPath }); | ||
var lessStrTo = lessStr.toString(); | ||
@@ -49,3 +66,3 @@ if (rmGlobal) { | ||
} | ||
less_1.default.render(lessStrTo, options).then(function (output) { | ||
less.render(lessStrTo, options).then(function (output) { | ||
if (rmGlobal) { | ||
@@ -55,3 +72,3 @@ output.css = output.css.replace(/:global\s+\{([\s\S]*?)(\s.+)?\}/g, '') | ||
} | ||
resolve((0, tslib_1.__assign)({ less: lessStr.toString(), path: lessPath }, output)); | ||
resolve(__assign({ less: lessStr.toString(), path: lessPath }, output)); | ||
}).catch(function (e) { | ||
@@ -62,2 +79,1 @@ reject(e); | ||
} | ||
exports.executeLess = executeLess; |
@@ -1,11 +0,7 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getLessFiles = void 0; | ||
var tslib_1 = require("tslib"); | ||
var directory_tree_1 = (0, tslib_1.__importDefault)(require("directory-tree")); | ||
function getLessFiles(folder, reg) { | ||
import dirTree from 'directory-tree'; | ||
export function getLessFiles(folder, reg) { | ||
if (reg === void 0) { reg = /\.(less|css)$/; } | ||
return new Promise(function (resolve, reject) { | ||
var lessPaths = []; | ||
(0, directory_tree_1.default)(folder, { | ||
dirTree(folder, { | ||
extensions: reg | ||
@@ -18,2 +14,1 @@ }, function (item) { | ||
} | ||
exports.getLessFiles = getLessFiles; |
#!/usr/bin/env node | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var minimist_1 = (0, tslib_1.__importDefault)(require("minimist")); | ||
var path_1 = (0, tslib_1.__importDefault)(require("path")); | ||
var chokidar_1 = (0, tslib_1.__importDefault)(require("chokidar")); | ||
var executeLess_1 = require("./executeLess"); | ||
var compile_1 = (0, tslib_1.__importStar)(require("./compile")); | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
import minimist from 'minimist'; | ||
import path from 'path'; | ||
import chokidar from 'chokidar'; | ||
import { executeLess } from './executeLess'; | ||
import compile, { outputFile } from './compile'; | ||
function outputHelp() { | ||
@@ -24,3 +57,3 @@ console.log('\n Usage: compile-less [options] [--help|h] [--version|v]'); | ||
} | ||
var argvs = (0, minimist_1.default)(process.argv.slice(2)); | ||
var argvs = minimist(process.argv.slice(2)); | ||
if (argvs.h || argvs.help) { | ||
@@ -32,3 +65,3 @@ outputHelp(); | ||
if (argvs.v || argvs.version) { | ||
console.log("\n compile-less v" + version + "\n"); | ||
console.log("\n compile-less v".concat(version, "\n")); | ||
process.exit(0); | ||
@@ -46,12 +79,12 @@ } | ||
; | ||
(function () { return (0, tslib_1.__awaiter)(void 0, void 0, void 0, function () { | ||
(function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var inputDir, error_1; | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 4, , 5]); | ||
inputDir = path_1.default.resolve(argvs.dir); | ||
inputDir = path.resolve(argvs.dir); | ||
if (!argvs.watch) return [3 /*break*/, 1]; | ||
chokidar_1.default.watch(inputDir).on('all', chokidarWatch).on('ready', function () { | ||
(0, compile_1.default)(argvs.dir, { | ||
chokidar.watch(inputDir).on('all', chokidarWatch).on('ready', function () { | ||
compile(argvs.dir, { | ||
out: argvs.out, | ||
@@ -64,3 +97,3 @@ combine: argvs.combine, | ||
return [3 /*break*/, 3]; | ||
case 1: return [4 /*yield*/, (0, compile_1.default)(argvs.dir, { | ||
case 1: return [4 /*yield*/, compile(argvs.dir, { | ||
out: argvs.out, | ||
@@ -76,3 +109,3 @@ combine: argvs.combine, | ||
error_1 = _a.sent(); | ||
console.log("\u001B[31m" + error_1.message + "\u001B[0m"); | ||
console.log("\u001B[31m".concat(error_1.message, "\u001B[0m")); | ||
console.log(error_1); | ||
@@ -97,5 +130,5 @@ process.exit(1); | ||
function chokidarWatch(eventName, changePath, stats) { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var reg, lessSource, error_2; | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
@@ -107,3 +140,3 @@ case 0: | ||
if (argvs.combine) { | ||
return [2 /*return*/, (0, compile_1.default)(argvs.dir, { | ||
return [2 /*return*/, compile(argvs.dir, { | ||
out: argvs.out, | ||
@@ -114,6 +147,6 @@ combine: argvs.combine, | ||
} | ||
return [4 /*yield*/, (0, executeLess_1.executeLess)(changePath, { rmGlobal: argvs['rm-global'] })]; | ||
return [4 /*yield*/, executeLess(changePath, { rmGlobal: argvs['rm-global'] })]; | ||
case 1: | ||
lessSource = _a.sent(); | ||
(0, compile_1.outputFile)(lessSource, path_1.default.join(process.cwd(), argvs.dir), path_1.default.join(process.cwd(), argvs.out)); | ||
outputFile(lessSource, path.join(process.cwd(), argvs.dir), path.join(process.cwd(), argvs.out)); | ||
_a.label = 2; | ||
@@ -120,0 +153,0 @@ case 2: return [3 /*break*/, 4]; |
{ | ||
"name": "compile-less-cli", | ||
"version": "1.8.9", | ||
"version": "1.8.10", | ||
"description": "All `.less` files are compiled into `.css` files.", | ||
@@ -13,5 +13,7 @@ "main": "lib/compile.js", | ||
"build": "tsbb build --disable-babel --no-esm", | ||
"test": "node ./lib/index.js -d test/src -o test/out", | ||
"test:watch": "node ./lib/index.js -d test/src -o test/out --combine test/out/dist.css --watch", | ||
"test:watch2": "node ./lib/index.js -d test/src -o test/out --watch --exclude-css" | ||
"test": "npm run build && tsbb test", | ||
"coverage": "npm run build && tsbb test --coverage", | ||
"example:test": "node ./lib/index.js -d test/src -o test/out", | ||
"example:test:watch": "node ./lib/index.js -d test/src -o test/out --combine test/out/dist.css --watch", | ||
"example:test:watch2": "node ./lib/index.js -d test/src -o test/out --watch --exclude-css" | ||
}, | ||
@@ -40,3 +42,3 @@ "repository": { | ||
"devDependencies": { | ||
"tsbb": "3.3.7" | ||
"tsbb": "3.5.4" | ||
}, | ||
@@ -47,8 +49,10 @@ "dependencies": { | ||
"@types/minimist": "1.2.2", | ||
"@types/node": "16.7.8", | ||
"@types/node": "17.0.6", | ||
"autoprefixer": "10.4.1", | ||
"chokidar": "3.5.2", | ||
"directory-tree": "3.0.0", | ||
"directory-tree": "3.0.1", | ||
"fs-extra": "10.0.0", | ||
"postcss": "8.4.5", | ||
"read-pkg-up": "7.0.1", | ||
"less": "4.1.1", | ||
"less": "4.1.2", | ||
"less-plugin-autoprefix": "2.0.0", | ||
@@ -55,0 +59,0 @@ "minimist": "1.2.5" |
@@ -8,6 +8,7 @@ compile-less | ||
[![npm version](https://img.shields.io/npm/v/compile-less-cli.svg)](https://www.npmjs.com/package/compile-less-cli) | ||
[![Coverage Status](https://jaywcjlove.github.io/compile-less/badges.svg)](https://jaywcjlove.github.io/compile-less/lcov-report/) | ||
All `.less` files are compiled into `.css` files. | ||
### Install | ||
## Install | ||
@@ -18,3 +19,3 @@ ```bash | ||
### Basic Usage | ||
## Basic Usage | ||
@@ -30,3 +31,3 @@ ```js | ||
### Command Line | ||
## Command Line | ||
@@ -58,3 +59,3 @@ Command help: | ||
### Development | ||
## Development | ||
@@ -72,1 +73,6 @@ Listen for files compiled with TypeScript | ||
``` | ||
## License | ||
Licensed under the MIT License. |
@@ -61,10 +61,10 @@ | ||
async function log(output: string, input?: string) { | ||
export async function log(output: string, input?: string) { | ||
const pkg = await readPkgUp(); | ||
const projectName = pkg ? pkg?.packageJson.name : ''; | ||
if (input) { | ||
console.log(`♻️ \x1b[32m ${projectName}\x1b[0m:`, input, '┈>', output); | ||
console.log(`♻️ \x1b[32m ${projectName}\x1b[0m: ${input} ┈> ${output}`); | ||
} else { | ||
console.log(`♻️ \x1b[32m ${projectName}\x1b[0m:`, 'Output one file: ┈>', output); | ||
console.log(`♻️ \x1b[32m ${projectName}\x1b[0m: Output one file: ┈> ${output}`); | ||
} | ||
} |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
33821
685
74
13
+ Addedautoprefixer@10.4.1
+ Addedpostcss@8.4.5
+ Added@types/node@17.0.6(transitive)
+ Addedautoprefixer@10.4.1(transitive)
+ Addedbrowserslist@4.23.0(transitive)
+ Addeddirectory-tree@3.0.1(transitive)
+ Addedescalade@3.1.2(transitive)
+ Addedfraction.js@4.3.7(transitive)
+ Addedless@4.1.2(transitive)
+ Addednanoid@3.3.7(transitive)
+ Addednode-releases@2.0.14(transitive)
+ Addedpostcss@8.4.5(transitive)
+ Addedpostcss-value-parser@4.2.0(transitive)
+ Addedsource-map-js@1.2.0(transitive)
+ Addedtslib@2.6.2(transitive)
+ Addedupdate-browserslist-db@1.0.13(transitive)
- Removed@types/node@16.7.8(transitive)
- Removeddirectory-tree@3.0.0(transitive)
- Removedless@4.1.1(transitive)
- Removedtslib@1.14.1(transitive)
Updated@types/node@17.0.6
Updateddirectory-tree@3.0.1
Updatedless@4.1.2