@w5s/mrm-preset 1.1.0 → 1.2.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/CHANGELOG.md CHANGED
@@ -3,6 +3,27 @@
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.0](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.1.1...@w5s/mrm-preset@1.2.0) (2023-08-01)
7
+
8
+
9
+ ### ✨ Features
10
+
11
+ - 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))
12
+
13
+ **Note:** Version bump only for package @w5s/mrm-preset
14
+
15
+
16
+
17
+
18
+
19
+ ## [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)
20
+
21
+ **Note:** Version bump only for package @w5s/mrm-preset
22
+
23
+
24
+
25
+
26
+
6
27
  # [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)
7
28
 
8
29
  ### ✨ Features
package/asdf/index.js ADDED
@@ -0,0 +1,16 @@
1
+ const { asdfConfig } = require('../core/asdf.js');
2
+
3
+ function task() {
4
+ asdfConfig({
5
+ state: 'present',
6
+ update: (config) => ({
7
+ nodejs: '18.17.0',
8
+ ...config,
9
+ }),
10
+ });
11
+ }
12
+
13
+ task.description = 'Configure ASDF';
14
+ task.parameters = {};
15
+
16
+ module.exports = task;
package/ci/github.js CHANGED
@@ -33,11 +33,11 @@ function task() {
33
33
  'runs-on': 'ubuntu-latest',
34
34
  steps: [
35
35
  { uses: 'actions/checkout@v3' },
36
+ { uses: 'dtinth/setup-github-actions-caching-for-turbo@v1' },
36
37
  {
37
- name: 'Use Node.js',
38
38
  uses: 'actions/setup-node@v3',
39
39
  with: {
40
- 'node-version': 'lts/*',
40
+ 'node-version-file': '.tool-versions',
41
41
  cache: packageManager,
42
42
  },
43
43
  },
package/config.json CHANGED
@@ -5,6 +5,7 @@
5
5
  "project",
6
6
  "contributing",
7
7
  "licenses",
8
+ "asdf",
8
9
  "release",
9
10
  "ci",
10
11
  "lang",
package/core/asdf.js ADDED
@@ -0,0 +1,41 @@
1
+ const { file } = require('mrm-core');
2
+
3
+ /**
4
+ * @typedef {{ [tool: string]: string }} ASDFConfig
5
+ */
6
+ /**
7
+ * @param {{
8
+ * state: 'present'|'absent',
9
+ * update?: (config: ASDFConfig) => ASDFConfig
10
+ * }} options
11
+ */
12
+ function asdfConfig({ state, update }) {
13
+ const hasASDF = state === 'present';
14
+ const toolVersionsFile = file('.tool-versions');
15
+
16
+ if (hasASDF) {
17
+ const eol = '\n';
18
+ const content = toolVersionsFile.get();
19
+ const parsed = Object.fromEntries(
20
+ content
21
+ .split(eol)
22
+ .map((_) => _.split(/\s+/, 2))
23
+ .filter((_) => _[0] !== '')
24
+ );
25
+
26
+ // @ts-ignore
27
+ const updated = update ? update(parsed) : parsed;
28
+
29
+ const formatted = Object.keys(updated)
30
+ .map((tool) => `${tool} ${updated[tool]}`)
31
+ .join(eol);
32
+
33
+ toolVersionsFile.save(formatted);
34
+ } else {
35
+ toolVersionsFile.delete();
36
+ }
37
+ }
38
+
39
+ module.exports = {
40
+ asdfConfig,
41
+ };
package/core/githubCI.js CHANGED
@@ -1,6 +1,6 @@
1
- const { yaml } = require('mrm-core');
2
1
  const path = require('node:path');
3
2
  const fs = require('node:fs');
3
+ const { yaml } = require('mrm-core');
4
4
 
5
5
  const FILE_PATH = '.github/workflows';
6
6
 
package/core/pkg.js CHANGED
@@ -5,11 +5,11 @@
5
5
  * @typedef {string|boolean|number|null|Array<unknown>|Record<string, unknown>} JsonValue
6
6
  */
7
7
 
8
+ const path = require('node:path');
8
9
  // @ts-ignore
9
10
  const { intersect } = require('semver-intersect');
10
11
  const { packageJson, file, json } = require('mrm-core');
11
12
  const glob = require('glob');
12
- const path = require('node:path');
13
13
  const jsonFile = require('./jsonFile.js');
14
14
 
15
15
  /**
package/core/vitest.js CHANGED
@@ -1,5 +1,5 @@
1
- const { file, packageJson } = require('mrm-core');
2
1
  const fs = require('node:fs');
2
+ const { file, packageJson } = require('mrm-core');
3
3
  const pkg = require('./pkg.js');
4
4
  const npm = require('./npm.js');
5
5
  const project = require('./project.js');
package/eslint/index.js CHANGED
@@ -144,7 +144,7 @@ function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended'
144
144
  ts: 'typescript',
145
145
  yaml: 'yaml',
146
146
  yml: 'yaml',
147
- }[ext] || ext)
147
+ })[ext] || ext
148
148
  )
149
149
  )
150
150
  ),
package/githooks/index.js CHANGED
@@ -44,7 +44,11 @@ function task() {
44
44
  path: 'CODEOWNERS',
45
45
  state: gitSupported ? 'file' : 'absent',
46
46
  update: (content) =>
47
- content.length === 0 ? template('', path.join(__dirname, 'templates', 'CODEOWNERS')).apply().get() : undefined,
47
+ content.length === 0
48
+ ? template('', path.join(__dirname, 'templates', 'CODEOWNERS'))
49
+ .apply()
50
+ .get()
51
+ : undefined,
48
52
  });
49
53
  }
50
54
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@w5s/mrm-preset",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Mrm configuration presets",
5
5
  "keywords": [
6
6
  "mrm",
@@ -52,5 +52,5 @@
52
52
  "publishConfig": {
53
53
  "access": "public"
54
54
  },
55
- "gitHead": "d1f8476f515b7be923ace0dba9ef86571f08747b"
55
+ "gitHead": "a10793f9e40481a6e84451e57851a3af630ce953"
56
56
  }
@@ -1,6 +0,0 @@
1
- [1] : exited with code 0
2
- [tsc]
3
- [tsc] > @w5s/mrm-preset@1.0.4 build:tsc
4
- [tsc] > tsc --noEmit --skipLibCheck
5
- [tsc]
6
- [tsc] npm run build:tsc exited with code 0
@@ -1,6 +0,0 @@
1
- [1] : exited with code 0
2
- [src]
3
- [src] > @w5s/mrm-preset@1.0.4 format:src
4
- [src] > eslint . --fix --ext=mjs,cjs,js,jsx,ts,tsx,json,jsonc,json5,yml,yaml
5
- [src]
6
- [src] npm run format:src exited with code SIGINT
@@ -1,6 +0,0 @@
1
- [1] : exited with code 0
2
- [src]
3
- [src] > @w5s/mrm-preset@1.0.4 lint:src
4
- [src] > eslint . --ext=mjs,cjs,js,jsx,ts,tsx,json,jsonc,json5,yml,yaml
5
- [src]
6
- [src] npm run lint:src exited with code 0
@@ -1,28 +0,0 @@
1
- [1] : exited with code 0
2
- [script]
3
- [script] > @w5s/mrm-preset@1.0.4 test:script
4
- [script] > mkdir _tester; cd _tester; mrm bootstrap --dir ..; mrm configure --dir ..
5
- [script]
6
- [script] mkdir: _tester: File exists
7
- [script] Running bootstrap...
8
- [script] Running alias configure...
9
- [script] Running gitignore...
10
- [script] Running project...
11
- [script] Update turbo.json
12
- [script] Running contributing...
13
- [script] Running licenses...
14
- [script] Running release...
15
- [script] Running ci...
16
- [script] Running lang...
17
- [script] Update tsconfig.json
18
- [script] Running commitlint...
19
- [script] Update .vscode/extensions.json
20
- [script] Running editorconfig...
21
- [script] Running eslint...
22
- [script] Running cspell...
23
- [script] Update .cspell.json
24
- [script] Running vitest...
25
- [script] Running renovate...
26
- [script] Running githooks...
27
- [script] Running postconfigure...
28
- [script] npm run test:script exited with code 0