@toptal/davinci-workflow 1.10.2-alpha-fx-fix-do-not-open-browser.1 → 1.10.2

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.
@@ -0,0 +1,9 @@
1
+ const baseConfig = require('../../.lintstagedrc.js')
2
+ const readmePath = require.resolve('./README.md')
3
+
4
+ module.exports = {
5
+ ...baseConfig,
6
+ '*.{yaml,js,md}': () => {
7
+ return ['yarn build:documentation', `git add ${readmePath}`]
8
+ },
9
+ }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @toptal/davinci-workflow
2
2
 
3
+ ## 1.10.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1344](https://github.com/toptal/davinci/pull/1344) [`64c000c2`](https://github.com/toptal/davinci/commit/64c000c25d97df2c8853a6cf80b7ca81461dae24) Thanks [@dmaklygin](https://github.com/dmaklygin)! - - implement workflow documentation generator
8
+
9
+ - Updated dependencies [[`64c000c2`](https://github.com/toptal/davinci/commit/64c000c25d97df2c8853a6cf80b7ca81461dae24)]:
10
+ - @toptal/davinci-cli-shared@1.5.4
11
+ - @toptal/davinci-monorepo@6.6.2
12
+
3
13
  ## 1.10.1
4
14
 
5
15
  ### Patch Changes
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Generates Github (GH) Workflows
4
4
 
5
- ## Usage
5
+ # Usage
6
6
 
7
7
  Use it by installing `yarn add @toptal/davinci` in your project.
8
8
 
@@ -18,38 +18,130 @@ or
18
18
 
19
19
  Arguments:
20
20
 
21
- - `workflow-name` - the name of the GH workflow to create
22
-
23
- ## GH Workflows
24
-
25
- - `typecheck` — Check an App on Typescript issues. Example: `davinci new-workflow typecheck`
26
- - `lint` Check app for Lint issues. Example: `davinci new-workflow lint`
27
- - `unit-tests` — Conduct Unit tests. Example: `davinci new-workflow unit-tests`
28
- - `danger` - Run check on PR title and commit messages for compliance. Example `davinci new-workflow danger`
29
- - `alpha-package` - Execute script to publish alpha version of package to NPM. Example `davinci new-workflow alpha-package`
30
- Example of usage in PR: write a new comment in PR
31
- `@toptal-bot run package:alpha-release` — it runs [build-publish-alpha-package](https://github.com/toptal/davinci-github-actions/tree/master/build-publish-alpha-package) GH Action.
32
- - `deploy-temploy` - Builds & Deploys application to Temploy. It creates a new instance of Docker image, pushes it to cloud and triggers an appropriate Jenkins job to deploy the image to temploy.
33
- Example of usage in PR: write a new comment in PR: `@toptal-bot run temploy`
34
- - `deploy` — Performs docker image build and deployment to staging/production environment. Consists of three Workflows:
35
- - `Deploy` (davinci-deploy.yml)
36
- - it's triggered when PR is merged to `master` or `main` branch
37
- - It builds and pushes a new instance of Docker image to google cloud
38
- - if `davinci.yml` is present in the root folder:
39
- - and `deploy_staging` key is set to **true** then triggers `Deploy to Staging` GH Workflow
40
- - and `deploy` key is set to **true** then triggers `Deploy to Production` GH Workflow
41
- - `Deploy to staging` (davinci-deploy-staging.yml)
42
- - Triggers Jenkins job for deployment to staging environment
43
- - how to trigger the Workflow manually:
44
- - add a new comment: `@toptal-bot run deploy-staging` in a PR. It will trigger a new GH Workflow. The latest commit in the PR branch will be taken to build a docker image.
45
- - In the `actions` tab, choose `Deploy to Staging` GH Workflow and provide a commit SHA
46
- - `Deploy to production` (davinci-deploy-production.yml)
47
- - Triggers Jenkins job for deployment to production environment
48
- - how to trigger the Workflow manually:
49
- - In the `actions` tab, choose `Deploy to Production` GH Workflow and provide a commit SHA
50
- - Find out more about how deployment works in [confluence](https://toptal-core.atlassian.net/l/c/ZN2K1f0r)
51
-
52
- ## Alias
53
-
54
- In all the commands you can use `davinci-workflow` directly if needed, instead of `davinci workflow`. This is not a recommended way to use `davinci`, but in very rare cases it might be useful.
21
+ * `workflow-name` - the name of the GH workflow to create
22
+
23
+ # GH Workflows
24
+
25
+ ## alpha-package
26
+ Executes script to publish alpha version of package to NPM
27
+
28
+ **Example:**
29
+ ```bash
30
+ $ davinci new-workflow alpha-package
31
+ ```
32
+ **Description:**
33
+
34
+ it triggers [build-publish-alpha-package](https://github.com/toptal/davinci-github-actions/tree/master/build-publish-alpha-package) GH Action.
35
+
36
+ **Example of usage:**
37
+
38
+ Write a new comment in PR `@toptal-bot run package:alpha-release`
39
+
40
+ ## typecheck
41
+ Checks an App on Typescript issues
42
+
43
+ **Example:**
44
+ ```bash
45
+ $ davinci new-workflow typecheck
46
+ ```
47
+ **Description:**
48
+
49
+ it triggers `typecheck` GH Action
50
+
51
+
52
+
53
+ ## lint
54
+ Checks an App for lint issues
55
+
56
+ **Example:**
57
+ ```bash
58
+ $ davinci new-workflow lint
59
+ ```
60
+ **Description:**
61
+
62
+ it triggers `lint` GH Action
63
+
64
+
65
+
66
+ ## unit-tests
67
+ Conducts unit tests
68
+
69
+ **Example:**
70
+ ```bash
71
+ $ davinci new-workflow unit-tests
72
+ ```
73
+ **Description:**
74
+
75
+ it triggers `unit-tests` GH Action
76
+
77
+
78
+
79
+ ## integration-tests
80
+ Conducts integration tests in a project using Cypress.
81
+
82
+ **Example:**
83
+ ```bash
84
+ $ davinci new-workflow integration-tests
85
+ ```
86
+ **Description:**
87
+
88
+ it triggers `integration-tests` GH Action
89
+
90
+
91
+
92
+ ## danger
93
+ Checks if the PR title and commit messages comply with Toptal's standards
94
+
95
+ **Example:**
96
+ ```bash
97
+ $ davinci new-workflow danger
98
+ ```
99
+ **Description:**
100
+
101
+ it triggers `danger` GH Action
102
+
103
+
104
+
105
+ ## deploy-temploy
106
+ Builds & Deploys application to Temploy
107
+
108
+ **Example:**
109
+ ```bash
110
+ $ davinci new-workflow deploy-temploy
111
+ ```
112
+ **Description:**
113
+
114
+ it creates a new instance of Docker image, pushes it to cloud and triggers an appropriate Jenkins job to deploy the image to temploy.
115
+
116
+ **Example of usage:**
117
+
118
+ Write a new comment in PR `@toptal-bot run temploy`
119
+
120
+ ## deploy
121
+ Performs docker image build and deployment to staging/production environment
122
+
123
+ **Example:**
124
+ ```bash
125
+ $ davinci new-workflow deploy
126
+ ```
127
+ **Description:**
128
+
129
+ performs docker image build and deployment to staging/production environment. Consists of three Workflows:
130
+
131
+ * `Deploy` (davinci-deploy.yml)
132
+ * it's triggered when PR is merged to `master` or `main` branch
133
+ * It builds and pushes a new instance of Docker image to google cloud
134
+ * if `davinci.yml` is present in the root folder:
135
+ * and `deploy_staging` key is set to **true** then triggers `Deploy to Staging` GH Workflow
136
+ * and `deploy` key is set to **true** then triggers `Deploy to Production` GH Workflow
137
+ * `Deploy to staging` (davinci-deploy-staging.yml)
138
+ * Triggers Jenkins job for deployment to staging environment
139
+ * how to trigger the Workflow manually:
140
+ * add a new comment: `@toptal-bot run deploy-staging` in a PR. It will trigger a new GH Workflow. The latest commit in the PR branch will be taken to build a docker image.
141
+ * In the `actions` tab, choose `Deploy to Staging` GH Workflow and provide a commit SHA
142
+ * `Deploy to production` (davinci-deploy-production.yml)
143
+ * Triggers Jenkins job for deployment to production environment
144
+ * how to trigger the Workflow manually:
145
+ * In the `actions` tab, choose `Deploy to Production` GH Workflow and provide a commit SHA
146
+ * Find out more about how deployment works in [confluence](https://toptal-core.atlassian.net/l/c/ZN2K1f0r)
55
147
 
package/bin/build.js ADDED
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env node
2
+ const fs = require('fs')
3
+ const path = require('path')
4
+ const remark = require('remark')
5
+ const headingRange = require('mdast-util-heading-range')
6
+ const fromMarkdown = require('mdast-util-from-markdown')
7
+ const { heading, paragraph, text, strong, code } = require('mdast-builder')
8
+
9
+ const { getWorkflowsDefinitions } = require('../src/utils/workflows')
10
+
11
+ const updateReadme = async () => {
12
+ const readmePathname = path.join(
13
+ require.resolve('@toptal/davinci-workflow'),
14
+ '../../',
15
+ 'README.md'
16
+ )
17
+ const sourceReadmeContent = fs.readFileSync(readmePathname, 'utf8')
18
+ const { workflows } = getWorkflowsDefinitions()
19
+
20
+ const list = Object.keys(workflows).map(workflowKey => {
21
+ const workflow = workflows[workflowKey]
22
+
23
+ const exampleOfUsage = workflow.example
24
+ ? paragraph([
25
+ strong(text('Example of usage:')),
26
+ text('\n\n'),
27
+ paragraph([fromMarkdown(workflow.example)]),
28
+ ])
29
+ : text('')
30
+
31
+ return paragraph([
32
+ heading(2, text(workflowKey)),
33
+ text('\n'),
34
+ paragraph([
35
+ text(workflow.title + '\n\n'),
36
+ paragraph([
37
+ strong(text('Example:')),
38
+ text('\n'),
39
+ code('bash', `$ davinci new-workflow ${workflowKey}`),
40
+ text('\n'),
41
+ ]),
42
+ paragraph([
43
+ strong(text('Description:')),
44
+ text('\n\n'),
45
+ fromMarkdown(workflow.description),
46
+ text('\n\n'),
47
+ ]),
48
+ exampleOfUsage,
49
+ ]),
50
+ ])
51
+ })
52
+
53
+ const processedContent = await remark()
54
+ .use(() => node => {
55
+ headingRange(node, 'GH Workflows', (start, nodes, end) => {
56
+ return [start, ...list, end]
57
+ })
58
+ })
59
+ .process(sourceReadmeContent)
60
+
61
+ fs.writeFileSync(readmePathname, String(processedContent), {
62
+ encoding: 'utf8',
63
+ })
64
+ }
65
+
66
+ try {
67
+ updateReadme()
68
+ } catch (e) {
69
+ console.error('Update Readme Error: ', e)
70
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@toptal/davinci-workflow",
3
+ "version": "1.10.2",
4
+ "description": "GH Workflow generator package for frontend applications",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "keywords": [
9
+ "Github Actions",
10
+ "GH Workflows",
11
+ "generator"
12
+ ],
13
+ "author": "Toptal",
14
+ "homepage": "https://github.com/toptal/davinci/tree/master/packages/workflow#readme",
15
+ "license": "ISC",
16
+ "bin": {
17
+ "davinci-workflow": "./bin/davinci-workflow.js"
18
+ },
19
+ "main": "./src/index.js",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/toptal/davinci.git"
23
+ },
24
+ "scripts": {
25
+ "build:documentation": "./bin/build.js",
26
+ "build:package": "../../bin/build-package.js",
27
+ "prepublishOnly": "../../bin/prepublish.js",
28
+ "test": "echo \"Error: run tests from root\" && exit 1"
29
+ },
30
+ "bugs": {
31
+ "url": "https://github.com/toptal/davinci/issues"
32
+ },
33
+ "dependencies": {
34
+ "@toptal/davinci-cli-shared": "1.5.4",
35
+ "@toptal/davinci-monorepo": "^6.6.2",
36
+ "@toptal/davinci-skeleton": "7.1.1",
37
+ "chalk": "^4.1.2",
38
+ "cosmiconfig": "^7.0.1",
39
+ "fs-extra": "^9.0.1",
40
+ "inquirer": "^8.2.4",
41
+ "inquirer-table-prompt": "^0.2.1",
42
+ "js-yaml": "^4.1.0",
43
+ "lodash.kebabcase": "^4.1.1",
44
+ "ora": "^5.4.1",
45
+ "remark": "^13.0.0",
46
+ "mdast-builder": "^1.1.1",
47
+ "mdast-util-heading-range": "^2.1.5",
48
+ "mdast-util-from-markdown": "^0.8.5"
49
+ }
50
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/davinci-workflow",
3
- "version": "1.10.2-alpha-fx-fix-do-not-open-browser.1+0a279c81",
3
+ "version": "1.10.2",
4
4
  "description": "GH Workflow generator package for frontend applications",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -22,6 +22,7 @@
22
22
  "url": "git+https://github.com/toptal/davinci.git"
23
23
  },
24
24
  "scripts": {
25
+ "build:documentation": "./bin/build.js",
25
26
  "build:package": "../../bin/build-package.js",
26
27
  "prepublishOnly": "../../bin/prepublish.js",
27
28
  "test": "echo \"Error: run tests from root\" && exit 1"
@@ -30,9 +31,9 @@
30
31
  "url": "https://github.com/toptal/davinci/issues"
31
32
  },
32
33
  "dependencies": {
33
- "@toptal/davinci-cli-shared": "1.5.4-alpha-fx-fix-do-not-open-browser.1+0a279c81",
34
- "@toptal/davinci-monorepo": "6.6.2-alpha-fx-fix-do-not-open-browser.1+0a279c81",
35
- "@toptal/davinci-skeleton": "7.1.2-alpha-fx-fix-do-not-open-browser.13+0a279c81",
34
+ "@toptal/davinci-cli-shared": "1.5.4",
35
+ "@toptal/davinci-monorepo": "^6.6.2",
36
+ "@toptal/davinci-skeleton": "7.1.1",
36
37
  "chalk": "^4.1.2",
37
38
  "cosmiconfig": "^7.0.1",
38
39
  "fs-extra": "^9.0.1",
@@ -40,7 +41,10 @@
40
41
  "inquirer-table-prompt": "^0.2.1",
41
42
  "js-yaml": "^4.1.0",
42
43
  "lodash.kebabcase": "^4.1.1",
43
- "ora": "^5.4.1"
44
- },
45
- "gitHead": "0a279c81d154ad6726437451a012e0f5d24b62a5"
44
+ "ora": "^5.4.1",
45
+ "remark": "^13.0.0",
46
+ "mdast-builder": "^1.1.1",
47
+ "mdast-util-heading-range": "^2.1.5",
48
+ "mdast-util-from-markdown": "^0.8.5"
49
+ }
46
50
  }