@w5s/mrm-preset 1.0.0-alpha.3 → 1.0.0-alpha.4
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 +19 -0
- package/contributing/templates/CODE_OF_CONDUCT.md +3 -4
- package/core/githooks.js +2 -1
- package/core/jest.js +2 -2
- package/core/pkg.js +30 -0
- package/core/semanticRelease.js +1 -1
- package/core/typedoc.js +1 -1
- package/eslint/index.js +2 -1
- package/githooks/index.js +4 -3
- package/lang/index.js +5 -5
- package/package.json +2 -2
- package/renovate/index.js +2 -2
- package/core/workspace.js +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.4](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.0.0-alpha.3...@w5s/mrm-preset@1.0.0-alpha.4) (2022-02-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* correct eslint vscode settings ([a32e0fb](https://github.com/w5s/project-config/commit/a32e0fb739cbe349565b26ea412cdf37e3d56bdb))
|
|
12
|
+
* correct mrm preset url ([ad6f030](https://github.com/w5s/project-config/commit/ad6f03091e0a294c043974b564e24c79023e659b))
|
|
13
|
+
* correct typo ([2218859](https://github.com/w5s/project-config/commit/221885997fec37149f7e349b00a58fbcb3bfb8db))
|
|
14
|
+
* rollback to eslint.validate vscode setting ([769a2e1](https://github.com/w5s/project-config/commit/769a2e100083aca4f5e9037fa539fcf1f6002d65))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* improve typescript eslint configuration ([efc6f1c](https://github.com/w5s/project-config/commit/efc6f1cef876e8fc5d4d1d1b94ca90a6805fbbbf))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [1.0.0-alpha.3](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.0.0-alpha.2...@w5s/mrm-preset@1.0.0-alpha.3) (2022-02-15)
|
|
7
26
|
|
|
8
27
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
We as members, contributors, and leaders pledge to make participation in our
|
|
7
7
|
community a harassment-free experience for everyone, regardless of age, body
|
|
8
8
|
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
9
|
-
identity and expression, level of experience, education,
|
|
9
|
+
identity and expression, level of experience, education, socioeconomic status,
|
|
10
10
|
nationality, personal appearance, race, caste, color, religion, or sexual identity
|
|
11
11
|
and orientation.
|
|
12
12
|
|
|
@@ -119,11 +119,11 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
|
119
119
|
version 2.0, available at
|
|
120
120
|
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
|
|
121
121
|
|
|
122
|
-
Community Impact Guidelines were inspired by
|
|
122
|
+
Community Impact Guidelines were inspired by
|
|
123
123
|
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
124
124
|
|
|
125
125
|
For answers to common questions about this code of conduct, see the FAQ at
|
|
126
|
-
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
|
|
126
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
|
|
127
127
|
at [https://www.contributor-covenant.org/translations][translations].
|
|
128
128
|
|
|
129
129
|
[homepage]: https://www.contributor-covenant.org
|
|
@@ -131,4 +131,3 @@ at [https://www.contributor-covenant.org/translations][translations].
|
|
|
131
131
|
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
132
132
|
[FAQ]: https://www.contributor-covenant.org/faq
|
|
133
133
|
[translations]: https://www.contributor-covenant.org/translations
|
|
134
|
-
|
package/core/githooks.js
CHANGED
|
@@ -44,7 +44,8 @@ function husky({ state }) {
|
|
|
44
44
|
* }} options
|
|
45
45
|
*/
|
|
46
46
|
function gitHook({ name, state, content }) {
|
|
47
|
-
const
|
|
47
|
+
const packageFileDefault = packageJson();
|
|
48
|
+
const hasHusky = pkg.hasDependency(packageFileDefault, 'husky', 'dev');
|
|
48
49
|
const hasGitHook = hasHusky && state === 'present';
|
|
49
50
|
const hookDirectory = '.husky';
|
|
50
51
|
const hookFileName = path.join(hookDirectory, name);
|
package/core/jest.js
CHANGED
|
@@ -13,8 +13,8 @@ const project = require('./project');
|
|
|
13
13
|
function jest({ state }) {
|
|
14
14
|
const packageFileDefault = packageJson();
|
|
15
15
|
const hasJest = state === 'present';
|
|
16
|
-
const hasTypescript =
|
|
17
|
-
const hasWorkspaces =
|
|
16
|
+
const hasTypescript = pkg.hasDependency(packageFileDefault, 'typescript', 'dev');
|
|
17
|
+
const hasWorkspaces = pkg.hasWorkspaces(packageFileDefault);
|
|
18
18
|
|
|
19
19
|
pkg.withPackageJson((packageFile) => {
|
|
20
20
|
if (hasJest) {
|
package/core/pkg.js
CHANGED
|
@@ -58,6 +58,34 @@ function manager(packageFile) {
|
|
|
58
58
|
return defaultManager;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @param {import('mrm-core').PackageJson} packageFile
|
|
64
|
+
*/
|
|
65
|
+
function hasWorkspaces(packageFile) {
|
|
66
|
+
return Boolean(packageFile.get('workspaces'));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
* @param {import('mrm-core').PackageJson} packageFile
|
|
72
|
+
* @param {string} packageName
|
|
73
|
+
* @param {'normal'|'dev'|'peer'=} dependencyType
|
|
74
|
+
*/
|
|
75
|
+
function hasDependency(packageFile, packageName, dependencyType) {
|
|
76
|
+
return Boolean(
|
|
77
|
+
packageFile.get(
|
|
78
|
+
`${
|
|
79
|
+
dependencyType == null || dependencyType === 'normal'
|
|
80
|
+
? 'dependencies'
|
|
81
|
+
: dependencyType === 'dev'
|
|
82
|
+
? 'devDependencies'
|
|
83
|
+
: 'peerDependencies'
|
|
84
|
+
}.${packageName}`
|
|
85
|
+
)
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
61
89
|
/**
|
|
62
90
|
*
|
|
63
91
|
* @param {import('mrm-core').PackageJson} packageFile
|
|
@@ -94,5 +122,7 @@ module.exports = {
|
|
|
94
122
|
script,
|
|
95
123
|
manager,
|
|
96
124
|
engineMinVersion,
|
|
125
|
+
hasDependency,
|
|
126
|
+
hasWorkspaces,
|
|
97
127
|
withPackageJson,
|
|
98
128
|
};
|
package/core/semanticRelease.js
CHANGED
package/core/typedoc.js
CHANGED
|
@@ -23,7 +23,7 @@ const jsonFile = require('./jsonFile');
|
|
|
23
23
|
*/
|
|
24
24
|
function typedoc({ state, update }) {
|
|
25
25
|
const packageFileDefault = packageJson();
|
|
26
|
-
const hasWorkspaces =
|
|
26
|
+
const hasWorkspaces = pkg.hasWorkspaces(packageFileDefault);
|
|
27
27
|
const hasTypedoc = state === 'present';
|
|
28
28
|
|
|
29
29
|
pkg.withPackageJson((packageFile) => {
|
package/eslint/index.js
CHANGED
|
@@ -15,7 +15,8 @@ function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended'
|
|
|
15
15
|
* }} config
|
|
16
16
|
*/
|
|
17
17
|
function task({ eslintPreset, eslintRules }) {
|
|
18
|
-
const
|
|
18
|
+
const packageFileDefault = packageJson();
|
|
19
|
+
const hasTypescript = pkg.hasDependency(packageFileDefault, 'typescript', 'dev');
|
|
19
20
|
const hasJSX = true;
|
|
20
21
|
const hasJSON = true;
|
|
21
22
|
|
package/githooks/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const { packageJson, template } = require('mrm-core');
|
|
3
3
|
const project = require('../core/project');
|
|
4
|
+
const pkg = require('../core/pkg');
|
|
4
5
|
const { hasGit } = require('../core/git');
|
|
5
6
|
const { gitHook, husky } = require('../core/githooks');
|
|
6
7
|
const { lintStaged } = require('../core/lintStaged');
|
|
@@ -10,9 +11,9 @@ function createGitHooks() {
|
|
|
10
11
|
function task() {
|
|
11
12
|
const gitSupported = hasGit();
|
|
12
13
|
const packageFile = packageJson();
|
|
13
|
-
const hasESLint =
|
|
14
|
-
const hasJest =
|
|
15
|
-
const hasTsc =
|
|
14
|
+
const hasESLint = pkg.hasDependency(packageFile, 'eslint', 'dev');
|
|
15
|
+
const hasJest = pkg.hasDependency(packageFile, 'jest', 'dev');
|
|
16
|
+
const hasTsc = pkg.hasDependency(packageFile, 'typescript', 'dev');
|
|
16
17
|
|
|
17
18
|
husky({
|
|
18
19
|
state: gitSupported ? 'present' : 'absent',
|
package/lang/index.js
CHANGED
|
@@ -4,7 +4,6 @@ const npm = require('../core/npm');
|
|
|
4
4
|
const { gitIgnore } = require('../core/git');
|
|
5
5
|
const project = require('../core/project');
|
|
6
6
|
const { eslintIgnore } = require('../core/eslint');
|
|
7
|
-
const { useWorkspaces } = require('../core/workspace');
|
|
8
7
|
const { typedoc } = require('../core/typedoc');
|
|
9
8
|
const pkg = require('../core/pkg');
|
|
10
9
|
|
|
@@ -27,8 +26,9 @@ function createLang({ language: languageDefault = 'typescript', tsConfig: tsConf
|
|
|
27
26
|
}
|
|
28
27
|
task.typescript = () => {
|
|
29
28
|
const tsConfigPreset = tsConfigDefault;
|
|
30
|
-
const
|
|
31
|
-
const
|
|
29
|
+
const packageFile = packageJson();
|
|
30
|
+
const isApplication = packageFile.get('mrmConfig.packageArchetype') === 'application';
|
|
31
|
+
const hasWorkspaces = pkg.hasWorkspaces(packageFile);
|
|
32
32
|
const tsConfigSettingsName = 'tsconfig.settings.json';
|
|
33
33
|
const tsConfigSettings = json(tsConfigSettingsName);
|
|
34
34
|
const tsConfig = json('tsconfig.json');
|
|
@@ -77,9 +77,9 @@ function createLang({ language: languageDefault = 'typescript', tsConfig: tsConf
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
// Application setup
|
|
80
|
-
pkg.withPackageJson((
|
|
80
|
+
pkg.withPackageJson((_packageFile) => {
|
|
81
81
|
if (isApplication) {
|
|
82
|
-
pkg.script(
|
|
82
|
+
pkg.script(_packageFile, {
|
|
83
83
|
name: project.develop,
|
|
84
84
|
script:
|
|
85
85
|
"NODE_ENV=development ts-node-dev --require='tsconfig-paths/register' -r dotenv/config -- ./src/index.ts dotenv_config_path=.env",
|
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.4",
|
|
4
4
|
"description": "Mrm configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mrm",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "cd7eb2b021bb3c9dbc91375cece5349173a7c81a"
|
|
49
49
|
}
|
package/renovate/index.js
CHANGED
|
@@ -54,6 +54,6 @@ function createRenovate({ renovatePresetApplication, renovatePresetLibrary }) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
module.exports = createRenovate({
|
|
57
|
-
renovatePresetApplication: '
|
|
58
|
-
renovatePresetLibrary: '
|
|
57
|
+
renovatePresetApplication: 'github>w5s/renovate-config:application',
|
|
58
|
+
renovatePresetLibrary: 'github>w5s/renovate-config:library',
|
|
59
59
|
});
|