Skip to content

Commit

Permalink
v0.11.0
Browse files Browse the repository at this point in the history
* feat(cmds): add `default-env` option to both `project` and `projectId` commands
* chore(deps): update dev dependencies include eslint, mocha, nyc, @babel/cli and more
  • Loading branch information
prescottprue authored Jan 8, 2020
1 parent a38208e commit 6ecdcf0
Show file tree
Hide file tree
Showing 6 changed files with 986 additions and 3,993 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/

- name: Get yarn cache
id: yarn-cache
Expand Down Expand Up @@ -56,21 +57,20 @@ jobs:
path: lib

- name: Publish To NPM
run: npm publish $(if [ ${{github.ref}} == 'refs/heads/next' ]; then echo '--tag next';fi;)
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm publish $(if [ ${{github.ref}} == 'refs/heads/next' ]; then echo '--tag next';fi;)
- name: Upload Coverage + Climate
if: success()
env:
CI: true
CODE_COV: ${{ secrets.CODE_COV }}
CODECLIMATE_REPO_TOKEN: ${{ secrets.CODE_CLIMATE }}
# Upload to Code Coverage. Curl used in place of codecov/codecov-action
# due to long build time. See https://github.com/codecov/codecov-action/issues/21
run: |
# Upload to Code Cover. Curl used in place of codecov/codecov-action
# due to long build time. See https://github.com/codecov/codecov-action/issues/21
curl -s https://codecov.io/bash | bash -s -- -t $CODE_COV
# Install codeclimate tool and upload
npm install -g codeclimate-test-reporter
codeclimate-test-reporter < coverage/lcov.info
7 changes: 6 additions & 1 deletion cmds/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ module.exports = function(program) {
program
.command('project')
.description('Get name of project associated with current CI environment')
.option(
'-d, --default-env <envName>',
'Default environment (used in place of master)'
)
.action((directory, options) => {
const projectKey = getProjectName()
const defaultProject = directory && directory.defaultEnv
const projectKey = getProjectName(defaultProject && { defaultProject })
if (!projectKey) {
process.exit(1)
} else {
Expand Down
7 changes: 6 additions & 1 deletion cmds/projectId.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ module.exports = function(program) {
program
.command('projectId')
.description('Get projectId of associated with current CI environment')
.option(
'-d, --default-env <envName>',
'Default environment (used in place of master)'
)
.action((directory, options) => {
const projectKey = getProjectId()
const defaultProject = directory && directory.defaultEnv
const projectKey = getProjectId(defaultProject && { defaultProject })
if (!projectKey) {
process.exit(1)
} else {
Expand Down
32 changes: 15 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "firebase-ci",
"version": "0.10.0",
"version": "0.11.0",
"description": "Simplified Firebase interaction for continuous integration including deploying hosting, functions, and database/storage rules.",
"main": "lib/index.js",
"bin": {
Expand Down Expand Up @@ -71,22 +71,21 @@
"lodash": "^4.17.15"
},
"devDependencies": {
"@babel/cli": "^7.7.0",
"@babel/core": "^7.7.2",
"@babel/plugin-transform-modules-commonjs": "^7.7.0",
"@babel/preset-env": "^7.7.1",
"@babel/register": "^7.7.0",
"@jedmao/semantic-release-npm-github-config": "^1.0.8",
"@babel/cli": "^7.7.7",
"@babel/core": "^7.7.7",
"@babel/plugin-transform-modules-commonjs": "^7.7.5",
"@babel/preset-env": "^7.7.7",
"@babel/register": "^7.7.7",
"babel-eslint": "^10.0.3",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-module-resolver": "^3.2.0",
"babel-plugin-module-resolver": "^4.0.0",
"chai": "^4.2.0",
"chai-files": "^1.4.0",
"codecov": "^3.6.1",
"cross-env": "^6.0.3",
"env-cmd": "^10.0.1",
"eslint": "^6.6.0",
"eslint-config-prettier": "^6.5.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.9.0",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.18.2",
Expand All @@ -95,13 +94,12 @@
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-promise": "^4.2.0",
"eslint-plugin-standard": "^4.0.0",
"husky": "^3.0.9",
"mocha": "^6.2.2",
"nyc": "^14.1.1",
"prettier": "^1.18.2",
"husky": "^4.0.0",
"mocha": "^7.0.0",
"nyc": "^15.0.0",
"prettier": "^1.19.1",
"rimraf": "^3.0.0",
"semantic-release": "^15.13.31",
"sinon": "^7.5.0",
"sinon-chai": "^3.3.0"
"sinon": "^8.0.4",
"sinon-chai": "^3.4.0"
}
}
25 changes: 20 additions & 5 deletions src/utils/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,13 @@ export function getProjectKey(opts) {
export function getProjectName(opts) {
const projectKey = getProjectKey(opts)
const firebaserc = getFile('.firebaserc')
return get(
firebaserc,
`projects.${projectKey}`,
get(firebaserc, 'projects.master', get(firebaserc, 'projects.default'))
return (
get(firebaserc, `projects.${projectKey}`) ||
(opts &&
opts.defaultProject &&
get(firebaserc, `projects.${opts.defaultProject}`)) ||
get(firebaserc, 'projects.master') ||
get(firebaserc, 'projects.default')
)
}

Expand All @@ -81,9 +84,21 @@ export function getProjectName(opts) {
export function getProjectId(opts) {
const projectKey = getProjectKey(opts)
const firebaserc = getFile('.firebaserc')
console.log('project key', projectKey)
return (
process.env.FIREBASE_CI_PROJECT ||
get(firebaserc, `ci.createConfig.${projectKey}.firebase.projectId`) ||
get(
firebaserc,
`ci.createConfig.${
projectKey === 'default' ? 'master' : projectKey
}.firebase.projectId`
) ||
(opts &&
opts.defaultProject &&
get(
firebaserc,
`ci.createConfig.${opts.defaultProject}.firebase.projectId`
)) ||
get(firebaserc, `ci.createConfig.master.firebase.projectId`) ||
getProjectName(opts)
)
Expand Down
Loading

0 comments on commit 6ecdcf0

Please sign in to comment.