@w5s/mrm-preset 1.3.0 → 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 +5 -0
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-format.log +22 -0
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-prepare.log +1 -1
- package/.turbo/turbo-test.log +1 -1
- package/CHANGELOG.md +8 -0
- package/core/git.ignore.js +5 -1
- package/core/git.js +3 -3
- package/core/githooks.js +3 -3
- package/editorconfig/_editorconfig +3 -0
- package/editorconfig/index.js +3 -3
- package/package.json +3 -2
- package/package.json.backup +3 -2
- package/core/block.js +0 -74
package/.eslintrc.json
ADDED
package/.turbo/turbo-build.log
CHANGED
|
@@ -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
|
package/.turbo/turbo-lint.log
CHANGED
package/.turbo/turbo-prepare.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[1] : exited with code 0
|
|
2
2
|
[template]
|
|
3
|
-
[template] > @w5s/mrm-preset@1.
|
|
3
|
+
[template] > @w5s/mrm-preset@1.4.0 prepare:template
|
|
4
4
|
[template] > cp ../../.editorconfig editorconfig/_editorconfig
|
|
5
5
|
[template]
|
|
6
6
|
[template] npm run prepare:template exited with code 0
|
package/.turbo/turbo-test.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.4.0](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.3.0...@w5s/mrm-preset@1.4.0) (2023-10-09)
|
|
7
|
+
|
|
8
|
+
### ✨ Features
|
|
9
|
+
|
|
10
|
+
- Ignore turbo files ([5de104f](https://github.com/w5s/project-config/commit/5de104f))
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @w5s/mrm-preset
|
|
13
|
+
|
|
6
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)
|
|
7
15
|
|
|
8
16
|
### ✨ Features
|
package/core/git.ignore.js
CHANGED
package/core/git.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { file, ini } = require('mrm-core');
|
|
2
|
-
const
|
|
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
|
|
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
|
-
|
|
51
|
+
blockSync({
|
|
52
52
|
path: hookFileName,
|
|
53
53
|
block: content,
|
|
54
|
-
|
|
54
|
+
insertPosition: ['after', 'EndOfFile'],
|
|
55
55
|
});
|
|
56
56
|
} else {
|
|
57
57
|
file(hookFileName).delete();
|
package/editorconfig/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
const { readFileSync } = require('node:fs');
|
|
2
|
-
|
|
2
|
+
const { blockSync } = require('@w5s/dev');
|
|
3
3
|
const { vscodeRecommendedExtension } = require('../core/vscode.js');
|
|
4
|
-
const block = require('../core/block.js');
|
|
5
4
|
|
|
6
5
|
function task() {
|
|
7
6
|
const templateContent = readFileSync(require.resolve('./_editorconfig'), 'utf8');
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
blockSync({
|
|
10
9
|
block: templateContent,
|
|
11
10
|
path: '.editorconfig',
|
|
11
|
+
insertPosition: ['after', 'EndOfFile'],
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
vscodeRecommendedExtension({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/mrm-preset",
|
|
3
|
-
"version": "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": "
|
|
40
|
+
"gitHead": "7ab5287bc67b525c4bcfe83456c642c5226d900f"
|
|
40
41
|
}
|
package/package.json.backup
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/mrm-preset",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Mrm configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mrm",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"test:script": "mkdir _tester; cd _tester; mrm bootstrap --dir ..; mrm configure --dir .."
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
+
"@w5s/dev": "^1.5.1",
|
|
41
42
|
"debug": "^4.3.3",
|
|
42
43
|
"glob": "^10.0.0",
|
|
43
44
|
"mrm-core": "^7.0.0",
|
|
@@ -56,5 +57,5 @@
|
|
|
56
57
|
"publishConfig": {
|
|
57
58
|
"access": "public"
|
|
58
59
|
},
|
|
59
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "7ab5287bc67b525c4bcfe83456c642c5226d900f"
|
|
60
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;
|