@w5s/mrm-preset 1.0.0-alpha.16 → 1.0.0-alpha.19
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 +11 -1
- package/.turbo/turbo-docs.log +1 -1
- package/.turbo/turbo-format.log +7 -0
- package/.turbo/turbo-lint.log +7 -1
- package/.turbo/turbo-prepare.log +2 -0
- package/.turbo/turbo-test.log +46 -21
- package/CHANGELOG.md +24 -0
- package/ci/_gitlab/AutoDevopsInclude.gitlab-ci.yml +2 -0
- package/commitlint/index.js +3 -0
- package/config.json +1 -0
- package/core/eslint.js +1 -1
- package/core/git.js +2 -18
- package/core/jsonFile.js +8 -7
- package/core/pkg.js +18 -1
- package/core/turbo.js +1 -0
- package/eslint/index.js +4 -9
- package/lang/index.js +3 -3
- package/package.json +11 -7
- package/project/index.js +160 -140
- package/release/index.js +1 -1
- package/renovate/index.js +3 -1
- package/tsconfig.json +2 -2
- package/LICENSE +0 -21
package/.turbo/turbo-build.log
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
@w5s/mrm-preset:build: cache hit, replaying output [
|
|
1
|
+
@w5s/mrm-preset:build: cache hit, replaying output [2mb2674e19e9d29ff6[0m
|
|
2
|
+
[32m@w5s/mrm-preset:build: [0m[0m[build:*tsc][0m
|
|
3
|
+
[32m@w5s/mrm-preset:build: [0m[0m[build:*tsc][0m > @w5s/mrm-preset@1.0.0-alpha.18 build:tsc
|
|
4
|
+
[32m@w5s/mrm-preset:build: [0m[0m[build:*tsc][0m > tsc --noEmit --skipLibCheck
|
|
5
|
+
[32m@w5s/mrm-preset:build: [0m[0m[build:*tsc][0m
|
|
6
|
+
[32m@w5s/mrm-preset:build: [0m[0m[build:*empty][0m
|
|
7
|
+
[32m@w5s/mrm-preset:build: [0m[0m[build:*empty][0m > @w5s/mrm-preset@1.0.0-alpha.18 build:empty
|
|
8
|
+
[32m@w5s/mrm-preset:build: [0m[0m[build:*empty][0m > :
|
|
9
|
+
[32m@w5s/mrm-preset:build: [0m[0m[build:*empty][0m
|
|
10
|
+
[32m@w5s/mrm-preset:build: [0m[0m[build:*empty][0m [0mnpm run build:empty exited with code 0[0m
|
|
11
|
+
[32m@w5s/mrm-preset:build: [0m[0m[build:*tsc][0m [0mnpm run build:tsc exited with code 0[0m
|
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 [2m7929426e31db918c[0m
|
|
2
2
|
[33m@w5s/mrm-preset:docs: [0mStarting markdown-magic [ '**/*.md', '!node_modules/**' ]
|
|
3
3
|
[33m@w5s/mrm-preset:docs: [0mℹ Notice:
|
|
4
4
|
[33m@w5s/mrm-preset:docs: [0m Missing transforms "BASIC_RULES","JSX_RULES" in _tester/node_modules/eslint-plugin-react/README.md
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
@w5s/mrm-preset:format: cache hit, replaying output 2ccea371b5ea23ec
|
|
2
|
+
@w5s/mrm-preset:format: [1] : exited with code 0
|
|
3
|
+
@w5s/mrm-preset:format: [format:*src]
|
|
4
|
+
@w5s/mrm-preset:format: [format:*src] > @w5s/mrm-preset@1.0.0-alpha.18 format:src
|
|
5
|
+
@w5s/mrm-preset:format: [format:*src] > eslint . --fix --ext=mjs,cjs,js,jsx,ts,tsx,json
|
|
6
|
+
@w5s/mrm-preset:format: [format:*src]
|
|
7
|
+
@w5s/mrm-preset:format: [format:*src] npm run format:src exited with code 0
|
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
@w5s/mrm-preset:lint: cache hit, replaying output [
|
|
1
|
+
@w5s/mrm-preset:lint: cache hit, replaying output [2m22fed320b23e49fa[0m
|
|
2
|
+
[35m@w5s/mrm-preset:lint: [0m[0m[1][0m [0m: exited with code 0[0m
|
|
3
|
+
[35m@w5s/mrm-preset:lint: [0m[0m[lint:*src][0m
|
|
4
|
+
[35m@w5s/mrm-preset:lint: [0m[0m[lint:*src][0m > @w5s/mrm-preset@1.0.0-alpha.18 lint:src
|
|
5
|
+
[35m@w5s/mrm-preset:lint: [0m[0m[lint:*src][0m > eslint . --ext=mjs,cjs,js,jsx,ts,tsx,json
|
|
6
|
+
[35m@w5s/mrm-preset:lint: [0m[0m[lint:*src][0m
|
|
7
|
+
[35m@w5s/mrm-preset:lint: [0m[0m[lint:*src][0m [0mnpm run lint:src exited with code 0[0m
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,21 +1,46 @@
|
|
|
1
|
-
@w5s/mrm-preset:test: cache hit, replaying output [
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
1
|
+
@w5s/mrm-preset:test: cache hit, replaying output [2m52d5e4f6637d08e9[0m
|
|
2
|
+
[33m@w5s/mrm-preset:test: [0mmkdir: _tester: File exists
|
|
3
|
+
[33m@w5s/mrm-preset:test: [0m[36mRunning bootstrap...[39m
|
|
4
|
+
[33m@w5s/mrm-preset:test: [0m[33mRunning alias configure...[39m
|
|
5
|
+
[33m@w5s/mrm-preset:test: [0m[36mRunning gitignore...[39m
|
|
6
|
+
[33m@w5s/mrm-preset:test: [0m[36mRunning project...[39m
|
|
7
|
+
[33m@w5s/mrm-preset:test: [0m[32mUpdate package.json[39m
|
|
8
|
+
[33m@w5s/mrm-preset:test: [0mUninstalling npm-run-all...
|
|
9
|
+
[33m@w5s/mrm-preset:test: [0m
|
|
10
|
+
[33m@w5s/mrm-preset:test: [0mremoved 19 packages, and audited 1391 packages in 3s
|
|
11
|
+
[33m@w5s/mrm-preset:test: [0m
|
|
12
|
+
[33m@w5s/mrm-preset:test: [0m143 packages are looking for funding
|
|
13
|
+
[33m@w5s/mrm-preset:test: [0m run `npm fund` for details
|
|
14
|
+
[33m@w5s/mrm-preset:test: [0m
|
|
15
|
+
[33m@w5s/mrm-preset:test: [0m6 moderate severity vulnerabilities
|
|
16
|
+
[33m@w5s/mrm-preset:test: [0m
|
|
17
|
+
[33m@w5s/mrm-preset:test: [0mTo address all issues (including breaking changes), run:
|
|
18
|
+
[33m@w5s/mrm-preset:test: [0m npm audit fix --force
|
|
19
|
+
[33m@w5s/mrm-preset:test: [0m
|
|
20
|
+
[33m@w5s/mrm-preset:test: [0mRun `npm audit` for details.
|
|
21
|
+
[33m@w5s/mrm-preset:test: [0mInstalling concurrently...
|
|
22
|
+
[33m@w5s/mrm-preset:test: [0m
|
|
23
|
+
[33m@w5s/mrm-preset:test: [0madded 12 packages, and audited 1403 packages in 7s
|
|
24
|
+
[33m@w5s/mrm-preset:test: [0m
|
|
25
|
+
[33m@w5s/mrm-preset:test: [0m144 packages are looking for funding
|
|
26
|
+
[33m@w5s/mrm-preset:test: [0m run `npm fund` for details
|
|
27
|
+
[33m@w5s/mrm-preset:test: [0m
|
|
28
|
+
[33m@w5s/mrm-preset:test: [0m6 moderate severity vulnerabilities
|
|
29
|
+
[33m@w5s/mrm-preset:test: [0m
|
|
30
|
+
[33m@w5s/mrm-preset:test: [0mTo address all issues (including breaking changes), run:
|
|
31
|
+
[33m@w5s/mrm-preset:test: [0m npm audit fix --force
|
|
32
|
+
[33m@w5s/mrm-preset:test: [0m
|
|
33
|
+
[33m@w5s/mrm-preset:test: [0mRun `npm audit` for details.
|
|
34
|
+
[33m@w5s/mrm-preset:test: [0m[36mRunning contributing...[39m
|
|
35
|
+
[33m@w5s/mrm-preset:test: [0m[36mRunning license...[39m
|
|
36
|
+
[33m@w5s/mrm-preset:test: [0m[36mRunning release...[39m
|
|
37
|
+
[33m@w5s/mrm-preset:test: [0m[36mRunning ci...[39m
|
|
38
|
+
[33m@w5s/mrm-preset:test: [0m[36mRunning lang...[39m
|
|
39
|
+
[33m@w5s/mrm-preset:test: [0m[36mRunning commitlint...[39m
|
|
40
|
+
[33m@w5s/mrm-preset:test: [0m[36mRunning editorconfig...[39m
|
|
41
|
+
[33m@w5s/mrm-preset:test: [0m[36mRunning eslint...[39m
|
|
42
|
+
[33m@w5s/mrm-preset:test: [0m[36mRunning cspell...[39m
|
|
43
|
+
[33m@w5s/mrm-preset:test: [0m[36mRunning jest...[39m
|
|
44
|
+
[33m@w5s/mrm-preset:test: [0m[36mRunning renovate...[39m
|
|
45
|
+
[33m@w5s/mrm-preset:test: [0m[36mRunning githooks...[39m
|
|
46
|
+
[33m@w5s/mrm-preset:test: [0m[36mRunning postconfigure...[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
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.19](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.0.0-alpha.18...@w5s/mrm-preset@1.0.0-alpha.19) (2022-06-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @w5s/mrm-preset
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [1.0.0-alpha.18](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.0.0-alpha.17...@w5s/mrm-preset@1.0.0-alpha.18) (2022-06-23)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @w5s/mrm-preset
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [1.0.0-alpha.17](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.0.0-alpha.16...@w5s/mrm-preset@1.0.0-alpha.17) (2022-06-23)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @w5s/mrm-preset
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
# [1.0.0-alpha.16](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.0.0-alpha.15...@w5s/mrm-preset@1.0.0-alpha.16) (2022-06-16)
|
|
7
31
|
|
|
8
32
|
|
package/commitlint/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { vscodeRecommendedExtension } = require('../core/vscode.js');
|
|
1
2
|
const { commitlint } = require('../core/commitlint.js');
|
|
2
3
|
const { hasGit } = require('../core/git.js');
|
|
3
4
|
|
|
@@ -21,6 +22,8 @@ function createCommitLint({ commitLintPreset: commitLintPresetDefault }) {
|
|
|
21
22
|
preset: commitLintPreset,
|
|
22
23
|
state: gitPresent ? 'present' : 'absent',
|
|
23
24
|
});
|
|
25
|
+
|
|
26
|
+
vscodeRecommendedExtension(['seatonjiang.gitmoji-vscode']);
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
task.description = 'Setup CommitLint';
|
package/config.json
CHANGED
package/core/eslint.js
CHANGED
package/core/git.js
CHANGED
|
@@ -7,24 +7,8 @@ const block = require('./block.js');
|
|
|
7
7
|
function remoteSync() {
|
|
8
8
|
try {
|
|
9
9
|
const gitConfig = ini('.git/config');
|
|
10
|
-
const remoteURL = gitConfig.get('
|
|
11
|
-
|
|
12
|
-
return remoteURL
|
|
13
|
-
? [
|
|
14
|
-
/**
|
|
15
|
-
* 1. filter github URL
|
|
16
|
-
*
|
|
17
|
-
* @param {string} returnValue
|
|
18
|
-
*/
|
|
19
|
-
(returnValue) => returnValue.replace(/^git@github.com:/, 'https://github.com/'),
|
|
20
|
-
/**
|
|
21
|
-
* 2. filter gitlab URL
|
|
22
|
-
*
|
|
23
|
-
* @param {string} returnValue
|
|
24
|
-
*/
|
|
25
|
-
(returnValue) => returnValue.replace(/^git@gitlab.com:/, 'https://gitlab.com/'),
|
|
26
|
-
].reduce((returnValue, filter) => filter(returnValue), remoteURL)
|
|
27
|
-
: remoteURL;
|
|
10
|
+
const remoteURL = gitConfig.get('remote "origin"').url.trim();
|
|
11
|
+
return remoteURL;
|
|
28
12
|
} catch {
|
|
29
13
|
// ignore error
|
|
30
14
|
}
|
package/core/jsonFile.js
CHANGED
|
@@ -41,16 +41,17 @@ function setValue(jsonFile, path, pathValue) {
|
|
|
41
41
|
*/
|
|
42
42
|
function value(jsonFile, { state, path, default: defaultValue, update: nextValue }) {
|
|
43
43
|
if (state === 'present') {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
let currentValue = getValue(jsonFile, path);
|
|
45
|
+
|
|
46
|
+
if (currentValue == null) {
|
|
47
|
+
currentValue = typeof defaultValue === 'function' ? defaultValue() : defaultValue;
|
|
48
|
+
if (currentValue != null) {
|
|
49
|
+
setValue(jsonFile, path, currentValue);
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const resolvedValue = typeof defaultValue === 'function' ? defaultValue() : defaultValue;
|
|
53
|
+
if (nextValue != null) {
|
|
54
|
+
const resolvedValue = typeof nextValue === 'function' ? nextValue(getValue(jsonFile, path)) : nextValue;
|
|
54
55
|
if (resolvedValue != null) {
|
|
55
56
|
setValue(jsonFile, path, resolvedValue);
|
|
56
57
|
}
|
package/core/pkg.js
CHANGED
|
@@ -13,6 +13,21 @@ const jsonFile = require('./jsonFile.js');
|
|
|
13
13
|
*/
|
|
14
14
|
const emptyScript = ':';
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @param {import('mrm-core').Json} packageFile
|
|
18
|
+
* @returns {'application'|'library'|'workspace'} the archetype value
|
|
19
|
+
*/
|
|
20
|
+
function archetype(packageFile) {
|
|
21
|
+
if (hasWorkspaces(packageFile)) {
|
|
22
|
+
return 'workspace';
|
|
23
|
+
}
|
|
24
|
+
if (packageFile.get('private') === true || (packageFile.get('main') == null && packageFile.get('exports'))) {
|
|
25
|
+
return 'application';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return 'library';
|
|
29
|
+
}
|
|
30
|
+
|
|
16
31
|
/**
|
|
17
32
|
* @param {(pkg: import('mrm-core').PackageJson) => void} block
|
|
18
33
|
*/
|
|
@@ -93,7 +108,7 @@ function manager(packageFile) {
|
|
|
93
108
|
|
|
94
109
|
/**
|
|
95
110
|
*
|
|
96
|
-
* @param {import('mrm-core').
|
|
111
|
+
* @param {import('mrm-core').Json} packageFile
|
|
97
112
|
*/
|
|
98
113
|
function hasWorkspaces(packageFile) {
|
|
99
114
|
return Boolean(packageFile.get('workspaces'));
|
|
@@ -143,11 +158,13 @@ function engineMinVersion(packageFile, engineVersionMap) {
|
|
|
143
158
|
Object.keys(engineVersionMap).map((engineName) => [engineName, engineConstraint(engineName)])
|
|
144
159
|
),
|
|
145
160
|
});
|
|
161
|
+
return packageFile.get('engines');
|
|
146
162
|
}
|
|
147
163
|
|
|
148
164
|
module.exports = {
|
|
149
165
|
...jsonFile,
|
|
150
166
|
emptyScript,
|
|
167
|
+
archetype,
|
|
151
168
|
script,
|
|
152
169
|
manager,
|
|
153
170
|
engineMinVersion,
|
package/core/turbo.js
CHANGED
package/eslint/index.js
CHANGED
|
@@ -11,10 +11,9 @@ function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended'
|
|
|
11
11
|
*
|
|
12
12
|
* @param {{
|
|
13
13
|
* eslintPreset: string,
|
|
14
|
-
* eslintRules: Record<string, any>
|
|
15
14
|
* }} config
|
|
16
15
|
*/
|
|
17
|
-
function task({ eslintPreset
|
|
16
|
+
function task({ eslintPreset }) {
|
|
18
17
|
const packageFileDefault = packageJson();
|
|
19
18
|
const hasWorkspaces = pkg.hasWorkspaces(packageFileDefault);
|
|
20
19
|
const hasTypescript = pkg.hasDependency(packageFileDefault, 'typescript', 'dev');
|
|
@@ -59,7 +58,6 @@ function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended'
|
|
|
59
58
|
update: (config) => ({
|
|
60
59
|
...config,
|
|
61
60
|
extends: [eslintPreset],
|
|
62
|
-
rules: eslintRules,
|
|
63
61
|
parserOptions: {
|
|
64
62
|
project: hasTypescript ? './tsconfig.json' : undefined,
|
|
65
63
|
...config.parserOptions,
|
|
@@ -121,13 +119,13 @@ function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended'
|
|
|
121
119
|
});
|
|
122
120
|
pkg.forEachWorkspace(({ packageFile }) => {
|
|
123
121
|
pkg.script(packageFile, {
|
|
124
|
-
name: project.lint
|
|
122
|
+
name: `${project.lint}:src`,
|
|
125
123
|
script: `eslint .${extOption}`,
|
|
126
124
|
state: 'default',
|
|
127
125
|
});
|
|
128
126
|
pkg.script(packageFile, {
|
|
129
|
-
name: project.format
|
|
130
|
-
script: `eslint .
|
|
127
|
+
name: `${project.format}:src`,
|
|
128
|
+
script: `eslint . --fix${extOption}`,
|
|
131
129
|
state: 'default',
|
|
132
130
|
});
|
|
133
131
|
});
|
|
@@ -166,9 +164,6 @@ function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended'
|
|
|
166
164
|
message: 'Enter ESLint preset name',
|
|
167
165
|
type: 'input',
|
|
168
166
|
},
|
|
169
|
-
eslintRules: {
|
|
170
|
-
type: 'config',
|
|
171
|
-
},
|
|
172
167
|
};
|
|
173
168
|
|
|
174
169
|
return task;
|
package/lang/index.js
CHANGED
|
@@ -27,7 +27,7 @@ function createLang({ language: languageDefault = 'typescript', tsConfig: tsConf
|
|
|
27
27
|
task.typescript = () => {
|
|
28
28
|
const tsConfigPreset = tsConfigDefault;
|
|
29
29
|
const packageFile = packageJson();
|
|
30
|
-
const isApplication =
|
|
30
|
+
const isApplication = pkg.archetype(packageFile) === 'application';
|
|
31
31
|
const hasWorkspaces = pkg.hasWorkspaces(packageFile);
|
|
32
32
|
const tsConfigSettingsName = 'tsconfig.settings.json';
|
|
33
33
|
const tsConfigSettings = json(tsConfigSettingsName);
|
|
@@ -44,7 +44,7 @@ function createLang({ language: languageDefault = 'typescript', tsConfig: tsConf
|
|
|
44
44
|
.unset('compilerOptions.outDir')
|
|
45
45
|
.unset('include')
|
|
46
46
|
.merge({
|
|
47
|
-
$schema: 'https://json.schemastore.org/tsconfig',
|
|
47
|
+
$schema: 'https://json.schemastore.org/tsconfig.json',
|
|
48
48
|
extends: `./${tsConfigSettingsName}`,
|
|
49
49
|
})
|
|
50
50
|
.save();
|
|
@@ -54,7 +54,7 @@ function createLang({ language: languageDefault = 'typescript', tsConfig: tsConf
|
|
|
54
54
|
} else {
|
|
55
55
|
tsConfigSettings
|
|
56
56
|
.merge({
|
|
57
|
-
$schema: 'https://json.schemastore.org/tsconfig',
|
|
57
|
+
$schema: 'https://json.schemastore.org/tsconfig.json',
|
|
58
58
|
compilerOptions: {},
|
|
59
59
|
extends: tsConfigPreset,
|
|
60
60
|
})
|
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.19",
|
|
4
4
|
"description": "Mrm configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mrm",
|
|
@@ -13,19 +13,23 @@
|
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "
|
|
16
|
+
"url": "git@github.com:w5s/project-config.git",
|
|
17
17
|
"directory": "packages/mrm-preset"
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"author": "Julien Polo <julien.polo@gmail.com>",
|
|
21
21
|
"main": "config.json",
|
|
22
22
|
"scripts": {
|
|
23
|
-
"build": "npm
|
|
23
|
+
"build": "concurrently \"npm:build:*\" ",
|
|
24
24
|
"build:empty": ":",
|
|
25
25
|
"build:tsc": "tsc --noEmit --skipLibCheck",
|
|
26
|
+
"clean": "concurrently \"npm:clean:*\" \":\"",
|
|
26
27
|
"docs": "md-magic --path '**/*.md' --ignore='node_modules'",
|
|
27
|
-
"format": "
|
|
28
|
-
"
|
|
28
|
+
"format": "concurrently \"npm:format:*\" \":\"",
|
|
29
|
+
"format:src": "eslint . --fix --ext=mjs,cjs,js,jsx,ts,tsx,json",
|
|
30
|
+
"lint": "concurrently \"npm:lint:*\" \":\"",
|
|
31
|
+
"lint:src": "eslint . --ext=mjs,cjs,js,jsx,ts,tsx,json",
|
|
32
|
+
"prepare": "concurrently \"npm:prepare:*\" \":\"",
|
|
29
33
|
"spellcheck": "cspell --no-progress '**'",
|
|
30
34
|
"test": "mkdir _tester; cd _tester; mrm bootstrap --dir ..; mrm configure --dir .."
|
|
31
35
|
},
|
|
@@ -41,11 +45,11 @@
|
|
|
41
45
|
"mrm": "4.0.0"
|
|
42
46
|
},
|
|
43
47
|
"engines": {
|
|
44
|
-
"node": ">=
|
|
48
|
+
"node": ">=16.x",
|
|
45
49
|
"yarn": ">=1.x"
|
|
46
50
|
},
|
|
47
51
|
"publishConfig": {
|
|
48
52
|
"access": "public"
|
|
49
53
|
},
|
|
50
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "f83a12bd102dc01498ec2ea00344a0fef14f9d69"
|
|
51
55
|
}
|
package/project/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { dirname } = require('node:path');
|
|
1
2
|
const { packageJson, json, makeDirs } = require('mrm-core');
|
|
2
3
|
const git = require('../core/git.js');
|
|
3
4
|
const pkg = require('../core/pkg.js');
|
|
@@ -29,185 +30,198 @@ const turboRun = (script) => `turbo run ${script}`;
|
|
|
29
30
|
/**
|
|
30
31
|
*
|
|
31
32
|
* @param {string} script
|
|
33
|
+
* @param {boolean} allowEmpty
|
|
32
34
|
*/
|
|
33
|
-
const npmRunAll = (script) => `npm
|
|
35
|
+
const npmRunAll = (script, allowEmpty) => `concurrently "npm:${script}:*" ${allowEmpty ? `"${pkg.emptyScript}"` : ''}`;
|
|
34
36
|
function task() {
|
|
35
|
-
const
|
|
37
|
+
const rootPackageFile = packageJson();
|
|
38
|
+
const rootUseWorkspace = pkg.hasWorkspaces(rootPackageFile);
|
|
39
|
+
const rootEngineMinVersion = Object.assign(
|
|
40
|
+
{
|
|
41
|
+
node: '>=12.x',
|
|
42
|
+
yarn: '>=1.x',
|
|
43
|
+
npm: '>=6.x',
|
|
44
|
+
},
|
|
45
|
+
mrmPackageJson.engines
|
|
46
|
+
);
|
|
36
47
|
const gitSupported = git.hasGit();
|
|
37
|
-
const
|
|
38
|
-
const
|
|
48
|
+
const packageManager = pkg.manager(rootPackageFile);
|
|
49
|
+
const gitRepository = git.remoteSync();
|
|
39
50
|
|
|
40
51
|
// Detect git repository
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const gitRepository = git.remoteSync();
|
|
46
|
-
if (gitRepository) {
|
|
47
|
-
return {
|
|
48
|
-
type: 'git',
|
|
49
|
-
url: gitRepository,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
+
if (rootUseWorkspace) {
|
|
53
|
+
const dirs = pkg.listWorkspaceMatchers(rootPackageFile).map(dirname);
|
|
54
|
+
makeDirs(dirs);
|
|
55
|
+
}
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
57
|
+
const addScripts = (/** @type {import("mrm-core").Json} */ currentPackageFile, /** @type {boolean} */ root) => {
|
|
58
|
+
const useWorkspace = pkg.hasWorkspaces(currentPackageFile);
|
|
56
59
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
pkg.script(packageFile, {
|
|
69
|
-
name: `${project.build}:packages`,
|
|
70
|
-
script: turboRun(project.build),
|
|
71
|
-
state: useWorkspace ? 'present' : 'absent',
|
|
72
|
-
});
|
|
73
|
-
pkg.script(packageFile, {
|
|
74
|
-
name: project.clean,
|
|
75
|
-
script: useWorkspace ? turboRun(project.clean) : pkg.emptyScript,
|
|
76
|
-
state: useWorkspace ? 'present' : 'default',
|
|
77
|
-
});
|
|
60
|
+
// build
|
|
61
|
+
pkg.script(currentPackageFile, {
|
|
62
|
+
name: project.build,
|
|
63
|
+
script: npmRunAll(project.build, false),
|
|
64
|
+
state: 'present',
|
|
65
|
+
});
|
|
66
|
+
pkg.script(currentPackageFile, {
|
|
67
|
+
name: `${project.build}:packages`,
|
|
68
|
+
script: turboRun(project.build),
|
|
69
|
+
state: useWorkspace ? 'present' : 'absent',
|
|
70
|
+
});
|
|
78
71
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
72
|
+
// lint
|
|
73
|
+
pkg.script(currentPackageFile, {
|
|
74
|
+
name: project.lint,
|
|
75
|
+
script: npmRunAll(project.lint, true),
|
|
76
|
+
state: 'present',
|
|
77
|
+
});
|
|
78
|
+
pkg.script(currentPackageFile, {
|
|
79
|
+
name: project.format,
|
|
80
|
+
script: npmRunAll(project.format, true),
|
|
81
|
+
state: 'present',
|
|
82
|
+
});
|
|
85
83
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
name: project.
|
|
89
|
-
script:
|
|
90
|
-
state: '
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
pkg.script(packageFile, {
|
|
98
|
-
name: project.format,
|
|
99
|
-
script: npmRunAll(project.format),
|
|
100
|
-
state: 'present',
|
|
101
|
-
});
|
|
102
|
-
pkg.script(packageFile, {
|
|
103
|
-
name: `${project.format}:empty`,
|
|
104
|
-
script: pkg.emptyScript,
|
|
105
|
-
state: !useWorkspace ? 'present' : 'absent',
|
|
106
|
-
});
|
|
84
|
+
// test
|
|
85
|
+
// pkg.script(currentPackageFile, {
|
|
86
|
+
// name: project.coverage,
|
|
87
|
+
// script: pkg.emptyScript,
|
|
88
|
+
// state: 'default',
|
|
89
|
+
// });
|
|
90
|
+
pkg.script(currentPackageFile, {
|
|
91
|
+
name: project.test,
|
|
92
|
+
script: useWorkspace ? npmRunAll(project.test, false) : pkg.emptyScript,
|
|
93
|
+
state: useWorkspace ? 'present' : 'default',
|
|
94
|
+
});
|
|
107
95
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
pkg.script(packageFile, {
|
|
115
|
-
name: project.test,
|
|
116
|
-
script: npmRunAll(project.test),
|
|
117
|
-
state: 'present',
|
|
118
|
-
});
|
|
119
|
-
pkg.script(packageFile, {
|
|
120
|
-
name: project.validate,
|
|
121
|
-
script: `${npmRun(project.build)} && ${npmRun(project.lint)} && ${npmRun(project.test)}`,
|
|
122
|
-
state: 'present',
|
|
123
|
-
});
|
|
96
|
+
// prepare
|
|
97
|
+
pkg.script(currentPackageFile, {
|
|
98
|
+
name: project.prepare,
|
|
99
|
+
script: npmRunAll(project.prepare, true),
|
|
100
|
+
state: 'present',
|
|
101
|
+
});
|
|
124
102
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
103
|
+
// clean
|
|
104
|
+
pkg.script(currentPackageFile, {
|
|
105
|
+
name: project.clean,
|
|
106
|
+
script: npmRunAll(project.clean, true),
|
|
107
|
+
state: 'present',
|
|
108
|
+
});
|
|
109
|
+
pkg.script(currentPackageFile, {
|
|
110
|
+
name: `${project.clean}:packages`,
|
|
111
|
+
script: turboRun(project.clean),
|
|
112
|
+
state: useWorkspace ? 'present' : 'absent',
|
|
113
|
+
});
|
|
131
114
|
|
|
132
|
-
|
|
133
|
-
pkg.script(packageFile, {
|
|
134
|
-
name: project.prepare,
|
|
135
|
-
script: npmRunAll(project.prepare),
|
|
136
|
-
state: 'present',
|
|
137
|
-
});
|
|
138
|
-
pkg.script(packageFile, {
|
|
139
|
-
name: `${project.prepare}:empty`,
|
|
140
|
-
script: !useWorkspace ? 'present' : 'absent',
|
|
141
|
-
state: 'default',
|
|
142
|
-
});
|
|
143
|
-
pkg.script(packageFile, {
|
|
144
|
-
name: `${project.prepare}:packages`,
|
|
145
|
-
script: turboRun(project.prepare),
|
|
146
|
-
state: useWorkspace ? 'present' : 'absent',
|
|
147
|
-
});
|
|
115
|
+
// Root
|
|
148
116
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
117
|
+
// rescue
|
|
118
|
+
pkg.script(currentPackageFile, {
|
|
119
|
+
name: project.rescue,
|
|
120
|
+
script: `${gitSupported ? 'git clean -fdx' : ''};${packageManager} install`,
|
|
121
|
+
state: root ? 'present' : 'absent',
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// release
|
|
125
|
+
pkg.script(currentPackageFile, {
|
|
126
|
+
name: project.release,
|
|
127
|
+
script: pkg.emptyScript,
|
|
128
|
+
state: root ? 'default' : 'absent',
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// code analysis
|
|
132
|
+
pkg.script(currentPackageFile, {
|
|
133
|
+
name: project.codeAnalysis,
|
|
134
|
+
script: pkg.emptyScript,
|
|
135
|
+
state: root ? 'default' : 'absent',
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// develop & auto build & load
|
|
139
|
+
pkg.script(currentPackageFile, {
|
|
140
|
+
name: project.develop,
|
|
141
|
+
script: pkg.emptyScript,
|
|
142
|
+
state: root ? 'default' : 'absent',
|
|
143
|
+
});
|
|
144
|
+
};
|
|
155
145
|
|
|
156
|
-
//
|
|
157
|
-
pkg.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
146
|
+
// eslint-disable-next-line no-shadow
|
|
147
|
+
pkg.withPackageJson((packageFile) => {
|
|
148
|
+
pkg.value(packageFile, {
|
|
149
|
+
path: 'repository',
|
|
150
|
+
state: 'present',
|
|
151
|
+
update: () =>
|
|
152
|
+
gitRepository
|
|
153
|
+
? {
|
|
154
|
+
type: 'git',
|
|
155
|
+
url: gitRepository,
|
|
156
|
+
}
|
|
157
|
+
: undefined,
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
addScripts(packageFile, true);
|
|
161
|
+
|
|
162
|
+
pkg.script(packageFile, {
|
|
163
|
+
name: project.validate,
|
|
164
|
+
script: `${npmRun(project.build)} && ${npmRun(project.lint)} && ${npmRun(project.test)}`,
|
|
165
|
+
state: 'present',
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
// Engine
|
|
169
|
+
pkg.engineMinVersion(packageFile, rootEngineMinVersion);
|
|
170
|
+
});
|
|
171
|
+
pkg.forEachWorkspace((workspace) => {
|
|
172
|
+
pkg.value(workspace.packageFile, {
|
|
173
|
+
path: 'repository',
|
|
174
|
+
state: 'present',
|
|
175
|
+
update: () =>
|
|
176
|
+
gitRepository
|
|
177
|
+
? {
|
|
178
|
+
type: 'git',
|
|
179
|
+
url: gitRepository,
|
|
180
|
+
directory: workspace.projectDir,
|
|
181
|
+
}
|
|
182
|
+
: undefined,
|
|
183
|
+
});
|
|
184
|
+
addScripts(workspace.packageFile, false);
|
|
161
185
|
});
|
|
162
186
|
|
|
163
187
|
// workspace
|
|
164
|
-
|
|
165
188
|
const lernaConfig = json('lerna.json', {
|
|
166
|
-
version:
|
|
189
|
+
version: rootPackageFile.get('version'),
|
|
167
190
|
});
|
|
168
|
-
if (
|
|
169
|
-
const packages = ['packages/*'];
|
|
191
|
+
if (rootUseWorkspace) {
|
|
170
192
|
const versionIndependent = lernaConfig.get('version') === 'independent';
|
|
171
|
-
|
|
193
|
+
const gitmoji = true;
|
|
194
|
+
|
|
172
195
|
lernaConfig.merge({
|
|
196
|
+
$schema: 'https://json.schemastore.org/lerna.json',
|
|
173
197
|
command: {
|
|
174
198
|
publish: {
|
|
175
199
|
conventionalCommits: true,
|
|
176
200
|
npmClient: 'npm',
|
|
177
201
|
},
|
|
178
202
|
version: {
|
|
179
|
-
message:
|
|
203
|
+
message: gitmoji
|
|
204
|
+
? `🔖 Publish${versionIndependent ? '' : ' %s'}`
|
|
205
|
+
: `chore(release): publish${versionIndependent ? '' : ' %s'}`,
|
|
180
206
|
},
|
|
181
207
|
},
|
|
182
208
|
npmClient: packageManager,
|
|
183
|
-
useWorkspaces:
|
|
209
|
+
useWorkspaces: rootUseWorkspace,
|
|
210
|
+
changelogPreset: 'gitmoji-config',
|
|
184
211
|
});
|
|
185
212
|
lernaConfig.save();
|
|
186
|
-
makeDirs('packages');
|
|
187
213
|
} else {
|
|
188
|
-
packageFile.unset('workspaces');
|
|
189
214
|
lernaConfig.delete();
|
|
190
215
|
}
|
|
191
216
|
|
|
192
|
-
|
|
193
|
-
pkg.engineMinVersion(
|
|
194
|
-
packageFile,
|
|
195
|
-
Object.assign(
|
|
196
|
-
{
|
|
197
|
-
node: '>=12.x',
|
|
198
|
-
yarn: '>=1.x',
|
|
199
|
-
npm: '>=6.x',
|
|
200
|
-
},
|
|
201
|
-
mrmPackageJson.engines
|
|
202
|
-
)
|
|
203
|
-
);
|
|
204
|
-
packageFile.save();
|
|
217
|
+
rootPackageFile.save();
|
|
205
218
|
|
|
206
219
|
// Turbo config
|
|
207
220
|
turbo({
|
|
208
|
-
state:
|
|
221
|
+
state: rootUseWorkspace ? 'present' : 'absent',
|
|
209
222
|
update: (_) => ({
|
|
210
223
|
..._,
|
|
224
|
+
baseBranch: 'origin/main',
|
|
211
225
|
pipeline: {
|
|
212
226
|
[project.build]: {
|
|
213
227
|
dependsOn: ['^build'],
|
|
@@ -231,15 +245,21 @@ function task() {
|
|
|
231
245
|
});
|
|
232
246
|
|
|
233
247
|
// Dependencies
|
|
248
|
+
// clean
|
|
234
249
|
npm.dependency({
|
|
235
250
|
dev: true,
|
|
236
251
|
name: ['npm-run-all'],
|
|
252
|
+
state: 'absent',
|
|
253
|
+
});
|
|
254
|
+
npm.dependency({
|
|
255
|
+
dev: true,
|
|
256
|
+
name: ['concurrently'],
|
|
237
257
|
state: 'present',
|
|
238
258
|
});
|
|
239
259
|
npm.dependency({
|
|
240
260
|
dev: true,
|
|
241
|
-
name: ['lerna'],
|
|
242
|
-
state:
|
|
261
|
+
name: ['lerna', 'conventional-changelog-gitmoji-config'],
|
|
262
|
+
state: rootUseWorkspace ? 'present' : 'absent',
|
|
243
263
|
});
|
|
244
264
|
|
|
245
265
|
// VSCode
|
package/release/index.js
CHANGED
|
@@ -4,7 +4,7 @@ const project = require('../core/project.js');
|
|
|
4
4
|
const { semanticRelease } = require('../core/semanticRelease.js');
|
|
5
5
|
|
|
6
6
|
function task() {
|
|
7
|
-
const useWorkspace = packageJson()
|
|
7
|
+
const useWorkspace = pkg.hasWorkspaces(packageJson());
|
|
8
8
|
|
|
9
9
|
// release
|
|
10
10
|
pkg.withPackageJson((packageFile) => {
|
package/renovate/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const { json, packageJson } = require('mrm-core');
|
|
2
2
|
const { hasGit } = require('../core/git.js');
|
|
3
|
+
const pkg = require('../core/pkg.js');
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
*
|
|
@@ -19,7 +20,8 @@ function createRenovate({ renovatePresetApplication, renovatePresetLibrary }) {
|
|
|
19
20
|
const gitSupported = hasGit();
|
|
20
21
|
|
|
21
22
|
if (gitSupported) {
|
|
22
|
-
const
|
|
23
|
+
const packageFile = packageJson();
|
|
24
|
+
const packageArchetype = pkg.archetype(packageFile);
|
|
23
25
|
const renovatePresetResolved =
|
|
24
26
|
renovatePreset || (packageArchetype === 'application' ? renovatePresetApplication : renovatePresetLibrary);
|
|
25
27
|
const renovateFile = json('renovate.json');
|
package/tsconfig.json
CHANGED
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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.
|