Initial commit (as a partial copy of md:quality)
This commit is contained in:
		@@ -0,0 +1,2 @@
 | 
			
		||||
README.md
 | 
			
		||||
deploy.sh
 | 
			
		||||
@@ -0,0 +1 @@
 | 
			
		||||
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
 | 
			
		||||
@@ -0,0 +1,22 @@
 | 
			
		||||
# Swagger UI Dist
 | 
			
		||||
[](http://badge.fury.io/js/swagger-ui-dist)
 | 
			
		||||
 | 
			
		||||
# API
 | 
			
		||||
 | 
			
		||||
This module, `swagger-ui-dist`, exposes Swagger-UI's entire dist folder as a dependency-free npm module.
 | 
			
		||||
Use `swagger-ui` instead, if you'd like to have npm install dependencies for you.
 | 
			
		||||
 | 
			
		||||
`SwaggerUIBundle` and `SwaggerUIStandalonePreset` can be imported:
 | 
			
		||||
```javascript
 | 
			
		||||
  import { SwaggerUIBundle, SwaggerUIStandalonePreset } from "swagger-ui-dist"
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
To get an absolute path to this directory for static file serving, use the exported `getAbsoluteFSPath` method:
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
const swaggerUiAssetPath = require("swagger-ui-dist").getAbsoluteFSPath()
 | 
			
		||||
 | 
			
		||||
// then instantiate server that serves files from the swaggerUiAssetPath
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
For anything else, check the [Swagger-UI](https://github.com/swagger-api/swagger-ui) repository.
 | 
			
		||||
@@ -0,0 +1,14 @@
 | 
			
		||||
/*
 | 
			
		||||
 * getAbsoluteFSPath
 | 
			
		||||
 * @return {string} When run in NodeJS env, returns the absolute path to the current directory
 | 
			
		||||
 *                  When run outside of NodeJS, will return an error message
 | 
			
		||||
 */
 | 
			
		||||
const getAbsoluteFSPath = function () {
 | 
			
		||||
  // detect whether we are running in a browser or nodejs
 | 
			
		||||
  if (typeof module !== "undefined" && module.exports) {
 | 
			
		||||
    return require("path").resolve(__dirname)
 | 
			
		||||
  }
 | 
			
		||||
  throw new Error('getAbsoluteFSPath can only be called within a Nodejs environment');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = getAbsoluteFSPath
 | 
			
		||||
@@ -0,0 +1,25 @@
 | 
			
		||||
# Deploy `swagger-ui-dist` to npm.
 | 
			
		||||
 | 
			
		||||
# Parameter Expansion: http://stackoverflow.com/questions/6393551/what-is-the-meaning-of-0-in-a-bash-script
 | 
			
		||||
cd "${0%/*}"
 | 
			
		||||
 | 
			
		||||
# Get UI version
 | 
			
		||||
UI_VERSION=$(node -p "require('../package.json').version")
 | 
			
		||||
 | 
			
		||||
# Replace our version placeholder with UI's version
 | 
			
		||||
sed -i "s|\$\$VERSION|$UI_VERSION|g" package.json
 | 
			
		||||
 | 
			
		||||
# Copy UI's dist files to our directory
 | 
			
		||||
cp ../dist/* .
 | 
			
		||||
 | 
			
		||||
# Copy LICENSE & NOTICE to our directory
 | 
			
		||||
cp ../LICENSE .
 | 
			
		||||
cp ../NOTICE .
 | 
			
		||||
 | 
			
		||||
if [ "$PUBLISH_DIST" = "true" ] || [ "$TRAVIS" = "true" ] ; then
 | 
			
		||||
  npm publish .
 | 
			
		||||
else
 | 
			
		||||
  npm pack .
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
find . -not -name .npmignore -not -name .npmrc -not -name deploy.sh -not -name index.js -not -name package.json -not -name README.md -not -name *.tgz -delete
 | 
			
		||||
@@ -0,0 +1,17 @@
 | 
			
		||||
try {
 | 
			
		||||
  module.exports.SwaggerUIBundle = require("./swagger-ui-bundle.js")
 | 
			
		||||
  module.exports.SwaggerUIStandalonePreset = require("./swagger-ui-standalone-preset.js")
 | 
			
		||||
} catch(e) {
 | 
			
		||||
  // swallow the error if there's a problem loading the assets.
 | 
			
		||||
  // allows this module to support providing the assets for browserish contexts,
 | 
			
		||||
  // without exploding in a Node context.
 | 
			
		||||
  //
 | 
			
		||||
  // see https://github.com/swagger-api/swagger-ui/issues/3291#issuecomment-311195388
 | 
			
		||||
  // for more information.
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// `absolutePath` and `getAbsoluteFSPath` are both here because at one point,
 | 
			
		||||
// we documented having one and actually implemented the other.
 | 
			
		||||
// They were both retained so we don't break anyone's code.
 | 
			
		||||
module.exports.absolutePath = require("./absolute-path.js")
 | 
			
		||||
module.exports.getAbsoluteFSPath = require("./absolute-path.js")
 | 
			
		||||
@@ -0,0 +1,18 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "swagger-ui-dist",
 | 
			
		||||
  "version": "$$VERSION",
 | 
			
		||||
  "main": "index.js",
 | 
			
		||||
  "repository": "git@github.com:swagger-api/swagger-ui.git",
 | 
			
		||||
  "contributors": [
 | 
			
		||||
    "(in alphabetical order)",
 | 
			
		||||
    "Anna Bodnia <anna.bodnia@gmail.com>",
 | 
			
		||||
    "Buu Nguyen <buunguyen@gmail.com>",
 | 
			
		||||
    "Josh Ponelat <jponelat@gmail.com>",
 | 
			
		||||
    "Kyle Shockey <kyleshockey1@gmail.com>",
 | 
			
		||||
    "Robert Barnwell <robert@robertismy.name>",
 | 
			
		||||
    "Sahar Jafari <shr.jafari@gmail.com>"
 | 
			
		||||
  ],
 | 
			
		||||
  "license": "Apache-2.0",
 | 
			
		||||
  "dependencies": {},
 | 
			
		||||
  "devDependencies": {}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user