Skip to content

Commit

Permalink
Merge branch 'master' into add-service-cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
shazron authored Jan 28, 2021
2 parents 6c66dc4 + 179f9d1 commit fcd12f2
Show file tree
Hide file tree
Showing 15 changed files with 387 additions and 397 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/on-push-publish-to-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: on-push-publish-to-npm
on:
push:
branches:
- master # Change this if not your default branch
paths:
- 'package.json'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 10
- run: npm install
- run: npm test
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/version-bump-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: version-bump-publish
on:
workflow_dispatch:
inputs:
level:
description: '<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease'
required: true
default: 'patch'
tag:
description: 'The tag to publish to.'
required: false
default: 'latest'
jobs:
checkout:
name: checkout
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
git config user.name github-actions
git config user.email github-actions@github.com
- uses: actions/setup-node@v1
with:
node-version: 10
- run: |
npm install
npm test
- name: bump and pub
if: ${{ github.event.inputs.level != '' }}
run: |
npm version ${{ github.event.inputs.level }}
git push
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
tag: ${{ github.event.inputs.tag }}
access: 'public'
53 changes: 28 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/index.js)_
_See code: [src/commands/app/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/index.js)_

## `aio app:add`

Expand All @@ -80,7 +80,7 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/add/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/add/index.js)_
_See code: [src/commands/app/add/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/add/index.js)_

## `aio app:add:action`

Expand All @@ -100,7 +100,7 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/add/action.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/add/action.js)_
_See code: [src/commands/app/add/action.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/add/action.js)_

## `aio app:add:ci`

Expand All @@ -118,7 +118,7 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/add/ci.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/add/ci.js)_
_See code: [src/commands/app/add/ci.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/add/ci.js)_

## `aio app:add:event`

Expand All @@ -138,7 +138,7 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/add/event.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/add/event.js)_
_See code: [src/commands/app/add/event.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/add/event.js)_

## `aio app:add:web-assets`

Expand All @@ -158,7 +158,7 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/add/web-assets.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/add/web-assets.js)_
_See code: [src/commands/app/add/web-assets.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/add/web-assets.js)_

## `aio app:build`

Expand All @@ -179,13 +179,14 @@ OPTIONS
--[no-]force-build Forces a build even if one already exists (default: true)
--skip-actions Skip build of actions
--skip-static Skip build of static files
--skip-web-assets Skip build of web assets
--version Show version
DESCRIPTION
This will always force a rebuild unless --no-force-build is set.
```

_See code: [src/commands/app/build.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/build.js)_
_See code: [src/commands/app/build.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/build.js)_

## `aio app:create [PATH]`

Expand All @@ -207,7 +208,7 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/create.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/create.js)_
_See code: [src/commands/app/create.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/create.js)_

## `aio app:delete`

Expand All @@ -224,7 +225,7 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/delete/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/delete/index.js)_
_See code: [src/commands/app/delete/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/delete/index.js)_

## `aio app:delete:action [ACTION-NAME]`

Expand All @@ -246,7 +247,7 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/delete/action.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/delete/action.js)_
_See code: [src/commands/app/delete/action.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/delete/action.js)_

## `aio app:delete:ci`

Expand All @@ -265,7 +266,7 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/delete/ci.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/delete/ci.js)_
_See code: [src/commands/app/delete/ci.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/delete/ci.js)_

## `aio app:delete:event EVENT-ACTION-NAME`

Expand All @@ -287,7 +288,7 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/delete/event.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/delete/event.js)_
_See code: [src/commands/app/delete/event.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/delete/event.js)_

## `aio app:delete:web-assets`

Expand All @@ -306,7 +307,7 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/delete/web-assets.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/delete/web-assets.js)_
_See code: [src/commands/app/delete/web-assets.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/delete/web-assets.js)_

## `aio app:deploy`

Expand All @@ -330,13 +331,14 @@ OPTIONS
--skip-build Skip build phase
--skip-deploy Skip deploy phase
--skip-static Skip build & deployment of static files
--skip-web-assets Skip build & deployment of web assets
--version Show version
DESCRIPTION
This will always force a rebuild unless --no-force-build is set.
```

_See code: [src/commands/app/deploy.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/deploy.js)_
_See code: [src/commands/app/deploy.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/deploy.js)_

## `aio app:get-url [ACTION]`

Expand All @@ -357,7 +359,7 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/get-url.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/get-url.js)_
_See code: [src/commands/app/get-url.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/get-url.js)_

## `aio app:init [PATH]`

Expand All @@ -382,7 +384,7 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/init.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/init.js)_
_See code: [src/commands/app/init.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/init.js)_

## `aio app:logs`

Expand All @@ -406,7 +408,7 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/logs.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/logs.js)_
_See code: [src/commands/app/logs.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/logs.js)_

## `aio app:run`

Expand All @@ -427,7 +429,7 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/run.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/run.js)_
_See code: [src/commands/app/run.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/run.js)_

## `aio app:test`

Expand All @@ -447,7 +449,7 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/test.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/test.js)_
_See code: [src/commands/app/test.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/test.js)_

## `aio app:undeploy`

Expand All @@ -461,13 +463,14 @@ USAGE
$ aio app:undeploy
OPTIONS
-v, --verbose Verbose output
--skip-actions Skip action build & deploy
--skip-static Skip build & deployment of static files
--version Show version
-v, --verbose Verbose output
--skip-actions Skip undeployment of actions
--skip-static Skip undeployment of static files
--skip-web-assets Skip undeployment of web assets
--version Show version
```

_See code: [src/commands/app/undeploy.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/undeploy.js)_
_See code: [src/commands/app/undeploy.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/undeploy.js)_

## `aio app:use [CONFIG_FILE_PATH]`

Expand All @@ -490,5 +493,5 @@ OPTIONS
--version Show version
```

_See code: [src/commands/app/use.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.3.2/src/commands/app/use.js)_
_See code: [src/commands/app/use.js](https://github.com/adobe/aio-cli-plugin-app/blob/5.4.0/src/commands/app/use.js)_
<!-- commandsstop -->
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@adobe/aio-cli-plugin-app",
"description": "Create, Build and Deploy Adobe I/O Applications",
"version": "5.3.2",
"version": "5.4.0",
"author": "Adobe Inc.",
"bugs": "https://github.com/adobe/aio-cli-plugin-app/issues",
"dependencies": {
Expand Down
5 changes: 3 additions & 2 deletions src/commands/app/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const coreConfig = require('@adobe/aio-lib-core-config')

const BaseCommand = require('../../BaseCommand')
const runDev = require('../../lib/run-dev')
const { defaultHttpServerPort: SERVER_DEFAULT_PORT } = require('../../lib/defaults')
const { runPackageScript, wrapError } = require('../../lib/app-helper')

const DEV_KEYS_DIR = 'dist/dev-keys/'
Expand Down Expand Up @@ -152,8 +153,8 @@ class Run extends BaseCommand {
res.end('Congrats, you have accepted the certificate and can now use it for development on this machine.\n' +
'You can close this window.')
})
const port = parseInt(process.env.PORT) || 9080
const actualPort = await getPort({ port: port })
const port = parseInt(process.env.PORT) || SERVER_DEFAULT_PORT
const actualPort = await getPort({ port })
server.listen(actualPort)
this.log('A self signed development certificate has been generated, you will need to accept it in your browser in order to use it.')
cli.open(`https://localhost:${actualPort}`)
Expand Down
61 changes: 61 additions & 0 deletions src/lib/bundle-serve.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
Copyright 2021 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:bundle-serve', { provider: 'debug' })
const httpTerminator = require('http-terminator')
const { defaultHttpServerPort: SERVER_DEFAULT_PORT } = require('./defaults')

/**
* @typedef {object} BundleWebObject
* @property {object} the Parcel bundler object
* @property {Function} cleanup callback function to cleanup available resources
*/

/**
* Serves the bundled web source via Parcel.
*
* @param {object} bundler the Parcel bundler object
* @param {number} uiPort the port number for the http server
* @param {object} [options] the Parcel bundler options
* @param {Function} [log] the app logger
* @returns {BundleWebObject} the BundleWebObject
*/
module.exports = async (bundler, uiPort = SERVER_DEFAULT_PORT, options = {}, log = () => {}) => {
log('serving front-end using bundler serve...')
let actualPort = uiPort

aioLogger.debug(`bundle-serve uiPort: ${uiPort}`)
aioLogger.debug(`bundle-serve options: ${JSON.stringify(options, null, 2)}`)

const uiServer = await bundler.serve(uiPort, options.https)
actualPort = uiServer.address().port
const terminator = httpTerminator.createHttpTerminator({
server: uiServer
})

if (actualPort !== uiPort) {
log(`Could not use port:${uiPort}, using port:${actualPort} instead`)
}

const url = `${options.https ? 'https:' : 'http:'}//localhost:${actualPort}`
log(`local frontend server running at ${url}`)

const cleanup = async () => {
aioLogger.debug('cleanup bundle-serve...')
await terminator.terminate()
}

return {
url,
cleanup
}
}
3 changes: 2 additions & 1 deletion src/lib/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ module.exports = {
CONSOLE_API_KEYS: {
prod: 'aio-cli-console-auth',
stage: 'aio-cli-console-auth-stage'
}
},
defaultHttpServerPort: 9080
}
Loading

0 comments on commit fcd12f2

Please sign in to comment.