@w5s/mrm-preset 1.2.1 → 1.4.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/.eslintrc.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "rules": {
3
+ "import/no-unresolved": "off"
4
+ }
5
+ }
@@ -1,6 +1,6 @@
1
1
  [1] : exited with code 0
2
2
  [tsc]
3
- [tsc] > @w5s/mrm-preset@1.2.0 build:tsc
3
+ [tsc] > @w5s/mrm-preset@1.3.0 build:tsc
4
4
  [tsc] > tsc --noEmit --skipLibCheck
5
5
  [tsc]
6
6
  [tsc] npm run build:tsc exited with code 0
@@ -0,0 +1,22 @@
1
+ [1] : exited with code 0
2
+ [src]
3
+ [src] > @w5s/mrm-preset@1.3.0 format:src
4
+ [src] > eslint . --fix --ext=mjs,cjs,js,jsx,ts,tsx,json,jsonc,json5,yml,yaml
5
+ [src]
6
+ [src]
7
+ [src] /Users/julienpolo/Code/w5s/project-config/packages/mrm-preset/core/git.js
8
+ [src] 2:31 error Unable to resolve path to module '@w5s/dev' import/no-unresolved
9
+ [src]
10
+ [src] /Users/julienpolo/Code/w5s/project-config/packages/mrm-preset/core/githooks.js
11
+ [src] 4:31 error Unable to resolve path to module '@w5s/dev' import/no-unresolved
12
+ [src]
13
+ [src] /Users/julienpolo/Code/w5s/project-config/packages/mrm-preset/editorconfig/index.js
14
+ [src] 2:31 error Unable to resolve path to module '@w5s/dev' import/no-unresolved
15
+ [src]
16
+ [src] ✖ 3 problems (3 errors, 0 warnings)
17
+ [src]
18
+ [src] npm ERR! Lifecycle script `format:src` failed with error:
19
+ [src] npm ERR! Error: command failed
20
+ [src] npm ERR! in workspace: @w5s/mrm-preset@1.3.0
21
+ [src] npm ERR! at location: /Users/julienpolo/Code/w5s/project-config/packages/mrm-preset
22
+ [src] npm run format:src exited with code 1
@@ -1,6 +1,6 @@
1
1
  [1] : exited with code 0
2
2
  [src]
3
- [src] > @w5s/mrm-preset@1.2.0 lint:src
3
+ [src] > @w5s/mrm-preset@1.3.0 lint:src
4
4
  [src] > eslint . --ext=mjs,cjs,js,jsx,ts,tsx,json,jsonc,json5,yml,yaml
5
5
  [src]
6
6
  [src] npm run lint:src exited with code 0
@@ -1 +1,6 @@
1
- [0] : exited with code 0
1
+ [1] : exited with code 0
2
+ [template]
3
+ [template] > @w5s/mrm-preset@1.4.0 prepare:template
4
+ [template] > cp ../../.editorconfig editorconfig/_editorconfig
5
+ [template]
6
+ [template] npm run prepare:template exited with code 0
@@ -1,6 +1,6 @@
1
1
  [1] : exited with code 0
2
2
  [script]
3
- [script] > @w5s/mrm-preset@1.2.0 test:script
3
+ [script] > @w5s/mrm-preset@1.3.0 test:script
4
4
  [script] > mkdir _tester; cd _tester; mrm bootstrap --dir ..; mrm configure --dir ..
5
5
  [script]
6
6
  [script] mkdir: _tester: File exists
@@ -8,16 +8,20 @@
8
8
  [script] Running alias configure...
9
9
  [script] Running gitignore...
10
10
  [script] Running project...
11
+ [script] Update turbo.json
11
12
  [script] Running contributing...
12
13
  [script] Running licenses...
13
14
  [script] Running asdf...
14
15
  [script] Running release...
15
16
  [script] Running ci...
16
17
  [script] Running lang...
18
+ [script] Update tsconfig.json
17
19
  [script] Running commitlint...
20
+ [script] Update .vscode/extensions.json
18
21
  [script] Running editorconfig...
19
22
  [script] Running eslint...
20
23
  [script] Running cspell...
24
+ [script] Update .cspell.json
21
25
  [script] Running vitest...
22
26
  [script] Running renovate...
23
27
  [script] Running githooks...
package/CHANGELOG.md CHANGED
@@ -3,40 +3,42 @@
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.2.1](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.2.0...@w5s/mrm-preset@1.2.1) (2023-08-08)
7
-
6
+ # [1.4.0](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.3.0...@w5s/mrm-preset@1.4.0) (2023-10-09)
8
7
 
9
- ### 🐛 Bug Fixes
8
+ ### Features
10
9
 
11
- - Fix doc configuration in mrm ([fe81b1a](https://github.com/w5s/project-config/commit/fe81b1a))
10
+ - Ignore turbo files ([5de104f](https://github.com/w5s/project-config/commit/5de104f))
12
11
 
13
12
  **Note:** Version bump only for package @w5s/mrm-preset
14
13
 
14
+ # [1.3.0](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.2.1...@w5s/mrm-preset@1.3.0) (2023-09-28)
15
15
 
16
+ ### ✨ Features
16
17
 
18
+ - Simplify editorconfig configuration ([7b1a5fd](https://github.com/w5s/project-config/commit/7b1a5fd))
17
19
 
20
+ **Note:** Version bump only for package @w5s/mrm-preset
18
21
 
19
- # [1.2.0](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.1.1...@w5s/mrm-preset@1.2.0) (2023-08-01)
20
-
22
+ ## [1.2.1](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.2.0...@w5s/mrm-preset@1.2.1) (2023-08-08)
21
23
 
22
- ### Features
24
+ ### 🐛 Bug Fixes
23
25
 
24
- - Add support for asdf ([a67f3b5](https://github.com/w5s/project-config/commit/a67f3b5)) - Add support for turbo caching in github actions ([d61aca7](https://github.com/w5s/project-config/commit/d61aca7))
26
+ - Fix doc configuration in mrm ([fe81b1a](https://github.com/w5s/project-config/commit/fe81b1a))
25
27
 
26
28
  **Note:** Version bump only for package @w5s/mrm-preset
27
29
 
30
+ # [1.2.0](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.1.1...@w5s/mrm-preset@1.2.0) (2023-08-01)
28
31
 
32
+ ### ✨ Features
29
33
 
34
+ - Add support for asdf ([a67f3b5](https://github.com/w5s/project-config/commit/a67f3b5)) - Add support for turbo caching in github actions ([d61aca7](https://github.com/w5s/project-config/commit/d61aca7))
30
35
 
36
+ **Note:** Version bump only for package @w5s/mrm-preset
31
37
 
32
38
  ## [1.1.1](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.1.0...@w5s/mrm-preset@1.1.1) (2023-07-12)
33
39
 
34
40
  **Note:** Version bump only for package @w5s/mrm-preset
35
41
 
36
-
37
-
38
-
39
-
40
42
  # [1.1.0](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.0.4...@w5s/mrm-preset@1.1.0) (2023-07-04)
41
43
 
42
44
  ### ✨ Features
@@ -133,7 +133,11 @@ module.exports = {
133
133
  .yarn/unplugged
134
134
  .yarn/build-state.yml
135
135
  .yarn/install-state.gz
136
- .pnp.*`,
136
+ .pnp.*
137
+
138
+ # Turbo
139
+ .turbo
140
+ `,
137
141
  VisualStudioCode: `
138
142
  .vscode/*
139
143
  !.vscode/settings.json
package/core/git.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const { file, ini } = require('mrm-core');
2
- const block = require('./block.js');
2
+ const { blockSync } = require('@w5s/dev');
3
3
  const templateMap = require('./git.ignore.js');
4
4
  /**
5
5
  *
@@ -40,9 +40,9 @@ function trimStartLine(content) {
40
40
  function gitIgnore(section, sectionContent) {
41
41
  const EOL = '\n';
42
42
 
43
- return block({
43
+ return blockSync({
44
44
  block: Array.isArray(sectionContent) ? sectionContent.join(EOL) : trimStartLine(sectionContent),
45
- marker: (mark) => `# ${mark} ### ${section} ###`,
45
+ marker: (mark) => `# ${mark.toUpperCase()} ### ${section} ###`,
46
46
  path: '.gitignore',
47
47
  });
48
48
  }
package/core/githooks.js CHANGED
@@ -1,10 +1,10 @@
1
1
  const { execSync } = require('node:child_process');
2
2
  const path = require('node:path');
3
3
  const { file, makeDirs } = require('mrm-core');
4
+ const { blockSync } = require('@w5s/dev');
4
5
  const project = require('./project.js');
5
6
  const npm = require('./npm.js');
6
7
  const pkg = require('./pkg.js');
7
- const block = require('./block.js');
8
8
 
9
9
  const hookDirectory = '.githooks';
10
10
 
@@ -48,10 +48,10 @@ function gitHook({ name, state, content }) {
48
48
  execSync(`npm exec -- husky add ${hookFileName} ""`, { stdio: 'inherit' });
49
49
  }
50
50
 
51
- block({
51
+ blockSync({
52
52
  path: hookFileName,
53
53
  block: content,
54
- insertAfter: 'end',
54
+ insertPosition: ['after', 'EndOfFile'],
55
55
  });
56
56
  } else {
57
57
  file(hookFileName).delete();
@@ -0,0 +1,62 @@
1
+ # BEGIN MANAGED BLOCK
2
+ # http://editorconfig.org
3
+ root = true
4
+
5
+ [*]
6
+ charset = utf-8
7
+ continuation_indent_size = 4
8
+ curly_bracket_next_line = false
9
+ end_of_line = lf
10
+ indent_brace_style = Stroustrup
11
+ indent_size = 2
12
+ indent_style = space
13
+ insert_final_newline = true
14
+ spaces_around_brackets = outside
15
+ spaces_around_operators = true
16
+ trim_trailing_whitespace = true
17
+
18
+ [*.{json,json5,webmanifest}]
19
+ indent_size = 2
20
+ indent_style = space
21
+ insert_final_newline = ignore
22
+
23
+ [*.{yml,yaml}]
24
+ indent_size = 2
25
+ indent_style = space
26
+
27
+ [*.{bat,reg,ps1,vbs,cs,cmd,fs,ahk}]
28
+ end_of_line = crlf
29
+
30
+ [*.{sh,zsh}]
31
+ end_of_line = lf
32
+
33
+ [*.{css,sass,scss,less,pcss}]
34
+ indent_size = 2
35
+ indent_style = space
36
+ max_line_length = 120
37
+ quote_type = single
38
+
39
+ [*.{js,jsx,jsm,ts,tsx,cjs,cjs,cjsx,cts,ctsx,mjs,mts,mtsx,js.hbs}]
40
+ indent_size = 2
41
+ indent_style = space
42
+ max_line_length = 120
43
+ quote_type = single
44
+
45
+ [*.{htm,html,svg,vue}]
46
+ indent_size = 2
47
+ indent_style = space
48
+
49
+ [*.{md,mdwn,mdown,markdown,mdx,apib}]
50
+ indent_size = 4
51
+ indent_style = space
52
+ insert_final_newline = true
53
+ trim_trailing_whitespace = false
54
+
55
+ [*.{py,robot}]
56
+ indent_size = 4
57
+ indent_style = space
58
+
59
+ [{Makefile,**.mk,**.make}]
60
+ indent_style = tab
61
+
62
+ # END MANAGED BLOCK
@@ -1,119 +1,22 @@
1
- const { ini } = require('mrm-core');
2
- const createDebug = require('debug');
1
+ const { readFileSync } = require('node:fs');
2
+ const { blockSync } = require('@w5s/dev');
3
3
  const { vscodeRecommendedExtension } = require('../core/vscode.js');
4
4
 
5
- /**
6
- *
7
- * @param {Record<string, Partial<{
8
- * charset: string,
9
- * continuation_indent_size: number,
10
- * curly_bracket_next_line: boolean,
11
- * end_of_line: 'lf'|'crlf',
12
- * indent_brace_style: 'Stroustrup',
13
- * indent_size: number,
14
- * indent_style: 'tab'|'space',
15
- * insert_final_newline: boolean|'ignore',
16
- * max_line_length: number,
17
- * quote_type: 'single'|'double',
18
- * root: boolean,
19
- * spaces_around_brackets: 'outside',
20
- * spaces_around_operators: boolean,
21
- * trim_trailing_whitespace: boolean,
22
- * }>>} defaults
23
- */
24
- function createEditorConfig(defaults) {
25
- const debug = createDebug('mrm-editorconfig');
5
+ function task() {
6
+ const templateContent = readFileSync(require.resolve('./_editorconfig'), 'utf8');
26
7
 
27
- /**
28
- * @param {string} section
29
- * @param {defaults} existing
30
- */
31
- function mergeSection(section, existing = {}) {
32
- return Object.assign(existing, defaults[section] || {});
33
- }
8
+ blockSync({
9
+ block: templateContent,
10
+ path: '.editorconfig',
11
+ insertPosition: ['after', 'EndOfFile'],
12
+ });
34
13
 
35
- function task() {
36
- const editorConfigFile = ini('.editorconfig', 'http://editorconfig.org');
37
-
38
- Object.keys(defaults).forEach((name) => {
39
- const values = mergeSection(name, editorConfigFile.get(name));
40
- debug('section %s: %o', name, values);
41
- editorConfigFile.set(name, values);
42
- });
43
-
44
- editorConfigFile.save();
45
-
46
- vscodeRecommendedExtension({
47
- name: 'editorconfig.editorconfig',
48
- state: 'present',
49
- });
50
- }
51
-
52
- task.description = 'Adds EditorConfig file';
53
-
54
- return task;
14
+ vscodeRecommendedExtension({
15
+ name: 'editorconfig.editorconfig',
16
+ state: 'present',
17
+ });
55
18
  }
56
19
 
57
- module.exports = createEditorConfig({
58
- '*': {
59
- // eslint-disable-next-line unicorn/text-encoding-identifier-case
60
- charset: 'utf-8',
61
- continuation_indent_size: 4,
62
- curly_bracket_next_line: false,
63
- end_of_line: 'lf',
64
- indent_brace_style: 'Stroustrup',
65
- indent_size: 2,
66
- indent_style: 'space',
67
- insert_final_newline: true,
68
- spaces_around_brackets: 'outside',
69
- spaces_around_operators: true,
70
- trim_trailing_whitespace: true,
71
- },
72
- '*.{json,json5,webmanifest}': {
73
- indent_size: 2,
74
- indent_style: 'space',
75
- insert_final_newline: 'ignore',
76
- },
77
- '*.{yml,yaml}': {
78
- indent_size: 2,
79
- indent_style: 'space',
80
- },
81
- '*.{bat,reg,ps1,vbs,cs,cmd,fs,ahk}': {
82
- end_of_line: 'crlf',
83
- },
84
- '*.{sh,zsh}': {
85
- end_of_line: 'lf',
86
- },
87
- '*.{css,sass,scss,less,pcss}': {
88
- indent_size: 2,
89
- indent_style: 'space',
90
- max_line_length: 120,
91
- quote_type: 'single',
92
- },
93
- '*.{js,jsx,jsm,ts,tsx,cjs,cjs,cjsx,cts,ctsx,mjs,mts,mtsx,js.hbs}': {
94
- indent_size: 2,
95
- indent_style: 'space',
96
- max_line_length: 120,
97
- quote_type: 'single',
98
- },
99
- '*.{htm,html,svg,vue}': {
100
- indent_size: 2,
101
- indent_style: 'space',
102
- },
103
- '*.{md,mdwn,mdown,markdown,mdx,apib}': {
104
- indent_size: 4,
105
- indent_style: 'space',
106
- insert_final_newline: true,
107
- trim_trailing_whitespace: false,
108
- },
109
- '*.{py,robot}': {
110
- indent_size: 4,
111
- indent_style: 'space',
112
- },
113
- Makefile: {
114
- indent_style: 'tab',
115
- },
116
- _global: {
117
- root: true,
118
- },
119
- });
20
+ task.description = 'Adds EditorConfig file';
21
+
22
+ module.exports = task;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@w5s/mrm-preset",
3
- "version": "1.2.1",
3
+ "version": "1.4.0",
4
4
  "description": "Mrm configuration presets",
5
5
  "keywords": [
6
6
  "mrm",
@@ -24,6 +24,7 @@
24
24
  "postpack": "npx clean-package restore"
25
25
  },
26
26
  "dependencies": {
27
+ "@w5s/dev": "^1.5.1",
27
28
  "debug": "^4.3.3",
28
29
  "glob": "^10.0.0",
29
30
  "mrm-core": "^7.0.0",
@@ -36,5 +37,5 @@
36
37
  "publishConfig": {
37
38
  "access": "public"
38
39
  },
39
- "gitHead": "16aaafb3d78f8485ca110ee2842005e6b938111b"
40
+ "gitHead": "7ab5287bc67b525c4bcfe83456c642c5226d900f"
40
41
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@w5s/mrm-preset",
3
- "version": "1.2.1",
3
+ "version": "1.4.0",
4
4
  "description": "Mrm configuration presets",
5
5
  "keywords": [
6
6
  "mrm",
@@ -32,11 +32,13 @@
32
32
  "postpack": "npx clean-package restore",
33
33
  "prepack": "npx clean-package",
34
34
  "prepare": "concurrently \"npm:prepare:*\" \":\"",
35
+ "prepare:template": "cp ../../.editorconfig editorconfig/_editorconfig",
35
36
  "spellcheck": "cspell --no-progress '**'",
36
37
  "test": "concurrently \"npm:test:*\" \":\"",
37
38
  "test:script": "mkdir _tester; cd _tester; mrm bootstrap --dir ..; mrm configure --dir .."
38
39
  },
39
40
  "dependencies": {
41
+ "@w5s/dev": "^1.5.1",
40
42
  "debug": "^4.3.3",
41
43
  "glob": "^10.0.0",
42
44
  "mrm-core": "^7.0.0",
@@ -44,8 +46,8 @@
44
46
  "sync-directory": "^6.0.0"
45
47
  },
46
48
  "devDependencies": {
47
- "@types/debug": "4.1.8",
48
- "mrm": "4.1.17",
49
+ "@types/debug": "4.1.9",
50
+ "mrm": "4.1.22",
49
51
  "mrm-preset-default": "4.1.11"
50
52
  },
51
53
  "clean-package": "../../clean-package.config.cjs",
@@ -55,5 +57,5 @@
55
57
  "publishConfig": {
56
58
  "access": "public"
57
59
  },
58
- "gitHead": "16aaafb3d78f8485ca110ee2842005e6b938111b"
60
+ "gitHead": "7ab5287bc67b525c4bcfe83456c642c5226d900f"
59
61
  }
package/core/block.js DELETED
@@ -1,74 +0,0 @@
1
- const { file } = require('mrm-core');
2
-
3
- /**
4
- * Replace a block in file that follows pattern :
5
- *
6
- * marker(markerBegin)
7
- * ...
8
- * marker(markerEnd)
9
- *
10
- * @param {{
11
- * markerBegin?: string,
12
- * markerEnd?: string,
13
- * marker?: (mark: string) => string,
14
- * path: string,
15
- * block: string,
16
- * insertBefore?: 'begin',
17
- * insertAfter?: 'end'
18
- * }} options
19
- */
20
- function block({
21
- markerBegin = 'BEGIN',
22
- markerEnd = 'END',
23
- marker = (mark) => `# ${mark} generated by mrm`,
24
- path,
25
- block: blockName,
26
- // insertBefore = 'begin',
27
- insertAfter,
28
- }) {
29
- const EOL = '\n';
30
- const beginBlock = marker(markerBegin);
31
- const endBlock = marker(markerEnd);
32
-
33
- /**
34
- * @param {string} content
35
- */
36
- function findBlock(content) {
37
- const startIndex = content.indexOf(beginBlock);
38
- const endIndex = content.indexOf(endBlock) + endBlock.length;
39
-
40
- return {
41
- endIndex,
42
- exists: startIndex >= 0 && endIndex >= 0,
43
- startIndex,
44
- };
45
- }
46
-
47
- /**
48
- * @param {string} fullContent
49
- * @param {string} blockContent
50
- */
51
- function apply(fullContent, blockContent) {
52
- const found = findBlock(fullContent);
53
- const replaceBlock = beginBlock + EOL + blockContent + EOL + endBlock;
54
-
55
- if (found.exists) {
56
- return fullContent.slice(0, Math.max(0, found.startIndex)) + replaceBlock + fullContent.slice(found.endIndex);
57
- }
58
-
59
- // insert
60
- if (insertAfter === 'end') {
61
- return fullContent + EOL + replaceBlock;
62
- }
63
-
64
- // if (insertBefore === 'begin') {
65
- return replaceBlock + EOL + fullContent;
66
- // }
67
- }
68
-
69
- const sourceFile = file(path);
70
- const sourceContent = sourceFile.get();
71
- sourceFile.save(apply(sourceContent, blockName));
72
- }
73
-
74
- module.exports = block;