@w5s/mrm-preset 1.0.0-alpha.1

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.
Files changed (51) hide show
  1. package/.eslintignore +1 -0
  2. package/CHANGELOG.md +17 -0
  3. package/README.md +56 -0
  4. package/bootstrap/README.md +5 -0
  5. package/bootstrap/index.js +97 -0
  6. package/ci/_gitlab/AutoDevops.gitlab-ci.yml +77 -0
  7. package/ci/_gitlab/AutoDevopsInclude.gitlab-ci.yml +251 -0
  8. package/ci/_gitlab/README.md +20 -0
  9. package/ci/_gitlab/Renovate.gitlab-ci.yml +30 -0
  10. package/ci/gitlab.js +38 -0
  11. package/ci/index.js +14 -0
  12. package/commitlint/index.js +40 -0
  13. package/config.json +20 -0
  14. package/contributing/index.js +26 -0
  15. package/contributing/templates/CODE_OF_CONDUCT.md +134 -0
  16. package/core/block.js +77 -0
  17. package/core/commitlint.js +39 -0
  18. package/core/cspell.js +66 -0
  19. package/core/eslint.js +22 -0
  20. package/core/file.js +29 -0
  21. package/core/git.js +73 -0
  22. package/core/githooks.js +71 -0
  23. package/core/gitlabCI.js +8 -0
  24. package/core/jest.js +105 -0
  25. package/core/jsonFile.js +65 -0
  26. package/core/lintStaged.js +36 -0
  27. package/core/npm.js +271 -0
  28. package/core/pkg.js +97 -0
  29. package/core/project.js +58 -0
  30. package/core/semanticRelease.js +43 -0
  31. package/core/typedoc.js +82 -0
  32. package/core/vscode.js +92 -0
  33. package/core/workspace.js +6 -0
  34. package/cspell/index.js +38 -0
  35. package/editorconfig/index.js +107 -0
  36. package/eslint/index.js +127 -0
  37. package/githooks/index.js +62 -0
  38. package/githooks/templates/CODEOWNERS +4 -0
  39. package/gitignore/index.js +25 -0
  40. package/gitignore/template.js +145 -0
  41. package/jest/index.js +19 -0
  42. package/lang/.eslintrc.json +8 -0
  43. package/lang/index.js +143 -0
  44. package/lang/templates/index.spec.ts +7 -0
  45. package/lang/templates/index.ts +6 -0
  46. package/package.json +48 -0
  47. package/postconfigure/index.js +17 -0
  48. package/project/index.js +232 -0
  49. package/release/index.js +29 -0
  50. package/renovate/index.js +61 -0
  51. package/tsconfig.json +13 -0
@@ -0,0 +1,26 @@
1
+ const path = require('path');
2
+ const { file } = require('mrm-core');
3
+
4
+ function task() {
5
+ // code of conduct
6
+ const EOL = '\n';
7
+ const codeOfConduct = 'CODE_OF_CONDUCT.md';
8
+ const codeOfConductFile = file(codeOfConduct);
9
+ if (!codeOfConductFile.exists() || !codeOfConductFile.get().includes(`<!-- EditMode: MANUAL -->`)) {
10
+ const codeOfConductTemplate = file(path.join(__dirname, 'templates', codeOfConduct)).get();
11
+ codeOfConductFile.save(
12
+ [
13
+ `<!--
14
+ Generated by mrm
15
+ * change EditMode: MANUAL to avoid overwriting by mrm
16
+ -->`,
17
+ `<!-- EditMode: AUTO -->`,
18
+ codeOfConductTemplate,
19
+ ].join(EOL)
20
+ );
21
+ }
22
+ }
23
+
24
+ task.description = 'Setup Contributing';
25
+ task.parameters = {};
26
+ module.exports = task;
@@ -0,0 +1,134 @@
1
+
2
+ # Contributor Covenant Code of Conduct
3
+
4
+ ## Our Pledge
5
+
6
+ We as members, contributors, and leaders pledge to make participation in our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
9
+ identity and expression, level of experience, education, socio-economic status,
10
+ nationality, personal appearance, race, caste, color, religion, or sexual identity
11
+ and orientation.
12
+
13
+ We pledge to act and interact in ways that contribute to an open, welcoming,
14
+ diverse, inclusive, and healthy community.
15
+
16
+ ## Our Standards
17
+
18
+ Examples of behavior that contributes to a positive environment for our
19
+ community include:
20
+
21
+ * Demonstrating empathy and kindness toward other people
22
+ * Being respectful of differing opinions, viewpoints, and experiences
23
+ * Giving and gracefully accepting constructive feedback
24
+ * Accepting responsibility and apologizing to those affected by our mistakes,
25
+ and learning from the experience
26
+ * Focusing on what is best not just for us as individuals, but for the
27
+ overall community
28
+
29
+ Examples of unacceptable behavior include:
30
+
31
+ * The use of sexualized language or imagery, and sexual attention or
32
+ advances of any kind
33
+ * Trolling, insulting or derogatory comments, and personal or political attacks
34
+ * Public or private harassment
35
+ * Publishing others' private information, such as a physical or email
36
+ address, without their explicit permission
37
+ * Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our standards of
43
+ acceptable behavior and will take appropriate and fair corrective action in
44
+ response to any behavior that they deem inappropriate, threatening, offensive,
45
+ or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or reject
48
+ comments, commits, code, wiki edits, issues, and other contributions that are
49
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
50
+ decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also applies when
55
+ an individual is officially representing the community in public spaces.
56
+ Examples of representing our community include using an official e-mail address,
57
+ posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event.
59
+
60
+ ## Enforcement
61
+
62
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
+ reported to the community leaders responsible for enforcement at
64
+ [INSERT CONTACT METHOD].
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
85
+
86
+ **Community Impact**: A violation through a single incident or series
87
+ of actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or
94
+ permanent ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within
114
+ the community.
115
+
116
+ ## Attribution
117
+
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.0, available at
120
+ [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
121
+
122
+ Community Impact Guidelines were inspired by
123
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124
+
125
+ For answers to common questions about this code of conduct, see the FAQ at
126
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available
127
+ at [https://www.contributor-covenant.org/translations][translations].
128
+
129
+ [homepage]: https://www.contributor-covenant.org
130
+ [v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
131
+ [Mozilla CoC]: https://github.com/mozilla/diversity
132
+ [FAQ]: https://www.contributor-covenant.org/faq
133
+ [translations]: https://www.contributor-covenant.org/translations
134
+
package/core/block.js ADDED
@@ -0,0 +1,77 @@
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) => {
24
+ return `# ${mark} generated by mrm`;
25
+ },
26
+ path,
27
+ block: blockName,
28
+ // @ts-ignore
29
+ insertBefore = 'begin',
30
+ insertAfter,
31
+ }) {
32
+ const EOL = '\n';
33
+ const beginBlock = marker(markerBegin);
34
+ const endBlock = marker(markerEnd);
35
+
36
+ /**
37
+ * @param {string} content
38
+ */
39
+ function findBlock(content) {
40
+ const startIndex = content.indexOf(beginBlock);
41
+ const endIndex = content.indexOf(endBlock) + endBlock.length;
42
+
43
+ return {
44
+ endIndex,
45
+ exists: startIndex >= 0 && endIndex >= 0,
46
+ startIndex,
47
+ };
48
+ }
49
+
50
+ /**
51
+ * @param {string} fullContent
52
+ * @param {string} blockContent
53
+ */
54
+ function apply(fullContent, blockContent) {
55
+ const found = findBlock(fullContent);
56
+ const replaceBlock = beginBlock + EOL + blockContent + EOL + endBlock;
57
+
58
+ if (found.exists) {
59
+ return fullContent.substr(0, found.startIndex) + replaceBlock + fullContent.substr(found.endIndex);
60
+ }
61
+
62
+ // insert
63
+ if (insertAfter === 'end') {
64
+ return fullContent + EOL + replaceBlock;
65
+ }
66
+
67
+ // if (insertBefore === 'begin') {
68
+ return replaceBlock + EOL + fullContent;
69
+ // }
70
+ }
71
+
72
+ const sourceFile = file(path);
73
+ const sourceContent = sourceFile.get();
74
+ sourceFile.save(apply(sourceContent, blockName));
75
+ }
76
+
77
+ module.exports = block;
@@ -0,0 +1,39 @@
1
+ const pkg = require('./pkg');
2
+ const npm = require('./npm');
3
+ const { gitHook } = require('./githooks');
4
+
5
+ /**
6
+ * @param {{
7
+ * state: 'present'|'absent',
8
+ * preset: string,
9
+ * }} options
10
+ */
11
+ function commitlint({ state, preset }) {
12
+ pkg.withPackageJson((packageFile) => {
13
+ if (state === 'present') {
14
+ packageFile.merge({
15
+ commitlint: {
16
+ extends: [preset],
17
+ },
18
+ });
19
+ } else {
20
+ packageFile.unset('commitlint');
21
+ }
22
+ });
23
+
24
+ gitHook({
25
+ name: 'commit-msg',
26
+ content: 'npm exec --no -- commitlint --edit $1',
27
+ state,
28
+ });
29
+
30
+ npm.dependency({
31
+ dev: true,
32
+ name: ['@commitlint/cli', preset],
33
+ state,
34
+ });
35
+ }
36
+
37
+ module.exports = {
38
+ commitlint,
39
+ };
package/core/cspell.js ADDED
@@ -0,0 +1,66 @@
1
+ const { json } = require('mrm-core');
2
+ const pkg = require('./pkg');
3
+ const npm = require('./npm');
4
+ /**
5
+ * @typedef {{
6
+ * version: '0.2',
7
+ * language: string,
8
+ * words?: string[],
9
+ * flagWords?: string[],
10
+ * ignorePaths?: string[],
11
+ * ignoreWords?: string[],
12
+ * ignoreRegExpList?: string[],
13
+ * import?: string[]
14
+ * }} CSpellConfig
15
+ */
16
+ /**
17
+ * @param {{
18
+ * state: 'present'|'absent'
19
+ * update?: (config: CSpellConfig) => CSpellConfig
20
+ * }} options
21
+ */
22
+ function cspell({ state, update }) {
23
+ const hasCSpell = state === 'present';
24
+
25
+ pkg.withPackageJson((packageFile) => {
26
+ pkg.script(packageFile, {
27
+ name: 'cspell',
28
+ script: 'cspell',
29
+ state,
30
+ });
31
+ });
32
+
33
+ const cSpellFile = json('cSpell.json', {
34
+ version: '0.2',
35
+ language: 'en',
36
+ words: [],
37
+ flagWords: [],
38
+ ignorePaths: [
39
+ '**/[.]*/**', // ignore hidden directories
40
+ ],
41
+ });
42
+
43
+ if (hasCSpell) {
44
+ if (update) {
45
+ cSpellFile.set(update(cSpellFile.get()));
46
+ }
47
+
48
+ /**
49
+ * Otherwise save the file with content
50
+ */
51
+ cSpellFile.save();
52
+ } else {
53
+ cSpellFile.delete();
54
+ }
55
+
56
+ // Dependencies
57
+ npm.dependency({
58
+ dev: true,
59
+ name: ['cspell'],
60
+ state,
61
+ });
62
+ }
63
+
64
+ module.exports = {
65
+ cspell,
66
+ };
package/core/eslint.js ADDED
@@ -0,0 +1,22 @@
1
+ const { packageJson } = require('mrm-core');
2
+
3
+ /**
4
+ * @param {import('eslint').Linter.Config} config
5
+ */
6
+ function eslintConfig(config) {
7
+ const packageFile = packageJson();
8
+ packageFile.merge({ eslintConfig: config });
9
+ packageFile.save();
10
+ }
11
+ exports.eslintConfig = eslintConfig;
12
+
13
+ /**
14
+ *
15
+ * @param {Array<string>} ignorePatterns
16
+ */
17
+ function eslintIgnore(ignorePatterns) {
18
+ const packageFile = packageJson();
19
+ packageFile.merge({ eslintIgnore: ignorePatterns });
20
+ packageFile.save();
21
+ }
22
+ exports.eslintIgnore = eslintIgnore;
package/core/file.js ADDED
@@ -0,0 +1,29 @@
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
+ };
package/core/git.js ADDED
@@ -0,0 +1,73 @@
1
+ const { file, ini } = require('mrm-core');
2
+ const block = require('./block');
3
+
4
+ /**
5
+ *
6
+ */
7
+ function remoteSync() {
8
+ try {
9
+ const gitConfig = ini('.git/config');
10
+ const remoteURL = gitConfig.get('[remote "origin"]').url;
11
+
12
+ return remoteURL
13
+ ? [
14
+ /**
15
+ * 1. filter github URL
16
+ * @param {string} returnValue
17
+ */
18
+ (returnValue) => {
19
+ return returnValue.replace(/^git@github.com:/, 'https://github.com/');
20
+ },
21
+ /**
22
+ * 2. filter gitlab URL
23
+ * @param {string} returnValue
24
+ */
25
+ (returnValue) => {
26
+ return returnValue.replace(/^git@gitlab.com:/, 'https://gitlab.com/');
27
+ },
28
+ ].reduce((returnValue, filter) => {
29
+ return filter(returnValue);
30
+ }, remoteURL)
31
+ : remoteURL;
32
+ } catch (error) {
33
+ // ignore error
34
+ }
35
+
36
+ return undefined;
37
+ }
38
+ exports.remoteSync = remoteSync;
39
+
40
+ function hasGit() {
41
+ return file('.git/config').exists();
42
+ }
43
+ exports.hasGit = hasGit;
44
+
45
+ /**
46
+ * @param {string} content
47
+ */
48
+ function trimStartLine(content) {
49
+ return content
50
+ .split(/\n/)
51
+ .map((line) => {
52
+ return line.replace(/^\s+/, '');
53
+ })
54
+ .filter((_) => _.length > 0)
55
+ .join('\n');
56
+ }
57
+
58
+ /**
59
+ * @param {string} section
60
+ * @param {string|Array<string>} sectionContent
61
+ */
62
+ function gitIgnore(section, sectionContent) {
63
+ const EOL = '\n';
64
+
65
+ return block({
66
+ block: Array.isArray(sectionContent) ? sectionContent.join(EOL) : trimStartLine(sectionContent),
67
+ marker: (mark) => {
68
+ return `# ${mark} ### ${section} ###`;
69
+ },
70
+ path: '.gitignore',
71
+ });
72
+ }
73
+ exports.gitIgnore = gitIgnore;
@@ -0,0 +1,71 @@
1
+ const { execSync } = require('child_process');
2
+ const path = require('path');
3
+ const { file, packageJson, makeDirs } = require('mrm-core');
4
+ const project = require('./project');
5
+ const npm = require('./npm');
6
+ const pkg = require('./pkg');
7
+ const block = require('./block');
8
+
9
+ /**
10
+ * @param {{
11
+ * state: 'present'|'absent',
12
+ * }} options
13
+ */
14
+ function husky({ state }) {
15
+ const hasHusky = state === 'present';
16
+
17
+ npm.dependency({
18
+ dev: true,
19
+ name: ['husky'],
20
+ state: hasHusky ? 'present' : 'absent',
21
+ });
22
+ if (hasHusky) {
23
+ npm.dependency({
24
+ dev: true,
25
+ name: ['is-ci'],
26
+ state: 'present',
27
+ });
28
+ }
29
+
30
+ pkg.withPackageJson((packageFile) => {
31
+ pkg.script(packageFile, {
32
+ name: `${project.prepare}:husky`,
33
+ state: hasHusky ? 'present' : 'absent',
34
+ script: 'is-ci || husky install',
35
+ });
36
+ });
37
+ }
38
+
39
+ /**
40
+ * @param {{
41
+ * name: 'pre-push'|'pre-commit'|'commit-msg',
42
+ * state: 'present'|'absent',
43
+ * content: string
44
+ * }} options
45
+ */
46
+ function gitHook({ name, state, content }) {
47
+ const hasHusky = Boolean(packageJson().get('devDependencies.husky'));
48
+ const hasGitHook = hasHusky && state === 'present';
49
+ const hookDirectory = '.husky';
50
+ const hookFileName = path.join(hookDirectory, name);
51
+ if (hasGitHook) {
52
+ makeDirs(hookDirectory);
53
+
54
+ if (!file(hookFileName).exists()) {
55
+ execSync(`npm exec -- husky add ${hookFileName} ""`, { stdio: 'inherit' });
56
+ }
57
+
58
+ block({
59
+ path: hookFileName,
60
+ block: content,
61
+ insertAfter: 'end',
62
+ });
63
+ } else {
64
+ file(hookFileName).delete();
65
+ }
66
+ }
67
+
68
+ module.exports = {
69
+ husky,
70
+ gitHook,
71
+ };
@@ -0,0 +1,8 @@
1
+ const { file } = require('mrm-core');
2
+
3
+ const FILE_PATH = '.gitlab-ci.yml';
4
+
5
+ function isSupported() {
6
+ return file(FILE_PATH).exists();
7
+ }
8
+ exports.isSupported = isSupported;
package/core/jest.js ADDED
@@ -0,0 +1,105 @@
1
+ /* eslint-disable no-template-curly-in-string */
2
+ const { packageJson } = require('mrm-core');
3
+ const { vscodeSnippets } = require('./vscode');
4
+ const pkg = require('./pkg');
5
+ const npm = require('./npm');
6
+ const project = require('./project');
7
+
8
+ /**
9
+ * @param {{
10
+ * state: 'present'|'absent'
11
+ * }} options
12
+ */
13
+ function jest({ state }) {
14
+ const packageFileDefault = packageJson();
15
+ const hasJest = state === 'present';
16
+ const hasTypescript = Boolean(packageFileDefault.get('devDependencies.typescript'));
17
+ const hasWorkspaces = Boolean(packageFileDefault.get('workspaces'));
18
+
19
+ pkg.withPackageJson((packageFile) => {
20
+ if (hasJest) {
21
+ const ignorePatterns = ['/node_modules/', '/docs/', '/lib/', '/build/', '/.cache/', '/public/'];
22
+ packageFile.merge({
23
+ jest: {
24
+ coveragePathIgnorePatterns: ignorePatterns,
25
+ testPathIgnorePatterns: ignorePatterns,
26
+ },
27
+ });
28
+ if (hasTypescript) {
29
+ packageFile.merge({
30
+ jest: {
31
+ globals: {
32
+ 'ts-jest': {
33
+ tsconfig: hasWorkspaces ? 'tsconfig.settings.json' : 'tsconfig.json',
34
+ },
35
+ },
36
+ roots: hasWorkspaces ? ['<rootDir>/packages'] : null,
37
+ transform: {
38
+ '^.+\\.tsx?$': 'ts-jest',
39
+ },
40
+ },
41
+ });
42
+ } else {
43
+ packageFile.unset('jest.globals.ts-jest').unset('jest.transform.^.+\\.tsx?$');
44
+ }
45
+ } else {
46
+ packageFile.unset('jest');
47
+ }
48
+
49
+ pkg.script(packageFile, {
50
+ name: project.coverage,
51
+ script: hasWorkspaces ? pkg.emptyScript : 'jest --coverage',
52
+ state: !hasJest || hasWorkspaces ? 'default' : 'present',
53
+ });
54
+ pkg.script(packageFile, {
55
+ name: project.test,
56
+ script: hasWorkspaces ? pkg.emptyScript : 'jest',
57
+ state: !hasJest || hasWorkspaces ? 'default' : 'present',
58
+ });
59
+ pkg.script(packageFile, {
60
+ name: `${project.test}:watch`,
61
+ script: pkg.emptyScript,
62
+ state: 'absent',
63
+ });
64
+ });
65
+ // Dependencies
66
+ npm.dependency({
67
+ dev: true,
68
+ name: ['jest', 'babel-jest', '@babel/core'],
69
+ state: hasJest ? 'present' : 'absent',
70
+ });
71
+ npm.dependency({
72
+ dev: true,
73
+ name: ['ts-jest', '@types/jest'],
74
+ state: hasJest && hasTypescript ? 'present' : 'absent',
75
+ });
76
+
77
+ vscodeSnippets({
78
+ name: 'jest',
79
+ snippets: {
80
+ 'Jest Describe Block': {
81
+ body: ["describe('${1:description}', () => {", '\t$0', '});'],
82
+ description: 'Jest describe block',
83
+ prefix: 'describe',
84
+ scope: 'javascript,typescript',
85
+ },
86
+ 'Jest Expect': {
87
+ body: 'expect($0)',
88
+ description: 'Jest expect assertion',
89
+ prefix: 'expect',
90
+ scope: 'javascript,typescript',
91
+ },
92
+ 'Jest Test Block': {
93
+ body: ["test('${1:description}', () => {", '\t$0', '});'],
94
+ description: 'Jest test block',
95
+ prefix: 'test',
96
+ scope: 'javascript,typescript',
97
+ },
98
+ },
99
+ state: hasJest ? 'present' : 'absent',
100
+ });
101
+ }
102
+
103
+ module.exports = {
104
+ jest,
105
+ };