occam-open-cli 5.0.36 → 5.0.38
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/operation/createRelease.js +2 -3
- package/lib/browser.js +1 -1
- package/lib/constants.js +1 -1
- package/lib/directory.js +1 -1
- package/lib/entries.js +1 -1
- package/lib/file.js +8 -19
- package/lib/files.js +1 -1
- package/lib/main.js +9 -1
- package/lib/messages.js +1 -1
- package/lib/node/dependency.js +32 -6
- package/lib/node/repository.js +32 -6
- package/lib/project.js +1 -1
- package/lib/projects.js +1 -1
- package/lib/release.js +1 -1
- package/lib/types.js +1 -1
- package/lib/utilities/content.js +27 -0
- package/lib/utilities/filePath.js +1 -1
- package/lib/utilities/fileSystem.js +7 -142
- package/lib/utilities/name.js +15 -4
- package/lib/utilities/node.js +1 -1
- package/lib/utilities/tokens.js +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -3
- package/src/file.js +1 -3
- package/src/main.js +2 -0
- package/src/node/dependency.js +2 -6
- package/src/node/repository.js +2 -6
- package/src/utilities/content.js +9 -0
- package/src/utilities/fileSystem.js +6 -126
- package/src/utilities/name.js +4 -0
|
@@ -1,113 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import mkdirp from "mkdirp";
|
|
4
|
-
|
|
5
3
|
import { characters, pathUtilities, fileSystemUtilities } from "necessary";
|
|
6
4
|
|
|
7
|
-
import File from "../file";
|
|
8
|
-
import Files from "../files";
|
|
9
5
|
import Entries from "../entries";
|
|
10
|
-
import Project from "../project";
|
|
11
6
|
import Release from "../release";
|
|
12
|
-
import Projects from "../projects";
|
|
13
7
|
import Directory from "../directory";
|
|
14
8
|
|
|
15
9
|
import { isNameHiddenName } from "../utilities/name";
|
|
16
10
|
import { ENTRIES_MAXIMUM_ARRAY_LENGTH } from "../constants";
|
|
17
11
|
import { isFilePathRecognisedFilePath } from "../utilities/filePath";
|
|
18
|
-
import { convertContentTabsToWhitespace } from "../file";
|
|
19
12
|
import { ENTRIES_MAXIMUM_ARRAY_LENGTH_EXCEEDED_MESSAGE } from "../messages";
|
|
20
13
|
|
|
21
14
|
const { PERIOD_CHARACTER } = characters,
|
|
22
|
-
{ concatenatePaths
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
export function loadFile(path, projectsDirectoryPath) {
|
|
26
|
-
let file = null;
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
const absolutePath = concatenatePaths(projectsDirectoryPath, path),
|
|
30
|
-
entryFile = isEntryFile(absolutePath);
|
|
31
|
-
|
|
32
|
-
if (entryFile) {
|
|
33
|
-
let content = readFile(absolutePath);
|
|
34
|
-
|
|
35
|
-
content = convertContentTabsToWhitespace(content); ///
|
|
36
|
-
|
|
37
|
-
file = new File(path, content);
|
|
38
|
-
}
|
|
39
|
-
} catch (error) {
|
|
40
|
-
///
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return file;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function saveFile(file, projectsDirectoryPath) {
|
|
47
|
-
const path = file.getPath(),
|
|
48
|
-
content = file.getContent(),
|
|
49
|
-
absolutePath = concatenatePaths(projectsDirectoryPath, path),
|
|
50
|
-
topmostAbsoluteDirectoryPath = topmostDirectoryPathFromPath(absolutePath);
|
|
51
|
-
|
|
52
|
-
mkdirp.sync(topmostAbsoluteDirectoryPath);
|
|
53
|
-
|
|
54
|
-
writeFile(absolutePath, content);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function loadFiles(paths, projectsDirectoryPath) {
|
|
58
|
-
const array = [],
|
|
59
|
-
files = new Files(array);
|
|
60
|
-
|
|
61
|
-
paths.forEach((path) => {
|
|
62
|
-
const file = loadFile(path, projectsDirectoryPath);
|
|
63
|
-
|
|
64
|
-
files.addFile(file);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
return files;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function saveFiles(files, projectsDirectoryPath) {
|
|
71
|
-
files.forEachFile((file) => {
|
|
72
|
-
saveFile(file, projectsDirectoryPath);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
15
|
+
{ concatenatePaths } = pathUtilities,
|
|
16
|
+
{ readDirectory, isEntryDirectory } = fileSystemUtilities;
|
|
75
17
|
|
|
76
|
-
export function
|
|
77
|
-
const
|
|
78
|
-
entries = entriesFromTopmostDirectoryName(topmostDirectoryName, projectsDirectoryPath, loadOnlyRecognisedFiles, doNotLoadHiddenFilesAndDirectories),
|
|
79
|
-
project = new Project(name, entries);
|
|
80
|
-
|
|
81
|
-
return project;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function loadProjects(projectsDirectoryPath, loadOnlyRecognisedFiles, doNotLoadHiddenFilesAndDirectories) {
|
|
85
|
-
let projects;
|
|
86
|
-
|
|
87
|
-
try {
|
|
88
|
-
const array = [];
|
|
89
|
-
|
|
90
|
-
projects = new Projects(array);
|
|
91
|
-
|
|
92
|
-
const topmostDirectoryNames = topmostDirectoryNamesFromProjectsDirectoryPath(projectsDirectoryPath, doNotLoadHiddenFilesAndDirectories);
|
|
93
|
-
|
|
94
|
-
topmostDirectoryNames.forEach((topmostDirectoryName) => {
|
|
95
|
-
const project = loadProject(topmostDirectoryName, projectsDirectoryPath, loadOnlyRecognisedFiles, doNotLoadHiddenFilesAndDirectories);
|
|
96
|
-
|
|
97
|
-
projects.addProject(project);
|
|
98
|
-
});
|
|
99
|
-
} catch (error) {
|
|
100
|
-
projects = null;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return projects;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export function releaseFromName(name) {
|
|
107
|
-
const topmostDirectoryName = name, ///
|
|
18
|
+
export function releaseFromReleaseName(releaseName) {
|
|
19
|
+
const topmostDirectoryName = releaseName, ///
|
|
108
20
|
projectsDirectoryPath = PERIOD_CHARACTER,
|
|
109
21
|
loadOnlyRecognisedFiles = true,
|
|
110
22
|
doNotLoadHiddenFilesAndDirectories = true,
|
|
23
|
+
name = releaseName, ///
|
|
111
24
|
entries = entriesFromTopmostDirectoryName(topmostDirectoryName, projectsDirectoryPath, loadOnlyRecognisedFiles, doNotLoadHiddenFilesAndDirectories),
|
|
112
25
|
versionNumber = null, ///
|
|
113
26
|
release = new Release(name, entries, versionNumber);
|
|
@@ -116,13 +29,7 @@ export function releaseFromName(name) {
|
|
|
116
29
|
}
|
|
117
30
|
|
|
118
31
|
export default {
|
|
119
|
-
|
|
120
|
-
saveFile,
|
|
121
|
-
loadFiles,
|
|
122
|
-
saveFiles,
|
|
123
|
-
loadProject,
|
|
124
|
-
loadProjects,
|
|
125
|
-
releaseFromName
|
|
32
|
+
releaseFromReleaseName
|
|
126
33
|
};
|
|
127
34
|
|
|
128
35
|
function directoryFromPath(path, projectsDirectoryPath) {
|
|
@@ -209,30 +116,3 @@ function entriesFromRelativeDirectoryPath(array, relativeDirectoryPath, projects
|
|
|
209
116
|
}
|
|
210
117
|
});
|
|
211
118
|
}
|
|
212
|
-
|
|
213
|
-
function topmostDirectoryNamesFromProjectsDirectoryPath(projectsDirectoryPath, doNotLoadHiddenFilesAndDirectories) {
|
|
214
|
-
let topmostDirectoryNames;
|
|
215
|
-
|
|
216
|
-
const subEntryNames = readDirectory(projectsDirectoryPath);
|
|
217
|
-
|
|
218
|
-
topmostDirectoryNames = subEntryNames.reduce((topmostDirectoryNames, subEntryName) => {
|
|
219
|
-
const absoluteSubEntryPath = concatenatePaths(projectsDirectoryPath, subEntryName),
|
|
220
|
-
subEntryNameHiddenName = isNameHiddenName(subEntryName),
|
|
221
|
-
subEntryNameNotHiddenName = !subEntryNameHiddenName,
|
|
222
|
-
loadHiddenFilesAndDirectories = !doNotLoadHiddenFilesAndDirectories;
|
|
223
|
-
|
|
224
|
-
if (subEntryNameNotHiddenName || loadHiddenFilesAndDirectories) {
|
|
225
|
-
const subEntryDirectory = isEntryDirectory(absoluteSubEntryPath);
|
|
226
|
-
|
|
227
|
-
if (subEntryDirectory) {
|
|
228
|
-
const topmostDirectoryName = subEntryName; ///
|
|
229
|
-
|
|
230
|
-
topmostDirectoryNames.push(topmostDirectoryName)
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return topmostDirectoryNames;
|
|
235
|
-
}, []);
|
|
236
|
-
|
|
237
|
-
return topmostDirectoryNames;
|
|
238
|
-
}
|