@splitscript.js/core
Advanced tools
Comparing version
@@ -0,1 +1,7 @@ | ||
# 2.2.2 | ||
Allow wildcard `**` at the end of events | ||
Watches for functions watches correct folder when passing a folder | ||
# 2.2.1 | ||
@@ -2,0 +8,0 @@ |
@@ -46,2 +46,6 @@ "use strict"; | ||
function globMatch(pattern, items) { | ||
const beforeDoubleStar = pattern.slice(0, pattern.indexOf("**")); | ||
const itemsBeforeDoubleStar = items.slice(0, beforeDoubleStar.length); | ||
if (pattern.at(-1) === "**" && JSON.stringify(beforeDoubleStar) === JSON.stringify(itemsBeforeDoubleStar)) | ||
return true; | ||
let patternIndex = 0; | ||
@@ -79,4 +83,4 @@ let itemIndex = 0; | ||
return; | ||
const type = await (0, import_utils.getType)(); | ||
const ss = await (0, import_utils.getSplitscriptConfig)(); | ||
const type = await (0, import_utils.getType)(root); | ||
const ss = await (0, import_utils.getSplitscriptConfig)(root); | ||
if (!ss.packages) { | ||
@@ -89,3 +93,3 @@ console.log(import_ansi_colors.default.bgRed(` ERROR `), `Invalid ss.json`); | ||
return; | ||
const eventName = (0, import_utils.getEventName)(filePath, eventFolder); | ||
const eventName = (0, import_utils.getEventName)(filePath, eventFolder, root); | ||
const packageName = ss.packages[eventFolder]?.packageName; | ||
@@ -127,3 +131,2 @@ if (!packageName) | ||
}).join(""); | ||
console.log(name); | ||
} | ||
@@ -130,0 +133,0 @@ } else { |
@@ -139,2 +139,3 @@ #!/usr/bin/env node | ||
(0, import_dev.watchProject)(import_path.default.join(root, file), main); | ||
(0, import_dev.watchFunctions)(import_path.default.join(root, file)); | ||
} else if (stat.isFile()) { | ||
@@ -147,5 +148,7 @@ if (!import_fs.default.existsSync(file)) | ||
(0, import_dev.watchProject)(import_path.default.join(root, import_path.default.dirname(file)), import_path.default.basename(file)); | ||
(0, import_dev.watchFunctions)(root); | ||
} | ||
} else { | ||
(0, import_dev.watchFunctions)(root); | ||
} | ||
(0, import_dev.watchFunctions)(root); | ||
}); | ||
@@ -152,0 +155,0 @@ program.command("build").description(import_ansi_colors.default.italic("Build a project for production")).argument("<folder>", "Name of folder to build").action(async (folder) => { |
@@ -93,6 +93,9 @@ "use strict"; | ||
} | ||
async function getType() { | ||
async function getType(root2) { | ||
let pckg = "{}"; | ||
if (import_node_fs.default.existsSync("./package.json")) { | ||
pckg = await import_promises.default.readFile("./package.json", "utf-8"); | ||
if (import_node_fs.default.existsSync(root2 ? import_node_path.default.join(root2, "package.json") : "./package.json")) { | ||
pckg = await import_promises.default.readFile( | ||
root2 ? import_node_path.default.join(root2, "package.json") : "./package.json", | ||
"utf-8" | ||
); | ||
} | ||
@@ -112,5 +115,5 @@ const obj = JSON.parse(pckg); | ||
} | ||
function getEventName(filepath, currentFunctionPackage) { | ||
function getEventName(filepath, currentFunctionPackage, root2) { | ||
const a = import_node_path.default.relative( | ||
import_node_path.default.join("./functions", currentFunctionPackage), | ||
root2 ? import_node_path.default.join(root2, "functions", currentFunctionPackage) : import_node_path.default.join("./functions", currentFunctionPackage), | ||
filepath | ||
@@ -117,0 +120,0 @@ ); |
{ | ||
"name": "@splitscript.js/core", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "Core SplitScript.js library", | ||
@@ -5,0 +5,0 @@ "types": "./dist/types/index.d.ts", |
@@ -56,4 +56,4 @@ <a href="#"> | ||
<sub><code>v2.2.1</code> | by [ultraviolet](https://github.com/ultravioletasdf)</sub> | ||
<sub><code>v2.2.2</code> | by [ultraviolet](https://github.com/ultravioletasdf)</sub> | ||
</div> |
54999
1.39%1267
0.72%