kryptheon 0.1.23 → 0.1.24
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/bin/kryptheon.js +1 -1
- package/kryptheon-project.js +23 -0
- package/package.json +1 -1
package/bin/kryptheon.js
CHANGED
|
@@ -2019,7 +2019,7 @@ function readCodeAndSave(opened) {
|
|
|
2019
2019
|
}
|
|
2020
2020
|
|
|
2021
2021
|
function codeRead() {
|
|
2022
|
-
const here = project.
|
|
2022
|
+
const here = project.inspectCodeFolder(USER_DIR);
|
|
2023
2023
|
if (!here.ok) {
|
|
2024
2024
|
for (const line of project.noProjectLines(here)) console.error(line);
|
|
2025
2025
|
return 1;
|
package/kryptheon-project.js
CHANGED
|
@@ -134,6 +134,28 @@ function inspectProject(dir, env) {
|
|
|
134
134
|
return Object.assign({ ok: true, reason: null }, base);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Whether `kryptheon code` may read this folder.
|
|
139
|
+
*
|
|
140
|
+
* The same as any command, with one opening: a plain site - index.html and
|
|
141
|
+
* a few scripts, no npm anywhere - has no package.json and never will. Found
|
|
142
|
+
* on a blind test: exactly such an app was refused, and nothing was read. The
|
|
143
|
+
* refusal exists so that a check does not run somebody else's recordings;
|
|
144
|
+
* reading the files in front of you cannot do that. A page at the top of the
|
|
145
|
+
* folder is what says it is a site. A home or system folder stays refused.
|
|
146
|
+
*/
|
|
147
|
+
function inspectCodeFolder(dir, env) {
|
|
148
|
+
const here = inspectProject(dir, env);
|
|
149
|
+
if (here.ok || here.reason !== 'no-package') return here;
|
|
150
|
+
let pages = [];
|
|
151
|
+
try {
|
|
152
|
+
pages = fs.readdirSync(dir).filter((name) => /\.html?$/i.test(name) && fs.statSync(path.join(dir, name)).isFile());
|
|
153
|
+
} catch (e) {
|
|
154
|
+
pages = [];
|
|
155
|
+
}
|
|
156
|
+
return pages.length ? Object.assign({}, here, { ok: true, reason: null, plainSite: true }) : here;
|
|
157
|
+
}
|
|
158
|
+
|
|
137
159
|
/**
|
|
138
160
|
* Why this folder is not a project, and what to do instead.
|
|
139
161
|
*
|
|
@@ -565,6 +587,7 @@ module.exports = {
|
|
|
565
587
|
tidy: tidy,
|
|
566
588
|
isHomeOrSystem: isHomeOrSystem,
|
|
567
589
|
inspectProject: inspectProject,
|
|
590
|
+
inspectCodeFolder: inspectCodeFolder,
|
|
568
591
|
noProjectLines: noProjectLines,
|
|
569
592
|
noRecordingsLines: noRecordingsLines,
|
|
570
593
|
};
|