@w5s/mrm-preset 1.0.0-alpha.41 → 1.0.0-alpha.43

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,20 @@
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.43 (2023-02-23)
7
+
8
+ - ✨ Improve mrm bootstrap script ([0445277](https://github.com/w5s/project-config/commit/0445277))
9
+ - ➖ Remove is-ci, lint-staged, commitlint dependency (used through npx) ([ae39f34](https://github.com/w5s/project-config/commit/ae39f34))
10
+ - ➖ Remove mrm dependency ([7ee3d94](https://github.com/w5s/project-config/commit/7ee3d94))
11
+ - 🐛 Fix unbound variable error ([d2aa040](https://github.com/w5s/project-config/commit/d2aa040))
12
+ - 💚 Fix ci ([cded057](https://github.com/w5s/project-config/commit/cded057))
13
+
14
+ ## 1.0.0-alpha.42 (2023-02-10)
15
+
16
+ - ✨ Configure @w5s/conventional-changelog ([b19e437](https://github.com/w5s/project-config/commit/b19e437))
17
+ - ✨ Improve typescript support for monorepo packages ([0a13a68](https://github.com/w5s/project-config/commit/0a13a68))
18
+ - 🗑️ Remove unneeded code ([ee9410e](https://github.com/w5s/project-config/commit/ee9410e))
19
+
6
20
  ## 1.0.0-alpha.41 (2023-02-06)
7
21
 
8
22
  - 📝 Update documentation ([8cd1934](https://github.com/w5s/project-config/commit/8cd1934))
@@ -29,11 +29,11 @@ function task({ mrmPreset, mrmTask, packageManager }) {
29
29
 
30
30
  npm.bootstrap(packageManager);
31
31
 
32
- npm.dependency({
33
- dev: true,
34
- name: ['mrm', mrmPreset],
35
- state: 'present',
36
- });
32
+ // npm.dependency({
33
+ // dev: true,
34
+ // name: ['mrm', mrmPreset],
35
+ // state: 'present',
36
+ // });
37
37
 
38
38
  pkg.withPackageJson((packageFile) => {
39
39
  const currentPackageManager = pkg.manager(packageFile);
@@ -47,7 +47,7 @@ function task({ mrmPreset, mrmTask, packageManager }) {
47
47
  pkg.script(packageFile, {
48
48
  name: 'mrm',
49
49
  state: 'present',
50
- default: `mrm --preset ${mrmPreset}`,
50
+ default: `npm exec --package=mrm --package=${mrmPreset} -- mrm --preset ${mrmPreset}`,
51
51
  });
52
52
  });
53
53
  }
@@ -23,13 +23,13 @@ function commitlint({ state, preset }) {
23
23
 
24
24
  gitHook({
25
25
  name: 'commit-msg',
26
- content: 'npm exec --no -- commitlint --edit $1',
26
+ content: 'npm exec -- commitlint --edit $1',
27
27
  state,
28
28
  });
29
29
 
30
30
  npm.dependency({
31
31
  dev: true,
32
- name: ['@commitlint/cli', preset],
32
+ name: [preset],
33
33
  state,
34
34
  });
35
35
  }
package/core/githooks.js CHANGED
@@ -1,11 +1,13 @@
1
1
  const { execSync } = require('node:child_process');
2
2
  const path = require('node:path');
3
- const { file, packageJson, makeDirs } = require('mrm-core');
3
+ const { file, makeDirs } = require('mrm-core');
4
4
  const project = require('./project.js');
5
5
  const npm = require('./npm.js');
6
6
  const pkg = require('./pkg.js');
7
7
  const block = require('./block.js');
8
8
 
9
+ const hookDirectory = '.githooks';
10
+
9
11
  /**
10
12
  * @param {{
11
13
  * state: 'present'|'absent',
@@ -17,21 +19,14 @@ function husky({ state }) {
17
19
  npm.dependency({
18
20
  dev: true,
19
21
  name: ['husky'],
20
- state: hasHusky ? 'present' : 'absent',
22
+ state: 'absent',
21
23
  });
22
- if (hasHusky) {
23
- npm.dependency({
24
- dev: true,
25
- name: ['is-ci'],
26
- state: 'present',
27
- });
28
- }
29
24
 
30
25
  pkg.withPackageJson((packageFile) => {
31
26
  pkg.script(packageFile, {
32
- name: `${project.prepare}:husky`,
27
+ name: `${project.prepare}:githooks`,
33
28
  state: hasHusky ? 'present' : 'absent',
34
- update: 'is-ci || husky install',
29
+ update: `[ -n "\${CI:-}" ] || npx husky install ${hookDirectory}`,
35
30
  });
36
31
  });
37
32
  }
@@ -44,10 +39,7 @@ function husky({ state }) {
44
39
  * }} options
45
40
  */
46
41
  function gitHook({ name, state, content }) {
47
- const packageFileDefault = packageJson();
48
- const hasHusky = pkg.hasDependency(packageFileDefault, 'husky', 'dev');
49
- const hasGitHook = hasHusky && state === 'present';
50
- const hookDirectory = '.husky';
42
+ const hasGitHook = state === 'present';
51
43
  const hookFileName = path.join(hookDirectory, name);
52
44
  if (hasGitHook) {
53
45
  makeDirs(hookDirectory);
package/githooks/index.js CHANGED
@@ -31,7 +31,7 @@ function task() {
31
31
  });
32
32
  gitHook({
33
33
  name: 'pre-commit',
34
- content: `npm exec --no -- lint-staged`,
34
+ content: `npm exec -- lint-staged`,
35
35
  state: gitSupported ? 'present' : 'absent',
36
36
  });
37
37
  gitHook({
package/lang/index.js CHANGED
@@ -49,6 +49,44 @@ function createLang({ language: languageDefault = 'typescript', tsConfig: tsConf
49
49
 
50
50
  file('src/index.ts').delete();
51
51
  file('src/index.spec.ts').delete();
52
+
53
+ pkg.forEachWorkspace(({ projectDir, packageFile: projectPackageFile }) => {
54
+ const projectTsConfig = json(`${projectDir}/tsconfig.json`);
55
+ const projectTsConfigBuild = json(`${projectDir}/tsconfig.build.json`);
56
+ const hasTypecript = projectTsConfig.exists();
57
+ pkg.script(projectPackageFile, {
58
+ name: 'build:tsc',
59
+ state: hasTypecript ? 'present' : 'absent',
60
+ update: () => 'tsc -b tsconfig.build.json',
61
+ });
62
+ pkg.script(projectPackageFile, {
63
+ name: 'clean:tsc',
64
+ state: hasTypecript ? 'present' : 'absent',
65
+ update: () => 'rm -rf lib',
66
+ });
67
+ if (hasTypecript && projectPackageFile.get('name') !== '@w5s/ts-config') {
68
+ projectTsConfig
69
+ .merge({
70
+ $schema: 'https://json.schemastore.org/tsconfig.json',
71
+ extends: '../../tsconfig.settings.json',
72
+ })
73
+ .save();
74
+
75
+ projectTsConfigBuild
76
+ .merge({
77
+ $schema: 'https://json.schemastore.org/tsconfig.json',
78
+ extends: './tsconfig.json',
79
+ compilerOptions: {
80
+ noEmit: false,
81
+ outDir: 'lib',
82
+ },
83
+ include: ['src'],
84
+ })
85
+ .save();
86
+ } else {
87
+ projectTsConfigBuild.delete();
88
+ }
89
+ });
52
90
  } else {
53
91
  tsConfigSettings
54
92
  .merge({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@w5s/mrm-preset",
3
- "version": "1.0.0-alpha.41",
3
+ "version": "1.0.0-alpha.43",
4
4
  "description": "Mrm configuration presets",
5
5
  "keywords": [
6
6
  "mrm",
@@ -43,7 +43,8 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/debug": "4.1.7",
46
- "mrm": "4.1.13"
46
+ "mrm": "4.1.13",
47
+ "mrm-preset-default": "4.1.11"
47
48
  },
48
49
  "engines": {
49
50
  "node": ">=16.0.0"
@@ -51,5 +52,5 @@
51
52
  "publishConfig": {
52
53
  "access": "public"
53
54
  },
54
- "gitHead": "cdb08978935c78ac2303b9a00f42f791e6361306"
55
+ "gitHead": "ace7dcdd3244c34b38de66da80347ca16e59838d"
55
56
  }
@@ -2,8 +2,16 @@ const { spawnSync } = require('node:child_process');
2
2
  const { packageJson } = require('mrm-core');
3
3
  const project = require('../core/project.js');
4
4
  const pkg = require('../core/pkg.js');
5
+ const npm = require('../core/npm.js');
5
6
 
6
7
  function task() {
8
+ // Remove old deps
9
+ npm.dependency({
10
+ dev: true,
11
+ name: ['is-ci', '@commitlint/cli', 'lint-staged', 'mrm'],
12
+ state: 'absent',
13
+ });
14
+
7
15
  const packageFile = packageJson();
8
16
  const packageManager = pkg.manager(packageFile);
9
17
  const formatResult = spawnSync(packageManager, ['run', project.format]);
package/project/index.js CHANGED
@@ -240,7 +240,7 @@ function task() {
240
240
  },
241
241
  npmClient: packageManager,
242
242
  useWorkspaces: rootUseWorkspace,
243
- changelogPreset: 'gitmoji-config',
243
+ changelogPreset: '@w5s/conventional-changelog',
244
244
  });
245
245
  lernaConfig.save();
246
246
  } else {
@@ -310,6 +310,11 @@ function task() {
310
310
  name: ['lerna'],
311
311
  state: rootUseWorkspace ? 'present' : 'absent',
312
312
  });
313
+ npm.dependency({
314
+ dev: true,
315
+ name: ['@w5s/conventional-changelog'],
316
+ state: 'present',
317
+ });
313
318
 
314
319
  // VSCode
315
320
  vscodeTask({
package/release/index.js CHANGED
@@ -10,7 +10,8 @@ function task() {
10
10
  pkg.withPackageJson((packageFile) => {
11
11
  pkg.script(packageFile, {
12
12
  name: project.release,
13
- update: useWorkspace ? 'is-ci && lerna publish --yes || lerna publish' : semanticRelease.command(),
13
+ // eslint-disable-next-line no-template-curly-in-string
14
+ update: useWorkspace ? '[ -n "${CI:-}" ] && lerna publish --yes || lerna publish' : semanticRelease.command(),
14
15
  state: 'present',
15
16
  });
16
17
  });
package/renovate/index.js CHANGED
@@ -27,7 +27,6 @@ function createRenovate({ renovatePresetApplication, renovatePresetLibrary }) {
27
27
  const renovateFile = json('renovate.json');
28
28
  renovateFile.merge({
29
29
  $schema: 'https://docs.renovatebot.com/renovate-schema.json',
30
- ignorePaths: ['**/node_modules/**'],
31
30
  });
32
31
  renovateFile.set(
33
32
  'extends',
@@ -1,6 +0,0 @@
1
- [1] : exited with code 0
2
- [tsc]
3
- [tsc] > @w5s/mrm-preset@1.0.0-alpha.40 build:tsc
4
- [tsc] > tsc --noEmit --skipLibCheck
5
- [tsc]
6
- [tsc] npm run build:tsc exited with code 0
@@ -1,63 +0,0 @@
1
- ✔ README.md Updated
2
- Transforms run
3
- ⁕ PKG_JSON:template=# W5s Mrm Preset _(${name})_
4
- ⁕ PKG_JSON:template=> ${description}&unknownTxt=
5
- ⁕ PKG_JSON:template=[${license}][license-url] © ${author}
6
- ⁕ PKG_JSON:template=[package-version-svg]: https://img.shields.io/npm/v/${name}.svg?style=flat-square
7
- ⁕ PKG_JSON:template=[package-url]: https://www.npmjs.com/package/${name}
8
- ⁕ PKG_JSON:template=[license-image]: https://img.shields.io/badge/license-${license}-green.svg?style=flat-square
9
-
10
- ✔ _tester/node_modules/@w5s/mrm-preset/README.md Updated
11
- Transforms run
12
- ⁕ PKG_JSON:template=# W5s Mrm Preset _(${name})_
13
- ⁕ PKG_JSON:template=> ${description}&unknownTxt=
14
- ⁕ PKG_JSON:template=[${license}][license-url] © ${author}
15
- ⁕ PKG_JSON:template=[package-version-svg]: https://img.shields.io/npm/v/${name}.svg?style=flat-square
16
- ⁕ PKG_JSON:template=[package-url]: https://www.npmjs.com/package/${name}
17
- ⁕ PKG_JSON:template=[license-image]: https://img.shields.io/badge/license-${license}-green.svg?style=flat-square
18
-
19
- ✔ _tester/node_modules/@w5s/eslint-config/README.md Updated
20
- Transforms run
21
- ⁕ PKG_JSON:template=# W5s ESLint configuration _(${name})_
22
- ⁕ PKG_JSON:template=> ${description}&unknownTxt=
23
- ⁕ PKG_JSON:template=```console\nnpm install --save-dev ${name}\n```
24
- ⁕ PKG_JSON:template=[${license}][license-url] © ${author}
25
- ⁕ PKG_JSON:template=[package-version-svg]: https://img.shields.io/npm/v/${name}.svg?style=flat-square
26
- ⁕ PKG_JSON:template=[package-url]: https://www.npmjs.com/package/${name}
27
- ⁕ PKG_JSON:template=[license-image]: https://img.shields.io/badge/license-${license}-green.svg?style=flat-square
28
-
29
- ✔ _tester/node_modules/@w5s/cspell-config/README.md Updated
30
- Transforms run
31
- ⁕ PKG_JSON:template=# W5s CSpell configuration _(${name})_
32
- ⁕ PKG_JSON:template=> ${description}&unknownTxt=
33
- ⁕ PKG_JSON:template=```console\nnpm install --save-dev ${name} cspell\n```
34
- ⁕ PKG_JSON:template=```json\n{\n "import": ["${name}"]\n}\n```
35
- ⁕ PKG_JSON:template=[${license}][license-url] © ${author}
36
- ⁕ PKG_JSON:template=[package-version-svg]: https://img.shields.io/npm/v/${name}.svg?style=flat-square
37
- ⁕ PKG_JSON:template=[package-url]: https://www.npmjs.com/package/${name}
38
- ⁕ PKG_JSON:template=[license-image]: https://img.shields.io/badge/license-${license}-green.svg?style=flat-square
39
-
40
- ✔ _tester/node_modules/@w5s/ts-config/README.md Updated
41
- Transforms run
42
- ⁕ PKG_JSON:template=# W5s Typescript configuration _(${name})_
43
- ⁕ PKG_JSON:template=> ${description}&unknownTxt=
44
- ⁕ PKG_JSON:template=```console\nnpm install --save-dev ${name}\n```
45
- ⁕ PKG_JSON:template=Typescript: ${peerDependencies.typescript}&unknownTxt=
46
- ⁕ PKG_JSON:template=[${license}][license-url] © ${author}
47
- ⁕ PKG_JSON:template=[package-version-svg]: https://img.shields.io/npm/v/${name}.svg?style=flat-square
48
- ⁕ PKG_JSON:template=[package-url]: https://www.npmjs.com/package/${name}
49
- ⁕ PKG_JSON:template=[license-image]: https://img.shields.io/badge/license-${license}-green.svg?style=flat-square
50
-
51
- ✔ _tester/node_modules/@w5s/prettier-config/README.md Updated
52
- Transforms run
53
- ⁕ PKG_JSON:template=# W5s Prettier configuration _(${name})_
54
- ⁕ PKG_JSON:template=> ${description}&unknownTxt=
55
- ⁕ PKG_JSON:template=```console\nnpm install --save-dev ${name}\n```
56
- ⁕ PKG_JSON:template=```json\n"${name}"\n```
57
- ⁕ PKG_JSON:template=```js\nmodule.exports = {\n ...require('${name}'),\n // Override rules\n};\n```
58
- ⁕ PKG_JSON:template=Prettier: ${peerDependencies.prettier}&unknownTxt=
59
- ⁕ PKG_JSON:template=[${license}][license-url] © ${author}
60
- ⁕ PKG_JSON:template=[package-version-svg]: https://img.shields.io/npm/v/${name}.svg?style=flat-square
61
- ⁕ PKG_JSON:template=[package-url]: https://www.npmjs.com/package/${name}
62
- ⁕ PKG_JSON:template=[license-image]: https://img.shields.io/badge/license-${license}-green.svg?style=flat-square
63
-
@@ -1,6 +0,0 @@
1
- [1] : exited with code 0
2
- [src]
3
- [src] > @w5s/mrm-preset@1.0.0-alpha.40 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 0
@@ -1,6 +0,0 @@
1
- [1] : exited with code 0
2
- [src]
3
- [src] > @w5s/mrm-preset@1.0.0-alpha.40 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 +0,0 @@
1
- CSpell: Files checked: 51, Issues found: 0 in 0 files
@@ -1,27 +0,0 @@
1
- [src]
2
- [src] > @w5s/mrm-preset@1.0.0-alpha.40 test:src
3
- [src] > mkdir _tester; cd _tester; mrm bootstrap --dir ..; mrm configure --dir ..
4
- [src]
5
- [src] mkdir: _tester: File exists
6
- [src] Running bootstrap...
7
- [src] Running alias configure...
8
- [src] Running gitignore...
9
- [src] Running project...
10
- [src] Update turbo.json
11
- [src] Running contributing...
12
- [src] Running licenses...
13
- [src] Running release...
14
- [src] Running ci...
15
- [src] Running lang...
16
- [src] Update tsconfig.json
17
- [src] Running commitlint...
18
- [src] Update .vscode/extensions.json
19
- [src] Running editorconfig...
20
- [src] Running eslint...
21
- [src] Running cspell...
22
- [src] Update .cspell.json
23
- [src] Running jest...
24
- [src] Running renovate...
25
- [src] Running githooks...
26
- [src] Running postconfigure...
27
- [src] npm run test:src exited with code 0