@w5s/mrm-preset 1.0.0-alpha.18 → 1.0.0-alpha.21
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 -1
- package/.turbo/turbo-lint.log +7 -1
- package/.turbo/turbo-prepare.log +2 -0
- package/.turbo/turbo-test.log +2 -3
- package/CHANGELOG.md +24 -0
- package/README.md +1 -1
- package/bootstrap/index.js +1 -1
- package/ci/gitlab.js +1 -1
- package/config.json +1 -0
- package/contributing/index.js +1 -1
- package/core/git.js +2 -18
- package/core/githooks.js +2 -2
- package/core/githubCI.js +2 -2
- package/core/pkg.js +20 -3
- package/core/turbo.js +1 -0
- package/eslint/index.js +3 -8
- package/githooks/index.js +1 -1
- package/lang/index.js +4 -4
- package/licenses/index.js +26 -0
- package/package.json +11 -8
- package/postconfigure/index.js +1 -1
- package/project/index.js +155 -137
- package/release/index.js +1 -1
- package/renovate/index.js +3 -1
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 997280f5aaf899ce
|
|
2
|
+
@w5s/mrm-preset:build: [build:*empty]
|
|
3
|
+
@w5s/mrm-preset:build: [build:*empty] > @w5s/mrm-preset@1.0.0-alpha.19 build:empty
|
|
4
|
+
@w5s/mrm-preset:build: [build:*empty] > :
|
|
5
|
+
@w5s/mrm-preset:build: [build:*empty]
|
|
6
|
+
@w5s/mrm-preset:build: [build:*tsc]
|
|
7
|
+
@w5s/mrm-preset:build: [build:*tsc] > @w5s/mrm-preset@1.0.0-alpha.19 build:tsc
|
|
8
|
+
@w5s/mrm-preset:build: [build:*tsc] > tsc --noEmit --skipLibCheck
|
|
9
|
+
@w5s/mrm-preset:build: [build:*tsc]
|
|
10
|
+
@w5s/mrm-preset:build: [build:*empty] npm run build:empty exited with code 0
|
|
11
|
+
@w5s/mrm-preset:build: [build:*tsc] npm run build:tsc exited with code 0
|
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 c068eefb6cfef61f
|
|
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
|
package/.turbo/turbo-format.log
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
@w5s/mrm-preset:format: cache hit, replaying output
|
|
1
|
+
@w5s/mrm-preset:format: cache hit, replaying output 787e0ab6858ee343
|
|
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.19 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 f7c8b4fc8efaad53
|
|
2
|
+
@w5s/mrm-preset:lint: [1] : exited with code 0
|
|
3
|
+
@w5s/mrm-preset:lint: [lint:*src]
|
|
4
|
+
@w5s/mrm-preset:lint: [lint:*src] > @w5s/mrm-preset@1.0.0-alpha.19 lint:src
|
|
5
|
+
@w5s/mrm-preset:lint: [lint:*src] > eslint . --ext=mjs,cjs,js,jsx,ts,tsx,json
|
|
6
|
+
@w5s/mrm-preset:lint: [lint:*src]
|
|
7
|
+
@w5s/mrm-preset:lint: [lint:*src] npm run lint:src exited with code 0
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
@w5s/mrm-preset:test: cache hit, replaying output
|
|
1
|
+
@w5s/mrm-preset:test: cache hit, replaying output 05c009fdd04ce5a0
|
|
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
|
|
5
5
|
@w5s/mrm-preset:test: [36mRunning gitignore...[39m
|
|
6
6
|
@w5s/mrm-preset:test: [36mRunning project...[39m
|
|
7
|
-
@w5s/mrm-preset:test: [32mUpdate package.json[39m
|
|
8
7
|
@w5s/mrm-preset:test: [36mRunning contributing...[39m
|
|
8
|
+
@w5s/mrm-preset:test: [36mRunning license...[39m
|
|
9
9
|
@w5s/mrm-preset:test: [36mRunning release...[39m
|
|
10
10
|
@w5s/mrm-preset:test: [36mRunning ci...[39m
|
|
11
11
|
@w5s/mrm-preset:test: [36mRunning lang...[39m
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
@w5s/mrm-preset:test: [36mRunning eslint...[39m
|
|
15
15
|
@w5s/mrm-preset:test: [36mRunning cspell...[39m
|
|
16
16
|
@w5s/mrm-preset:test: [36mRunning jest...[39m
|
|
17
|
-
@w5s/mrm-preset:test: [32mUpdate package.json[39m
|
|
18
17
|
@w5s/mrm-preset:test: [36mRunning renovate...[39m
|
|
19
18
|
@w5s/mrm-preset:test: [36mRunning githooks...[39m
|
|
20
19
|
@w5s/mrm-preset:test: [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.21](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.0.0-alpha.20...@w5s/mrm-preset@1.0.0-alpha.21) (2022-08-09)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @w5s/mrm-preset
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [1.0.0-alpha.20](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.0.0-alpha.19...@w5s/mrm-preset@1.0.0-alpha.20) (2022-08-09)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @w5s/mrm-preset
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [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)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @w5s/mrm-preset
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
# [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)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @w5s/mrm-preset
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Initialize your project using this command :
|
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
21
|
# from the root of your project
|
|
22
|
-
npm exec --package=@w5s/mrm-preset -- mrm bootstrap --preset @w5s/mrm-preset
|
|
22
|
+
npm exec --package=@w5s/mrm-preset --package=mrm -- mrm bootstrap --preset @w5s/mrm-preset
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
This will install in `package.json` the npm scripts
|
package/bootstrap/index.js
CHANGED
package/ci/gitlab.js
CHANGED
package/config.json
CHANGED
package/contributing/index.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/githooks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const { execSync } = require('child_process');
|
|
2
|
-
const path = require('path');
|
|
1
|
+
const { execSync } = require('node:child_process');
|
|
2
|
+
const path = require('node:path');
|
|
3
3
|
const { file, packageJson, makeDirs } = require('mrm-core');
|
|
4
4
|
const project = require('./project.js');
|
|
5
5
|
const npm = require('./npm.js');
|
package/core/githubCI.js
CHANGED
package/core/pkg.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
const { intersect } = require('semver-intersect');
|
|
6
6
|
const { packageJson, file, json } = require('mrm-core');
|
|
7
7
|
const glob = require('glob');
|
|
8
|
-
const path = require('path');
|
|
8
|
+
const path = require('node:path');
|
|
9
9
|
const jsonFile = require('./jsonFile.js');
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -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'));
|
|
@@ -121,7 +136,7 @@ function hasDependency(packageFile, packageName, dependencyType) {
|
|
|
121
136
|
|
|
122
137
|
/**
|
|
123
138
|
*
|
|
124
|
-
* @param {import('mrm-core').
|
|
139
|
+
* @param {import('mrm-core').Json} packageFile
|
|
125
140
|
* @param {Record<string, string>} engineVersionMap
|
|
126
141
|
*/
|
|
127
142
|
function engineMinVersion(packageFile, engineVersionMap) {
|
|
@@ -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,12 +119,12 @@ 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
|
|
127
|
+
name: `${project.format}:src`,
|
|
130
128
|
script: `eslint . --fix${extOption}`,
|
|
131
129
|
state: 'default',
|
|
132
130
|
});
|
|
@@ -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/githooks/index.js
CHANGED
package/lang/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const path = require('path');
|
|
1
|
+
const path = require('node:path');
|
|
2
2
|
const { json, file, template, packageJson } = require('mrm-core');
|
|
3
3
|
const npm = require('../core/npm.js');
|
|
4
4
|
const { gitIgnore } = require('../core/git.js');
|
|
@@ -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);
|
|
@@ -66,7 +66,7 @@ function createLang({ language: languageDefault = 'typescript', tsConfig: tsConf
|
|
|
66
66
|
rootDir: './src',
|
|
67
67
|
},
|
|
68
68
|
extends: `./${tsConfigSettingsName}`,
|
|
69
|
-
include: ['
|
|
69
|
+
include: ['src'],
|
|
70
70
|
})
|
|
71
71
|
.save();
|
|
72
72
|
|
|
@@ -104,7 +104,7 @@ function createLang({ language: languageDefault = 'typescript', tsConfig: tsConf
|
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
typedoc({
|
|
107
|
-
state: 'present',
|
|
107
|
+
state: isApplication ? 'absent' : 'present',
|
|
108
108
|
update: (config) => ({
|
|
109
109
|
// Default values
|
|
110
110
|
tsconfig: 'tsconfig.json',
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const { packageJson } = require('mrm-core');
|
|
2
|
+
const pkg = require('../core/pkg.js');
|
|
3
|
+
const jsonFile = require('../core/jsonFile.js');
|
|
4
|
+
|
|
5
|
+
function task() {
|
|
6
|
+
pkg.withPackageJson((packageFile) => {
|
|
7
|
+
jsonFile.value(packageFile, {
|
|
8
|
+
path: 'license',
|
|
9
|
+
state: 'present',
|
|
10
|
+
default: 'UNLICENSED',
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
const license = packageJson().get('license');
|
|
14
|
+
|
|
15
|
+
pkg.forEachWorkspace(({ packageFile }) => {
|
|
16
|
+
jsonFile.value(packageFile, {
|
|
17
|
+
path: 'license',
|
|
18
|
+
state: 'present',
|
|
19
|
+
default: license,
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
task.description = 'Setup License';
|
|
25
|
+
task.parameters = {};
|
|
26
|
+
module.exports = task;
|
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.21",
|
|
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,10 @@
|
|
|
41
45
|
"mrm": "4.0.0"
|
|
42
46
|
},
|
|
43
47
|
"engines": {
|
|
44
|
-
"node": ">=
|
|
45
|
-
"yarn": ">=1.x"
|
|
48
|
+
"node": ">=16.0.0"
|
|
46
49
|
},
|
|
47
50
|
"publishConfig": {
|
|
48
51
|
"access": "public"
|
|
49
52
|
},
|
|
50
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "524f252acd9eba4c34b5ae0850bd6670b31db429"
|
|
51
54
|
}
|
package/postconfigure/index.js
CHANGED
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,147 +30,171 @@ 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: pkg.emptyScript,
|
|
141
|
-
state: !useWorkspace ? 'present' : 'absent',
|
|
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
|
-
|
|
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
|
+
};
|
|
145
|
+
|
|
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);
|
|
154
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);
|
|
155
185
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
name: project.release,
|
|
159
|
-
script: pkg.emptyScript,
|
|
160
|
-
state: 'default',
|
|
186
|
+
// Engine
|
|
187
|
+
pkg.engineMinVersion(workspace.packageFile, { node: rootEngineMinVersion.node });
|
|
161
188
|
});
|
|
162
189
|
|
|
163
190
|
// workspace
|
|
164
|
-
|
|
165
191
|
const lernaConfig = json('lerna.json', {
|
|
166
|
-
version:
|
|
192
|
+
version: rootPackageFile.get('version'),
|
|
167
193
|
});
|
|
168
|
-
if (
|
|
169
|
-
const packages = ['packages/*'];
|
|
194
|
+
if (rootUseWorkspace) {
|
|
170
195
|
const versionIndependent = lernaConfig.get('version') === 'independent';
|
|
171
196
|
const gitmoji = true;
|
|
172
|
-
|
|
197
|
+
|
|
173
198
|
lernaConfig.merge({
|
|
174
199
|
$schema: 'https://json.schemastore.org/lerna.json',
|
|
175
200
|
command: {
|
|
@@ -184,35 +209,22 @@ function task() {
|
|
|
184
209
|
},
|
|
185
210
|
},
|
|
186
211
|
npmClient: packageManager,
|
|
187
|
-
useWorkspaces:
|
|
212
|
+
useWorkspaces: rootUseWorkspace,
|
|
188
213
|
changelogPreset: 'gitmoji-config',
|
|
189
214
|
});
|
|
190
215
|
lernaConfig.save();
|
|
191
|
-
makeDirs('packages');
|
|
192
216
|
} else {
|
|
193
|
-
packageFile.unset('workspaces');
|
|
194
217
|
lernaConfig.delete();
|
|
195
218
|
}
|
|
196
219
|
|
|
197
|
-
|
|
198
|
-
pkg.engineMinVersion(
|
|
199
|
-
packageFile,
|
|
200
|
-
Object.assign(
|
|
201
|
-
{
|
|
202
|
-
node: '>=12.x',
|
|
203
|
-
yarn: '>=1.x',
|
|
204
|
-
npm: '>=6.x',
|
|
205
|
-
},
|
|
206
|
-
mrmPackageJson.engines
|
|
207
|
-
)
|
|
208
|
-
);
|
|
209
|
-
packageFile.save();
|
|
220
|
+
rootPackageFile.save();
|
|
210
221
|
|
|
211
222
|
// Turbo config
|
|
212
223
|
turbo({
|
|
213
|
-
state:
|
|
224
|
+
state: rootUseWorkspace ? 'present' : 'absent',
|
|
214
225
|
update: (_) => ({
|
|
215
226
|
..._,
|
|
227
|
+
baseBranch: 'origin/main',
|
|
216
228
|
pipeline: {
|
|
217
229
|
[project.build]: {
|
|
218
230
|
dependsOn: ['^build'],
|
|
@@ -236,15 +248,21 @@ function task() {
|
|
|
236
248
|
});
|
|
237
249
|
|
|
238
250
|
// Dependencies
|
|
251
|
+
// clean
|
|
239
252
|
npm.dependency({
|
|
240
253
|
dev: true,
|
|
241
254
|
name: ['npm-run-all'],
|
|
255
|
+
state: 'absent',
|
|
256
|
+
});
|
|
257
|
+
npm.dependency({
|
|
258
|
+
dev: true,
|
|
259
|
+
name: ['concurrently'],
|
|
242
260
|
state: 'present',
|
|
243
261
|
});
|
|
244
262
|
npm.dependency({
|
|
245
263
|
dev: true,
|
|
246
264
|
name: ['lerna', 'conventional-changelog-gitmoji-config'],
|
|
247
|
-
state:
|
|
265
|
+
state: rootUseWorkspace ? 'present' : 'absent',
|
|
248
266
|
});
|
|
249
267
|
|
|
250
268
|
// 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');
|