@w5s/mrm-preset 1.0.0-alpha.10 → 1.0.0-alpha.11

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.
@@ -1 +1 @@
1
- @w5s/mrm-preset:build: cache hit, replaying output f5896e66681a4f6f
1
+ @w5s/mrm-preset:build: cache hit, replaying output 3c115708988953a1
@@ -1,4 +1,4 @@
1
- @w5s/mrm-preset:docs: cache hit, replaying output 56cb27b41ce298a4
1
+ @w5s/mrm-preset:docs: cache hit, replaying output 95ec4e4c5dc4e562
2
2
  @w5s/mrm-preset:docs: Starting markdown-magic [ '**/*.md', '!node_modules/**' ]
3
3
  @w5s/mrm-preset:docs: ℹ Notice:
4
4
  @w5s/mrm-preset:docs: Missing transforms "BASIC_RULES","JSX_RULES" in _tester/node_modules/eslint-plugin-react/README.md
@@ -1 +1 @@
1
- @w5s/mrm-preset:lint: cache hit, replaying output 9b4498f76ba22156
1
+ @w5s/mrm-preset:lint: cache hit, replaying output 7e471593505748d5
@@ -1,4 +1,4 @@
1
- @w5s/mrm-preset:test: cache hit, replaying output 8744e1e74430cf77
1
+ @w5s/mrm-preset:test: cache hit, replaying output 3972076d5900fa18
2
2
  @w5s/mrm-preset:test: mkdir: _tester: File exists
3
3
  @w5s/mrm-preset:test: Running bootstrap...
4
4
  @w5s/mrm-preset:test: Running alias configure...
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
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.11](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.0.0-alpha.10...@w5s/mrm-preset@1.0.0-alpha.11) (2022-05-20)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * correct prepare package script ([f2d5fbf](https://github.com/w5s/project-config/commit/f2d5fbfc4e7b66dece1d1139e2ba3835bcf524a1))
12
+
13
+
14
+ ### Features
15
+
16
+ * add minimal support for yarn + github ci ([b9ae537](https://github.com/w5s/project-config/commit/b9ae53746fa9a3f92a1ca0e3600e20cdda583a45))
17
+
18
+
19
+
20
+
21
+
6
22
  # [1.0.0-alpha.10](https://github.com/w5s/project-config/compare/@w5s/mrm-preset@1.0.0-alpha.9...@w5s/mrm-preset@1.0.0-alpha.10) (2022-05-13)
7
23
 
8
24
 
package/ci/github.js ADDED
@@ -0,0 +1,47 @@
1
+ /* eslint-disable global-require, sort-keys-fix/sort-keys-fix */
2
+ const { packageJson } = require('mrm-core');
3
+ const githubCI = require('../core/githubCI');
4
+ const pkg = require('../core/pkg');
5
+
6
+ function task() {
7
+ const state = 'present';
8
+ const packageManager = pkg.manager(packageJson());
9
+ githubCI.workflow({
10
+ name: 'node.js.yml',
11
+ state,
12
+ update: (config) => ({
13
+ name: 'Node.js CI',
14
+ ...config,
15
+ on: {
16
+ push: {
17
+ branches: ['main'],
18
+ },
19
+ pull_request: {
20
+ branches: ['main'],
21
+ },
22
+ },
23
+ jobs: {
24
+ ...config.jobs,
25
+ build: {
26
+ 'runs-on': 'ubuntu-latest',
27
+ steps: [
28
+ { uses: 'actions/checkout@v3' },
29
+ {
30
+ name: 'Use Node.js',
31
+ uses: 'actions/setup-node@v3',
32
+ with: {
33
+ 'node-version': 'lts/*',
34
+ cache: packageManager,
35
+ },
36
+ },
37
+ { run: `${packageManager} install` },
38
+ { run: `${packageManager} run build` },
39
+ { run: `${packageManager} validate` },
40
+ ],
41
+ },
42
+ },
43
+ }),
44
+ });
45
+ }
46
+
47
+ module.exports = task;
package/ci/index.js CHANGED
@@ -1,11 +1,16 @@
1
1
  const gitlabCI = require('../core/gitlabCI');
2
+ const githubCI = require('../core/githubCI');
2
3
  const gitlab = require('./gitlab');
4
+ const github = require('./github');
3
5
 
4
6
  function task() {
5
7
  // check gitlab support
6
8
  if (gitlabCI.isSupported()) {
7
9
  gitlab();
8
10
  }
11
+ if (githubCI.isSupported()) {
12
+ github();
13
+ }
9
14
  }
10
15
 
11
16
  task.description = 'Setup Continuous Integration';
@@ -0,0 +1,56 @@
1
+ const { yaml } = require('mrm-core');
2
+ const path = require('path');
3
+ const fs = require('fs');
4
+
5
+ const FILE_PATH = '.github/workflows';
6
+
7
+ function isSupported() {
8
+ return fs.existsSync(FILE_PATH);
9
+ }
10
+ exports.isSupported = isSupported;
11
+
12
+ /**
13
+ * @typedef { string | {
14
+ * group: string,
15
+ * 'cancel-in-progress': boolean,
16
+ * }} GithubWorkflowConcurrency
17
+ */
18
+ // TODO: add strict typing
19
+ /**
20
+ * @typedef {{
21
+ * name?: string,
22
+ * jobs?: Record<string, any>
23
+ * on?: any,
24
+ * env?: Record<string, string>,
25
+ * permissions?: any,
26
+ * defaults?: Record<string, any>,
27
+ * concurrency?: GithubWorkflowConcurrency,
28
+ * }} GithubWorkflowConfig
29
+ */
30
+
31
+ /**
32
+ * @param {{
33
+ * state: 'present'|'absent',
34
+ * name: string,
35
+ * update?: (config: GithubWorkflowConfig) => GithubWorkflowConfig
36
+ * }} options
37
+ */
38
+ function workflow({ name, state, update }) {
39
+ const workflowFile = yaml(path.join(FILE_PATH, name));
40
+ if (state === 'present') {
41
+ /** @type {GithubWorkflowConfig} */
42
+ let value = workflowFile.get() || {
43
+ jobs: {},
44
+ };
45
+ if (update) {
46
+ value = update(value);
47
+ // @ts-ignore
48
+ workflowFile.set(value);
49
+ }
50
+
51
+ workflowFile.save();
52
+ } else {
53
+ workflowFile.delete();
54
+ }
55
+ }
56
+ exports.workflow = workflow;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@w5s/mrm-preset",
3
- "version": "1.0.0-alpha.10",
3
+ "version": "1.0.0-alpha.11",
4
4
  "description": "Mrm configuration presets",
5
5
  "keywords": [
6
6
  "mrm",
@@ -32,7 +32,7 @@
32
32
  "debug": "^4.3.3",
33
33
  "mrm-core": "^7.0.0",
34
34
  "semver-intersect": "^1.4.0",
35
- "sync-directory": "^4.0.0"
35
+ "sync-directory": "^5.0.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/debug": "^4.1.7",
@@ -45,5 +45,5 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "gitHead": "8199bc183499e02e465e51157734be8c5ef9d7e5"
48
+ "gitHead": "123632828a2c65c3ca28b515666582b689fb9dea"
49
49
  }
package/project/index.js CHANGED
@@ -112,7 +112,7 @@ function task() {
112
112
  });
113
113
  pkg.script(packageFile, {
114
114
  name: `${project.prepare}:packages`,
115
- script: turboRun(project.test),
115
+ script: turboRun(project.prepare),
116
116
  state: useWorkspace ? 'present' : 'absent',
117
117
  });
118
118
  pkg.script(packageFile, {
@@ -139,11 +139,6 @@ function task() {
139
139
  script: pkg.emptyScript,
140
140
  state: 'default',
141
141
  });
142
- pkg.script(packageFile, {
143
- name: `${project.prepare}:packages`,
144
- script: 'lerna bootstrap',
145
- state: useWorkspace ? 'present' : 'absent',
146
- });
147
142
 
148
143
  // rescue
149
144
  pkg.script(packageFile, {