@w5s/mrm-preset 1.3.0 → 2.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/.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.1 build:tsc
3
+ [tsc] > @w5s/mrm-preset@1.4.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.1 lint:src
3
+ [src] > @w5s/mrm-preset@1.4.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,6 +1,6 @@
1
1
  [1] : exited with code 0
2
2
  [template]
3
- [template] > @w5s/mrm-preset@1.3.0 prepare:template
3
+ [template] > @w5s/mrm-preset@2.0.0 prepare:template
4
4
  [template] > cp ../../.editorconfig editorconfig/_editorconfig
5
5
  [template]
6
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.1 test:script
3
+ [script] > @w5s/mrm-preset@1.4.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
package/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
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
+ # [2.0.0](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.4.0...@w5s/mrm-preset@2.0.0) (2023-10-13)
7
+
8
+ ### 🎫 Chores
9
+
10
+ - Drop support for NodeJS 16 ([1e7b464](https://github.com/w5s/project-config/commit/1e7b464))
11
+
12
+ ### 💥 BREAKING CHANGES
13
+
14
+ - NodeJS 16 or lower could not work with this configuration
15
+
16
+ # [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)
17
+
18
+ ### ✨ Features
19
+
20
+ - Ignore turbo files ([5de104f](https://github.com/w5s/project-config/commit/5de104f))
21
+
22
+ **Note:** Version bump only for package @w5s/mrm-preset
23
+
6
24
  # [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
25
 
8
26
  ### ✨ 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();
@@ -1,3 +1,4 @@
1
+ # BEGIN MANAGED BLOCK
1
2
  # http://editorconfig.org
2
3
  root = true
3
4
 
@@ -57,3 +58,5 @@ indent_style = space
57
58
 
58
59
  [{Makefile,**.mk,**.make}]
59
60
  indent_style = tab
61
+
62
+ # END MANAGED BLOCK
@@ -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
- block({
8
+ blockSync({
10
9
  block: templateContent,
11
10
  path: '.editorconfig',
11
+ insertPosition: ['after', 'EndOfFile'],
12
12
  });
13
13
 
14
14
  vscodeRecommendedExtension({
package/githooks/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  const path = require('node:path');
2
2
  const { packageJson, template } = require('mrm-core');
3
+ const { fileSync } = require('@w5s/dev');
3
4
  const project = require('../core/project.js');
4
5
  const pkg = require('../core/pkg.js');
5
6
  const { hasGit } = require('../core/git.js');
6
7
  const { gitHook, husky } = require('../core/githooks.js');
7
8
  const { lintStaged } = require('../core/lintStaged.js');
8
- const { file } = require('../core/file.js');
9
9
 
10
10
  function task() {
11
11
  const gitSupported = hasGit();
@@ -40,9 +40,9 @@ function task() {
40
40
  state: gitSupported ? 'present' : 'absent',
41
41
  });
42
42
 
43
- file({
43
+ fileSync({
44
44
  path: 'CODEOWNERS',
45
- state: gitSupported ? 'file' : 'absent',
45
+ state: gitSupported ? 'present' : 'absent',
46
46
  update: (content) =>
47
47
  content.length === 0
48
48
  ? template('', path.join(__dirname, 'templates', 'CODEOWNERS'))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@w5s/mrm-preset",
3
- "version": "1.3.0",
3
+ "version": "2.0.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": "^2.0.0",
27
28
  "debug": "^4.3.3",
28
29
  "glob": "^10.0.0",
29
30
  "mrm-core": "^7.0.0",
@@ -31,10 +32,10 @@
31
32
  "sync-directory": "^6.0.0"
32
33
  },
33
34
  "engines": {
34
- "node": ">=16.0.0"
35
+ "node": ">=18.0.0"
35
36
  },
36
37
  "publishConfig": {
37
38
  "access": "public"
38
39
  },
39
- "gitHead": "40aa9e728c83ee50a5a381817c59df91458cf6a0"
40
+ "gitHead": "df3ad719f23deb6ab6a2c546664b0496fee3a039"
40
41
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@w5s/mrm-preset",
3
- "version": "1.3.0",
3
+ "version": "2.0.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": "^2.0.0",
41
42
  "debug": "^4.3.3",
42
43
  "glob": "^10.0.0",
43
44
  "mrm-core": "^7.0.0",
@@ -51,10 +52,10 @@
51
52
  },
52
53
  "clean-package": "../../clean-package.config.cjs",
53
54
  "engines": {
54
- "node": ">=16.0.0"
55
+ "node": ">=18.0.0"
55
56
  },
56
57
  "publishConfig": {
57
58
  "access": "public"
58
59
  },
59
- "gitHead": "40aa9e728c83ee50a5a381817c59df91458cf6a0"
60
+ "gitHead": "df3ad719f23deb6ab6a2c546664b0496fee3a039"
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;
package/core/file.js DELETED
@@ -1,29 +0,0 @@
1
- const { file: mrmFile } = require('mrm-core');
2
-
3
- /**
4
- *
5
- * @param {{
6
- * path: string,
7
- * state: 'file'|'absent',
8
- * update?: (content: string) => string | undefined,
9
- * }} options
10
- */
11
- function file({ path, state, update }) {
12
- const fileHandler = mrmFile(path);
13
- if (state === 'file') {
14
- if (update) {
15
- const newContent = update(fileHandler.get());
16
- if (newContent != null) {
17
- fileHandler.save(newContent);
18
- }
19
- } else if (!fileHandler.exists()) {
20
- fileHandler.save('');
21
- }
22
- } else {
23
- fileHandler.delete();
24
- }
25
- }
26
-
27
- module.exports = {
28
- file,
29
- };