forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'ms/master'
- Loading branch information
Showing
9 changed files
with
234 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
# Script used by the Azure DevOps build agent to start the verdaccio npm proxy server | ||
|
||
THIS_DIR=$PWD | ||
|
||
COMMAND="$TMPDIR/launchVerdaccio.command" | ||
echo "cd ${THIS_DIR}; sudo n 10 ; verdaccio --config ./.ado/verdaccio/config.yaml &> ./.ado/verdaccio/console.log" > "$COMMAND" | ||
chmod +x "$COMMAND" | ||
open "$COMMAND" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env node | ||
// @ts-check | ||
|
||
const child_process = require("child_process"); | ||
|
||
const username = process.argv[2]; | ||
const password = process.argv[3]; | ||
const email = process.argv[4]; | ||
const registry = process.argv[5]; | ||
|
||
if (!username) { | ||
console.error("Please specify username"); | ||
process.exit(1); | ||
} | ||
|
||
if (!password) { | ||
console.error("Please specify password"); | ||
process.exit(1); | ||
} | ||
|
||
if (!email) { | ||
console.error("Please specify email"); | ||
process.exit(1); | ||
} | ||
|
||
const child = child_process.exec(`npm adduser${registry? (' --registry ' + registry) :''}` ); | ||
|
||
child.stdout.on("data", d => { | ||
const data = d.toString(); | ||
process.stdout.write(d + "\n"); | ||
if (data.match(/username/i)) { | ||
child.stdin.write(username + "\n"); | ||
} else if (data.match(/password/i)) { | ||
child.stdin.write(password + "\n"); | ||
} else if (data.match(/email/i)) { | ||
child.stdin.write(email + "\n"); | ||
} else if (data.match(/logged in as/i)) { | ||
child.stdin.end(); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
parameters: | ||
configuration: | ||
|
||
steps: | ||
- checkout: self # self represents the repo where the initial Pipelines YAML file was found | ||
clean: true # whether to fetch clean each time | ||
# fetchDepth: 2 # the depth of commits to ask Git to fetch | ||
lfs: false # whether to download Git-LFS files | ||
submodules: false # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules | ||
persistCredentials: false # set to 'true' to leave the OAuth token in the Git config after the initial fetch | ||
|
||
# First do a build of the local package, since we point the cli at the local files, it needs to be pre-built | ||
- task: CmdLine@2 | ||
displayName: yarn install (local react-native-macos) | ||
inputs: | ||
script: yarn install --frozen-lockfile | ||
|
||
- task: CmdLine@2 | ||
displayName: yarn install (local react-native-macos-init) | ||
inputs: | ||
script: | | ||
cd packages/react-native-macos-init | ||
yarn install | ||
- task: CmdLine@2 | ||
displayName: yarn build (local react-native-macos-init) | ||
inputs: | ||
script: | | ||
cd packages/react-native-macos-init | ||
yarn build | ||
- task: CmdLine@2 | ||
displayName: Install Verdaccio | ||
inputs: | ||
script: | | ||
npm install --global verdaccio | ||
- task: CmdLine@2 | ||
displayName: Install n used by ado-start-verdaccio.sh | ||
inputs: | ||
script: | | ||
npm install --global n | ||
- task: ShellScript@2 | ||
displayName: Launch test npm server (verdaccio) | ||
inputs: | ||
scriptPath: '.ado/ado-start-verdaccio.sh' | ||
disableAutoCwd: true | ||
cwd: '' | ||
|
||
- script: | | ||
npm set registry http://localhost:4873 | ||
displayName: Modify default npm config to point to local verdaccio server | ||
- script: | | ||
node .ado/waitForVerdaccio.js | ||
displayName: Wait for verdaccio server to boot | ||
- script: | | ||
node .ado/npmAddUser.js user pass mail@nomail.com http://localhost:4873 | ||
displayName: Add npm user to verdaccio | ||
- task: CmdLine@2 | ||
displayName: Bump package version | ||
inputs: | ||
script: node .ado/bumpFileVersions.js | ||
|
||
- task: CmdLine@2 | ||
displayName: "Prepare package.json for npm publishing as react-native-macos" | ||
inputs: | ||
script: node .ado/renamePackageToMac.js | ||
|
||
- script: | | ||
npm publish --registry http://localhost:4873 | ||
displayName: Publish react-native-macos to verdaccio | ||
- script: | | ||
cd packages/react-native-macos-init | ||
npx --no-install beachball publish --branch origin/$(System.PullRequest.TargetBranch) --no-push --registry http://localhost:4873 --yes --access public | ||
displayName: Publish react-native-macos-init to verdaccio | ||
- task: CmdLine@2 | ||
displayName: Install react-native cli | ||
inputs: | ||
script: npm install -g react-native-cli | ||
|
||
- task: CmdLine@2 | ||
displayName: Init new project | ||
inputs: | ||
script: react-native init testcli | ||
workingDirectory: $(Agent.BuildDirectory) | ||
|
||
- task: CmdLine@2 | ||
displayName: Apply macos template | ||
inputs: | ||
script: npx react-native-macos-init --version latest --overwrite --prerelease | ||
workingDirectory: $(Agent.BuildDirectory)/testcli | ||
|
||
# TODO: react-native run-macos and test when implemented |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
variables: | ||
VmImage: macOS-10.14 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
storage: ./storage | ||
auth: | ||
htpasswd: | ||
file: ./htpasswd | ||
uplinks: | ||
npmjs: | ||
url: https://registry.npmjs.org/ | ||
max_fails: 40 | ||
maxage: 30m | ||
timeout: 60s | ||
agent_options: | ||
keepAlive: true | ||
maxSockets: 40 | ||
maxFreeSockets: 10 | ||
packages: | ||
'@*/*': | ||
access: $all | ||
publish: $all | ||
proxy: npmjs | ||
'**': | ||
access: $all | ||
publish: $all | ||
proxy: npmjs | ||
logs: | ||
- {type: file, path: verdaccio.log, format: pretty, level: debug} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env node | ||
// @ts-check | ||
|
||
const http = require('http'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
function queryForServerStatus() { | ||
|
||
http.get('http://localhost:4873', res => { | ||
console.log(`Server status: ${res.statusCode}`); | ||
if (res.statusCode != 200) { | ||
setTimeout(queryForServerStatus, 2000); | ||
} | ||
}).on('error', err => { | ||
console.log(err.message); | ||
try { | ||
const logFile = fs.readFileSync(path.resolve(__dirname, 'verdaccio/console.log')).toString('utf8'); | ||
console.log('verdaccio console output: ' + logFile); | ||
} catch (error) { | ||
console.log('no verdaccio console output yet.'); | ||
} | ||
setTimeout(queryForServerStatus, 2000); | ||
}); | ||
} | ||
|
||
console.log('Waiting for verdaccio instance to respond...'); | ||
|
||
queryForServerStatus(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters