virmator 12.0.3 → 13.0.1
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/README.md +224 -129
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +21 -5
- package/dist/index.d.ts +1416 -1310
- package/dist/index.js +25 -63
- package/dist/tests/test-virmator.mock.d.ts +3 -0
- package/dist/tests/test-virmator.mock.js +5 -0
- package/package.json +25 -69
- package/src/cli.ts +29 -0
- package/src/index.ts +26 -0
- package/src/tests/test-virmator.mock.ts +13 -0
- package/base-configs/base-cspell.js +0 -272
- package/base-configs/base-mocharc.cjs +0 -20
- package/base-configs/base-nyc.js +0 -40
- package/base-configs/base-prettierrc.js +0 -32
- package/base-configs/base-web-test-runner.mjs +0 -137
- package/base-configs/test-files-glob.js +0 -13
- package/base-configs/tsconfig.base.json +0 -32
- package/configs/.gitattributes +0 -2
- package/configs/.github/workflows/build-for-gh-pages.yml +0 -24
- package/configs/.github/workflows/tagged-release.yml +0 -41
- package/configs/.github/workflows/tests.yml +0 -25
- package/configs/.nvmrc +0 -1
- package/configs/.prettierignore +0 -11
- package/configs/.prettierrc.js +0 -13
- package/configs/.vscode/settings.json +0 -50
- package/configs/LICENSE-CC0 +0 -121
- package/configs/LICENSE-MIT +0 -21
- package/configs/configs/dep-cruiser.config.ts +0 -22
- package/configs/configs/mocha.config.cjs +0 -8
- package/configs/configs/ncu.config.ts +0 -12
- package/configs/configs/nyc.config.js +0 -7
- package/configs/configs/typedoc.config.ts +0 -20
- package/configs/configs/vite.config.ts +0 -14
- package/configs/configs/web-test-runner.config.mjs +0 -21
- package/configs/cspell.config.cjs +0 -11
- package/configs/dep-cruiser.config.ts +0 -22
- package/configs/gitignore.txt +0 -13
- package/configs/ncu.config.ts +0 -13
- package/configs/npmignore.txt +0 -26
- package/configs/package.json +0 -23
- package/configs/src/index.html +0 -12
- package/configs/src/ui/elements/vir-app.element.ts +0 -10
- package/configs/tsconfig.json +0 -16
- package/configs/www-static/_redirects +0 -1
- package/configs/www-static/index.css +0 -7
- package/cspell.config.cjs +0 -13
- package/dist/api/command/command-configs.d.ts +0 -3
- package/dist/api/command/command-configs.js +0 -10
- package/dist/api/command/command-description.d.ts +0 -8
- package/dist/api/command/command-description.js +0 -2
- package/dist/api/command/command-executor.d.ts +0 -30
- package/dist/api/command/command-executor.js +0 -6
- package/dist/api/command/command-help.d.ts +0 -8
- package/dist/api/command/command-help.js +0 -2
- package/dist/api/command/command-logging.d.ts +0 -11
- package/dist/api/command/command-logging.js +0 -17
- package/dist/api/command/command-mapping.d.ts +0 -7
- package/dist/api/command/command-mapping.js +0 -9
- package/dist/api/command/command-messages.d.ts +0 -1
- package/dist/api/command/command-messages.js +0 -9
- package/dist/api/command/command-to-help-message.d.ts +0 -9
- package/dist/api/command/command-to-help-message.js +0 -175
- package/dist/api/command/define-command-inputs.d.ts +0 -22
- package/dist/api/command/define-command-inputs.js +0 -8
- package/dist/api/command/define-command.d.ts +0 -22
- package/dist/api/command/define-command.js +0 -41
- package/dist/api/config/config-file-definition.d.ts +0 -15
- package/dist/api/config/config-file-definition.js +0 -2
- package/dist/api/config/config-paths.d.ts +0 -7
- package/dist/api/config/config-paths.js +0 -7
- package/dist/api/config/copy-config.d.ts +0 -27
- package/dist/api/config/copy-config.js +0 -98
- package/dist/api/create-virmator.d.ts +0 -8
- package/dist/api/create-virmator.js +0 -67
- package/dist/api/run-command/check-npm-deps.d.ts +0 -8
- package/dist/api/run-command/check-npm-deps.js +0 -111
- package/dist/api/run-command/extract-arguments.d.ts +0 -6
- package/dist/api/run-command/extract-arguments.js +0 -36
- package/dist/api/run-command/run-command-executor.d.ts +0 -5
- package/dist/api/run-command/run-command-executor.js +0 -50
- package/dist/api/run-command/run-extended-virmator.d.ts +0 -10
- package/dist/api/run-command/run-extended-virmator.js +0 -53
- package/dist/api/run-command/run-shell-command.d.ts +0 -8
- package/dist/api/run-command/run-shell-command.js +0 -21
- package/dist/api/virmator-types.d.ts +0 -18
- package/dist/api/virmator-types.js +0 -2
- package/dist/augments/array.d.ts +0 -1
- package/dist/augments/array.js +0 -6
- package/dist/augments/console.d.ts +0 -9
- package/dist/augments/console.js +0 -43
- package/dist/augments/fs.d.ts +0 -11
- package/dist/augments/fs.js +0 -71
- package/dist/augments/git.d.ts +0 -1
- package/dist/augments/git.js +0 -12
- package/dist/augments/json.d.ts +0 -1
- package/dist/augments/json.js +0 -11
- package/dist/augments/npm.d.ts +0 -11
- package/dist/augments/npm.js +0 -52
- package/dist/augments/object.d.ts +0 -4
- package/dist/augments/object.js +0 -44
- package/dist/augments/path.d.ts +0 -1
- package/dist/augments/path.js +0 -12
- package/dist/augments/prettier.d.ts +0 -1
- package/dist/augments/prettier.js +0 -52
- package/dist/augments/regexp.d.ts +0 -1
- package/dist/augments/regexp.js +0 -6
- package/dist/augments/string.d.ts +0 -2
- package/dist/augments/string.js +0 -9
- package/dist/augments/type.d.ts +0 -1
- package/dist/augments/type.js +0 -2
- package/dist/augments/typescript-config-file.d.ts +0 -5
- package/dist/augments/typescript-config-file.js +0 -62
- package/dist/commands/compile.command.d.ts +0 -84
- package/dist/commands/compile.command.js +0 -58
- package/dist/commands/deps.command.d.ts +0 -144
- package/dist/commands/deps.command.js +0 -208
- package/dist/commands/docs.command.d.ts +0 -99
- package/dist/commands/docs.command.js +0 -192
- package/dist/commands/extra-configs/all-extra-configs.d.ts +0 -2
- package/dist/commands/extra-configs/all-extra-configs.js +0 -71
- package/dist/commands/extra-configs/combine-json-config.d.ts +0 -2
- package/dist/commands/extra-configs/combine-json-config.js +0 -21
- package/dist/commands/extra-configs/combine-text-config.d.ts +0 -2
- package/dist/commands/extra-configs/combine-text-config.js +0 -26
- package/dist/commands/extra-configs/create-default-package-json.d.ts +0 -1
- package/dist/commands/extra-configs/create-default-package-json.js +0 -86
- package/dist/commands/format.command.d.ts +0 -215
- package/dist/commands/format.command.js +0 -157
- package/dist/commands/frontend.command.d.ts +0 -149
- package/dist/commands/frontend.command.js +0 -140
- package/dist/commands/init.command.d.ts +0 -163
- package/dist/commands/init.command.js +0 -53
- package/dist/commands/publish.command.d.ts +0 -33
- package/dist/commands/publish.command.js +0 -193
- package/dist/commands/spellcheck.command.d.ts +0 -74
- package/dist/commands/spellcheck.command.js +0 -60
- package/dist/commands/test-web.command.d.ts +0 -189
- package/dist/commands/test-web.command.js +0 -125
- package/dist/commands/test.command.d.ts +0 -224
- package/dist/commands/test.command.js +0 -100
- package/dist/commands/update-configs.command.d.ts +0 -33
- package/dist/commands/update-configs.command.js +0 -35
- package/dist/compiled-base-configs/base-dep-cruiser.config.d.ts +0 -195
- package/dist/compiled-base-configs/base-dep-cruiser.config.js +0 -206
- package/dist/compiled-base-configs/base-ncu.d.ts +0 -6
- package/dist/compiled-base-configs/base-ncu.js +0 -16
- package/dist/compiled-base-configs/base-typedoc.d.ts +0 -3
- package/dist/compiled-base-configs/base-typedoc.js +0 -36
- package/dist/compiled-base-configs/base-vite.d.ts +0 -27
- package/dist/compiled-base-configs/base-vite.js +0 -74
- package/dist/compiled-base-configs/vite-always-reload-plugin.d.ts +0 -10
- package/dist/compiled-base-configs/vite-always-reload-plugin.js +0 -99
- package/dist/file-paths/package-paths.d.ts +0 -12
- package/dist/file-paths/package-paths.js +0 -46
- package/dist/scripts/save-help-message.d.ts +0 -1
- package/dist/scripts/save-help-message.js +0 -33
- package/mocha.config.cjs +0 -16
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateDepCruiserConfig = generateDepCruiserConfig;
|
|
4
|
-
function generateDepCruiserConfig({ fileExceptions, omitRules, }) {
|
|
5
|
-
const forbiddenRules = [
|
|
6
|
-
/* rules from the 'recommended' preset: */
|
|
7
|
-
{
|
|
8
|
-
name: 'no-circular',
|
|
9
|
-
severity: 'error',
|
|
10
|
-
comment: 'This dependency is part of a circular relationship.',
|
|
11
|
-
from: {},
|
|
12
|
-
to: {
|
|
13
|
-
circular: true,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
name: 'no-orphans',
|
|
18
|
-
comment: "This is an orphan module - it's likely not used (anymore?). Either use it or " +
|
|
19
|
-
"remove it. If it's logical this module is an orphan (i.e. it's a config file), " +
|
|
20
|
-
'add an exception for it in your dependency-cruiser configuration.',
|
|
21
|
-
severity: 'error',
|
|
22
|
-
from: {
|
|
23
|
-
orphan: true,
|
|
24
|
-
pathNot: [
|
|
25
|
-
'\\.d\\.ts$', // TypeScript declaration files
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
to: {},
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
name: 'no-deprecated-core',
|
|
32
|
-
comment: 'A module depends on a node core module that has been deprecated. Find an alternative - these are ' +
|
|
33
|
-
"bound to exist - node doesn't deprecate lightly.",
|
|
34
|
-
severity: 'error',
|
|
35
|
-
from: {},
|
|
36
|
-
to: {
|
|
37
|
-
dependencyTypes: ['core'],
|
|
38
|
-
path: [
|
|
39
|
-
'^(v8/tools/codemap)$',
|
|
40
|
-
'^(v8/tools/consarray)$',
|
|
41
|
-
'^(v8/tools/csvparser)$',
|
|
42
|
-
'^(v8/tools/logreader)$',
|
|
43
|
-
'^(v8/tools/profile_view)$',
|
|
44
|
-
'^(v8/tools/profile)$',
|
|
45
|
-
'^(v8/tools/SourceMap)$',
|
|
46
|
-
'^(v8/tools/splaytree)$',
|
|
47
|
-
'^(v8/tools/tickprocessor-driver)$',
|
|
48
|
-
'^(v8/tools/tickprocessor)$',
|
|
49
|
-
'^(node-inspect/lib/_inspect)$',
|
|
50
|
-
'^(node-inspect/lib/internal/inspect_client)$',
|
|
51
|
-
'^(node-inspect/lib/internal/inspect_repl)$',
|
|
52
|
-
'^(async_hooks)$',
|
|
53
|
-
'^(punycode)$',
|
|
54
|
-
'^(domain)$',
|
|
55
|
-
'^(constants)$',
|
|
56
|
-
'^(sys)$',
|
|
57
|
-
'^(_linklist)$',
|
|
58
|
-
'^(_stream_wrap)$',
|
|
59
|
-
],
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: 'not-to-deprecated',
|
|
64
|
-
comment: 'This module uses a (version of an) npm module that has been deprecated. Either upgrade to a later ' +
|
|
65
|
-
'version of that module, or find an alternative. Deprecated modules are a security risk.',
|
|
66
|
-
severity: 'error',
|
|
67
|
-
from: {},
|
|
68
|
-
to: {
|
|
69
|
-
dependencyTypes: ['deprecated'],
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: 'no-non-package-json',
|
|
74
|
-
severity: 'error',
|
|
75
|
-
comment: "This module depends on an npm package that isn't in the 'dependencies' section of your package.json. " +
|
|
76
|
-
"That's problematic as the package either (1) won't be available on live (2 - worse) will be " +
|
|
77
|
-
'available on live with an non-guaranteed version. Fix it by adding the package to the dependencies ' +
|
|
78
|
-
'in your package.json.',
|
|
79
|
-
from: {},
|
|
80
|
-
to: {
|
|
81
|
-
dependencyTypes: [
|
|
82
|
-
'npm-no-pkg',
|
|
83
|
-
'npm-unknown',
|
|
84
|
-
],
|
|
85
|
-
pathNot: [
|
|
86
|
-
'^src/',
|
|
87
|
-
],
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: 'not-to-unresolvable',
|
|
92
|
-
comment: "This module depends on a module that cannot be found ('resolved to disk'). If it's an npm " +
|
|
93
|
-
'module: add it to your package.json. In all other cases you likely already know what to do.',
|
|
94
|
-
severity: 'error',
|
|
95
|
-
from: {},
|
|
96
|
-
to: {
|
|
97
|
-
couldNotResolve: true,
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: 'no-duplicate-dep-types',
|
|
102
|
-
comment: "Likely this module depends on an external ('npm') package that occurs more than once " +
|
|
103
|
-
'in your package.json i.e. both as a devDependencies and in dependencies. This will cause ' +
|
|
104
|
-
'maintenance problems later on.',
|
|
105
|
-
severity: 'error',
|
|
106
|
-
from: {},
|
|
107
|
-
to: {
|
|
108
|
-
moreThanOneDependencyType: true,
|
|
109
|
-
// as it's pretty common to have a type import be a type only import
|
|
110
|
-
// _and_ (e.g.) a devDependency - don't consider type-only dependency
|
|
111
|
-
// types for this rule
|
|
112
|
-
dependencyTypesNot: [
|
|
113
|
-
'type-only',
|
|
114
|
-
],
|
|
115
|
-
pathNot: [
|
|
116
|
-
'^src/',
|
|
117
|
-
],
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
/* rules you might want to tweak for your specific situation: */
|
|
121
|
-
{
|
|
122
|
-
name: 'not-to-spec',
|
|
123
|
-
comment: 'This module depends on a spec (test) file. The sole responsibility of a spec file is to test code. ' +
|
|
124
|
-
"If there's something in a spec that's of use to other modules, it doesn't have that single " +
|
|
125
|
-
'responsibility anymore. Factor it out into (e.g.) a separate utility/ helper or a mock.',
|
|
126
|
-
severity: 'error',
|
|
127
|
-
from: {},
|
|
128
|
-
to: {
|
|
129
|
-
path: '\\.test\\.ts$',
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
name: 'not-to-dev-dep',
|
|
134
|
-
severity: 'error',
|
|
135
|
-
comment: "This module depends on an npm package from the 'devDependencies' section of your " +
|
|
136
|
-
'package.json.',
|
|
137
|
-
from: {
|
|
138
|
-
path: '^(packages)',
|
|
139
|
-
pathNot: [
|
|
140
|
-
'\\.(spec|test)\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\.md)$',
|
|
141
|
-
],
|
|
142
|
-
},
|
|
143
|
-
to: {
|
|
144
|
-
dependencyTypes: ['npm-dev'],
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: 'optional-deps-used',
|
|
149
|
-
severity: 'error',
|
|
150
|
-
comment: 'This module depends on an npm package that is declared as an optional dependency ' +
|
|
151
|
-
"in your package.json. As this makes sense in limited situations only, it's flagged here. " +
|
|
152
|
-
"If you're using an optional dependency here by design - add an exception to your" +
|
|
153
|
-
'dependency-cruiser configuration.',
|
|
154
|
-
from: {},
|
|
155
|
-
to: {
|
|
156
|
-
dependencyTypes: ['npm-optional'],
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
];
|
|
160
|
-
Object.entries(fileExceptions).forEach(([ruleName, fileExceptions,]) => {
|
|
161
|
-
const rule = forbiddenRules.find((rule) => rule.name === ruleName);
|
|
162
|
-
if (!rule) {
|
|
163
|
-
throw new Error(`Rule name not used: '${ruleName}'`);
|
|
164
|
-
}
|
|
165
|
-
const fromPathNot = rule.from.pathNot
|
|
166
|
-
? Array.isArray(rule.from.pathNot)
|
|
167
|
-
? rule.from.pathNot
|
|
168
|
-
: [rule.from.pathNot]
|
|
169
|
-
: [];
|
|
170
|
-
const toPathNot = rule.to.pathNot
|
|
171
|
-
? Array.isArray(rule.to.pathNot)
|
|
172
|
-
? rule.to.pathNot
|
|
173
|
-
: [rule.to.pathNot]
|
|
174
|
-
: [];
|
|
175
|
-
if (fileExceptions.from?.length) {
|
|
176
|
-
fromPathNot.push(...fileExceptions.from);
|
|
177
|
-
}
|
|
178
|
-
if (fileExceptions.to?.length) {
|
|
179
|
-
toPathNot.push(...fileExceptions.to);
|
|
180
|
-
}
|
|
181
|
-
if (!rule.from.pathNot) {
|
|
182
|
-
rule.from.pathNot = fromPathNot;
|
|
183
|
-
}
|
|
184
|
-
if (!rule.to.pathNot) {
|
|
185
|
-
rule.to.pathNot = toPathNot;
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
return {
|
|
189
|
-
forbidden: forbiddenRules.filter((rule) => !omitRules.includes(rule.name)),
|
|
190
|
-
options: {
|
|
191
|
-
doNotFollow: {
|
|
192
|
-
dependencyTypes: [
|
|
193
|
-
'core',
|
|
194
|
-
'npm',
|
|
195
|
-
'npm-bundled',
|
|
196
|
-
'npm-dev',
|
|
197
|
-
'npm-no-pkg',
|
|
198
|
-
'npm-optional',
|
|
199
|
-
'npm-peer',
|
|
200
|
-
'npm-unknown',
|
|
201
|
-
],
|
|
202
|
-
},
|
|
203
|
-
tsPreCompilationDeps: true,
|
|
204
|
-
},
|
|
205
|
-
};
|
|
206
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.baseNcuConfig = void 0;
|
|
4
|
-
exports.baseNcuConfig = {
|
|
5
|
-
color: true,
|
|
6
|
-
upgrade: true,
|
|
7
|
-
root: true,
|
|
8
|
-
reject: [
|
|
9
|
-
/** Version > 16.13 throws chalk init errors. */
|
|
10
|
-
'npm-check-updates',
|
|
11
|
-
/** Note ready for Vite v5 */
|
|
12
|
-
'vite',
|
|
13
|
-
/** V5 requires "type":"module" */
|
|
14
|
-
'chai',
|
|
15
|
-
],
|
|
16
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.baseTypedocConfig = exports.defaultDocumentationRequirements = void 0;
|
|
4
|
-
exports.defaultDocumentationRequirements = [
|
|
5
|
-
'Accessor',
|
|
6
|
-
'Class',
|
|
7
|
-
'Enum',
|
|
8
|
-
'Function',
|
|
9
|
-
'Interface',
|
|
10
|
-
'Method',
|
|
11
|
-
'Module',
|
|
12
|
-
'Namespace',
|
|
13
|
-
'Reference',
|
|
14
|
-
'TypeAlias',
|
|
15
|
-
'Variable',
|
|
16
|
-
];
|
|
17
|
-
exports.baseTypedocConfig = {
|
|
18
|
-
cacheBust: true,
|
|
19
|
-
cleanOutputDir: true,
|
|
20
|
-
excludeExternals: true,
|
|
21
|
-
excludePrivate: true,
|
|
22
|
-
githubPages: true,
|
|
23
|
-
includeVersion: true,
|
|
24
|
-
searchInComments: true,
|
|
25
|
-
skipErrorChecking: true,
|
|
26
|
-
treatWarningsAsErrors: true,
|
|
27
|
-
validation: {
|
|
28
|
-
notExported: true,
|
|
29
|
-
invalidLink: true,
|
|
30
|
-
notDocumented: true,
|
|
31
|
-
},
|
|
32
|
-
requiredToBeDocumented: exports.defaultDocumentationRequirements,
|
|
33
|
-
navigation: {
|
|
34
|
-
includeCategories: true,
|
|
35
|
-
},
|
|
36
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { UserConfig, UserConfigExport } from 'vite';
|
|
2
|
-
export declare const basePlugins: readonly [import("vite").PluginOption, import("vite").Plugin];
|
|
3
|
-
export declare function findGitRepoRoot(dir: string): string;
|
|
4
|
-
export type BaseConfigOptions = {
|
|
5
|
-
/** If your prod deploy is going to be GitHub pages, set this to true. */
|
|
6
|
-
forGitHubPages: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Path to the package directory that owns this vite config. Should most likely be left empty or
|
|
9
|
-
* set to resolve(__dirname, '..').
|
|
10
|
-
*/
|
|
11
|
-
packageDirPath?: string;
|
|
12
|
-
/** Disables printing of server directory paths. */
|
|
13
|
-
disableStartupLogs?: boolean;
|
|
14
|
-
};
|
|
15
|
-
export type ConfigPaths = {
|
|
16
|
-
srcDir: string;
|
|
17
|
-
staticDir: string;
|
|
18
|
-
outDir: string;
|
|
19
|
-
cwd: string;
|
|
20
|
-
};
|
|
21
|
-
export type OverrideCallback = (baseConfig: Readonly<UserConfig>, basePaths: Readonly<ConfigPaths>) => UserConfig | Promise<UserConfig>;
|
|
22
|
-
export declare function createBaseConfig({ forGitHubPages, packageDirPath }: BaseConfigOptions): {
|
|
23
|
-
baseConfig: UserConfig;
|
|
24
|
-
basePaths: ConfigPaths;
|
|
25
|
-
};
|
|
26
|
-
export declare function combineConfigs(baseConfigOptions: BaseConfigOptions, overrideCallback: OverrideCallback | undefined): Promise<UserConfig>;
|
|
27
|
-
export declare function defineConfig(baseConfigOptions: BaseConfigOptions, overrideCallback: OverrideCallback | undefined): UserConfigExport;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.basePlugins = void 0;
|
|
7
|
-
exports.findGitRepoRoot = findGitRepoRoot;
|
|
8
|
-
exports.createBaseConfig = createBaseConfig;
|
|
9
|
-
exports.combineConfigs = combineConfigs;
|
|
10
|
-
exports.defineConfig = defineConfig;
|
|
11
|
-
const node_js_1 = require("@augment-vir/node-js");
|
|
12
|
-
const fs_1 = require("fs");
|
|
13
|
-
const path_1 = require("path");
|
|
14
|
-
const vite_tsconfig_paths_1 = __importDefault(require("vite-tsconfig-paths"));
|
|
15
|
-
const vite_always_reload_plugin_1 = require("./vite-always-reload-plugin");
|
|
16
|
-
exports.basePlugins = [
|
|
17
|
-
(0, vite_always_reload_plugin_1.alwaysReloadPlugin)(),
|
|
18
|
-
(0, vite_tsconfig_paths_1.default)(),
|
|
19
|
-
];
|
|
20
|
-
function findGitRepoRoot(dir) {
|
|
21
|
-
if ((0, fs_1.existsSync)((0, path_1.join)(dir, '.git'))) {
|
|
22
|
-
return dir;
|
|
23
|
-
}
|
|
24
|
-
const nextDir = (0, path_1.dirname)(dir);
|
|
25
|
-
if (nextDir === dir) {
|
|
26
|
-
// failed to find an ancestor dir with a .git folder
|
|
27
|
-
return '';
|
|
28
|
-
}
|
|
29
|
-
return findGitRepoRoot(nextDir);
|
|
30
|
-
}
|
|
31
|
-
function createBaseConfig({ forGitHubPages, packageDirPath }) {
|
|
32
|
-
const cwd = packageDirPath || process.cwd();
|
|
33
|
-
const basePath = forGitHubPages && process.env.CI ? `/${(0, path_1.basename)(findGitRepoRoot(cwd))}` : '/';
|
|
34
|
-
const srcDir = (0, path_1.join)(cwd, 'src');
|
|
35
|
-
const staticDir = (0, path_1.join)(cwd, 'www-static');
|
|
36
|
-
const outDir = (0, path_1.join)(cwd, 'dist');
|
|
37
|
-
return {
|
|
38
|
-
baseConfig: {
|
|
39
|
-
clearScreen: false,
|
|
40
|
-
base: basePath,
|
|
41
|
-
publicDir: staticDir,
|
|
42
|
-
root: srcDir,
|
|
43
|
-
plugins: [
|
|
44
|
-
...exports.basePlugins,
|
|
45
|
-
],
|
|
46
|
-
build: {
|
|
47
|
-
outDir,
|
|
48
|
-
emptyOutDir: true,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
basePaths: {
|
|
52
|
-
cwd,
|
|
53
|
-
outDir,
|
|
54
|
-
srcDir,
|
|
55
|
-
staticDir,
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
async function combineConfigs(baseConfigOptions, overrideCallback) {
|
|
60
|
-
const { baseConfig, basePaths } = createBaseConfig(baseConfigOptions);
|
|
61
|
-
const fullConfig = overrideCallback
|
|
62
|
-
? await overrideCallback(baseConfig, basePaths)
|
|
63
|
-
: baseConfig;
|
|
64
|
-
if (!baseConfigOptions.disableStartupLogs) {
|
|
65
|
-
node_js_1.log.faint(`public dir: ${node_js_1.logColors.info}${(0, path_1.relative)(process.cwd(), fullConfig.publicDir || '')}${node_js_1.logColors.reset}`);
|
|
66
|
-
node_js_1.log.faint(`root dir: ${node_js_1.logColors.info}${(0, path_1.relative)(process.cwd(), fullConfig.root || '')}${node_js_1.logColors.reset}`);
|
|
67
|
-
node_js_1.log.faint(`out dir: ${node_js_1.logColors.info}${(0, path_1.relative)(process.cwd(), fullConfig.build?.outDir || '')}${node_js_1.logColors.reset}`);
|
|
68
|
-
node_js_1.log.faint(`base path: ${node_js_1.logColors.info}${fullConfig.base}${node_js_1.logColors.reset}`);
|
|
69
|
-
}
|
|
70
|
-
return fullConfig;
|
|
71
|
-
}
|
|
72
|
-
function defineConfig(baseConfigOptions, overrideCallback) {
|
|
73
|
-
return combineConfigs(baseConfigOptions, overrideCallback);
|
|
74
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PluginOption } from 'vite';
|
|
2
|
-
/**
|
|
3
|
-
* There are similar plugins out there that try to do this but they aren't aggressive enough. This
|
|
4
|
-
* plugin literally always reloads on save, no questions asked.
|
|
5
|
-
*/
|
|
6
|
-
export declare function alwaysReloadPlugin(config?: Partial<{
|
|
7
|
-
exclusions: string[];
|
|
8
|
-
/** Inclusions apply after exclusions so they will override exclusions. */
|
|
9
|
-
inclusions: string[];
|
|
10
|
-
}>): PluginOption;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.alwaysReloadPlugin = alwaysReloadPlugin;
|
|
4
|
-
const node_js_1 = require("@augment-vir/node-js");
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
/**
|
|
8
|
-
* Include actual paths and symlinked target paths if they exist.
|
|
9
|
-
*
|
|
10
|
-
* This is needed because when removing files from the watcher, sym links have be removed with the
|
|
11
|
-
* path to the symlink itself AND the path to the symlink target or the path will still be watched.
|
|
12
|
-
*/
|
|
13
|
-
function mapToActualPaths(paths) {
|
|
14
|
-
return paths.reduce((accum, path) => {
|
|
15
|
-
if ((0, fs_1.existsSync)(path)) {
|
|
16
|
-
if ((0, fs_1.lstatSync)(path).isSymbolicLink()) {
|
|
17
|
-
console.info('reading symlink from', path);
|
|
18
|
-
// sym links AND the original path both need to be included
|
|
19
|
-
return accum.concat((0, fs_1.readlinkSync)(path), path);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
return accum.concat(path);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
return accum;
|
|
27
|
-
}
|
|
28
|
-
}, []);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* There are similar plugins out there that try to do this but they aren't aggressive enough. This
|
|
32
|
-
* plugin literally always reloads on save, no questions asked.
|
|
33
|
-
*/
|
|
34
|
-
function alwaysReloadPlugin(config = {}) {
|
|
35
|
-
return {
|
|
36
|
-
name: 'alwaysReloadPlugin',
|
|
37
|
-
apply: 'serve',
|
|
38
|
-
config: () => ({ server: { watch: { disableGlobbing: false } } }),
|
|
39
|
-
handleHotUpdate() {
|
|
40
|
-
return [];
|
|
41
|
-
},
|
|
42
|
-
configureServer({ watcher, ws, config: { logger, publicDir = '', root = process.cwd() } }) {
|
|
43
|
-
const { inclusions = [], exclusions = [] } = config;
|
|
44
|
-
let callingAlready = false;
|
|
45
|
-
const oldInfoLog = logger.info;
|
|
46
|
-
function customInfoLog(message, options) {
|
|
47
|
-
/**
|
|
48
|
-
* Ignore vite's built-in extra page reload logging as this will duplicate our
|
|
49
|
-
* messages.
|
|
50
|
-
*/
|
|
51
|
-
if (message.startsWith('page reload')) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
oldInfoLog(message, options);
|
|
55
|
-
}
|
|
56
|
-
logger.info = customInfoLog;
|
|
57
|
-
function reloadCallback(path) {
|
|
58
|
-
// prevent duplicate calls cause the watcher is very eager to call callbacks multiple times in a row
|
|
59
|
-
if (!callingAlready) {
|
|
60
|
-
callingAlready = true;
|
|
61
|
-
ws.send({
|
|
62
|
-
type: 'full-reload',
|
|
63
|
-
path: '*',
|
|
64
|
-
});
|
|
65
|
-
logger.info(`${node_js_1.logColors.success}page reload ${node_js_1.logColors.faint}${(0, path_1.relative)(process.cwd(), path)}${node_js_1.logColors.reset}`, {
|
|
66
|
-
clear: true,
|
|
67
|
-
timestamp: true,
|
|
68
|
-
});
|
|
69
|
-
/**
|
|
70
|
-
* Debounce reloads calls so that they don't get spammed. If you're actually
|
|
71
|
-
* intentionally saving faster than this, then what the heck are you doing?
|
|
72
|
-
*/
|
|
73
|
-
setTimeout(() => {
|
|
74
|
-
callingAlready = false;
|
|
75
|
-
}, 100);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
watcher.add(root);
|
|
79
|
-
if (exclusions.length) {
|
|
80
|
-
watcher.unwatch(mapToActualPaths(exclusions));
|
|
81
|
-
}
|
|
82
|
-
// ignore macOS file system metadata stuff
|
|
83
|
-
watcher.unwatch('./**/.DS_Store');
|
|
84
|
-
if (inclusions.length) {
|
|
85
|
-
watcher.add(mapToActualPaths(inclusions));
|
|
86
|
-
}
|
|
87
|
-
if (publicDir) {
|
|
88
|
-
watcher.add(publicDir);
|
|
89
|
-
}
|
|
90
|
-
if (!watcher.listeners('change').includes(reloadCallback)) {
|
|
91
|
-
watcher.on('change', reloadCallback);
|
|
92
|
-
watcher.on('add', reloadCallback);
|
|
93
|
-
watcher.on('unlink', reloadCallback);
|
|
94
|
-
}
|
|
95
|
-
// // for debugging. Note that this isn't actually reliable, test the actual reloads.
|
|
96
|
-
// console.info({watched: watcher.getWatched()});
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const virmatorPackageDir: string;
|
|
2
|
-
export declare const virmatorConfigsDir: string;
|
|
3
|
-
export declare const virmatorConfigs: {
|
|
4
|
-
gitHubWorkflows: string;
|
|
5
|
-
vsCode: string;
|
|
6
|
-
src: string;
|
|
7
|
-
};
|
|
8
|
-
export declare function getNpmBinPath({ repoDir, command, packageDirPath, }: {
|
|
9
|
-
repoDir: string;
|
|
10
|
-
command: string;
|
|
11
|
-
packageDirPath: string;
|
|
12
|
-
}): Promise<string>;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.virmatorConfigs = exports.virmatorConfigsDir = exports.virmatorPackageDir = void 0;
|
|
4
|
-
exports.getNpmBinPath = getNpmBinPath;
|
|
5
|
-
const common_1 = require("@augment-vir/common");
|
|
6
|
-
const node_js_1 = require("@augment-vir/node-js");
|
|
7
|
-
const fs_1 = require("fs");
|
|
8
|
-
const path_1 = require("path");
|
|
9
|
-
const fs_2 = require("../augments/fs");
|
|
10
|
-
exports.virmatorPackageDir = (0, path_1.dirname)((0, path_1.dirname)(__dirname));
|
|
11
|
-
exports.virmatorConfigsDir = (0, path_1.join)(exports.virmatorPackageDir, 'configs');
|
|
12
|
-
exports.virmatorConfigs = {
|
|
13
|
-
gitHubWorkflows: (0, path_1.join)(exports.virmatorPackageDir, '.github', 'workflows'),
|
|
14
|
-
vsCode: (0, path_1.join)(exports.virmatorConfigsDir, '.vscode'),
|
|
15
|
-
src: (0, path_1.join)(exports.virmatorConfigsDir, 'src'),
|
|
16
|
-
};
|
|
17
|
-
async function getNpmBinPath({ repoDir, command, packageDirPath, }) {
|
|
18
|
-
return ((await getNpmBinPathInternal({ repoDir, command, packageDirPath })) ??
|
|
19
|
-
getNpmBinPathInternal({ repoDir, command, packageDirPath: exports.virmatorPackageDir }));
|
|
20
|
-
}
|
|
21
|
-
async function getNpmBinPathInternal({ repoDir, command, packageDirPath, }) {
|
|
22
|
-
const topLevelBinPath = (0, path_1.join)('node_modules', '.bin', command);
|
|
23
|
-
const internalPackageBinPath = (0, path_1.join)(packageDirPath, 'node_modules', '.bin', command);
|
|
24
|
-
const startSearchDirPath = repoDir;
|
|
25
|
-
try {
|
|
26
|
-
const nodeModulesWithValidBin = await (0, fs_2.recursivelyUpwardsSearchForDir)(startSearchDirPath, (dirPath) => {
|
|
27
|
-
return ((0, fs_1.existsSync)((0, path_1.join)(dirPath, topLevelBinPath)) ||
|
|
28
|
-
(0, fs_1.existsSync)((0, path_1.join)(dirPath, internalPackageBinPath)));
|
|
29
|
-
});
|
|
30
|
-
if (!nodeModulesWithValidBin) {
|
|
31
|
-
throw new Error(`Search failed to find "${command}" bin path. Started in "${startSearchDirPath}".`);
|
|
32
|
-
}
|
|
33
|
-
const foundTopLevelBinPath = (0, path_1.join)(nodeModulesWithValidBin, topLevelBinPath);
|
|
34
|
-
const foundInternalPackageBinPath = (0, path_1.join)(nodeModulesWithValidBin, internalPackageBinPath);
|
|
35
|
-
const actualBinPath = (0, fs_1.existsSync)(foundInternalPackageBinPath)
|
|
36
|
-
? foundInternalPackageBinPath
|
|
37
|
-
: foundTopLevelBinPath;
|
|
38
|
-
if (!(0, fs_1.existsSync)(actualBinPath)) {
|
|
39
|
-
throw new Error(`Discovered bin path for "${command}" does not actually exist: "${actualBinPath}". Started at "${startSearchDirPath}".`);
|
|
40
|
-
}
|
|
41
|
-
return (0, node_js_1.interpolationSafeWindowsPath)(actualBinPath);
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
throw new Error(`Failed to find npm bin path for "${command}": ${(0, common_1.extractErrorMessage)(error)}. Started at "${startSearchDirPath}".`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const node_js_1 = require("@augment-vir/node-js");
|
|
4
|
-
const promises_1 = require("fs/promises");
|
|
5
|
-
const __1 = require("..");
|
|
6
|
-
const command_to_help_message_1 = require("../api/command/command-to-help-message");
|
|
7
|
-
const prettier_1 = require("../augments/prettier");
|
|
8
|
-
const virmator_test_file_paths_1 = require("../test/virmator-test-file-paths");
|
|
9
|
-
const usageTrigger = '<!-- usage below -->';
|
|
10
|
-
async function main(args) {
|
|
11
|
-
const check = args.join(' ').includes('check');
|
|
12
|
-
const helpMessage = (0, command_to_help_message_1.generateHelpMessage)(__1.virmator.packageBinName, __1.virmator.commandMapping, command_to_help_message_1.HelpMessageSyntax.Markdown);
|
|
13
|
-
const originalReadme = (await (0, promises_1.readFile)(virmator_test_file_paths_1.virmatorReadme)).toString();
|
|
14
|
-
const triggerIndex = originalReadme.indexOf(usageTrigger);
|
|
15
|
-
if (triggerIndex === -1) {
|
|
16
|
-
throw new Error(`Could not find the trigger "${usageTrigger}" in the README file: ${virmator_test_file_paths_1.virmatorReadme}`);
|
|
17
|
-
}
|
|
18
|
-
const newReadme = await (0, prettier_1.formatCode)(`${originalReadme.slice(0, triggerIndex + usageTrigger.length)}\n\n${helpMessage}`, 'README.md');
|
|
19
|
-
await (0, promises_1.writeFile)(virmator_test_file_paths_1.virmatorReadme, newReadme);
|
|
20
|
-
if (check) {
|
|
21
|
-
const formattedReadme = (await (0, promises_1.readFile)(virmator_test_file_paths_1.virmatorReadme)).toString();
|
|
22
|
-
const wasReadmeChanged = formattedReadme !== originalReadme;
|
|
23
|
-
await (0, promises_1.writeFile)(virmator_test_file_paths_1.virmatorReadme, originalReadme);
|
|
24
|
-
if (wasReadmeChanged) {
|
|
25
|
-
console.info(`${node_js_1.logColors.bold}${node_js_1.logColors.error}README usage message is not up to date.${node_js_1.logColors.reset}\nRun ${node_js_1.logColors.info}npm run docs${node_js_1.logColors.reset} to update.\n`);
|
|
26
|
-
throw new Error(`README not up to date.`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
main(process.argv.slice(2)).catch((error) => {
|
|
31
|
-
console.error(error);
|
|
32
|
-
process.exit(1);
|
|
33
|
-
});
|
package/mocha.config.cjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const baseOptions = require('./base-configs/base-mocharc.cjs');
|
|
2
|
-
const SpecReporterWithFileNames = require('mocha-spec-reporter-with-file-names');
|
|
3
|
-
|
|
4
|
-
const oneMinuteMs = 60_000;
|
|
5
|
-
|
|
6
|
-
/** @type {import('mocha').MochaOptions} */
|
|
7
|
-
const mochaConfig = {
|
|
8
|
-
...baseOptions,
|
|
9
|
-
slow: oneMinuteMs,
|
|
10
|
-
timeout: 20 * oneMinuteMs,
|
|
11
|
-
// heavy modification of files requires parallel to be off
|
|
12
|
-
parallel: false,
|
|
13
|
-
reporter: SpecReporterWithFileNames.pathToThisReporter,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
module.exports = mochaConfig;
|