@w5s/mrm-preset 1.0.0-alpha.11 → 1.0.0-alpha.14
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-docs.log +1 -1
- package/.turbo/turbo-format.log +1 -0
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-spellcheck.log +2 -0
- package/.turbo/turbo-test.log +2 -1
- package/CHANGELOG.md +45 -0
- package/core/cspell.js +0 -9
- package/core/jest.js +1 -6
- package/core/pkg.js +40 -5
- package/core/project.js +6 -0
- package/core/turbo.js +56 -0
- package/cspell/index.js +21 -0
- package/eslint/index.js +60 -12
- package/package.json +6 -4
- package/project/index.js +49 -36
package/.turbo/turbo-build.log
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@w5s/mrm-preset:build: cache hit, replaying output
|
|
1
|
+
@w5s/mrm-preset:build: cache hit, replaying output c6b4f1c7f63e49b4
|
package/.turbo/turbo-docs.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@w5s/mrm-preset:docs: cache hit, replaying output
|
|
1
|
+
@w5s/mrm-preset:docs: cache hit, replaying output 744547a9c29d1593
|
|
2
2
|
@w5s/mrm-preset:docs: Starting markdown-magic [ '**/*.md', '!node_modules/**' ]
|
|
3
3
|
@w5s/mrm-preset:docs: ℹ Notice:
|
|
4
4
|
@w5s/mrm-preset:docs: Missing transforms "BASIC_RULES","JSX_RULES" in _tester/node_modules/eslint-plugin-react/README.md
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@w5s/mrm-preset:format: cache hit, replaying output [2m3dd24b3a1f0380bc[0m
|
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@w5s/mrm-preset:lint: cache hit, replaying output
|
|
1
|
+
@w5s/mrm-preset:lint: cache hit, replaying output 55431f2ab0e89fe7
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@w5s/mrm-preset:test: cache hit, replaying output
|
|
1
|
+
@w5s/mrm-preset:test: cache hit, replaying output a48676b2c6596bd4
|
|
2
2
|
@w5s/mrm-preset:test: mkdir: _tester: File exists
|
|
3
3
|
@w5s/mrm-preset:test: [36mRunning bootstrap...[39m
|
|
4
4
|
@w5s/mrm-preset:test: [33mRunning alias configure...[39m
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
@w5s/mrm-preset:test: [36mRunning commitlint...[39m
|
|
13
13
|
@w5s/mrm-preset:test: [36mRunning editorconfig...[39m
|
|
14
14
|
@w5s/mrm-preset:test: [36mRunning eslint...[39m
|
|
15
|
+
@w5s/mrm-preset:test: [32mUpdate package.json[39m
|
|
15
16
|
@w5s/mrm-preset:test: [36mRunning cspell...[39m
|
|
16
17
|
@w5s/mrm-preset:test: [36mRunning jest...[39m
|
|
17
18
|
@w5s/mrm-preset:test: [32mUpdate package.json[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,51 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.0.0-alpha.14](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.0.0-alpha.13...@w5s/mrm-preset@1.0.0-alpha.14) (2022-06-10)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* add prepare task to turbo configuration ([717d59a](https://github.com/w5s/project-config/commit/717d59a724c1de8cb37f37c23aae8f4cc57fc231))
|
|
12
|
+
* remove --quiet option on format ([268b0a7](https://github.com/w5s/project-config/commit/268b0a76dbd03cfa6729988472948a66e2b749c9))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [1.0.0-alpha.13](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.0.0-alpha.12...@w5s/mrm-preset@1.0.0-alpha.13) (2022-06-07)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* improve cspell output ([a5721b5](https://github.com/w5s/project-config/commit/a5721b5c8e97817dc68e9444f4443d3cb7893a27))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# [1.0.0-alpha.12](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.0.0-alpha.11...@w5s/mrm-preset@1.0.0-alpha.12) (2022-06-07)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* add spellcheck task to turbo config ([1029c2b](https://github.com/w5s/project-config/commit/1029c2b97b12b44618ce741d045b02712f0ebf18))
|
|
35
|
+
* clean non useful empty script when possible ([2e7e60a](https://github.com/w5s/project-config/commit/2e7e60a400506bbca00db653813668fa47f8f065))
|
|
36
|
+
* correct docs task in turbo ([0fca8c9](https://github.com/w5s/project-config/commit/0fca8c9ca0389b090e6aa2a66d47ab63b1cb138e))
|
|
37
|
+
* remove uneeded @types/jest typing ([475f6bb](https://github.com/w5s/project-config/commit/475f6bbdc101d31460cd8ffb7f5deb3b97176d5c))
|
|
38
|
+
* remove uneeded cspell script ([ba8d38b](https://github.com/w5s/project-config/commit/ba8d38b8053a24a7937c24c270f5d61d3dad71c7))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
* configure spellcheck ([4be6a96](https://github.com/w5s/project-config/commit/4be6a96d6d30e1085b73c0befcab1d3fa30475ab))
|
|
44
|
+
* improve eslint mrm support for workspaces ([2dacc2e](https://github.com/w5s/project-config/commit/2dacc2e867ebb74c8de777af2ce9f173426ebc33))
|
|
45
|
+
* improve turbo support for lint and format ([76e19e0](https://github.com/w5s/project-config/commit/76e19e02918aba66a2e6e9c06a7d0bed99500ecc))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
6
51
|
# [1.0.0-alpha.11](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.0.0-alpha.10...@w5s/mrm-preset@1.0.0-alpha.11) (2022-05-20)
|
|
7
52
|
|
|
8
53
|
|
package/core/cspell.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const { json } = require('mrm-core');
|
|
2
|
-
const pkg = require('./pkg');
|
|
3
2
|
const npm = require('./npm');
|
|
4
3
|
/**
|
|
5
4
|
* @typedef {{
|
|
@@ -22,14 +21,6 @@ const npm = require('./npm');
|
|
|
22
21
|
function cspell({ state, update }) {
|
|
23
22
|
const hasCSpell = state === 'present';
|
|
24
23
|
|
|
25
|
-
pkg.withPackageJson((packageFile) => {
|
|
26
|
-
pkg.script(packageFile, {
|
|
27
|
-
name: 'cspell',
|
|
28
|
-
script: 'cspell',
|
|
29
|
-
state,
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
24
|
const cSpellFile = json('cSpell.json', {
|
|
34
25
|
version: '0.2',
|
|
35
26
|
language: 'en',
|
package/core/jest.js
CHANGED
|
@@ -13,7 +13,6 @@ function jest({ state }) {
|
|
|
13
13
|
const packageFileDefault = packageJson();
|
|
14
14
|
const hasJest = state === 'present';
|
|
15
15
|
const hasWorkspaces = pkg.hasWorkspaces(packageFileDefault);
|
|
16
|
-
const hasTypescript = pkg.hasDependency(packageFileDefault, 'typescript', 'dev');
|
|
17
16
|
|
|
18
17
|
pkg.withPackageJson((packageFile) => {
|
|
19
18
|
if (hasJest) {
|
|
@@ -53,17 +52,13 @@ function jest({ state }) {
|
|
|
53
52
|
state: !hasJest || hasWorkspaces ? 'default' : 'present',
|
|
54
53
|
});
|
|
55
54
|
});
|
|
55
|
+
|
|
56
56
|
// Dependencies
|
|
57
57
|
npm.dependency({
|
|
58
58
|
dev: true,
|
|
59
59
|
name: ['jest', 'es-jest'],
|
|
60
60
|
state: hasJest ? 'present' : 'absent',
|
|
61
61
|
});
|
|
62
|
-
npm.dependency({
|
|
63
|
-
dev: true,
|
|
64
|
-
name: ['@types/jest'],
|
|
65
|
-
state: hasJest && hasTypescript ? 'present' : 'absent',
|
|
66
|
-
});
|
|
67
62
|
|
|
68
63
|
// vscodeSnippets({
|
|
69
64
|
// name: 'jest',
|
package/core/pkg.js
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
// @ts-ignore
|
|
5
5
|
const { intersect } = require('semver-intersect');
|
|
6
|
-
const { packageJson, file } = require('mrm-core');
|
|
6
|
+
const { packageJson, file, json } = require('mrm-core');
|
|
7
|
+
const glob = require('glob');
|
|
8
|
+
const path = require('path');
|
|
7
9
|
const jsonFile = require('./jsonFile');
|
|
8
10
|
|
|
9
11
|
/**
|
|
@@ -21,7 +23,38 @@ function withPackageJson(block) {
|
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
|
-
* @param {import(
|
|
26
|
+
* @param {import("mrm-core").Json} packageFile
|
|
27
|
+
* @returns {string[]} - The list of workspace matchers
|
|
28
|
+
*/
|
|
29
|
+
function listWorkspaceMatchers(packageFile) {
|
|
30
|
+
return packageFile.get('workspaces.packages', packageFile.get('workspaces', []));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param {(workspace: {
|
|
35
|
+
* projectDir: string;
|
|
36
|
+
* packageFile: import("mrm-core").Json;
|
|
37
|
+
* }) => void} fn
|
|
38
|
+
*/
|
|
39
|
+
function forEachWorkspace(fn) {
|
|
40
|
+
const packageRoot = packageJson();
|
|
41
|
+
const workspacesMatchers = listWorkspaceMatchers(packageRoot);
|
|
42
|
+
|
|
43
|
+
for (const workspaceMatcher of workspacesMatchers) {
|
|
44
|
+
const directories = glob.sync(workspaceMatcher);
|
|
45
|
+
directories.forEach((directory) => {
|
|
46
|
+
const packageFile = json(path.join(directory, 'package.json'));
|
|
47
|
+
fn({
|
|
48
|
+
projectDir: directory,
|
|
49
|
+
packageFile,
|
|
50
|
+
});
|
|
51
|
+
packageFile.save();
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @param {import('mrm-core').Json} packageFile
|
|
25
58
|
* @param {{
|
|
26
59
|
* name: string,
|
|
27
60
|
* state: 'present'|'absent'|'default',
|
|
@@ -30,9 +63,9 @@ function withPackageJson(block) {
|
|
|
30
63
|
*/
|
|
31
64
|
function script(packageFile, { name, state, script: scriptName }) {
|
|
32
65
|
if (state === 'absent') {
|
|
33
|
-
packageFile.
|
|
34
|
-
} else if (state === 'present' || (state === 'default' && !packageFile.
|
|
35
|
-
packageFile.
|
|
66
|
+
packageFile.unset(['scripts', name]);
|
|
67
|
+
} else if (state === 'present' || (state === 'default' && !packageFile.get(['scripts', name]))) {
|
|
68
|
+
packageFile.set(['scripts', name], scriptName);
|
|
36
69
|
}
|
|
37
70
|
}
|
|
38
71
|
|
|
@@ -121,4 +154,6 @@ module.exports = {
|
|
|
121
154
|
hasDependency,
|
|
122
155
|
hasWorkspaces,
|
|
123
156
|
withPackageJson,
|
|
157
|
+
forEachWorkspace,
|
|
158
|
+
listWorkspaceMatchers,
|
|
124
159
|
};
|
package/core/project.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** @type {'docs'} */
|
|
2
|
+
const docs = 'docs';
|
|
1
3
|
/** @type {'install'} */
|
|
2
4
|
const install = 'install';
|
|
3
5
|
/** @type {'prepare'} */
|
|
@@ -24,6 +26,8 @@ const validate = 'validate';
|
|
|
24
26
|
const release = 'release';
|
|
25
27
|
/** @type {'rescue'} */
|
|
26
28
|
const rescue = 'rescue';
|
|
29
|
+
/** @type {'spellcheck'} */
|
|
30
|
+
const spellcheck = 'spellcheck';
|
|
27
31
|
|
|
28
32
|
/**
|
|
29
33
|
* @param {string} taskName
|
|
@@ -41,6 +45,7 @@ function post(taskName) {
|
|
|
41
45
|
|
|
42
46
|
module.exports = {
|
|
43
47
|
build,
|
|
48
|
+
docs,
|
|
44
49
|
prepare,
|
|
45
50
|
develop,
|
|
46
51
|
clean,
|
|
@@ -55,4 +60,5 @@ module.exports = {
|
|
|
55
60
|
rescue,
|
|
56
61
|
test,
|
|
57
62
|
validate,
|
|
63
|
+
spellcheck,
|
|
58
64
|
};
|
package/core/turbo.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const { packageJson, json } = require('mrm-core');
|
|
2
|
+
const pkg = require('./pkg');
|
|
3
|
+
const npm = require('./npm');
|
|
4
|
+
const jsonFile = require('./jsonFile');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {{
|
|
8
|
+
* $schema: string,
|
|
9
|
+
* pipeline?: Record<string, unknown>,
|
|
10
|
+
* globalDependencies?: Array<string>,
|
|
11
|
+
* }} TurboConfig
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {{
|
|
16
|
+
* state: 'present'|'absent',
|
|
17
|
+
* update: (config: TurboConfig) => TurboConfig
|
|
18
|
+
* }} options
|
|
19
|
+
*/
|
|
20
|
+
function turbo({ state, update }) {
|
|
21
|
+
const packageFileDefault = packageJson();
|
|
22
|
+
const hasWorkspaces = pkg.hasWorkspaces(packageFileDefault);
|
|
23
|
+
const hasTurbo = state === 'present' && hasWorkspaces;
|
|
24
|
+
|
|
25
|
+
const turboFile = json('turbo.json');
|
|
26
|
+
|
|
27
|
+
if (hasTurbo) {
|
|
28
|
+
jsonFile.value(turboFile, {
|
|
29
|
+
path: undefined,
|
|
30
|
+
state,
|
|
31
|
+
update,
|
|
32
|
+
/** @type {TurboConfig} */
|
|
33
|
+
default: {
|
|
34
|
+
$schema: 'https://turborepo.org/schema.json',
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Otherwise save the file with content
|
|
40
|
+
*/
|
|
41
|
+
turboFile.save();
|
|
42
|
+
} else {
|
|
43
|
+
turboFile.delete();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Dependencies
|
|
47
|
+
npm.dependency({
|
|
48
|
+
dev: true,
|
|
49
|
+
name: ['turbo'],
|
|
50
|
+
state: hasTurbo ? 'present' : 'absent',
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = {
|
|
55
|
+
turbo,
|
|
56
|
+
};
|
package/cspell/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const { cspell } = require('../core/cspell');
|
|
2
|
+
const project = require('../core/project');
|
|
3
|
+
const pkg = require('../core/pkg');
|
|
2
4
|
|
|
3
5
|
function task() {
|
|
4
6
|
cspell({
|
|
@@ -20,6 +22,25 @@ function task() {
|
|
|
20
22
|
),
|
|
21
23
|
}),
|
|
22
24
|
});
|
|
25
|
+
|
|
26
|
+
pkg.withPackageJson((packageFile) => {
|
|
27
|
+
const hasWorkspaces = pkg.hasWorkspaces(packageFile);
|
|
28
|
+
const workspaceMatchers = pkg.listWorkspaceMatchers(packageFile);
|
|
29
|
+
pkg.script(packageFile, {
|
|
30
|
+
name: project.spellcheck,
|
|
31
|
+
script: `cspell --no-progress '**' ${
|
|
32
|
+
hasWorkspaces ? `${workspaceMatchers.map((_) => `--exclude='${_}/**'`).join(' ')} && turbo run spellcheck` : ''
|
|
33
|
+
}`,
|
|
34
|
+
state: 'present',
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
pkg.forEachWorkspace(({ packageFile }) => {
|
|
38
|
+
pkg.script(packageFile, {
|
|
39
|
+
name: project.spellcheck,
|
|
40
|
+
script: `cspell --no-progress '**'`,
|
|
41
|
+
state: 'present',
|
|
42
|
+
});
|
|
43
|
+
});
|
|
23
44
|
}
|
|
24
45
|
|
|
25
46
|
task.description = 'Adds CSpell support';
|
package/eslint/index.js
CHANGED
|
@@ -16,6 +16,7 @@ function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended'
|
|
|
16
16
|
*/
|
|
17
17
|
function task({ eslintPreset, eslintRules }) {
|
|
18
18
|
const packageFileDefault = packageJson();
|
|
19
|
+
const hasWorkspaces = pkg.hasWorkspaces(packageFileDefault);
|
|
19
20
|
const hasTypescript = pkg.hasDependency(packageFileDefault, 'typescript', 'dev');
|
|
20
21
|
const hasJSX = true;
|
|
21
22
|
const hasJSON = true;
|
|
@@ -63,6 +64,8 @@ function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended'
|
|
|
63
64
|
|
|
64
65
|
/** @type {Record<string, boolean>} */
|
|
65
66
|
const extsMap = {
|
|
67
|
+
mjs: true,
|
|
68
|
+
cjs: true,
|
|
66
69
|
js: true,
|
|
67
70
|
jsx: hasJSX,
|
|
68
71
|
ts: hasTypescript,
|
|
@@ -73,15 +76,54 @@ function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended'
|
|
|
73
76
|
const extOption = ` --ext=${extList.join(',')}`;
|
|
74
77
|
|
|
75
78
|
pkg.withPackageJson((packageFile) => {
|
|
79
|
+
const ignorePatterns = pkg
|
|
80
|
+
.listWorkspaceMatchers(packageFile)
|
|
81
|
+
.map((_) => ` --ignore-pattern='${_}/**'`)
|
|
82
|
+
.join('');
|
|
83
|
+
|
|
84
|
+
// workspaces
|
|
85
|
+
pkg.script(packageFile, {
|
|
86
|
+
name: `${project.lint}:root`,
|
|
87
|
+
script: `eslint .${extOption}${ignorePatterns}`,
|
|
88
|
+
state: hasWorkspaces ? 'present' : 'absent',
|
|
89
|
+
});
|
|
90
|
+
pkg.script(packageFile, {
|
|
91
|
+
name: `${project.format}:root`,
|
|
92
|
+
script: `eslint .${extOption}${ignorePatterns} --fix`,
|
|
93
|
+
state: hasWorkspaces ? 'present' : 'absent',
|
|
94
|
+
});
|
|
95
|
+
pkg.script(packageFile, {
|
|
96
|
+
name: `${project.lint}:packages`,
|
|
97
|
+
script: `turbo run ${project.lint}`,
|
|
98
|
+
state: hasWorkspaces ? 'present' : 'absent',
|
|
99
|
+
});
|
|
100
|
+
pkg.script(packageFile, {
|
|
101
|
+
name: `${project.format}:packages`,
|
|
102
|
+
script: `turbo run ${project.format}`,
|
|
103
|
+
state: hasWorkspaces ? 'present' : 'absent',
|
|
104
|
+
});
|
|
105
|
+
// regular package
|
|
106
|
+
pkg.script(packageFile, {
|
|
107
|
+
name: `${project.lint}:src`,
|
|
108
|
+
script: `eslint .${extOption}`,
|
|
109
|
+
state: !hasWorkspaces ? 'present' : 'absent',
|
|
110
|
+
});
|
|
111
|
+
pkg.script(packageFile, {
|
|
112
|
+
name: `${project.format}:src`,
|
|
113
|
+
script: `eslint . --fix${extOption}`,
|
|
114
|
+
state: !hasWorkspaces ? 'present' : 'absent',
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
pkg.forEachWorkspace(({ packageFile }) => {
|
|
76
118
|
pkg.script(packageFile, {
|
|
77
119
|
name: project.lint,
|
|
78
|
-
script: `eslint
|
|
79
|
-
state: '
|
|
120
|
+
script: `eslint .${extOption}`,
|
|
121
|
+
state: 'default',
|
|
80
122
|
});
|
|
81
123
|
pkg.script(packageFile, {
|
|
82
124
|
name: project.format,
|
|
83
|
-
script: `eslint .
|
|
84
|
-
state: '
|
|
125
|
+
script: `eslint . -fix${extOption}`,
|
|
126
|
+
state: 'default',
|
|
85
127
|
});
|
|
86
128
|
});
|
|
87
129
|
|
|
@@ -93,14 +135,20 @@ function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended'
|
|
|
93
135
|
'editor.codeActionsOnSave': settings['editor.codeActionsOnSave'] || {
|
|
94
136
|
'source.fixAll': true,
|
|
95
137
|
},
|
|
96
|
-
'eslint.validate':
|
|
97
|
-
(
|
|
98
|
-
(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
138
|
+
'eslint.validate': Array.from(
|
|
139
|
+
new Set(
|
|
140
|
+
extList.map(
|
|
141
|
+
(ext) =>
|
|
142
|
+
({
|
|
143
|
+
cjs: 'javascript',
|
|
144
|
+
mjs: 'javascript',
|
|
145
|
+
jsx: 'javascriptreact',
|
|
146
|
+
js: 'javascript',
|
|
147
|
+
tsx: 'typescriptreact',
|
|
148
|
+
ts: 'typescript',
|
|
149
|
+
}[ext] || ext)
|
|
150
|
+
)
|
|
151
|
+
)
|
|
104
152
|
),
|
|
105
153
|
}),
|
|
106
154
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/mrm-preset",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.14",
|
|
4
4
|
"description": "Mrm configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mrm",
|
|
@@ -24,12 +24,14 @@
|
|
|
24
24
|
"build:empty": ":",
|
|
25
25
|
"build:tsc": "tsc --noEmit --skipLibCheck",
|
|
26
26
|
"docs": "md-magic --path '**/*.md' --ignore='node_modules'",
|
|
27
|
-
"format": "eslint . --fix",
|
|
28
|
-
"lint": "eslint .",
|
|
27
|
+
"format": "eslint . --fix --ext=mjs,cjs,js,jsx,ts,tsx,json",
|
|
28
|
+
"lint": "eslint . --ext=mjs,cjs,js,jsx,ts,tsx,json",
|
|
29
|
+
"spellcheck": "cspell --no-progress '**'",
|
|
29
30
|
"test": "mkdir _tester; cd _tester; mrm bootstrap --dir ..; mrm configure --dir .."
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
32
33
|
"debug": "^4.3.3",
|
|
34
|
+
"glob": "^8.0.3",
|
|
33
35
|
"mrm-core": "^7.0.0",
|
|
34
36
|
"semver-intersect": "^1.4.0",
|
|
35
37
|
"sync-directory": "^5.0.0"
|
|
@@ -45,5 +47,5 @@
|
|
|
45
47
|
"publishConfig": {
|
|
46
48
|
"access": "public"
|
|
47
49
|
},
|
|
48
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "55a9106dcf41315e4a1e0fa73b912853c6cf6f06"
|
|
49
51
|
}
|
package/project/index.js
CHANGED
|
@@ -5,6 +5,7 @@ const npm = require('../core/npm');
|
|
|
5
5
|
const { vscodeTask } = require('../core/vscode');
|
|
6
6
|
const project = require('../core/project');
|
|
7
7
|
const mrmPackageJson = require('../package.json');
|
|
8
|
+
const { turbo } = require('../core/turbo');
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
*
|
|
@@ -62,7 +63,7 @@ function task() {
|
|
|
62
63
|
pkg.script(packageFile, {
|
|
63
64
|
name: `${project.build}:empty`,
|
|
64
65
|
script: pkg.emptyScript,
|
|
65
|
-
state: 'present',
|
|
66
|
+
state: !useWorkspace ? 'present' : 'absent',
|
|
66
67
|
});
|
|
67
68
|
pkg.script(packageFile, {
|
|
68
69
|
name: `${project.build}:packages`,
|
|
@@ -85,13 +86,23 @@ function task() {
|
|
|
85
86
|
// lint
|
|
86
87
|
pkg.script(packageFile, {
|
|
87
88
|
name: project.lint,
|
|
89
|
+
script: npmRunAll(project.lint),
|
|
90
|
+
state: 'present',
|
|
91
|
+
});
|
|
92
|
+
pkg.script(packageFile, {
|
|
93
|
+
name: `${project.lint}:empty`,
|
|
88
94
|
script: pkg.emptyScript,
|
|
89
|
-
state: '
|
|
95
|
+
state: !useWorkspace ? 'present' : 'absent',
|
|
90
96
|
});
|
|
91
97
|
pkg.script(packageFile, {
|
|
92
98
|
name: project.format,
|
|
99
|
+
script: npmRunAll(project.format),
|
|
100
|
+
state: 'present',
|
|
101
|
+
});
|
|
102
|
+
pkg.script(packageFile, {
|
|
103
|
+
name: `${project.format}:empty`,
|
|
93
104
|
script: pkg.emptyScript,
|
|
94
|
-
state: '
|
|
105
|
+
state: !useWorkspace ? 'present' : 'absent',
|
|
95
106
|
});
|
|
96
107
|
|
|
97
108
|
// test
|
|
@@ -105,16 +116,6 @@ function task() {
|
|
|
105
116
|
script: npmRunAll(project.test),
|
|
106
117
|
state: 'present',
|
|
107
118
|
});
|
|
108
|
-
pkg.script(packageFile, {
|
|
109
|
-
name: `${project.prepare}:empty`,
|
|
110
|
-
script: pkg.emptyScript,
|
|
111
|
-
state: 'default',
|
|
112
|
-
});
|
|
113
|
-
pkg.script(packageFile, {
|
|
114
|
-
name: `${project.prepare}:packages`,
|
|
115
|
-
script: turboRun(project.prepare),
|
|
116
|
-
state: useWorkspace ? 'present' : 'absent',
|
|
117
|
-
});
|
|
118
119
|
pkg.script(packageFile, {
|
|
119
120
|
name: project.validate,
|
|
120
121
|
script: `${npmRun(project.build)} && ${npmRun(project.lint)} && ${npmRun(project.test)}`,
|
|
@@ -136,9 +137,14 @@ function task() {
|
|
|
136
137
|
});
|
|
137
138
|
pkg.script(packageFile, {
|
|
138
139
|
name: `${project.prepare}:empty`,
|
|
139
|
-
script:
|
|
140
|
+
script: !useWorkspace ? 'present' : 'absent',
|
|
140
141
|
state: 'default',
|
|
141
142
|
});
|
|
143
|
+
pkg.script(packageFile, {
|
|
144
|
+
name: `${project.prepare}:packages`,
|
|
145
|
+
script: turboRun(project.prepare),
|
|
146
|
+
state: useWorkspace ? 'present' : 'absent',
|
|
147
|
+
});
|
|
142
148
|
|
|
143
149
|
// rescue
|
|
144
150
|
pkg.script(packageFile, {
|
|
@@ -155,25 +161,7 @@ function task() {
|
|
|
155
161
|
});
|
|
156
162
|
|
|
157
163
|
// workspace
|
|
158
|
-
|
|
159
|
-
$schema: 'https://turborepo.org/schema.json',
|
|
160
|
-
pipeline: {
|
|
161
|
-
[project.build]: {
|
|
162
|
-
dependsOn: ['^build'],
|
|
163
|
-
outputs: ['lib/**', 'dist/**', '.next/**'],
|
|
164
|
-
},
|
|
165
|
-
[project.test]: {},
|
|
166
|
-
[project.lint]: {},
|
|
167
|
-
[project.format]: {},
|
|
168
|
-
[project.clean]: {
|
|
169
|
-
cache: false,
|
|
170
|
-
},
|
|
171
|
-
[project.develop]: {
|
|
172
|
-
cache: false,
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
globalDependencies: ['tsconfig.settings.json'],
|
|
176
|
-
});
|
|
164
|
+
|
|
177
165
|
const lernaConfig = json('lerna.json', {
|
|
178
166
|
version: packageFile.get('version'),
|
|
179
167
|
});
|
|
@@ -195,12 +183,10 @@ function task() {
|
|
|
195
183
|
useWorkspaces: useWorkspace,
|
|
196
184
|
});
|
|
197
185
|
lernaConfig.save();
|
|
198
|
-
turboConfig.save();
|
|
199
186
|
makeDirs('packages');
|
|
200
187
|
} else {
|
|
201
188
|
packageFile.unset('workspaces');
|
|
202
189
|
lernaConfig.delete();
|
|
203
|
-
turboConfig.delete();
|
|
204
190
|
}
|
|
205
191
|
|
|
206
192
|
// Engine
|
|
@@ -217,6 +203,33 @@ function task() {
|
|
|
217
203
|
);
|
|
218
204
|
packageFile.save();
|
|
219
205
|
|
|
206
|
+
// Turbo config
|
|
207
|
+
turbo({
|
|
208
|
+
state: useWorkspace ? 'present' : 'absent',
|
|
209
|
+
update: (_) => ({
|
|
210
|
+
..._,
|
|
211
|
+
pipeline: {
|
|
212
|
+
[project.build]: {
|
|
213
|
+
dependsOn: ['^build'],
|
|
214
|
+
outputs: ['lib/**', 'dist/**', '.next/**'],
|
|
215
|
+
},
|
|
216
|
+
[project.test]: {},
|
|
217
|
+
[project.lint]: {},
|
|
218
|
+
[project.prepare]: {},
|
|
219
|
+
[project.format]: {},
|
|
220
|
+
[project.docs]: {},
|
|
221
|
+
[project.spellcheck]: {},
|
|
222
|
+
[project.clean]: {
|
|
223
|
+
cache: false,
|
|
224
|
+
},
|
|
225
|
+
[project.develop]: {
|
|
226
|
+
cache: false,
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
globalDependencies: ['tsconfig.settings.json'],
|
|
230
|
+
}),
|
|
231
|
+
});
|
|
232
|
+
|
|
220
233
|
// Dependencies
|
|
221
234
|
npm.dependency({
|
|
222
235
|
dev: true,
|
|
@@ -225,7 +238,7 @@ function task() {
|
|
|
225
238
|
});
|
|
226
239
|
npm.dependency({
|
|
227
240
|
dev: true,
|
|
228
|
-
name: ['lerna'
|
|
241
|
+
name: ['lerna'],
|
|
229
242
|
state: useWorkspace ? 'present' : 'absent',
|
|
230
243
|
});
|
|
231
244
|
|