Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 4c685ed

Browse files
christopherandersoncleemullins
authored andcommitted
chore: swap to rush/pnpm & azure-pipelines.yml (#381)
* wip: added rush to command and chatdown * chore: remove lerna * chore: add rush * chore: fix build & test for rush * chore: add azure-pipeline [WIP] * fix: use correct rush package in ci * chore: bump timeouts on tests * chore: disable linting on tests where it doesn't work * chore: implicityAny enabled on tests for config * chore: disable flakey test * chore: disable parallelism on coverage * chore: use Node 12 * chore: rearrange ci steps * chore: swap to windows * chore: disable bad tests * chore: allow warnings * chore: disable reporting coverage to coveralls * chore: address dialog changes * chore: add pr and cron triggers * docs: update contributing docs * chore: fix branches in azure-pipelines.yml * fix: types * fix: flakey test
1 parent a95f65a commit 4c685ed

File tree

93 files changed

+7466
-372
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+7466
-372
lines changed

.gitattributes

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,19 @@
33
###############################################################################
44
* text=auto
55

6+
7+
8+
# Don't allow people to merge changes to these generated files, because the result
9+
# may be invalid. You need to run "rush update" again.
10+
pnpm-lock.yaml merge=binary
11+
shrinkwrap.yaml merge=binary
12+
npm-shrinkwrap.json merge=binary
13+
yarn.lock merge=binary
14+
15+
# Rush's JSON config files use JavaScript-style code comments. The rule below prevents pedantic
16+
# syntax highlighters such as GitHub's from highlighting these comments as errors. Your text editor
17+
# may also require a special configuration to allow comments in JSON.
18+
#
19+
# For more information, see this issue: https://github.com/Microsoft/web-build-tools/issues/1088
20+
#
21+
*.json linguist-language=JSON-with-Comments

.gitignore

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# Logs
2-
logs
32
*.log
43
npm-debug.log*
54
yarn-debug.log*
65
yarn-error.log*
76

87
# Runtime data
9-
pids
108
*.pid
119
*.seed
1210
*.pid.lock
@@ -36,9 +34,6 @@ build/Release
3634
node_modules/
3735
jspm_packages/
3836

39-
# TypeScript v1 declaration files
40-
typings/
41-
4237
# Optional npm cache directory
4338
.npm
4439

@@ -60,6 +55,13 @@ typings/
6055
# next.js build output
6156
.next
6257

58+
# Common toolchain intermediate files
59+
temp
60+
61+
# Rush files
62+
common/temp/**
63+
.rush/temp/**
64+
6365
.DS_Store
6466

6567
# Visual Studio setup

CONTRIBUTING.md

Lines changed: 86 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,40 @@
1-
# Contribution guide
1+
# 👩‍💻 Contribution guide
22

3+
## 🛠 Required tools
34

4-
## Build the project
5-
1. Clone the repo by running 'git clone https://github.com/microsoft/botframework-cli.git'
6-
2. Inside the project folder run 'npm install'
7-
3. Run 'npm run build'
5+
We use [rush](https://rushjs.io/) with [pnpm](https://pnpm.js.org) to manage our monorepo. All your commands to build and test will use `rush`/`rushx`.
86

9-
## Steps to create a new plugin
7+
- git
8+
- node 10 LTS or 12 LTS
9+
- (other versions not officially supported) (recommend [nvs](https://github.com/jasongin/nvs/releases) to help manage node versions)
10+
11+
- (rush newer rush versions will manage this for you)
12+
- (optional) pnpm@5+
13+
- useful to make vs code happy when trying to resolve your typescript version
14+
- MacOSX, Windows, "modern" Linux
15+
- We develop on Mac and Windows machines, and test on Ubuntu 14+.
1016

11-
1. Build the project
12-
2. Inside the packages folder(https://github.com/microsoft/botframework-cli/tree/master/packages) run 'npx oclif plugin <plugin-name>'
13-
3. Follow the wizard and set the prompts:
14-
15-
? npm package: @microsoft/bf-<plugin-name>
16-
? description: <Plugin brief description>
17-
? author: Microsoft
18-
? version: 1.0.0
19-
? license: MIT
20-
? Who is the GitHub owner of repository (https://github.com/OWNER/repo): microsoft
21-
? What is the GitHub name of repository (https://github.com/owner/REPO): botframework-cli
22-
? Select a package manager: npm
23-
? TypeScript: Y
24-
? Use tslint (linter for TypeScript): Y
25-
? Use mocha (testing framework): Y
26-
? Add CI service config (Press <space> to select, <a> to toggle all, <i> to invert selection): select any
27-
28-
4. Go to the folder created by the previous command and add @microsoft/bf-cli-command as a dependency in your package.json file
29-
30-
"dependencies": {
31-
...,
32-
"@microsoft/bf-cli-command": "1.0.0",
33-
...
34-
}
35-
36-
5. At the root level(https://github.com/microsoft/botframework-cli) run 'npm run build' to bootstrap the packages
17+
## ⚡ Quickstart to contribute
3718

38-
## Steps to create a new command
39-
1. Inside the plugin folder run 'npx oclif command <command-name>'.
40-
a. To add a subcommand use a colon separated format as follows:
41-
<command-name:subcommand-name>
42-
2. Replace the import 'import {Command, flags} from '@oclif/command' line inside the newly created command with '@microsoft/bf-cli-command'
43-
44-
- import {Command, flags} from '@oclif/command'
45-
+ import {Command, flags} from '@microsoft/bf-cli-command'
46-
47-
3. Add the typing to the flags property like this if needed:
48-
49-
static flags: flags.Input<any> = {
50-
help: flags.help({description: 'Display help'}),
51-
}
52-
53-
4. Implement the run method
19+
0. Fork the repo at https://github.com/microsoft/botframework-cli
20+
0. Clone your fork - `git clone https://github.com/<YOU>/botframework-cli.git`
21+
0. `npm i -g @microsoft/rush`
22+
- Install rush
23+
0. `rush update`
24+
- installs and links packages - use `rush install` and `rush link` for readonly
25+
0. `rush build`
26+
- builds all the projects
27+
0. `rush test`
28+
- runs tests in all the projects
5429

55-
## General Guidelines
30+
## 💅 Tips
31+
32+
- DO NOT USE `npm install` (and in general avoid `npm` commands). If you need to add a package, look at `rush add` or modify the package.json directly.
33+
- We don't hoist common dev dependencies from a single list. It must be declared in each package, but pnpm will only install it once.
34+
- You can use `rush --help` to get more details about what commands you can run.
35+
- You can also use `rushx` to run specific commands in a given package (but rush install/link usually needs to have run for it to work).
36+
37+
## 📃 General Guidelines
5638

5739
### Common Options Rules
5840

@@ -79,8 +61,6 @@
7961
- Detect --in / --out file or folder based on specified value. If need to disambiguate introduce param (only if no way to infer).
8062
- Use the input/output stream tables below to guide command line I/O processing
8163

82-
83-
8464
#### Input Stream
8565

8666
| Specified | Expected | Exist | File Action | Folder Action |
@@ -179,3 +159,58 @@ CLI contribution Software Development Lifecycle is as follows:
179159
3. Implement. All code must be test-covered at > 90% coverage integrated into CI.
180160
4. Schedule a team show & tell demo for introduction, feedback and fine tuning
181161

162+
## ❓ FAQ
163+
164+
### Why rush/pnpm?
165+
166+
Rush and pnpm are newer tools and not all that popular outside of Microsoft, why use them?
167+
168+
- Speed. We get ordered and parallel builds for free.
169+
- Standarization. Many of the Microsoft JS repos are moving to `rush`.
170+
- Quality of life. The command line help, enforcement & customization tools, etc. that come from `rush` and `pnpm` are super useful. Also, we like avoiding the "parent" project for hoisting dependencies. That frequently bites us with our old system.
171+
172+
### Steps to create a new plugin
173+
174+
1. Build the project
175+
2. Inside the packages folder(https://github.com/microsoft/botframework-cli/tree/master/packages) run 'npx oclif plugin <plugin-name>'
176+
3. Follow the wizard and set the prompts:
177+
178+
? npm package: @microsoft/bf-<plugin-name>
179+
? description: <Plugin brief description>
180+
? author: Microsoft
181+
? version: 1.0.0
182+
? license: MIT
183+
? Who is the GitHub owner of repository (https://github.com/OWNER/repo): microsoft
184+
? What is the GitHub name of repository (https://github.com/owner/REPO): botframework-cli
185+
? Select a package manager: npm
186+
? TypeScript: Y
187+
? Use tslint (linter for TypeScript): Y
188+
? Use mocha (testing framework): Y
189+
? Add CI service config (Press <space> to select, <a> to toggle all, <i> to invert selection): select any
190+
191+
4. Go to the folder created by the previous command and add @microsoft/bf-cli-command as a dependency in your package.json file
192+
193+
"dependencies": {
194+
...,
195+
"@microsoft/bf-cli-command": "1.0.0",
196+
...
197+
}
198+
199+
5. At the root level(https://github.com/microsoft/botframework-cli) run 'npm run build' to bootstrap the packages
200+
201+
### Steps to create a new command
202+
1. Inside the plugin folder run 'npx oclif command <command-name>'.
203+
a. To add a subcommand use a colon separated format as follows:
204+
<command-name:subcommand-name>
205+
2. Replace the import 'import {Command, flags} from '@oclif/command' line inside the newly created command with '@microsoft/bf-cli-command'
206+
207+
- import {Command, flags} from '@oclif/command'
208+
+ import {Command, flags} from '@microsoft/bf-cli-command'
209+
210+
3. Add the typing to the flags property like this if needed:
211+
212+
static flags: flags.Input<any> = {
213+
help: flags.help({description: 'Display help'}),
214+
}
215+
216+
4. Implement the run method

azure-pipelines.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
trigger:
2+
batch: true
3+
branches:
4+
include:
5+
- master
6+
7+
pr:
8+
- master
9+
10+
schedules:
11+
- cron: "0 0 * * *"
12+
displayName: Daily midnight build
13+
branches:
14+
include:
15+
- master
16+
17+
strategy:
18+
matrix:
19+
linux:
20+
imageName: "windows-2019"
21+
nodeVersion: "12.x"
22+
maxParallel: 3
23+
24+
pool:
25+
vmImage: $(imageName)
26+
27+
steps:
28+
- powershell: 'Get-ChildItem env:* | sort-object name'
29+
displayName: 'Log environment variables'
30+
continueOnError: true
31+
32+
- task: NodeTool@0
33+
displayName: 'Use Node 12.x'
34+
inputs:
35+
versionSpec: $(nodeVersion)
36+
37+
- task: Npm@1
38+
displayName: 'Install rush'
39+
inputs:
40+
command: custom
41+
verbose: false
42+
customCommand: 'install --global @microsoft/rush'
43+
44+
- script: 'rush update'
45+
displayName: 'rush update'
46+
47+
- script: 'rush build'
48+
displayName: 'rush build'
49+
50+
- script: 'rush test'
51+
displayName: 'rush test'
52+
53+
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
54+
displayName: 'Component Detection'
55+
56+
- script: 'rush report:coverage'
57+
displayName: 'rush report:coverage'
58+
enabled: false
59+
60+
- task: PublishBuildArtifacts@1
61+
enabled: false
62+
displayName: 'Publish Artifact: nyc_output'
63+
inputs:
64+
PathtoPublish: '$(Build.SourcesDirectory)\.nyc_output'
65+
ArtifactName: 'nyc_output'

common/config/rush/.npmrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Rush uses this file to configure the package registry, regardless of whether the
2+
# package manager is PNPM, NPM, or Yarn. Prior to invoking the package manager,
3+
# Rush will always copy this file to the folder where installation is performed.
4+
# When NPM is the package manager, Rush works around NPM's processing of
5+
# undefined environment variables by deleting any lines that reference undefined
6+
# environment variables.
7+
#
8+
# DO NOT SPECIFY AUTHENTICATION CREDENTIALS IN THIS FILE. It should only be used
9+
# to configure registry sources.
10+
11+
registry=https://registry.npmjs.org/
12+
always-auth=false

0 commit comments

Comments
 (0)