-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into add-service-cmd
- Loading branch information
Showing
15 changed files
with
387 additions
and
397 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,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 }} |
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,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' |
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
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,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 | ||
} | ||
} |
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
Oops, something went wrong.