@w5s/mrm-preset 1.0.0-alpha.1 → 1.0.0-alpha.2
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/CHANGELOG.md +12 -0
- package/LICENSE +21 -0
- package/ci/gitlab.js +1 -3
- package/core/block.js +1 -3
- package/core/git.js +5 -15
- package/core/npm.js +2 -6
- package/core/pkg.js +5 -4
- package/core/vscode.js +2 -8
- package/eslint/index.js +15 -17
- package/package.json +4 -3
- package/project/index.js +3 -6
- package/renovate/index.js +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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.2](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.0.0-alpha.1...@w5s/mrm-preset@1.0.0-alpha.2) (2022-02-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* enable source.fixAll for vscode ([d484156](https://github.com/w5s/project-config/commit/d484156c063f2bf9f5cb3212878aa07bb4f8fd6f))
|
|
12
|
+
* improve arrow-body-style configuration ([a4ee8a9](https://github.com/w5s/project-config/commit/a4ee8a9f3912285b45287afc4ccae2fa57431c6a))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
# 1.0.0-alpha.1 (2022-02-12)
|
|
7
19
|
|
|
8
20
|
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Julien Polo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/ci/gitlab.js
CHANGED
|
@@ -21,9 +21,7 @@ function task() {
|
|
|
21
21
|
/**
|
|
22
22
|
* @param {string|{local: string}} include
|
|
23
23
|
*/
|
|
24
|
-
(include) =>
|
|
25
|
-
return (typeof include === 'string' ? include : include.local) === includePath;
|
|
26
|
-
}
|
|
24
|
+
(include) => (typeof include === 'string' ? include : include.local) === includePath
|
|
27
25
|
);
|
|
28
26
|
const addInclude = (/** @type {string} */ includePath) =>
|
|
29
27
|
gitlabCIConfig.set('include', gitlabCIConfig.get('include', []).concat([{ local: includePath }]));
|
package/core/block.js
CHANGED
|
@@ -20,9 +20,7 @@ const { file } = require('mrm-core');
|
|
|
20
20
|
function block({
|
|
21
21
|
markerBegin = 'BEGIN',
|
|
22
22
|
markerEnd = 'END',
|
|
23
|
-
marker = (mark) => {
|
|
24
|
-
return `# ${mark} generated by mrm`;
|
|
25
|
-
},
|
|
23
|
+
marker = (mark) => `# ${mark} generated by mrm`,
|
|
26
24
|
path,
|
|
27
25
|
block: blockName,
|
|
28
26
|
// @ts-ignore
|
package/core/git.js
CHANGED
|
@@ -15,19 +15,13 @@ function remoteSync() {
|
|
|
15
15
|
* 1. filter github URL
|
|
16
16
|
* @param {string} returnValue
|
|
17
17
|
*/
|
|
18
|
-
(returnValue) =>
|
|
19
|
-
return returnValue.replace(/^git@github.com:/, 'https://github.com/');
|
|
20
|
-
},
|
|
18
|
+
(returnValue) => returnValue.replace(/^git@github.com:/, 'https://github.com/'),
|
|
21
19
|
/**
|
|
22
20
|
* 2. filter gitlab URL
|
|
23
21
|
* @param {string} returnValue
|
|
24
22
|
*/
|
|
25
|
-
(returnValue) =>
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
].reduce((returnValue, filter) => {
|
|
29
|
-
return filter(returnValue);
|
|
30
|
-
}, remoteURL)
|
|
23
|
+
(returnValue) => returnValue.replace(/^git@gitlab.com:/, 'https://gitlab.com/'),
|
|
24
|
+
].reduce((returnValue, filter) => filter(returnValue), remoteURL)
|
|
31
25
|
: remoteURL;
|
|
32
26
|
} catch (error) {
|
|
33
27
|
// ignore error
|
|
@@ -48,9 +42,7 @@ exports.hasGit = hasGit;
|
|
|
48
42
|
function trimStartLine(content) {
|
|
49
43
|
return content
|
|
50
44
|
.split(/\n/)
|
|
51
|
-
.map((line) =>
|
|
52
|
-
return line.replace(/^\s+/, '');
|
|
53
|
-
})
|
|
45
|
+
.map((line) => line.replace(/^\s+/, ''))
|
|
54
46
|
.filter((_) => _.length > 0)
|
|
55
47
|
.join('\n');
|
|
56
48
|
}
|
|
@@ -64,9 +56,7 @@ function gitIgnore(section, sectionContent) {
|
|
|
64
56
|
|
|
65
57
|
return block({
|
|
66
58
|
block: Array.isArray(sectionContent) ? sectionContent.join(EOL) : trimStartLine(sectionContent),
|
|
67
|
-
marker: (mark) => {
|
|
68
|
-
return `# ${mark} ### ${section} ###`;
|
|
69
|
-
},
|
|
59
|
+
marker: (mark) => `# ${mark} ### ${section} ###`,
|
|
70
60
|
path: '.gitignore',
|
|
71
61
|
});
|
|
72
62
|
}
|
package/core/npm.js
CHANGED
|
@@ -72,9 +72,7 @@ function install(deps, options = {}, exec) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
log.info(`Installing ${listify(newDeps)}...`);
|
|
75
|
-
const versionedDeps = newDeps.map((dep) =>
|
|
76
|
-
return getVersionedDep(dep, versions);
|
|
77
|
-
});
|
|
75
|
+
const versionedDeps = newDeps.map((dep) => getVersionedDep(dep, versions));
|
|
78
76
|
|
|
79
77
|
// eslint-disable-next-line consistent-return
|
|
80
78
|
return run(versionedDeps, { dev }, exec);
|
|
@@ -96,9 +94,7 @@ function uninstall(deps, options = {}, exec) {
|
|
|
96
94
|
const installed = getOwnDependencies({ dev });
|
|
97
95
|
|
|
98
96
|
// @ts-ignore
|
|
99
|
-
const newDeps = deps.filter((dep) =>
|
|
100
|
-
return installed[dep];
|
|
101
|
-
});
|
|
97
|
+
const newDeps = deps.filter((dep) => installed[dep]);
|
|
102
98
|
|
|
103
99
|
if (newDeps.length === 0) {
|
|
104
100
|
return;
|
package/core/pkg.js
CHANGED
|
@@ -78,12 +78,13 @@ function engineMinVersion(packageFile, engineVersionMap) {
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
packageFile.merge({
|
|
81
|
-
engines: Object.keys(engineVersionMap).reduce(
|
|
82
|
-
|
|
81
|
+
engines: Object.keys(engineVersionMap).reduce(
|
|
82
|
+
(acc, engineName) => ({
|
|
83
83
|
...acc,
|
|
84
84
|
[engineName]: engineConstraint(engineName),
|
|
85
|
-
}
|
|
86
|
-
|
|
85
|
+
}),
|
|
86
|
+
{}
|
|
87
|
+
),
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
90
|
|
package/core/vscode.js
CHANGED
|
@@ -31,16 +31,10 @@ function vscodeTask(newTask) {
|
|
|
31
31
|
* @type {Array<any>}
|
|
32
32
|
*/
|
|
33
33
|
const tasks = vscodeTaskFile.get('tasks', []);
|
|
34
|
-
if (
|
|
35
|
-
tasks.find((task) => {
|
|
36
|
-
return task.script === newTask.script;
|
|
37
|
-
})
|
|
38
|
-
) {
|
|
34
|
+
if (tasks.find((task) => task.script === newTask.script)) {
|
|
39
35
|
vscodeTaskFile.set(
|
|
40
36
|
'tasks',
|
|
41
|
-
tasks.map((task) =>
|
|
42
|
-
return task.script === newTask.script ? newTask : task;
|
|
43
|
-
})
|
|
37
|
+
tasks.map((task) => (task.script === newTask.script ? newTask : task))
|
|
44
38
|
);
|
|
45
39
|
} else {
|
|
46
40
|
vscodeTaskFile.set('tasks', [newTask].concat(tasks));
|
package/eslint/index.js
CHANGED
|
@@ -87,23 +87,21 @@ function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended'
|
|
|
87
87
|
// VSCode support
|
|
88
88
|
vscodeSettings({
|
|
89
89
|
state: 'present',
|
|
90
|
-
update: (settings) => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
'
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
};
|
|
106
|
-
},
|
|
90
|
+
update: (settings) => ({
|
|
91
|
+
...settings,
|
|
92
|
+
'editor.codeActionsOnSave': settings['editor.codeActionsOnSave'] || {
|
|
93
|
+
'source.fixAll': true,
|
|
94
|
+
},
|
|
95
|
+
'eslint.validate': extList.map(
|
|
96
|
+
(ext) =>
|
|
97
|
+
({
|
|
98
|
+
jsx: 'javascriptreact',
|
|
99
|
+
js: 'javascript',
|
|
100
|
+
tsx: 'typescriptreact',
|
|
101
|
+
ts: 'typescript',
|
|
102
|
+
}[ext] || ext)
|
|
103
|
+
),
|
|
104
|
+
}),
|
|
107
105
|
});
|
|
108
106
|
}
|
|
109
107
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/mrm-preset",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.2",
|
|
4
4
|
"description": "Mrm configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mrm",
|
|
7
7
|
"config",
|
|
8
8
|
"bootstrap"
|
|
9
9
|
],
|
|
10
|
-
"homepage": "https://github.com/w5s/project-config/blob/
|
|
10
|
+
"homepage": "https://github.com/w5s/project-config/blob/main/packages/mrm-preset#readme",
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/w5s/project-config.git/issues"
|
|
13
13
|
},
|
|
@@ -44,5 +44,6 @@
|
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
|
-
}
|
|
47
|
+
},
|
|
48
|
+
"gitHead": "1fd5f03e6f071785cc5be4f9a57430485cf9d6fc"
|
|
48
49
|
}
|
package/project/index.js
CHANGED
|
@@ -29,16 +29,13 @@ function task() {
|
|
|
29
29
|
*
|
|
30
30
|
* @param {string} script
|
|
31
31
|
*/
|
|
32
|
-
const lernaRun = (script) => {
|
|
33
|
-
|
|
34
|
-
};
|
|
32
|
+
const lernaRun = (script) => `lerna run ${script}`;
|
|
33
|
+
|
|
35
34
|
/**
|
|
36
35
|
*
|
|
37
36
|
* @param {string} script
|
|
38
37
|
*/
|
|
39
|
-
const npmRunAll = (script) => {
|
|
40
|
-
return `npm-run-all -p "${script}:*"`;
|
|
41
|
-
};
|
|
38
|
+
const npmRunAll = (script) => `npm-run-all -p "${script}:*"`;
|
|
42
39
|
|
|
43
40
|
// Detect git repository
|
|
44
41
|
pkg.value(packageFile, {
|
package/renovate/index.js
CHANGED
|
@@ -34,9 +34,7 @@ function createRenovate({ renovatePresetApplication, renovatePresetLibrary }) {
|
|
|
34
34
|
/**
|
|
35
35
|
* @param {string} extension
|
|
36
36
|
*/
|
|
37
|
-
(extension) =>
|
|
38
|
-
return extension !== renovatePresetApplication && extension !== renovatePresetLibrary;
|
|
39
|
-
}
|
|
37
|
+
(extension) => extension !== renovatePresetApplication && extension !== renovatePresetLibrary
|
|
40
38
|
)
|
|
41
39
|
)
|
|
42
40
|
);
|