@w5s/mrm-preset 3.5.6 → 3.5.8
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +11 -11
- package/.turbo/turbo-test.log +23 -258
- package/CHANGELOG.md +8 -0
- package/asdf/{index.js → index.cjs} +1 -1
- package/bootstrap/{index.js → index.cjs} +11 -10
- package/ci/_gitlab/Renovate.gitlab-ci.yml +1 -1
- package/ci/{github.js → github.cjs} +10 -10
- package/ci/{gitlab.js → gitlab.cjs} +1 -2
- package/ci/{index.js → index.cjs} +4 -4
- package/commitlint/{index.js → index.cjs} +3 -3
- package/core/{asdf.js → asdf.cjs} +2 -2
- package/core/{commitlint.js → commitlint.cjs} +5 -5
- package/core/{cspell.js → cspell.cjs} +5 -4
- package/core/{eslint.js → eslint.cjs} +5 -4
- package/core/{git.js → git.cjs} +4 -3
- package/core/{githooks.js → githooks.cjs} +3 -3
- package/core/{jest.js → jest.cjs} +11 -10
- package/core/{jsonFile.js → jsonFile.cjs} +1 -1
- package/core/{lintStaged.js → lintStaged.cjs} +4 -4
- package/core/{npm.js → npm.cjs} +204 -205
- package/core/{pkg.js → pkg.cjs} +71 -69
- package/core/{semanticRelease.js → semanticRelease.cjs} +7 -7
- package/core/{turbo.js → turbo.cjs} +5 -4
- package/core/{typedoc.js → typedoc.cjs} +9 -8
- package/core/{vitest.js → vitest.cjs} +8 -7
- package/core/{vscode.js → vscode.cjs} +1 -1
- package/cspell/{index.js → index.cjs} +8 -8
- package/editorconfig/{index.js → index.cjs} +4 -3
- package/eslint/{index.js → index.cjs} +10 -9
- package/githooks/{index.js → index.cjs} +12 -11
- package/gitignore/{index.js → index.cjs} +1 -1
- package/lang/{index.js → index.cjs} +4 -4
- package/licenses/{index.js → index.cjs} +5 -4
- package/package.json +4 -4
- package/package.json.backup +9 -9
- package/post-configure/{index.js → index.cjs} +5 -4
- package/project/{index.js → index.cjs} +65 -64
- package/release/{index.js → index.cjs} +6 -5
- package/renovate/{index.js → index.cjs} +3 -2
- package/vitest/{index.js → index.cjs} +1 -1
- package/contributing/{index.js → index.cjs} +1 -1
- package/core/{git.ignore.js → git.ignore.cjs} +27 -27
- package/core/{githubCI.js → githubCI.cjs} +2 -2
- package/core/{gitlabCI.js → gitlabCI.cjs} +0 -0
- package/core/{project.js → project.cjs} +8 -8
package/core/{pkg.js → pkg.cjs}
RENAMED
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
* @typedef {string|boolean|number|null|Array<unknown>|Record<string, unknown>} JsonValue
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
const glob = require('glob');
|
|
9
|
+
const { file, json, packageJson } = require('mrm-core');
|
|
8
10
|
const path = require('node:path');
|
|
9
11
|
// @ts-ignore
|
|
10
12
|
const { intersect } = require('semver-intersect');
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const jsonFile = require('./jsonFile.js');
|
|
13
|
+
|
|
14
|
+
const jsonFile = require('./jsonFile.cjs');
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* An empty placeholder for npm script
|
|
@@ -32,23 +33,6 @@ function archetype(packageFile) {
|
|
|
32
33
|
return 'library';
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
/**
|
|
36
|
-
* @param {(pkg: import('mrm-core').PackageJson) => void} block
|
|
37
|
-
*/
|
|
38
|
-
function withPackageJson(block) {
|
|
39
|
-
const packageFile = packageJson();
|
|
40
|
-
block(packageFile);
|
|
41
|
-
packageFile.save();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @param {import("mrm-core").Json} packageFile
|
|
46
|
-
* @returns {string[]} - The list of workspace matchers
|
|
47
|
-
*/
|
|
48
|
-
function listWorkspaceMatchers(packageFile) {
|
|
49
|
-
return packageFile.get('workspaces.packages', packageFile.get('workspaces', []));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
36
|
/**
|
|
53
37
|
* @param {(workspace: {
|
|
54
38
|
* projectDir: string;
|
|
@@ -61,17 +45,26 @@ function forEachWorkspace(fn) {
|
|
|
61
45
|
|
|
62
46
|
for (const workspaceMatcher of workspacesMatchers) {
|
|
63
47
|
const directories = glob.sync(workspaceMatcher);
|
|
48
|
+
// eslint-disable-next-line unicorn/no-for-each
|
|
64
49
|
directories.forEach((directory) => {
|
|
65
50
|
const packageFile = json(path.join(directory, 'package.json'));
|
|
66
51
|
fn({
|
|
67
|
-
projectDir: directory,
|
|
68
52
|
packageFile,
|
|
53
|
+
projectDir: directory,
|
|
69
54
|
});
|
|
70
55
|
packageFile.save();
|
|
71
56
|
});
|
|
72
57
|
}
|
|
73
58
|
}
|
|
74
59
|
|
|
60
|
+
/**
|
|
61
|
+
* @param {import("mrm-core").Json} packageFile
|
|
62
|
+
* @returns {string[]} - The list of workspace matchers
|
|
63
|
+
*/
|
|
64
|
+
function listWorkspaceMatchers(packageFile) {
|
|
65
|
+
return packageFile.get('workspaces.packages', packageFile.get('workspaces', []));
|
|
66
|
+
}
|
|
67
|
+
|
|
75
68
|
/**
|
|
76
69
|
* @template {undefined|JsonValue} T
|
|
77
70
|
* @param {import('mrm-core').Json} packageFile
|
|
@@ -89,37 +82,42 @@ function script(packageFile, options) {
|
|
|
89
82
|
});
|
|
90
83
|
}
|
|
91
84
|
|
|
92
|
-
const defaultManager = 'npm';
|
|
93
|
-
|
|
94
85
|
/**
|
|
95
|
-
* @param {import('mrm-core').PackageJson}
|
|
96
|
-
* @returns {'yarn'|'npm'|'pnpm'} - The manager used by the package
|
|
86
|
+
* @param {(pkg: import('mrm-core').PackageJson) => void} block
|
|
97
87
|
*/
|
|
98
|
-
function
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return head ?? tail;
|
|
103
|
-
}
|
|
104
|
-
if (file('yarn.lock').exists()) {
|
|
105
|
-
return 'yarn';
|
|
106
|
-
}
|
|
107
|
-
if (file('package-lock.json').exists()) {
|
|
108
|
-
return 'npm';
|
|
109
|
-
}
|
|
110
|
-
if (file('pnpm-lock.yaml').exists()) {
|
|
111
|
-
return 'pnpm';
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return defaultManager;
|
|
88
|
+
function withPackageJson(block) {
|
|
89
|
+
const packageFile = packageJson();
|
|
90
|
+
block(packageFile);
|
|
91
|
+
packageFile.save();
|
|
115
92
|
}
|
|
116
93
|
|
|
94
|
+
const defaultManager = 'npm';
|
|
95
|
+
|
|
117
96
|
/**
|
|
118
97
|
*
|
|
119
98
|
* @param {import('mrm-core').Json} packageFile
|
|
99
|
+
* @param {Record<string, string>} engineVersionMap
|
|
120
100
|
*/
|
|
121
|
-
function
|
|
122
|
-
|
|
101
|
+
function engineMinVersion(packageFile, engineVersionMap) {
|
|
102
|
+
/**
|
|
103
|
+
* @param {string} engineName
|
|
104
|
+
*/
|
|
105
|
+
const engineConstraint = (engineName) => {
|
|
106
|
+
const defaultVersion = engineVersionMap[engineName];
|
|
107
|
+
const currentVersion = packageFile.get(`engines.${engineName}`, defaultVersion);
|
|
108
|
+
try {
|
|
109
|
+
return intersect(currentVersion, defaultVersion);
|
|
110
|
+
} catch {
|
|
111
|
+
return currentVersion; // leave unchanged
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
packageFile.merge({
|
|
116
|
+
engines: Object.fromEntries(
|
|
117
|
+
Object.keys(engineVersionMap).map((engineName) => [engineName, engineConstraint(engineName)]),
|
|
118
|
+
),
|
|
119
|
+
});
|
|
120
|
+
return packageFile.get('engines');
|
|
123
121
|
}
|
|
124
122
|
|
|
125
123
|
/**
|
|
@@ -145,40 +143,44 @@ function hasDependency(packageFile, packageName, dependencyType) {
|
|
|
145
143
|
/**
|
|
146
144
|
*
|
|
147
145
|
* @param {import('mrm-core').Json} packageFile
|
|
148
|
-
* @param {Record<string, string>} engineVersionMap
|
|
149
146
|
*/
|
|
150
|
-
function
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
*/
|
|
154
|
-
const engineConstraint = (engineName) => {
|
|
155
|
-
const defaultVersion = engineVersionMap[engineName];
|
|
156
|
-
const currentVersion = packageFile.get(`engines.${engineName}`, defaultVersion);
|
|
157
|
-
try {
|
|
158
|
-
return intersect(currentVersion, defaultVersion);
|
|
159
|
-
} catch {
|
|
160
|
-
return currentVersion; // leave unchanged
|
|
161
|
-
}
|
|
162
|
-
};
|
|
147
|
+
function hasWorkspaces(packageFile) {
|
|
148
|
+
return Boolean(packageFile.get('workspaces'));
|
|
149
|
+
}
|
|
163
150
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
151
|
+
/**
|
|
152
|
+
* @param {import('mrm-core').PackageJson} packageFile
|
|
153
|
+
* @returns {'yarn'|'npm'|'pnpm'} - The manager used by the package
|
|
154
|
+
*/
|
|
155
|
+
function manager(packageFile) {
|
|
156
|
+
if (packageFile.get('packageManager')) {
|
|
157
|
+
const [head, tail] = packageFile.get('packageManager').split('@', 2);
|
|
158
|
+
|
|
159
|
+
return head ?? tail;
|
|
160
|
+
}
|
|
161
|
+
if (file('yarn.lock').exists()) {
|
|
162
|
+
return 'yarn';
|
|
163
|
+
}
|
|
164
|
+
if (file('package-lock.json').exists()) {
|
|
165
|
+
return 'npm';
|
|
166
|
+
}
|
|
167
|
+
if (file('pnpm-lock.yaml').exists()) {
|
|
168
|
+
return 'pnpm';
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return defaultManager;
|
|
170
172
|
}
|
|
171
173
|
|
|
172
174
|
module.exports = {
|
|
173
175
|
...jsonFile,
|
|
174
|
-
emptyScript,
|
|
175
176
|
archetype,
|
|
176
|
-
|
|
177
|
-
manager,
|
|
177
|
+
emptyScript,
|
|
178
178
|
engineMinVersion,
|
|
179
|
+
forEachWorkspace,
|
|
179
180
|
hasDependency,
|
|
180
181
|
hasWorkspaces,
|
|
181
|
-
withPackageJson,
|
|
182
|
-
forEachWorkspace,
|
|
183
182
|
listWorkspaceMatchers,
|
|
183
|
+
manager,
|
|
184
|
+
script,
|
|
185
|
+
withPackageJson,
|
|
184
186
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
1
|
+
const jsonFile = require('./jsonFile.cjs');
|
|
2
|
+
const npm = require('./npm.cjs');
|
|
3
|
+
const pkg = require('./pkg.cjs');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {{
|
|
@@ -15,7 +15,7 @@ const jsonFile = require('./jsonFile.js');
|
|
|
15
15
|
* update?: (config: SemanticReleaseConfig) => SemanticReleaseConfig
|
|
16
16
|
* }} options
|
|
17
17
|
*/
|
|
18
|
-
function semanticRelease({ state, update
|
|
18
|
+
function semanticRelease({ preset, state, update }) {
|
|
19
19
|
npm.dependency({
|
|
20
20
|
dev: true,
|
|
21
21
|
name: ['semantic-release', ...(preset ? [preset] : [])],
|
|
@@ -24,13 +24,13 @@ function semanticRelease({ state, update, preset }) {
|
|
|
24
24
|
|
|
25
25
|
pkg.withPackageJson((packageFile) => {
|
|
26
26
|
jsonFile.value(packageFile, {
|
|
27
|
-
path: 'release',
|
|
28
|
-
state,
|
|
29
|
-
update,
|
|
30
27
|
/** @type {SemanticReleaseConfig} */
|
|
31
28
|
default: {
|
|
32
29
|
extends: preset ? [preset] : [],
|
|
33
30
|
},
|
|
31
|
+
path: 'release',
|
|
32
|
+
state,
|
|
33
|
+
update,
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
36
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const { json } = require('mrm-core');
|
|
2
|
-
|
|
3
|
-
const jsonFile = require('./jsonFile.
|
|
2
|
+
|
|
3
|
+
const jsonFile = require('./jsonFile.cjs');
|
|
4
|
+
const npm = require('./npm.cjs');
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* @typedef {{
|
|
@@ -23,14 +24,14 @@ function turbo({ state, update }) {
|
|
|
23
24
|
|
|
24
25
|
if (hasTurbo) {
|
|
25
26
|
jsonFile.value(turboFile, {
|
|
27
|
+
/** @type {TurboConfig} */
|
|
28
|
+
default: {},
|
|
26
29
|
path: undefined,
|
|
27
30
|
state,
|
|
28
31
|
update: (previousValue) => ({
|
|
29
32
|
$schema: 'https://turbo.build/schema.json',
|
|
30
33
|
...update(previousValue),
|
|
31
34
|
}),
|
|
32
|
-
/** @type {TurboConfig} */
|
|
33
|
-
default: {},
|
|
34
35
|
});
|
|
35
36
|
|
|
36
37
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
const {
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
const { json, packageJson } = require('mrm-core');
|
|
2
|
+
|
|
3
|
+
const jsonFile = require('./jsonFile.cjs');
|
|
4
|
+
const npm = require('./npm.cjs');
|
|
5
|
+
const pkg = require('./pkg.cjs');
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @typedef {{
|
|
@@ -30,22 +31,22 @@ function typedoc({ state, update }) {
|
|
|
30
31
|
|
|
31
32
|
if (hasTypedoc) {
|
|
32
33
|
jsonFile.value(typedocFile, {
|
|
34
|
+
/** @type {TypeDocConfig} */
|
|
35
|
+
default: {},
|
|
33
36
|
path: undefined,
|
|
34
37
|
state,
|
|
35
38
|
update: (config) => ({
|
|
36
39
|
...update(config),
|
|
37
40
|
...(hasWorkspaces
|
|
38
41
|
? {
|
|
39
|
-
entryPointStrategy: 'packages',
|
|
40
42
|
entryPoints: undefined,
|
|
43
|
+
entryPointStrategy: 'packages',
|
|
41
44
|
}
|
|
42
45
|
: {
|
|
43
|
-
entryPointStrategy: undefined,
|
|
44
46
|
entryPoints: ['src/index.ts'],
|
|
47
|
+
entryPointStrategy: undefined,
|
|
45
48
|
}),
|
|
46
49
|
}),
|
|
47
|
-
/** @type {TypeDocConfig} */
|
|
48
|
-
default: {},
|
|
49
50
|
});
|
|
50
51
|
|
|
51
52
|
/**
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
const fs = require('node:fs');
|
|
2
1
|
const { file, packageJson } = require('mrm-core');
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
const
|
|
2
|
+
const fs = require('node:fs');
|
|
3
|
+
|
|
4
|
+
const npm = require('./npm.cjs');
|
|
5
|
+
const pkg = require('./pkg.cjs');
|
|
6
|
+
const project = require('./project.cjs');
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @param {{
|
|
@@ -32,12 +33,12 @@ function vitest({ state }) {
|
|
|
32
33
|
vitestVersion = packageFile.get('devDependencies.vitest');
|
|
33
34
|
pkg.script(packageFile, {
|
|
34
35
|
name: `${project.test}:root`,
|
|
35
|
-
update,
|
|
36
36
|
state: hasWorkspace ? 'absent' : 'present',
|
|
37
|
+
update,
|
|
37
38
|
});
|
|
38
39
|
});
|
|
39
40
|
|
|
40
|
-
pkg.forEachWorkspace(({
|
|
41
|
+
pkg.forEachWorkspace(({ packageFile, projectDir }) => {
|
|
41
42
|
const hasSrc = fs.existsSync(`${projectDir}/src`);
|
|
42
43
|
const packageState = hasVitest && hasSrc ? 'present' : 'absent';
|
|
43
44
|
pkg.value(packageFile, {
|
|
@@ -52,8 +53,8 @@ function vitest({ state }) {
|
|
|
52
53
|
});
|
|
53
54
|
pkg.script(packageFile, {
|
|
54
55
|
name: `${project.test}:src`,
|
|
55
|
-
update,
|
|
56
56
|
state: packageState,
|
|
57
|
+
update,
|
|
57
58
|
});
|
|
58
59
|
const viteConfig = file(`${projectDir}/vite.config.mts`);
|
|
59
60
|
if (packageState === 'absent') {
|
|
@@ -67,7 +67,7 @@ exports.vscodeTask = vscodeTask;
|
|
|
67
67
|
* }
|
|
68
68
|
* }} snippets
|
|
69
69
|
*/
|
|
70
|
-
function vscodeSnippets({ name = 'mrm', state = 'present'
|
|
70
|
+
function vscodeSnippets({ name = 'mrm', snippets, state = 'present' }) {
|
|
71
71
|
const snippetFile = json(`.vscode/${name}.code-snippets`);
|
|
72
72
|
if (state === 'present') {
|
|
73
73
|
snippetFile.merge(snippets);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const { cspell } = require('../core/cspell.
|
|
2
|
-
const
|
|
3
|
-
const pkg = require('../core/pkg.
|
|
4
|
-
const
|
|
1
|
+
const { cspell } = require('../core/cspell.cjs');
|
|
2
|
+
const npm = require('../core/npm.cjs');
|
|
3
|
+
const pkg = require('../core/pkg.cjs');
|
|
4
|
+
const project = require('../core/project.cjs');
|
|
5
5
|
|
|
6
6
|
function task() {
|
|
7
7
|
const preset = '@w5s/cspell-config';
|
|
@@ -23,22 +23,22 @@ function task() {
|
|
|
23
23
|
const workspaceMatchers = pkg.listWorkspaceMatchers(packageFile);
|
|
24
24
|
pkg.script(packageFile, {
|
|
25
25
|
name: project.spellcheck,
|
|
26
|
-
update: `turbo run spellcheck`,
|
|
27
26
|
state: 'present',
|
|
27
|
+
update: `turbo run spellcheck`,
|
|
28
28
|
});
|
|
29
29
|
pkg.script(packageFile, {
|
|
30
30
|
name: `${project.spellcheck}:root`,
|
|
31
|
+
state: 'present',
|
|
31
32
|
update: `cspell --no-progress '**' ${
|
|
32
|
-
hasWorkspaces ?
|
|
33
|
+
hasWorkspaces ? (workspaceMatchers.map((_) => `--exclude='${_}/**'`).join(' ')) : ''
|
|
33
34
|
}`,
|
|
34
|
-
state: 'present',
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
37
|
pkg.forEachWorkspace(({ packageFile }) => {
|
|
38
38
|
pkg.script(packageFile, {
|
|
39
39
|
name: project.spellcheck,
|
|
40
|
-
update: `cspell --no-progress '**'`,
|
|
41
40
|
state: 'present',
|
|
41
|
+
update: `cspell --no-progress '**'`,
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
44
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
const { readFileSync } = require('node:fs');
|
|
2
1
|
const { blockSync } = require('@w5s/configurator-core');
|
|
3
|
-
const {
|
|
2
|
+
const { readFileSync } = require('node:fs');
|
|
3
|
+
|
|
4
|
+
const { vscodeRecommendedExtension } = require('../core/vscode.cjs');
|
|
4
5
|
|
|
5
6
|
function task() {
|
|
6
7
|
const templateContent = readFileSync(require.resolve('./_editorconfig'), 'utf8').slice(0, -1);
|
|
7
8
|
|
|
8
9
|
blockSync({
|
|
9
10
|
block: templateContent,
|
|
10
|
-
path: '.editorconfig',
|
|
11
11
|
insertPosition: ['before', 'BeginningOfFile'],
|
|
12
|
+
path: '.editorconfig',
|
|
12
13
|
});
|
|
13
14
|
|
|
14
15
|
vscodeRecommendedExtension({
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
const { packageJson } = require('mrm-core');
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
2
|
+
|
|
3
|
+
const { eslintConfig } = require('../core/eslint.cjs');
|
|
4
|
+
const npm = require('../core/npm.cjs');
|
|
5
|
+
const pkg = require('../core/pkg.cjs');
|
|
6
|
+
const project = require('../core/project.cjs');
|
|
7
|
+
const { vscodeRecommendedExtension, vscodeSettings } = require('../core/vscode.cjs');
|
|
7
8
|
|
|
8
9
|
function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended' }) {
|
|
9
10
|
/**
|
|
@@ -54,13 +55,13 @@ function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended'
|
|
|
54
55
|
// workspaces
|
|
55
56
|
pkg.script(packageFile, {
|
|
56
57
|
name: `${project.lint}:root`,
|
|
57
|
-
update: `eslint .${extOption}${hasWorkspaces ? ignorePatterns : ''}`,
|
|
58
58
|
state: 'present',
|
|
59
|
+
update: `eslint .${extOption}${hasWorkspaces ? ignorePatterns : ''}`,
|
|
59
60
|
});
|
|
60
61
|
pkg.script(packageFile, {
|
|
61
62
|
name: `${project.format}:root`,
|
|
62
|
-
update: `eslint .${extOption}${hasWorkspaces ? ignorePatterns : ''} --fix`,
|
|
63
63
|
state: 'present',
|
|
64
|
+
update: `eslint .${extOption}${hasWorkspaces ? ignorePatterns : ''} --fix`,
|
|
64
65
|
});
|
|
65
66
|
|
|
66
67
|
// clean
|
|
@@ -88,13 +89,13 @@ function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended'
|
|
|
88
89
|
: _);
|
|
89
90
|
pkg.script(packageFile, {
|
|
90
91
|
name: `${project.lint}:src`,
|
|
91
|
-
update: updater(false),
|
|
92
92
|
state: 'present',
|
|
93
|
+
update: updater(false),
|
|
93
94
|
});
|
|
94
95
|
pkg.script(packageFile, {
|
|
95
96
|
name: `${project.format}:src`,
|
|
96
|
-
update: updater(true),
|
|
97
97
|
state: 'present',
|
|
98
|
+
update: updater(true),
|
|
98
99
|
});
|
|
99
100
|
});
|
|
100
101
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
const path = require('node:path');
|
|
2
|
-
const { packageJson, template } = require('mrm-core');
|
|
3
1
|
const { fileSync } = require('@w5s/configurator-core');
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const {
|
|
8
|
-
const {
|
|
2
|
+
const { packageJson, template } = require('mrm-core');
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
|
|
5
|
+
const { hasGit } = require('../core/git.cjs');
|
|
6
|
+
const { gitHook } = require('../core/githooks.cjs');
|
|
7
|
+
const { lintStaged } = require('../core/lintStaged.cjs');
|
|
8
|
+
const pkg = require('../core/pkg.cjs');
|
|
9
|
+
const project = require('../core/project.cjs');
|
|
9
10
|
|
|
10
11
|
function task() {
|
|
11
12
|
const gitSupported = hasGit();
|
|
@@ -16,14 +17,14 @@ function task() {
|
|
|
16
17
|
state: gitSupported ? 'present' : 'absent',
|
|
17
18
|
update: (config) => ({
|
|
18
19
|
...config,
|
|
19
|
-
'*.{json,jsonc,json5}': [...(hasESLint ? ['eslint'] : [])],
|
|
20
|
-
'*.{yml,yaml}': [...(hasESLint ? ['eslint'] : [])],
|
|
21
20
|
'*.js?(x)': [...(hasESLint ? ['eslint'] : [])],
|
|
22
21
|
'*.ts?(x)': [
|
|
23
22
|
// TODO: https://github.com/okonet/lint-staged/issues/825
|
|
24
23
|
// ...(hasTsc ? ["tsc --noEmit --skipLibCheck"] : []),
|
|
25
24
|
...(hasESLint ? ['eslint'] : []),
|
|
26
25
|
],
|
|
26
|
+
'*.{json,jsonc,json5}': [...(hasESLint ? ['eslint'] : [])],
|
|
27
|
+
'*.{yml,yaml}': [...(hasESLint ? ['eslint'] : [])],
|
|
27
28
|
}),
|
|
28
29
|
});
|
|
29
30
|
pkg.withPackageJson((_packageFile) => {
|
|
@@ -37,13 +38,13 @@ function task() {
|
|
|
37
38
|
});
|
|
38
39
|
|
|
39
40
|
gitHook({
|
|
40
|
-
name: 'pre-commit',
|
|
41
41
|
content: `npm exec -- lint-staged`,
|
|
42
|
+
name: 'pre-commit',
|
|
42
43
|
state: gitSupported ? 'present' : 'absent',
|
|
43
44
|
});
|
|
44
45
|
gitHook({
|
|
45
|
-
name: 'pre-push',
|
|
46
46
|
content: `npm run ${project.validate}`,
|
|
47
|
+
name: 'pre-push',
|
|
47
48
|
state: gitSupported ? 'present' : 'absent',
|
|
48
49
|
});
|
|
49
50
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const path = require('node:path');
|
|
2
2
|
const { json, file, template, packageJson } = require('mrm-core');
|
|
3
|
-
const npm = require('../core/npm.
|
|
4
|
-
const project = require('../core/project.
|
|
5
|
-
// const { typedoc } = require('../core/typedoc.
|
|
6
|
-
const pkg = require('../core/pkg.
|
|
3
|
+
const npm = require('../core/npm.cjs');
|
|
4
|
+
const project = require('../core/project.cjs');
|
|
5
|
+
// const { typedoc } = require('../core/typedoc.cjs');
|
|
6
|
+
const pkg = require('../core/pkg.cjs');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
const { packageJson } = require('mrm-core');
|
|
2
|
-
|
|
3
|
-
const jsonFile = require('../core/jsonFile.
|
|
2
|
+
|
|
3
|
+
const jsonFile = require('../core/jsonFile.cjs');
|
|
4
|
+
const pkg = require('../core/pkg.cjs');
|
|
4
5
|
|
|
5
6
|
function task() {
|
|
6
7
|
pkg.withPackageJson((packageFile) => {
|
|
7
8
|
jsonFile.value(packageFile, {
|
|
9
|
+
default: 'UNLICENSED',
|
|
8
10
|
path: 'license',
|
|
9
11
|
state: 'present',
|
|
10
|
-
default: 'UNLICENSED',
|
|
11
12
|
});
|
|
12
13
|
});
|
|
13
14
|
const license = packageJson().get('license');
|
|
14
15
|
|
|
15
16
|
pkg.forEachWorkspace(({ packageFile }) => {
|
|
16
17
|
jsonFile.value(packageFile, {
|
|
18
|
+
default: license,
|
|
17
19
|
path: 'license',
|
|
18
20
|
state: 'present',
|
|
19
|
-
default: license,
|
|
20
21
|
});
|
|
21
22
|
});
|
|
22
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/mrm-preset",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.8",
|
|
4
4
|
"description": "Mrm configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mrm",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"postpack": "clean-package restore"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@w5s/configurator-core": "^1.0.0-alpha.
|
|
28
|
-
"@w5s/dev": "^3.4.
|
|
27
|
+
"@w5s/configurator-core": "^1.0.0-alpha.9",
|
|
28
|
+
"@w5s/dev": "^3.4.8",
|
|
29
29
|
"debug": "^4.3.3",
|
|
30
30
|
"glob": "^13.0.0",
|
|
31
31
|
"mrm-core": "^7.0.0",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"sideEffect": false,
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "e6c63e0164ce2199e59bdca360f4766b6a78584d"
|
|
43
43
|
}
|
package/package.json.backup
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/mrm-preset",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.8",
|
|
4
4
|
"description": "Mrm configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mrm",
|
|
@@ -22,25 +22,25 @@
|
|
|
22
22
|
"main": "config.json",
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "pnpm run \"/^build:.*/\"",
|
|
25
|
-
"build:tsc": "tsc",
|
|
25
|
+
"build:tsc": "pnpm exec tsc",
|
|
26
26
|
"clean": "pnpm run \"/^clean:.*/\"",
|
|
27
27
|
"clean:tsc": "rm -rf dist",
|
|
28
28
|
"docs": "node ../../markdown.mjs",
|
|
29
29
|
"format": "pnpm run \"/^format:.*/\"",
|
|
30
|
-
"format:src": "eslint . --fix",
|
|
30
|
+
"format:src": "pnpm exec eslint . --fix",
|
|
31
31
|
"lint": "pnpm run \"/^lint:.*/\"",
|
|
32
|
-
"lint:src": "eslint .",
|
|
32
|
+
"lint:src": "pnpm exec eslint .",
|
|
33
33
|
"postpack": "clean-package restore",
|
|
34
34
|
"prepack": "clean-package",
|
|
35
|
-
"spellcheck": "cspell --no-progress '**'",
|
|
35
|
+
"spellcheck": "pnpm exec cspell --no-progress '**'",
|
|
36
36
|
"test": "pnpm run \"/^test:.*/\"",
|
|
37
37
|
"test:script": "mkdir -p .temp; cd .temp; mrm bootstrap --dir ..; mrm configure --dir ..",
|
|
38
38
|
"typecheck": "pnpm run \"/^typecheck:.*/\"",
|
|
39
|
-
"typecheck:src": "tsc --noEmit"
|
|
39
|
+
"typecheck:src": "pnpm exec tsc --noEmit"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@w5s/configurator-core": "^1.0.0-alpha.
|
|
43
|
-
"@w5s/dev": "^3.4.
|
|
42
|
+
"@w5s/configurator-core": "^1.0.0-alpha.9",
|
|
43
|
+
"@w5s/dev": "^3.4.8",
|
|
44
44
|
"debug": "^4.3.3",
|
|
45
45
|
"glob": "^13.0.0",
|
|
46
46
|
"mrm-core": "^7.0.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
62
|
"sideEffect": false,
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "e6c63e0164ce2199e59bdca360f4766b6a78584d"
|
|
64
64
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
const { spawnSync } = require('node:child_process');
|
|
2
1
|
const { packageJson } = require('mrm-core');
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
const npm = require('../core/npm.
|
|
2
|
+
const { spawnSync } = require('node:child_process');
|
|
3
|
+
|
|
4
|
+
const npm = require('../core/npm.cjs');
|
|
5
|
+
const pkg = require('../core/pkg.cjs');
|
|
6
|
+
const project = require('../core/project.cjs');
|
|
6
7
|
|
|
7
8
|
function task() {
|
|
8
9
|
// Remove old deps
|