@w5s/mrm-preset 1.0.0-alpha.9 → 1.0.0
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 +6 -1
- package/.turbo/turbo-docs.log +9 -43
- package/.turbo/turbo-format.log +6 -0
- package/.turbo/turbo-lint.log +6 -52
- package/.turbo/turbo-prepare.log +1 -0
- package/.turbo/turbo-test.log +28 -21
- package/CHANGELOG.md +186 -42
- package/README.md +7 -7
- package/bootstrap/README.md +1 -1
- package/bootstrap/index.js +14 -38
- package/ci/_gitlab/AutoDevops.gitlab-ci.yml +1 -2
- package/ci/_gitlab/AutoDevopsInclude.gitlab-ci.yml +19 -19
- package/ci/_gitlab/Renovate.gitlab-ci.yml +6 -6
- package/ci/github.js +53 -0
- package/ci/gitlab.js +1 -2
- package/ci/index.js +7 -2
- package/commitlint/index.js +8 -2
- package/config.json +2 -1
- package/contributing/index.js +1 -1
- package/core/commitlint.js +5 -5
- package/core/cspell.js +2 -11
- package/core/eslint.js +25 -6
- package/core/git.js +4 -23
- package/core/githooks.js +13 -21
- package/core/githubCI.js +56 -0
- package/core/jest.js +26 -36
- package/core/jsonFile.js +8 -7
- package/core/lintStaged.js +3 -3
- package/core/npm.js +15 -13
- package/core/pkg.js +71 -14
- package/core/project.js +6 -0
- package/core/semanticRelease.js +3 -3
- package/core/turbo.js +52 -0
- package/core/typedoc.js +3 -3
- package/core/vitest.js +77 -0
- package/core/vscode.js +15 -5
- package/cspell/index.js +35 -14
- package/editorconfig/index.js +19 -9
- package/eslint/index.js +90 -47
- package/githooks/index.js +16 -12
- package/gitignore/index.js +1 -1
- package/lang/.eslintrc.json +1 -3
- package/lang/index.js +73 -36
- package/lang/templates/index.spec.ts +3 -2
- package/lang/templates/index.ts +1 -2
- package/licenses/index.js +26 -0
- package/package.json +21 -14
- package/postconfigure/index.js +11 -3
- package/project/index.js +253 -171
- package/release/index.js +5 -5
- package/renovate/index.js +4 -3
- package/tsconfig.json +3 -6
- package/{jest → vitest}/index.js +3 -3
package/eslint/index.js
CHANGED
|
@@ -1,91 +1,129 @@
|
|
|
1
1
|
const { packageJson } = require('mrm-core');
|
|
2
|
-
const pkg = require('../core/pkg');
|
|
3
|
-
const npm = require('../core/npm');
|
|
4
|
-
const { gitIgnore } = require('../core/git');
|
|
5
|
-
const {
|
|
6
|
-
const project = require('../core/project');
|
|
7
|
-
const { vscodeSettings } = require('../core/vscode');
|
|
2
|
+
const pkg = require('../core/pkg.js');
|
|
3
|
+
const npm = require('../core/npm.js');
|
|
4
|
+
const { gitIgnore } = require('../core/git.js');
|
|
5
|
+
const { eslintConfig } = require('../core/eslint.js');
|
|
6
|
+
const project = require('../core/project.js');
|
|
7
|
+
const { vscodeSettings, vscodeRecommendedExtension } = require('../core/vscode.js');
|
|
8
8
|
|
|
9
9
|
function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended' }) {
|
|
10
10
|
/**
|
|
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();
|
|
18
|
+
const hasWorkspaces = pkg.hasWorkspaces(packageFileDefault);
|
|
19
19
|
const hasTypescript = pkg.hasDependency(packageFileDefault, 'typescript', 'dev');
|
|
20
20
|
const hasJSX = true;
|
|
21
21
|
const hasJSON = true;
|
|
22
|
+
const hasYAML = true;
|
|
22
23
|
|
|
23
24
|
// Should be added first
|
|
24
25
|
gitIgnore('ESLint', ['.eslintcache']);
|
|
25
|
-
eslintIgnore([
|
|
26
|
-
// List of paths to ignore
|
|
27
|
-
'node_modules/',
|
|
28
|
-
'coverage/',
|
|
29
|
-
'build/',
|
|
30
|
-
'.cache/',
|
|
31
|
-
'**/tsconfig.json',
|
|
32
|
-
'.vscode/**',
|
|
33
|
-
'public/',
|
|
34
|
-
]);
|
|
35
26
|
|
|
36
27
|
// Dependencies
|
|
37
28
|
npm.dependency({
|
|
38
29
|
dev: true,
|
|
39
|
-
name: ['eslint', '
|
|
30
|
+
name: ['eslint', 'prettier'],
|
|
40
31
|
state: 'present',
|
|
41
32
|
});
|
|
42
33
|
|
|
43
|
-
// Clean legacy
|
|
44
|
-
npm.dependency({
|
|
45
|
-
dev: true,
|
|
46
|
-
name: ['@typescript-eslint/parser', '@typescript-eslint/eslint-plugin', 'babel-eslint'],
|
|
47
|
-
state: 'absent',
|
|
48
|
-
});
|
|
49
|
-
|
|
50
34
|
// Preset
|
|
51
35
|
npm.dependency({
|
|
52
36
|
dev: true,
|
|
53
37
|
name: eslintPreset,
|
|
54
|
-
state:
|
|
38
|
+
state: eslintPreset.startsWith('eslint:') ? 'absent' : 'present',
|
|
55
39
|
});
|
|
56
40
|
eslintConfig({
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
41
|
+
state: 'present',
|
|
42
|
+
update: (config) => ({
|
|
43
|
+
...config,
|
|
44
|
+
extends: [eslintPreset],
|
|
45
|
+
parserOptions: {
|
|
46
|
+
project: hasTypescript ? './tsconfig.json' : undefined,
|
|
47
|
+
...config.parserOptions,
|
|
48
|
+
},
|
|
49
|
+
}),
|
|
62
50
|
});
|
|
63
51
|
|
|
64
52
|
/** @type {Record<string, boolean>} */
|
|
65
53
|
const extsMap = {
|
|
54
|
+
mjs: true,
|
|
55
|
+
cjs: true,
|
|
66
56
|
js: true,
|
|
67
57
|
jsx: hasJSX,
|
|
68
58
|
ts: hasTypescript,
|
|
69
59
|
tsx: hasTypescript && hasJSX,
|
|
70
60
|
json: hasJSON,
|
|
61
|
+
jsonc: hasJSON,
|
|
62
|
+
json5: hasJSON,
|
|
63
|
+
yml: hasYAML,
|
|
64
|
+
yaml: hasYAML,
|
|
71
65
|
};
|
|
72
66
|
const extList = Object.keys(extsMap).filter((ext) => extsMap[ext]);
|
|
73
67
|
const extOption = ` --ext=${extList.join(',')}`;
|
|
74
68
|
|
|
75
69
|
pkg.withPackageJson((packageFile) => {
|
|
70
|
+
const ignorePatterns = pkg
|
|
71
|
+
.listWorkspaceMatchers(packageFile)
|
|
72
|
+
.map((_) => ` --ignore-pattern='${_}/**'`)
|
|
73
|
+
.join('');
|
|
74
|
+
|
|
75
|
+
// workspaces
|
|
76
76
|
pkg.script(packageFile, {
|
|
77
|
-
name: project.lint
|
|
78
|
-
|
|
77
|
+
name: `${project.lint}:root`,
|
|
78
|
+
update: `eslint .${extOption}${hasWorkspaces ? ignorePatterns : ''}`,
|
|
79
79
|
state: 'present',
|
|
80
80
|
});
|
|
81
81
|
pkg.script(packageFile, {
|
|
82
|
-
name: project.format
|
|
83
|
-
|
|
82
|
+
name: `${project.format}:root`,
|
|
83
|
+
update: `eslint .${extOption}${hasWorkspaces ? ignorePatterns : ''} --fix`,
|
|
84
|
+
state: 'present',
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// clean
|
|
88
|
+
pkg.script(packageFile, {
|
|
89
|
+
name: `${project.lint}:packages`,
|
|
90
|
+
state: 'absent',
|
|
91
|
+
});
|
|
92
|
+
pkg.script(packageFile, {
|
|
93
|
+
name: `${project.format}:packages`,
|
|
94
|
+
state: 'absent',
|
|
95
|
+
});
|
|
96
|
+
pkg.script(packageFile, {
|
|
97
|
+
name: `${project.lint}:src`,
|
|
98
|
+
state: 'absent',
|
|
99
|
+
});
|
|
100
|
+
pkg.script(packageFile, {
|
|
101
|
+
name: `${project.format}:src`,
|
|
102
|
+
state: 'absent',
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
pkg.forEachWorkspace(({ packageFile }) => {
|
|
106
|
+
const updater = (/** @type {boolean} */ format) => (/** @type {string} */ _) =>
|
|
107
|
+
_ == null || _ === '' || _.trimStart().startsWith('eslint')
|
|
108
|
+
? `eslint .${format ? ' --fix' : ''}${extOption}`
|
|
109
|
+
: _;
|
|
110
|
+
pkg.script(packageFile, {
|
|
111
|
+
name: `${project.lint}:src`,
|
|
112
|
+
update: updater(),
|
|
113
|
+
state: 'present',
|
|
114
|
+
});
|
|
115
|
+
pkg.script(packageFile, {
|
|
116
|
+
name: `${project.format}:src`,
|
|
117
|
+
update: updater(true),
|
|
84
118
|
state: 'present',
|
|
85
119
|
});
|
|
86
120
|
});
|
|
87
121
|
|
|
88
122
|
// VSCode support
|
|
123
|
+
vscodeRecommendedExtension({
|
|
124
|
+
name: 'dbaeumer.vscode-eslint',
|
|
125
|
+
state: 'present',
|
|
126
|
+
});
|
|
89
127
|
vscodeSettings({
|
|
90
128
|
state: 'present',
|
|
91
129
|
update: (settings) => ({
|
|
@@ -93,14 +131,22 @@ function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended'
|
|
|
93
131
|
'editor.codeActionsOnSave': settings['editor.codeActionsOnSave'] || {
|
|
94
132
|
'source.fixAll': true,
|
|
95
133
|
},
|
|
96
|
-
'eslint.validate':
|
|
97
|
-
(
|
|
98
|
-
(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
134
|
+
'eslint.validate': Array.from(
|
|
135
|
+
new Set(
|
|
136
|
+
extList.map(
|
|
137
|
+
(ext) =>
|
|
138
|
+
({
|
|
139
|
+
cjs: 'javascript',
|
|
140
|
+
mjs: 'javascript',
|
|
141
|
+
jsx: 'javascriptreact',
|
|
142
|
+
js: 'javascript',
|
|
143
|
+
tsx: 'typescriptreact',
|
|
144
|
+
ts: 'typescript',
|
|
145
|
+
yaml: 'yaml',
|
|
146
|
+
yml: 'yaml',
|
|
147
|
+
}[ext] || ext)
|
|
148
|
+
)
|
|
149
|
+
)
|
|
104
150
|
),
|
|
105
151
|
}),
|
|
106
152
|
});
|
|
@@ -113,9 +159,6 @@ function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended'
|
|
|
113
159
|
message: 'Enter ESLint preset name',
|
|
114
160
|
type: 'input',
|
|
115
161
|
},
|
|
116
|
-
eslintRules: {
|
|
117
|
-
type: 'config',
|
|
118
|
-
},
|
|
119
162
|
};
|
|
120
163
|
|
|
121
164
|
return task;
|
package/githooks/index.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
const path = require('path');
|
|
1
|
+
const path = require('node:path');
|
|
2
2
|
const { packageJson, template } = require('mrm-core');
|
|
3
|
-
const project = require('../core/project');
|
|
4
|
-
const pkg = require('../core/pkg');
|
|
5
|
-
const { hasGit } = require('../core/git');
|
|
6
|
-
const { gitHook, husky } = require('../core/githooks');
|
|
7
|
-
const { lintStaged } = require('../core/lintStaged');
|
|
8
|
-
const { file } = require('../core/file');
|
|
3
|
+
const project = require('../core/project.js');
|
|
4
|
+
const pkg = require('../core/pkg.js');
|
|
5
|
+
const { hasGit } = require('../core/git.js');
|
|
6
|
+
const { gitHook, husky } = require('../core/githooks.js');
|
|
7
|
+
const { lintStaged } = require('../core/lintStaged.js');
|
|
8
|
+
const { file } = require('../core/file.js');
|
|
9
9
|
|
|
10
10
|
function task() {
|
|
11
11
|
const gitSupported = hasGit();
|
|
12
12
|
const packageFile = packageJson();
|
|
13
13
|
const hasESLint = pkg.hasDependency(packageFile, 'eslint', 'dev');
|
|
14
|
-
const hasTsc = pkg.hasDependency(packageFile, 'typescript', 'dev');
|
|
15
14
|
|
|
16
15
|
husky({
|
|
17
16
|
state: gitSupported ? 'present' : 'absent',
|
|
@@ -20,14 +19,19 @@ function task() {
|
|
|
20
19
|
state: gitSupported ? 'present' : 'absent',
|
|
21
20
|
update: (config) => ({
|
|
22
21
|
...config,
|
|
23
|
-
'*.json': [...(hasESLint ? ['eslint'] : [])],
|
|
24
|
-
'*.
|
|
25
|
-
'*.
|
|
22
|
+
'*.{json,jsonc,json5}': [...(hasESLint ? ['eslint'] : [])],
|
|
23
|
+
'*.{yml,yaml}': [...(hasESLint ? ['eslint'] : [])],
|
|
24
|
+
'*.js?(x)': [...(hasESLint ? ['eslint'] : [])],
|
|
25
|
+
'*.ts?(x)': [
|
|
26
|
+
// TODO: https://github.com/okonet/lint-staged/issues/825
|
|
27
|
+
// ...(hasTsc ? ["tsc --noEmit --skipLibCheck"] : []),
|
|
28
|
+
...(hasESLint ? ['eslint'] : []),
|
|
29
|
+
],
|
|
26
30
|
}),
|
|
27
31
|
});
|
|
28
32
|
gitHook({
|
|
29
33
|
name: 'pre-commit',
|
|
30
|
-
content: `npm exec --
|
|
34
|
+
content: `npm exec -- lint-staged`,
|
|
31
35
|
state: gitSupported ? 'present' : 'absent',
|
|
32
36
|
});
|
|
33
37
|
gitHook({
|
package/gitignore/index.js
CHANGED
package/lang/.eslintrc.json
CHANGED
package/lang/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
const path = require('path');
|
|
1
|
+
const path = require('node:path');
|
|
2
2
|
const { json, file, template, packageJson } = require('mrm-core');
|
|
3
|
-
const npm = require('../core/npm');
|
|
4
|
-
const { gitIgnore } = require('../core/git');
|
|
5
|
-
const project = require('../core/project');
|
|
6
|
-
const {
|
|
7
|
-
const
|
|
8
|
-
const pkg = require('../core/pkg');
|
|
3
|
+
const npm = require('../core/npm.js');
|
|
4
|
+
const { gitIgnore } = require('../core/git.js');
|
|
5
|
+
const project = require('../core/project.js');
|
|
6
|
+
// const { typedoc } = require('../core/typedoc.js');
|
|
7
|
+
const pkg = require('../core/pkg.js');
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
*
|
|
@@ -27,7 +26,7 @@ function createLang({ language: languageDefault = 'typescript', tsConfig: tsConf
|
|
|
27
26
|
task.typescript = () => {
|
|
28
27
|
const tsConfigPreset = tsConfigDefault;
|
|
29
28
|
const packageFile = packageJson();
|
|
30
|
-
const isApplication =
|
|
29
|
+
const isApplication = pkg.archetype(packageFile) === 'application';
|
|
31
30
|
const hasWorkspaces = pkg.hasWorkspaces(packageFile);
|
|
32
31
|
const tsConfigSettingsName = 'tsconfig.settings.json';
|
|
33
32
|
const tsConfigSettings = json(tsConfigSettingsName);
|
|
@@ -35,25 +34,63 @@ function createLang({ language: languageDefault = 'typescript', tsConfig: tsConf
|
|
|
35
34
|
|
|
36
35
|
// Should be run first
|
|
37
36
|
gitIgnore('Typescript', ['lib/', '*.tsbuildinfo', 'typings/']);
|
|
38
|
-
eslintIgnore(['lib/']);
|
|
39
37
|
|
|
38
|
+
// const excludeList = ['**/*.test.*', '**/*.spec.*', '**/__tests__/**'];
|
|
40
39
|
if (hasWorkspaces) {
|
|
41
40
|
tsConfig
|
|
42
41
|
.unset('compilerOptions.rootDir')
|
|
43
42
|
.unset('compilerOptions.outDir')
|
|
44
43
|
.unset('include')
|
|
45
44
|
.merge({
|
|
46
|
-
$schema: 'https://json.schemastore.org/tsconfig',
|
|
45
|
+
$schema: 'https://json.schemastore.org/tsconfig.json',
|
|
47
46
|
extends: `./${tsConfigSettingsName}`,
|
|
48
47
|
})
|
|
49
48
|
.save();
|
|
50
49
|
|
|
51
50
|
file('src/index.ts').delete();
|
|
52
51
|
file('src/index.spec.ts').delete();
|
|
52
|
+
|
|
53
|
+
pkg.forEachWorkspace(({ projectDir, packageFile: projectPackageFile }) => {
|
|
54
|
+
const projectTsConfig = json(`${projectDir}/tsconfig.json`);
|
|
55
|
+
const projectTsConfigBuild = json(`${projectDir}/tsconfig.build.json`);
|
|
56
|
+
const hasTypecript = projectTsConfig.exists();
|
|
57
|
+
pkg.script(projectPackageFile, {
|
|
58
|
+
name: 'build:tsc',
|
|
59
|
+
state: hasTypecript ? 'present' : 'absent',
|
|
60
|
+
update: () => 'tsc -b tsconfig.build.json',
|
|
61
|
+
});
|
|
62
|
+
pkg.script(projectPackageFile, {
|
|
63
|
+
name: 'clean:tsc',
|
|
64
|
+
state: hasTypecript ? 'present' : 'absent',
|
|
65
|
+
update: () => 'rm -rf lib',
|
|
66
|
+
});
|
|
67
|
+
if (hasTypecript && projectPackageFile.get('name') !== '@w5s/ts-config') {
|
|
68
|
+
projectTsConfig
|
|
69
|
+
.merge({
|
|
70
|
+
$schema: 'https://json.schemastore.org/tsconfig.json',
|
|
71
|
+
extends: '../../tsconfig.settings.json',
|
|
72
|
+
})
|
|
73
|
+
.save();
|
|
74
|
+
|
|
75
|
+
projectTsConfigBuild
|
|
76
|
+
.merge({
|
|
77
|
+
$schema: 'https://json.schemastore.org/tsconfig.json',
|
|
78
|
+
extends: './tsconfig.json',
|
|
79
|
+
compilerOptions: {
|
|
80
|
+
noEmit: false,
|
|
81
|
+
outDir: 'lib',
|
|
82
|
+
},
|
|
83
|
+
include: ['src'],
|
|
84
|
+
})
|
|
85
|
+
.save();
|
|
86
|
+
} else {
|
|
87
|
+
projectTsConfigBuild.delete();
|
|
88
|
+
}
|
|
89
|
+
});
|
|
53
90
|
} else {
|
|
54
91
|
tsConfigSettings
|
|
55
92
|
.merge({
|
|
56
|
-
$schema: 'https://json.schemastore.org/tsconfig',
|
|
93
|
+
$schema: 'https://json.schemastore.org/tsconfig.json',
|
|
57
94
|
compilerOptions: {},
|
|
58
95
|
extends: tsConfigPreset,
|
|
59
96
|
})
|
|
@@ -65,7 +102,7 @@ function createLang({ language: languageDefault = 'typescript', tsConfig: tsConf
|
|
|
65
102
|
rootDir: './src',
|
|
66
103
|
},
|
|
67
104
|
extends: `./${tsConfigSettingsName}`,
|
|
68
|
-
include: ['
|
|
105
|
+
include: ['src'],
|
|
69
106
|
})
|
|
70
107
|
.save();
|
|
71
108
|
|
|
@@ -83,7 +120,7 @@ function createLang({ language: languageDefault = 'typescript', tsConfig: tsConf
|
|
|
83
120
|
if (isApplication) {
|
|
84
121
|
pkg.script(_packageFile, {
|
|
85
122
|
name: project.develop,
|
|
86
|
-
|
|
123
|
+
update:
|
|
87
124
|
"NODE_ENV=development ts-node-dev --require='tsconfig-paths/register' -r dotenv/config -- ./src/index.ts dotenv_config_path=.env",
|
|
88
125
|
state: 'present',
|
|
89
126
|
});
|
|
@@ -102,29 +139,29 @@ function createLang({ language: languageDefault = 'typescript', tsConfig: tsConf
|
|
|
102
139
|
state: 'present',
|
|
103
140
|
});
|
|
104
141
|
|
|
105
|
-
typedoc({
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
});
|
|
142
|
+
// typedoc({
|
|
143
|
+
// state: isApplication ? 'absent' : 'present',
|
|
144
|
+
// update: (config) => ({
|
|
145
|
+
// // Default values
|
|
146
|
+
// tsconfig: 'tsconfig.json',
|
|
147
|
+
// excludePrivate: true,
|
|
148
|
+
// excludeExternals: true,
|
|
149
|
+
// readme: 'README.md',
|
|
150
|
+
// theme: 'default',
|
|
151
|
+
// // Inherits current
|
|
152
|
+
// ...config,
|
|
153
|
+
// // Force values
|
|
154
|
+
// out: 'public',
|
|
155
|
+
// exclude: [
|
|
156
|
+
// '**/build/**/*',
|
|
157
|
+
// '**/example/**/*',
|
|
158
|
+
// '**/lib/**/*',
|
|
159
|
+
// '**/node_modules/**',
|
|
160
|
+
// '**/__tests__/*.(ts|tsx)',
|
|
161
|
+
// '**/*.(spec|test).(ts|tsx)',
|
|
162
|
+
// ],
|
|
163
|
+
// }),
|
|
164
|
+
// });
|
|
128
165
|
};
|
|
129
166
|
|
|
130
167
|
task.description = 'Setup Programming Language';
|
package/lang/templates/index.ts
CHANGED
|
@@ -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
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Mrm configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mrm",
|
|
@@ -13,37 +13,44 @@
|
|
|
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
|
+
"type": "commonjs",
|
|
21
22
|
"main": "config.json",
|
|
22
23
|
"scripts": {
|
|
23
|
-
"build": "npm
|
|
24
|
-
"build:empty": ":",
|
|
24
|
+
"build": "concurrently \"npm:build:*\" \":\"",
|
|
25
25
|
"build:tsc": "tsc --noEmit --skipLibCheck",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
26
|
+
"clean": "concurrently \"npm:clean:*\" \":\"",
|
|
27
|
+
"docs": "node ../../markdown.mjs",
|
|
28
|
+
"format": "concurrently \"npm:format:*\" \":\"",
|
|
29
|
+
"format:src": "eslint . --fix --ext=mjs,cjs,js,jsx,ts,tsx,json,jsonc,json5,yml,yaml",
|
|
30
|
+
"lint": "concurrently \"npm:lint:*\" \":\"",
|
|
31
|
+
"lint:src": "eslint . --ext=mjs,cjs,js,jsx,ts,tsx,json,jsonc,json5,yml,yaml",
|
|
32
|
+
"prepare": "concurrently \"npm:prepare:*\" \":\"",
|
|
33
|
+
"spellcheck": "cspell --no-progress '**'",
|
|
34
|
+
"test": "concurrently \"npm:test:*\" \":\"",
|
|
35
|
+
"test:script": "mkdir _tester; cd _tester; mrm bootstrap --dir ..; mrm configure --dir .."
|
|
30
36
|
},
|
|
31
37
|
"dependencies": {
|
|
32
38
|
"debug": "^4.3.3",
|
|
39
|
+
"glob": "^8.0.3",
|
|
33
40
|
"mrm-core": "^7.0.0",
|
|
34
41
|
"semver-intersect": "^1.4.0",
|
|
35
|
-
"sync-directory": "^
|
|
42
|
+
"sync-directory": "^6.0.0"
|
|
36
43
|
},
|
|
37
44
|
"devDependencies": {
|
|
38
|
-
"@types/debug": "
|
|
39
|
-
"mrm": "4.
|
|
45
|
+
"@types/debug": "4.1.7",
|
|
46
|
+
"mrm": "4.1.13",
|
|
47
|
+
"mrm-preset-default": "4.1.11"
|
|
40
48
|
},
|
|
41
49
|
"engines": {
|
|
42
|
-
"node": ">=
|
|
43
|
-
"yarn": ">=1.x"
|
|
50
|
+
"node": ">=16.0.0"
|
|
44
51
|
},
|
|
45
52
|
"publishConfig": {
|
|
46
53
|
"access": "public"
|
|
47
54
|
},
|
|
48
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "20f944de90b5a5c30d6446ced65271ea3fd31c99"
|
|
49
56
|
}
|
package/postconfigure/index.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
const { spawnSync } = require('child_process');
|
|
1
|
+
const { spawnSync } = require('node:child_process');
|
|
2
2
|
const { packageJson } = require('mrm-core');
|
|
3
|
-
const project = require('../core/project');
|
|
4
|
-
const pkg = require('../core/pkg');
|
|
3
|
+
const project = require('../core/project.js');
|
|
4
|
+
const pkg = require('../core/pkg.js');
|
|
5
|
+
const npm = require('../core/npm.js');
|
|
5
6
|
|
|
6
7
|
function task() {
|
|
8
|
+
// Remove old deps
|
|
9
|
+
npm.dependency({
|
|
10
|
+
dev: true,
|
|
11
|
+
name: ['is-ci', '@commitlint/cli', 'lint-staged', 'mrm'],
|
|
12
|
+
state: 'absent',
|
|
13
|
+
});
|
|
14
|
+
|
|
7
15
|
const packageFile = packageJson();
|
|
8
16
|
const packageManager = pkg.manager(packageFile);
|
|
9
17
|
const formatResult = spawnSync(packageManager, ['run', project.format]);
|