@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 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, socio-economic status,
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 hasHusky = Boolean(packageJson().get('devDependencies.husky'));
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 = Boolean(packageFileDefault.get('devDependencies.typescript'));
17
- const hasWorkspaces = Boolean(packageFileDefault.get('workspaces'));
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
  };
@@ -34,7 +34,7 @@ function semanticRelease({ state, update, preset }) {
34
34
  });
35
35
  });
36
36
  }
37
- semanticRelease.command = function () {
37
+ semanticRelease.command = function command() {
38
38
  return 'semantic-release';
39
39
  };
40
40
 
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 = Boolean(packageFileDefault.get('workspaces'));
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 hasTypescript = packageJson().get('devDependencies.typescript');
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 = Boolean(packageFile.get('devDependencies.eslint'));
14
- const hasJest = Boolean(packageFile.get('devDependencies.jest'));
15
- const hasTsc = Boolean(packageFile.get('devDependencies.typescript'));
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 isApplication = packageJson().get('mrmConfig.packageArchetype') === 'application';
31
- const hasWorkspaces = useWorkspaces();
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((packageFile) => {
80
+ pkg.withPackageJson((_packageFile) => {
81
81
  if (isApplication) {
82
- pkg.script(packageFile, {
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",
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": "9935d3a478d08c3c6c02f467f65c623a16749753"
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: '@w5s/renovate-config:application',
58
- renovatePresetLibrary: '@w5s/renovate-config:library',
57
+ renovatePresetApplication: 'github>w5s/renovate-config:application',
58
+ renovatePresetLibrary: 'github>w5s/renovate-config:library',
59
59
  });
package/core/workspace.js DELETED
@@ -1,6 +0,0 @@
1
- const { packageJson } = require('mrm-core');
2
-
3
- function useWorkspaces() {
4
- return packageJson().get('mrmConfig.packageArchetype') === 'workspace';
5
- }
6
- exports.useWorkspaces = useWorkspaces;