From 1fc5f9f468ee013f336ac1b184f46e9f39429d18 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 14 Jul 2020 21:11:46 +0200 Subject: [PATCH] docgen: add package.json and bin entrypoint --- packages/docgen/bin/backstage-docgen | 34 +++++++++++++++++++ packages/docgen/package.json | 49 ++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100755 packages/docgen/bin/backstage-docgen create mode 100644 packages/docgen/package.json diff --git a/packages/docgen/bin/backstage-docgen b/packages/docgen/bin/backstage-docgen new file mode 100755 index 0000000000..2b445ca9af --- /dev/null +++ b/packages/docgen/bin/backstage-docgen @@ -0,0 +1,34 @@ +#!/usr/bin/env node +/* + * Copyright 2020 Spotify AB + * + * Licensed 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 CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const path = require('path'); + +// Figure out whether we're running inside the backstage repo or as an installed dependency +const isLocal = require('fs').existsSync(path.resolve(__dirname, '../src')); + +if (!isLocal || process.env.BACKSTAGE_E2E_CLI_TEST) { + require('..'); +} else { + require('ts-node').register({ + transpileOnly: true, + compilerOptions: { + module: 'CommonJS', + }, + }); + + require('../src'); +} diff --git a/packages/docgen/package.json b/packages/docgen/package.json new file mode 100644 index 0000000000..0d25860e8e --- /dev/null +++ b/packages/docgen/package.json @@ -0,0 +1,49 @@ +{ + "name": "docgen", + "description": "Tool for generating API Documentation for itself", + "version": "0.1.1-alpha.13", + "private": true, + "homepage": "https://backstage.io", + "repository": { + "type": "git", + "url": "https://github.com/spotify/backstage", + "directory": "packages/docgen" + }, + "keywords": [ + "backstage" + ], + "license": "Apache-2.0", + "main": "src/index.ts", + "scripts": { + "build": "backstage-cli build --outputs cjs", + "lint": "backstage-cli lint", + "test": "backstage-cli test", + "test:e2e": "node e2e-test/cli-e2e-test.js", + "clean": "backstage-cli clean", + "start": "nodemon --" + }, + "bin": { + "backstage-docgen": "bin/backstage-docgen" + }, + "dependencies": { + "chalk": "^4.0.0", + "commander": "^4.1.1", + "fs-extra": "^9.0.0", + "typescript": "^3.9.3", + "ts-node": "^8.6.2" + }, + "devDependencies": { + "@types/fs-extra": "^9.0.1", + "@types/node": "^13.7.2", + "nodemon": "^2.0.2" + }, + "files": [ + "bin", + "dist" + ], + "nodemonConfig": { + "watch": "./src", + "exec": "bin/backstage-docgen", + "ext": "ts" + } +}