diff --git a/packages/backend-common/tsconfig.json b/packages/backend-common/tsconfig.json index 6d7ca21afa..ca39bf9964 100644 --- a/packages/backend-common/tsconfig.json +++ b/packages/backend-common/tsconfig.json @@ -1,7 +1,6 @@ { "include": ["src"], "compilerOptions": { - "baseUrl": "src", "outDir": "dist", "incremental": true, "sourceMap": true, diff --git a/packages/backend/tsconfig.json b/packages/backend/tsconfig.json index b463ac102f..0f255b6d2c 100644 --- a/packages/backend/tsconfig.json +++ b/packages/backend/tsconfig.json @@ -1,7 +1,6 @@ { "include": ["src"], "compilerOptions": { - "baseUrl": "src", "outDir": "dist", "incremental": true, "sourceMap": true, diff --git a/packages/cli/bin/backstage-cli b/packages/cli/bin/backstage-cli index ad5cc09749..15b97d7063 100755 --- a/packages/cli/bin/backstage-cli +++ b/packages/cli/bin/backstage-cli @@ -21,68 +21,12 @@ const path = require('path'); const isLocal = require('fs').existsSync(path.resolve(__dirname, '../src')); if (!isLocal || process.env.BACKSTAGE_E2E_CLI_TEST) { - // src-relative imports are a pain to get to work with plain tsc compilation, as the - // transpiled code will maintain the imports as they are in the source. Which means an - // import for `helpers/paths` will start like that in the output, which won't work in NodeJS. - // - // This is a solution for getting src-relative imports to work with typescript/node in - // the published package. We're using `module: "amd"` to ship the entire cli implementation - // in one file, and it also happens to generate correct module definition and import statements. - // Minimal AMD implementation - const moduleFactories = {}; - const moduleCache = {}; - global.define = (name, deps, moduleFunc) => { - moduleFactories[name] = () => { - const exportsObj = {}; - - // require() that first searches for locally defined amd modules - const requireFunc = name => { - let factory = moduleFactories[name]; - if (!factory) { - // Check /index as well, to mirror nodejs resolution - const index = `${name}/index`; - if (!moduleFactories[index]) { - return require(name); - } - name = index; - factory = moduleFactories[name]; - } - if (!moduleCache[name]) { - moduleCache[name] = factory(); - } - return moduleCache[name]; - }; - const impls = deps.slice(2).map(requireFunc); - - moduleFunc(requireFunc, exportsObj, ...impls); - - return exportsObj; - }; - }; require('../dist'); - - // index module is the entrypoint - moduleFactories.index(); } else { - const tsConfigPath = path.resolve(__dirname, '../tsconfig.json'); - const { - baseUrl: relativeBaseUrl, - paths = {}, - } = require(tsConfigPath).compilerOptions; - const baseUrl = path.resolve(__dirname, '..', relativeBaseUrl); - - // Use tsconfig-paths to resolve src-relative paths during development - const cleanupPaths = require('tsconfig-paths').register({ baseUrl, paths }); - require('ts-node').register({ project: path.resolve(__dirname, '../tsconfig.build.json'), - compilerOptions: { - module: 'CommonJS', - }, transpileOnly: true, }); require('../src'); - - cleanupPaths(); } diff --git a/packages/cli/package.json b/packages/cli/package.json index 418e5f9fe2..96775065de 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -45,7 +45,6 @@ "del": "^5.1.0", "nodemon": "^2.0.2", "ts-node": "^8.6.2", - "tsconfig-paths": "^3.9.0", "zombie": "^6.1.4" }, "dependencies": { diff --git a/packages/cli/src/commands/app/build.ts b/packages/cli/src/commands/app/build.ts index 601e31a9c1..362f79a7fa 100644 --- a/packages/cli/src/commands/app/build.ts +++ b/packages/cli/src/commands/app/build.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { run } from 'lib/run'; +import { run } from '../../lib/run'; export default async () => { const args = ['build']; diff --git a/packages/cli/src/commands/app/serve.ts b/packages/cli/src/commands/app/serve.ts index 22775242ca..1d0ccfc465 100644 --- a/packages/cli/src/commands/app/serve.ts +++ b/packages/cli/src/commands/app/serve.ts @@ -14,9 +14,9 @@ * limitations under the License. */ -import { run } from 'lib/run'; -import { createLogFunc } from 'lib/logging'; -import { watchDeps } from 'lib/watchDeps'; +import { run } from '../../lib/run'; +import { createLogFunc } from '../../lib/logging'; +import { watchDeps } from '../../lib/watchDeps'; export default async () => { // Start dynamic watch and build of dependencies, then serve the app diff --git a/packages/cli/src/commands/build-cache/index.ts b/packages/cli/src/commands/build-cache/index.ts index e58313c6b2..72199ec42e 100644 --- a/packages/cli/src/commands/build-cache/index.ts +++ b/packages/cli/src/commands/build-cache/index.ts @@ -15,8 +15,8 @@ */ import { Command } from 'commander'; -import { run } from 'lib/run'; -import { withCache, parseOptions } from 'lib/buildCache'; +import { run } from '../../lib/run'; +import { withCache, parseOptions } from '../../lib/buildCache'; /* * The build-cache command is used to make builds a no-op if there are no changes to the package. diff --git a/packages/cli/src/commands/clean/clean.ts b/packages/cli/src/commands/clean/clean.ts index 06998a4ca3..2fa49fcc4a 100644 --- a/packages/cli/src/commands/clean/clean.ts +++ b/packages/cli/src/commands/clean/clean.ts @@ -16,8 +16,8 @@ import fs from 'fs-extra'; import { resolve as resolvePath, relative as relativePath } from 'path'; -import { paths } from 'lib/paths'; -import { getDefaultCacheOptions } from 'lib/buildCache'; +import { paths } from '../../lib/paths'; +import { getDefaultCacheOptions } from '../../lib/buildCache'; export default async function clean() { const cacheOptions = getDefaultCacheOptions(); diff --git a/packages/cli/src/commands/create-app/createApp.ts b/packages/cli/src/commands/create-app/createApp.ts index b5c9ba69eb..2a9f6ff9fd 100644 --- a/packages/cli/src/commands/create-app/createApp.ts +++ b/packages/cli/src/commands/create-app/createApp.ts @@ -21,9 +21,9 @@ import inquirer, { Answers, Question } from 'inquirer'; import { exec as execCb } from 'child_process'; import { resolve as resolvePath } from 'path'; import os from 'os'; -import { Task, templatingTask } from 'lib/tasks'; -import { paths } from 'lib/paths'; -import { version } from 'lib/version'; +import { Task, templatingTask } from '../../lib/tasks'; +import { paths } from '../../lib/paths'; +import { version } from '../../lib/version'; const exec = promisify(execCb); async function checkExists(rootDir: string, name: string) { @@ -63,7 +63,7 @@ async function buildApp(appFolder: string) { await Task.forItem('executing', command, async () => { process.chdir(appFolder); - await exec(command).catch(error => { + await exec(command).catch((error) => { process.stdout.write(error.stderr); process.stdout.write(error.stdout); throw new Error(`Could not execute command ${chalk.cyan(command)}`); @@ -78,7 +78,7 @@ export async function moveApp( id: string, ) { await Task.forItem('moving', id, async () => { - await fs.move(tempDir, destination).catch(error => { + await fs.move(tempDir, destination).catch((error) => { throw new Error( `Failed to move app from ${tempDir} to ${destination}: ${error.message}`, ); @@ -101,7 +101,7 @@ async function addPackageResolutions(appDir: string) { packageFileJson.resolutions[`@backstage/${pkg}`] = `file:${pkgPath}`; const newContents = `${JSON.stringify(packageFileJson, null, 2)}\n`; - await fs.writeFile(pkgJsonPath, newContents, 'utf-8').catch(error => { + await fs.writeFile(pkgJsonPath, newContents, 'utf-8').catch((error) => { throw new Error( `Failed to add resolutions to package.json: ${error.message}`, ); diff --git a/packages/cli/src/commands/create-plugin/createPlugin.ts b/packages/cli/src/commands/create-plugin/createPlugin.ts index 3c92397a3d..b0bf1d85b5 100644 --- a/packages/cli/src/commands/create-plugin/createPlugin.ts +++ b/packages/cli/src/commands/create-plugin/createPlugin.ts @@ -25,10 +25,10 @@ import { parseOwnerIds, addCodeownersEntry, getCodeownersFilePath, -} from 'lib/codeowners'; -import { paths } from 'lib/paths'; -import { version } from 'lib/version'; -import { Task, templatingTask } from 'lib/tasks'; +} from '../../lib/codeowners'; +import { paths } from '../../lib/paths'; +import { version } from '../../lib/version'; +import { Task, templatingTask } from '../../lib/tasks'; const exec = promisify(execCb); async function checkExists(rootDir: string, id: string) { @@ -107,7 +107,7 @@ export async function addPluginDependencyToApp( packageFileJson.dependencies = sortObjectByKeys(dependencies); const newContents = `${JSON.stringify(packageFileJson, null, 2)}\n`; - await fs.writeFile(packageFile, newContents, 'utf-8').catch(error => { + await fs.writeFile(packageFile, newContents, 'utf-8').catch((error) => { throw new Error( `Failed to add plugin as dependency to app: ${packageFile}: ${error.message}`, ); @@ -119,14 +119,14 @@ export async function addPluginToApp(rootDir: string, pluginName: string) { const pluginPackage = `@backstage/plugin-${pluginName}`; const pluginNameCapitalized = pluginName .split('-') - .map(name => capitalize(name)) + .map((name) => capitalize(name)) .join(''); const pluginExport = `export { plugin as ${pluginNameCapitalized} } from '${pluginPackage}';`; const pluginsFilePath = 'packages/app/src/plugins.ts'; const pluginsFile = resolvePath(rootDir, pluginsFilePath); await Task.forItem('processing', pluginsFilePath, async () => { - await addExportStatement(pluginsFile, pluginExport).catch(error => { + await addExportStatement(pluginsFile, pluginExport).catch((error) => { throw new Error( `Failed to import plugin in app: ${pluginsFile}: ${error.message}`, ); @@ -146,7 +146,7 @@ async function buildPlugin(pluginFolder: string) { await Task.forItem('executing', command, async () => { process.chdir(pluginFolder); - await exec(command).catch(error => { + await exec(command).catch((error) => { process.stdout.write(error.stderr); process.stdout.write(error.stdout); throw new Error(`Could not execute command ${chalk.cyan(command)}`); @@ -161,7 +161,7 @@ export async function movePlugin( id: string, ) { await Task.forItem('moving', id, async () => { - await fs.move(tempDir, destination).catch(error => { + await fs.move(tempDir, destination).catch((error) => { throw new Error( `Failed to move plugin from ${tempDir} to ${destination}: ${error.message}`, ); diff --git a/packages/cli/src/commands/lint.ts b/packages/cli/src/commands/lint.ts index 2d74b4122f..07819bacfb 100644 --- a/packages/cli/src/commands/lint.ts +++ b/packages/cli/src/commands/lint.ts @@ -15,7 +15,7 @@ */ import { Command } from 'commander'; -import { run } from 'lib/run'; +import { run } from '../lib/run'; export default async (cmd: Command) => { const args = ['lint', '--max-warnings=0', '--format=codeframe']; diff --git a/packages/cli/src/commands/plugin/build.ts b/packages/cli/src/commands/plugin/build.ts index aedf39e5b4..fcda3f424b 100644 --- a/packages/cli/src/commands/plugin/build.ts +++ b/packages/cli/src/commands/plugin/build.ts @@ -17,8 +17,8 @@ import { rollup, watch, OutputOptions } from 'rollup'; import { Command } from 'commander'; import chalk from 'chalk'; -import { withCache, getDefaultCacheOptions } from 'lib/buildCache'; -import { paths } from 'lib/paths'; +import { withCache, getDefaultCacheOptions } from '../../lib/buildCache'; +import { paths } from '../../lib/paths'; import conf from './rollup.config'; function logError(error: any) { @@ -62,7 +62,7 @@ export default async (cmd: Command) => { // Instead we just wait until the user sends an interrupt signal. await new Promise(() => { const watcher = watch(conf); - watcher.on('event', event => { + watcher.on('event', (event) => { // START — the watcher is (re)starting // BUNDLE_START — building an individual bundle // BUNDLE_END — finished building a bundle diff --git a/packages/cli/src/commands/plugin/diff/handlers.ts b/packages/cli/src/commands/plugin/diff/handlers.ts index df7ca081de..32079415ea 100644 --- a/packages/cli/src/commands/plugin/diff/handlers.ts +++ b/packages/cli/src/commands/plugin/diff/handlers.ts @@ -18,7 +18,7 @@ import fs from 'fs-extra'; import chalk from 'chalk'; import { dirname } from 'path'; import { diffLines } from 'diff'; -import { paths } from 'lib/paths'; +import { paths } from '../../../lib/paths'; import { TemplateFile, PromptFunc, FileHandler } from './types'; export async function writeTargetFile(targetPath: string, contents: string) { @@ -193,8 +193,8 @@ export async function handleAllFiles( ) { for (const file of files) { const { targetPath } = file; - const fileHandler = fileHandlers.find(handler => - handler.patterns.some(pattern => + const fileHandler = fileHandlers.find((handler) => + handler.patterns.some((pattern) => typeof pattern === 'string' ? pattern === targetPath : pattern.test(targetPath), diff --git a/packages/cli/src/commands/plugin/diff/read.ts b/packages/cli/src/commands/plugin/diff/read.ts index ef981a0081..316cc46922 100644 --- a/packages/cli/src/commands/plugin/diff/read.ts +++ b/packages/cli/src/commands/plugin/diff/read.ts @@ -18,8 +18,8 @@ import fs from 'fs-extra'; import { relative as relativePath } from 'path'; import handlebars from 'handlebars'; import recursiveReadDir from 'recursive-readdir'; -import { paths } from 'lib/paths'; -import { version } from 'lib/version'; +import { paths } from '../../../lib/paths'; +import { version } from '../../../lib/version'; import { PluginInfo, TemplateFile } from './types'; // Reads info from the existing plugin diff --git a/packages/cli/src/commands/plugin/rollup.config.ts b/packages/cli/src/commands/plugin/rollup.config.ts index 95077e2df3..36b43bf5a7 100644 --- a/packages/cli/src/commands/plugin/rollup.config.ts +++ b/packages/cli/src/commands/plugin/rollup.config.ts @@ -22,7 +22,7 @@ import postcss from 'rollup-plugin-postcss'; import imageFiles from 'rollup-plugin-image-files'; import json from '@rollup/plugin-json'; import { RollupWatchOptions } from 'rollup'; -import { paths } from 'lib/paths'; +import { paths } from '../../lib/paths'; export default { input: 'src/index.ts', diff --git a/packages/cli/src/commands/plugin/serve/index.ts b/packages/cli/src/commands/plugin/serve/index.ts index 00c7728b63..9bdd46dc84 100644 --- a/packages/cli/src/commands/plugin/serve/index.ts +++ b/packages/cli/src/commands/plugin/serve/index.ts @@ -15,7 +15,7 @@ */ import { startDevServer } from './server'; -import { watchDeps } from 'lib/watchDeps'; +import { watchDeps } from '../../../lib/watchDeps'; export default async () => { await watchDeps({ build: true }); diff --git a/packages/cli/src/commands/plugin/serve/paths.ts b/packages/cli/src/commands/plugin/serve/paths.ts index b44a7bff74..56c3f6ffb7 100644 --- a/packages/cli/src/commands/plugin/serve/paths.ts +++ b/packages/cli/src/commands/plugin/serve/paths.ts @@ -15,7 +15,7 @@ */ import { existsSync } from 'fs'; -import { paths } from 'lib/paths'; +import { paths } from '../../../lib/paths'; export function getPaths() { const resolveTargetModule = (path: string) => { diff --git a/packages/cli/src/commands/plugin/testCommand.ts b/packages/cli/src/commands/plugin/testCommand.ts index 333af5494e..df031d8e89 100644 --- a/packages/cli/src/commands/plugin/testCommand.ts +++ b/packages/cli/src/commands/plugin/testCommand.ts @@ -15,7 +15,7 @@ */ import { Command } from 'commander'; -import { run } from 'lib/run'; +import { run } from '../../lib/run'; export default async (cmd: Command) => { const args = ['test']; diff --git a/packages/cli/src/commands/remove-plugin/removePlugin.test.ts b/packages/cli/src/commands/remove-plugin/removePlugin.test.ts index 17962d10b9..465260008d 100644 --- a/packages/cli/src/commands/remove-plugin/removePlugin.test.ts +++ b/packages/cli/src/commands/remove-plugin/removePlugin.test.ts @@ -17,13 +17,13 @@ import fse from 'fs-extra'; import path from 'path'; import os from 'os'; -import { paths } from 'lib/paths'; +import { paths } from '../../lib/paths'; import { addExportStatement, capitalize, createTemporaryPluginFolder, } from '../create-plugin/createPlugin'; -import { addCodeownersEntry } from 'lib/codeowners'; +import { addCodeownersEntry } from '../../lib/codeowners'; import { removeReferencesFromAppPackage, removeReferencesFromPluginsFile, @@ -39,10 +39,7 @@ const testPluginPackage = `${BACKSTAGE}/plugin-${testPluginName}`; const tempDir = path.join(os.tmpdir(), 'remove-plugin-test'); const removeEmptyLines = (file: string): string => - file - .split('\n') - .filter(Boolean) - .join('\n'); + file.split('\n').filter(Boolean).join('\n'); const createTestPackageFile = async ( testFilePath: string, @@ -69,7 +66,7 @@ const createTestPluginFile = async ( fse.copyFileSync(pluginsFilePath, testFilePath); const pluginNameCapitalized = testPluginName .split('-') - .map(name => capitalize(name)) + .map((name) => capitalize(name)) .join(''); const exportStatement = `export { default as ${pluginNameCapitalized}} from @backstage/plugin-${testPluginName}`; addExportStatement(testFilePath, exportStatement); diff --git a/packages/cli/src/commands/remove-plugin/removePlugin.ts b/packages/cli/src/commands/remove-plugin/removePlugin.ts index 1b8447fade..cf4cc73f20 100644 --- a/packages/cli/src/commands/remove-plugin/removePlugin.ts +++ b/packages/cli/src/commands/remove-plugin/removePlugin.ts @@ -17,9 +17,9 @@ import fse from 'fs-extra'; import path from 'path'; import chalk from 'chalk'; import inquirer, { Answers, Question } from 'inquirer'; -import { getCodeownersFilePath } from 'lib/codeowners'; -import { paths } from 'lib/paths'; -import { Task } from 'lib/tasks'; +import { getCodeownersFilePath } from '../../lib/codeowners'; +import { paths } from '../../lib/paths'; +import { Task } from '../../lib/tasks'; // import os from 'os'; const BACKSTAGE = '@backstage'; @@ -85,7 +85,7 @@ const removeAllStatementsContainingID = async (file: string, ID: string) => { const contentAfterRemoval = originalContent .split('\n') .filter(Boolean) // get rid of empty lines - .filter(statement => { + .filter((statement) => { return !statement.includes(`${ID}`); }) // get rid of lines with pluginName .concat(['']) // newline at end of line @@ -105,7 +105,7 @@ export const removeReferencesFromPluginsFile = async ( ) => { const pluginNameCapitalized = pluginName .split('-') - .map(name => capitalize(name)) + .map((name) => capitalize(name)) .join(''); await Task.forItem('removing', 'export references', async () => { diff --git a/packages/cli/src/commands/testCommand.ts b/packages/cli/src/commands/testCommand.ts index 4d567169dc..9969aee3b4 100644 --- a/packages/cli/src/commands/testCommand.ts +++ b/packages/cli/src/commands/testCommand.ts @@ -15,8 +15,8 @@ */ import { Command } from 'commander'; -import { paths } from 'lib/paths'; -import { runCheck } from 'lib/run'; +import { paths } from '../lib/paths'; +import { runCheck } from '../lib/run'; function includesAnyOf(hayStack: string[], ...needles: string[]) { for (const needle of needles) { diff --git a/packages/cli/src/commands/watch-deps/index.ts b/packages/cli/src/commands/watch-deps/index.ts index ec9e4be58f..61f403883c 100644 --- a/packages/cli/src/commands/watch-deps/index.ts +++ b/packages/cli/src/commands/watch-deps/index.ts @@ -15,9 +15,9 @@ */ import { Command } from 'commander'; -import { run } from 'lib/run'; -import { createLogPipe } from 'lib/logging'; -import { watchDeps, Options } from 'lib/watchDeps'; +import { run } from '../../lib/run'; +import { createLogPipe } from '../../lib/logging'; +import { watchDeps, Options } from '../../lib/watchDeps'; /* * The watch-deps command is meant to improve iteration speed while working in a large monorepo diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 6c6aec3776..e20cef2615 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -16,8 +16,8 @@ import program from 'commander'; import chalk from 'chalk'; -import { exitWithError } from 'lib/errors'; -import { version } from 'lib/version'; +import { exitWithError } from './lib/errors'; +import { version } from './lib/version'; const main = (argv: string[]) => { program.name('backstage-cli').version(version); @@ -25,68 +25,68 @@ const main = (argv: string[]) => { program .command('create-app') .description('Creates a new app in a new directory') - .action(actionHandler(() => require('commands/create-app/createApp'))); + .action(actionHandler(() => require('./commands/create-app/createApp'))); program .command('app:build') .description('Build an app for a production release') - .action(actionHandler(() => require('commands/app/build'))); + .action(actionHandler(() => require('./commands/app/build'))); program .command('app:serve') .description('Serve an app for local development') - .action(actionHandler(() => require('commands/app/serve'))); + .action(actionHandler(() => require('./commands/app/serve'))); program .command('create-plugin') .description('Creates a new plugin in the current repository') .action( - actionHandler(() => require('commands/create-plugin/createPlugin')), + actionHandler(() => require('./commands/create-plugin/createPlugin')), ); program .command('remove-plugin') .description('Removes plugin in the current repository') .action( - actionHandler(() => require('commands/remove-plugin/removePlugin')), + actionHandler(() => require('./commands/remove-plugin/removePlugin')), ); program .command('plugin:build') .option('--watch', 'Enable watch mode') .description('Build a plugin') - .action(actionHandler(() => require('commands/plugin/build'))); + .action(actionHandler(() => require('./commands/plugin/build'))); program .command('plugin:serve') .description('Serves the dev/ folder of a plugin') - .action(actionHandler(() => require('commands/plugin/serve'))); + .action(actionHandler(() => require('./commands/plugin/serve'))); program .command('plugin:diff') .option('--check', 'Fail if changes are required') .option('--yes', 'Apply all changes') .description('Diff an existing plugin with the creation template') - .action(actionHandler(() => require('commands/plugin/diff'))); + .action(actionHandler(() => require('./commands/plugin/diff'))); program .command('lint') .option('--fix', 'Attempt to automatically fix violations') .description('Lint a package') - .action(actionHandler(() => require('commands/lint'))); + .action(actionHandler(() => require('./commands/lint'))); program .command('test') .allowUnknownOption(true) // Allows the command to run, but we still need to parse raw args .helpOption(', --backstage-cli-help') // Let Jest handle help .description('Run tests, forwarding args to Jest, defaulting to watch mode') - .action(actionHandler(() => require('commands/testCommand'))); + .action(actionHandler(() => require('./commands/testCommand'))); program .command('watch-deps') .option('--build', 'Build all dependencies on startup') .description('Watch all dependencies while running another command') - .action(actionHandler(() => require('commands/watch-deps'))); + .action(actionHandler(() => require('./commands/watch-deps'))); program .command('build-cache') @@ -103,12 +103,12 @@ const main = (argv: string[]) => { 'Cache dir', '/node_modules/.cache/backstage-builds', ) - .action(actionHandler(() => require('commands/build-cache'))); + .action(actionHandler(() => require('./commands/build-cache'))); program .command('clean') .description('Delete cache directories') - .action(actionHandler(() => require('commands/clean/clean'))); + .action(actionHandler(() => require('./commands/clean/clean'))); program.on('command:*', () => { console.log(); @@ -142,7 +142,7 @@ function actionHandler( }; } -process.on('unhandledRejection', rejection => { +process.on('unhandledRejection', (rejection) => { if (rejection instanceof Error) { exitWithError(rejection); } else { diff --git a/packages/cli/src/lib/buildCache/cache.ts b/packages/cli/src/lib/buildCache/cache.ts index 8ba2d8851d..d49eedaba9 100644 --- a/packages/cli/src/lib/buildCache/cache.ts +++ b/packages/cli/src/lib/buildCache/cache.ts @@ -16,11 +16,11 @@ import fs from 'fs-extra'; import { resolve as resolvePath, relative as relativePath } from 'path'; -import { runPlain, runCheck } from 'lib/run'; +import { runPlain, runCheck } from '../run'; import { Options } from './options'; import { extractArchive, createArchive } from './archive'; -import { paths } from 'lib/paths'; -import { version, isDev } from 'lib/version'; +import { paths } from '../paths'; +import { version, isDev } from '../version'; const INFO_FILE = '.backstage-build-cache'; @@ -127,9 +127,7 @@ export class Cache { await writeCacheInfo(outputDir, { key }); const timestamp = new Date().toISOString().replace(/-|:|\..*/g, ''); - const rand = Math.random() - .toString(36) - .slice(2, 6); + const rand = Math.random().toString(36).slice(2, 6); const archiveName = `cache-${timestamp}-${rand}.tgz`; const archivePath = resolvePath(location, archiveName); @@ -137,7 +135,7 @@ export class Cache { const { entries = [] } = (await readCacheInfo(location)) ?? {}; // Check if there's already aan entry for this key, in that case we just wanna bump it - const entryIndex = entries.findIndex(e => compareKeys(e.key, key)); + const entryIndex = entries.findIndex((e) => compareKeys(e.key, key)); if (entryIndex !== -1) { const [existingEntry] = entries.splice(entryIndex, 1); entries.unshift(existingEntry); @@ -167,7 +165,7 @@ export class Cache { return { hit: true, archive }; } - const matchingEntry = this.entries.find(e => compareKeys(e.key, key)); + const matchingEntry = this.entries.find((e) => compareKeys(e.key, key)); if (!matchingEntry) { return { hit: false, archive }; } diff --git a/packages/cli/src/lib/buildCache/options.ts b/packages/cli/src/lib/buildCache/options.ts index 5edb46e913..9a6a379fce 100644 --- a/packages/cli/src/lib/buildCache/options.ts +++ b/packages/cli/src/lib/buildCache/options.ts @@ -16,7 +16,7 @@ import { resolve as resolvePath } from 'path'; import { Command } from 'commander'; -import { paths } from 'lib/paths'; +import { paths } from '../paths'; const DEFAULT_CACHE_DIR = '/node_modules/.cache/backstage-builds'; const DEFAULT_MAX_ENTRIES = 10; diff --git a/packages/cli/src/lib/watchDeps/compiler.ts b/packages/cli/src/lib/watchDeps/compiler.ts index c8a0eb7d78..5ea8efc3e6 100644 --- a/packages/cli/src/lib/watchDeps/compiler.ts +++ b/packages/cli/src/lib/watchDeps/compiler.ts @@ -15,14 +15,14 @@ */ import { spawn } from 'child_process'; -import { LogPipe } from 'lib/logging'; +import { LogPipe } from '../logging'; import chalk from 'chalk'; import { Package } from './packages'; export function startCompiler(pkg: Package, logPipe: LogPipe) { // First we figure out which yarn script is a available, falling back to "build --watch" const scriptName = ['build:watch', 'watch'].find( - script => script in pkg.scripts, + (script) => script in pkg.scripts, ); const args = scriptName ? [scriptName] : ['build', '--watch']; @@ -40,7 +40,7 @@ export function startCompiler(pkg: Package, logPipe: LogPipe) { watch.stderr.on('data', logErr); const promise = new Promise((resolve, reject) => { - watch.on('error', error => { + watch.on('error', (error) => { reject(error); }); diff --git a/packages/cli/src/lib/watchDeps/logger.ts b/packages/cli/src/lib/watchDeps/logger.ts index 7f3862509a..59eb400301 100644 --- a/packages/cli/src/lib/watchDeps/logger.ts +++ b/packages/cli/src/lib/watchDeps/logger.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { createLogPipe } from 'lib/logging'; +import { createLogPipe } from '../logging'; export type ColorFunc = (msg: string) => string; diff --git a/packages/cli/src/lib/watchDeps/packages.ts b/packages/cli/src/lib/watchDeps/packages.ts index 4eee0f3069..7a45524b45 100644 --- a/packages/cli/src/lib/watchDeps/packages.ts +++ b/packages/cli/src/lib/watchDeps/packages.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { paths } from 'lib/paths'; +import { paths } from '../paths'; const LernaProject = require('@lerna/project'); const PackageGraph = require('@lerna/package-graph'); diff --git a/packages/cli/src/lib/watchDeps/watchDeps.ts b/packages/cli/src/lib/watchDeps/watchDeps.ts index e4b5d1e4b3..c986749d3b 100644 --- a/packages/cli/src/lib/watchDeps/watchDeps.ts +++ b/packages/cli/src/lib/watchDeps/watchDeps.ts @@ -20,8 +20,8 @@ import { createLogPipeFactory } from './logger'; import { findAllDeps } from './packages'; import { startWatcher, startPackageWatcher } from './watcher'; import { startCompiler } from './compiler'; -import { run } from 'lib/run'; -import { paths } from 'lib/paths'; +import { run } from '../run'; +import { paths } from '../paths'; const PACKAGE_BLACKLIST = [ // We never want to watch for changes in the cli, but all packages will depend on it. @@ -66,8 +66,8 @@ export async function watchDeps(options: Options = {}) { } // We lazily watch all our deps, as in we don't start the actual watch compiler until a change is detected - const watcher = await startWatcher(deps, WATCH_LOCATIONS, pkg => { - startCompiler(pkg, createLogPipe(pkg.name)).promise.catch(error => { + const watcher = await startWatcher(deps, WATCH_LOCATIONS, (pkg) => { + startCompiler(pkg, createLogPipe(pkg.name)).promise.catch((error) => { process.stderr.write(`${error}\n`); }); }); diff --git a/packages/cli/src/lib/watchDeps/watcher.ts b/packages/cli/src/lib/watchDeps/watcher.ts index c6c4487d0a..bcfe766b63 100644 --- a/packages/cli/src/lib/watchDeps/watcher.ts +++ b/packages/cli/src/lib/watchDeps/watcher.ts @@ -18,7 +18,7 @@ import { resolve as resolvePath } from 'path'; import chalk from 'chalk'; import chokidar from 'chokidar'; import { Package } from './packages'; -import { createLogFunc } from 'lib/logging'; +import { createLogFunc } from '../logging'; export type Watcher = { update(newPackages: Package[]): Promise; @@ -42,7 +42,7 @@ export async function startWatcher( let signalled = false; watchedPackageLocations.add(pkg.location); - const watchLocations = paths.map(path => resolvePath(pkg.location, path)); + const watchLocations = paths.map((path) => resolvePath(pkg.location, path)); const watcher = chokidar .watch(watchLocations, { cwd: pkg.location, diff --git a/packages/cli/templates/default-app/plugins/welcome/tsconfig.json b/packages/cli/templates/default-app/plugins/welcome/tsconfig.json index 7b73db2f0f..5a3931ffce 100644 --- a/packages/cli/templates/default-app/plugins/welcome/tsconfig.json +++ b/packages/cli/templates/default-app/plugins/welcome/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "include": ["src"], - "compilerOptions": { - "baseUrl": "src" - } + "compilerOptions": {} } diff --git a/packages/cli/templates/default-plugin/tsconfig.json b/packages/cli/templates/default-plugin/tsconfig.json index 7b73db2f0f..5a3931ffce 100644 --- a/packages/cli/templates/default-plugin/tsconfig.json +++ b/packages/cli/templates/default-plugin/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "include": ["src"], - "compilerOptions": { - "baseUrl": "src" - } + "compilerOptions": {} } diff --git a/packages/cli/tsconfig.build.json b/packages/cli/tsconfig.build.json index 116632b612..1ef5cdace5 100644 --- a/packages/cli/tsconfig.build.json +++ b/packages/cli/tsconfig.build.json @@ -2,7 +2,7 @@ "extends": "./tsconfig.json", "exclude": ["**/*.test.*"], "compilerOptions": { - "outFile": "dist/index.js", - "module": "amd" + "outDir": "dist", + "module": "CommonJS" } } diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index 7b73db2f0f..5a3931ffce 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "include": ["src"], - "compilerOptions": { - "baseUrl": "src" - } + "compilerOptions": {} } diff --git a/packages/core/src/api/apis/definitions/featureFlags.ts b/packages/core/src/api/apis/definitions/featureFlags.ts index 5d6a134f84..926fe091d5 100644 --- a/packages/core/src/api/apis/definitions/featureFlags.ts +++ b/packages/core/src/api/apis/definitions/featureFlags.ts @@ -19,7 +19,7 @@ import { UserFlags, FeatureFlagsRegistry, FeatureFlagsRegistryItem, -} from 'api/app/FeatureFlags'; +} from '../../app/FeatureFlags'; /** * The feature flags API is used to toggle functionality to users across plugins and Backstage. diff --git a/packages/core/src/api/app/AppBuilder.tsx b/packages/core/src/api/app/AppBuilder.tsx index 94d6df1b3d..f65482b996 100644 --- a/packages/core/src/api/app/AppBuilder.tsx +++ b/packages/core/src/api/app/AppBuilder.tsx @@ -18,9 +18,9 @@ import React, { ComponentType } from 'react'; import { Route, Switch, Redirect } from 'react-router-dom'; import { AppContextProvider } from './AppContext'; import { App } from './types'; -import BackstagePlugin from 'api/plugin/Plugin'; +import BackstagePlugin from '../plugin/Plugin'; import { FeatureFlagsRegistryItem } from './FeatureFlags'; -import { featureFlagsApiRef } from 'api/apis/definitions/featureFlags'; +import { featureFlagsApiRef } from '../apis/definitions/featureFlags'; import ErrorPage from '../../layout/ErrorPage'; import { @@ -28,8 +28,8 @@ import { SystemIcons, SystemIconKey, defaultSystemIcons, -} from 'icons'; -import { ApiHolder, ApiProvider } from 'api/apis'; +} from '../../icons'; +import { ApiHolder, ApiProvider } from '../apis'; import LoginPage from './LoginPage'; class AppImpl implements App { diff --git a/packages/core/src/api/app/FeatureFlags.test.tsx b/packages/core/src/api/app/FeatureFlags.test.tsx index 38fe457781..5822d05be8 100644 --- a/packages/core/src/api/app/FeatureFlags.test.tsx +++ b/packages/core/src/api/app/FeatureFlags.test.tsx @@ -18,7 +18,7 @@ import { FeatureFlags as FeatureFlagsImpl } from './FeatureFlags'; import { FeatureFlagState, FeatureFlagsApi, -} from 'api/apis/definitions/featureFlags'; +} from '../apis/definitions/featureFlags'; describe('FeatureFlags', () => { beforeEach(() => { @@ -150,7 +150,7 @@ describe('FeatureFlags', () => { it('should get the correct values', () => { const getByName = (name: string) => - featureFlags.getRegisteredFlags().find(flag => flag.name === name); + featureFlags.getRegisteredFlags().find((flag) => flag.name === name); expect(getByName('registered-flag-0')).toBeUndefined(); expect(getByName('registered-flag-1')).toEqual({ diff --git a/packages/core/src/api/app/FeatureFlags.tsx b/packages/core/src/api/app/FeatureFlags.tsx index fcbefedb3e..63c1b19d88 100644 --- a/packages/core/src/api/app/FeatureFlags.tsx +++ b/packages/core/src/api/app/FeatureFlags.tsx @@ -14,11 +14,11 @@ * limitations under the License. */ -import { FeatureFlagName } from 'api/plugin/types'; +import { FeatureFlagName } from '../plugin/types'; import { FeatureFlagState, FeatureFlagsApi, -} from 'api/apis/definitions/featureFlags'; +} from '../apis/definitions/featureFlags'; /** * Helper method for validating compatibility and flag name. @@ -130,12 +130,12 @@ export interface FeatureFlagsRegistryItem { export class FeatureFlagsRegistry extends Array { static from(entries: FeatureFlagsRegistryItem[]) { - Array.from(entries).forEach(entry => validateFlagName(entry.name)); + Array.from(entries).forEach((entry) => validateFlagName(entry.name)); return new FeatureFlagsRegistry(...entries); } push(...entries: FeatureFlagsRegistryItem[]): number { - Array.from(entries).forEach(entry => validateFlagName(entry.name)); + Array.from(entries).forEach((entry) => validateFlagName(entry.name)); return super.push(...entries); } @@ -146,7 +146,7 @@ export class FeatureFlagsRegistry extends Array { )[] ): FeatureFlagsRegistryItem[] { const _concat = super.concat(...entries); - Array.from(_concat).forEach(entry => validateFlagName(entry.name)); + Array.from(_concat).forEach((entry) => validateFlagName(entry.name)); return _concat; } diff --git a/packages/core/src/api/app/LoginPage/LoginPage.tsx b/packages/core/src/api/app/LoginPage/LoginPage.tsx index 9176c4c522..07160e750c 100644 --- a/packages/core/src/api/app/LoginPage/LoginPage.tsx +++ b/packages/core/src/api/app/LoginPage/LoginPage.tsx @@ -16,10 +16,10 @@ import React, { FC, useState } from 'react'; import { GitHub as GitHubIcon } from '@material-ui/icons'; -import Page from 'layout/Page'; -import Header from 'layout/Header'; -import Content from 'layout/Content/Content'; -import ContentHeader from 'layout/ContentHeader/ContentHeader'; +import Page from '../../../layout/Page'; +import Header from '../../../layout/Header'; +import Content from '../../../layout/Content/Content'; +import ContentHeader from '../../../layout/ContentHeader/ContentHeader'; import { Grid, Typography, @@ -29,7 +29,7 @@ import { ListItem, Link, } from '@material-ui/core'; -import InfoCard from 'layout/InfoCard/InfoCard'; +import InfoCard from '../../../layout/InfoCard/InfoCard'; enum AuthType { GitHub, @@ -72,11 +72,11 @@ const LoginPage: FC<{}> = () => { 'Content-Type': 'application/x-www-form-urlencoded', }), }) - .then(response => { + .then((response) => { if (response.status === 200) return response.json(); throw Error(`${response.status} ${response.statusText}`); }) - .then(data => { + .then((data) => { const info = { username: username, token: token, diff --git a/packages/core/src/api/plugin/Plugin.tsx b/packages/core/src/api/plugin/Plugin.tsx index a8b694ae8d..3d067c66ad 100644 --- a/packages/core/src/api/plugin/Plugin.tsx +++ b/packages/core/src/api/plugin/Plugin.tsx @@ -21,7 +21,7 @@ import { RouteOptions, FeatureFlagName, } from './types'; -import { validateBrowserCompat, validateFlagName } from 'api/app/FeatureFlags'; +import { validateBrowserCompat, validateFlagName } from '../app/FeatureFlags'; export type PluginConfig = { id: string; diff --git a/packages/core/src/components/CopyTextButton/CopyTextButton.stories.tsx b/packages/core/src/components/CopyTextButton/CopyTextButton.stories.tsx index e8e1317e4e..80c11f6b4a 100644 --- a/packages/core/src/components/CopyTextButton/CopyTextButton.stories.tsx +++ b/packages/core/src/components/CopyTextButton/CopyTextButton.stories.tsx @@ -16,7 +16,7 @@ import React from 'react'; import CopyTextButton from '.'; -import { ApiProvider, errorApiRef, ApiRegistry, ErrorApi } from 'api'; +import { ApiProvider, errorApiRef, ApiRegistry, ErrorApi } from '../../api'; export default { title: 'CopyTextButton', diff --git a/packages/core/src/components/CopyTextButton/CopyTextButton.test.tsx b/packages/core/src/components/CopyTextButton/CopyTextButton.test.tsx index 28aaf2f0c0..695a700738 100644 --- a/packages/core/src/components/CopyTextButton/CopyTextButton.test.tsx +++ b/packages/core/src/components/CopyTextButton/CopyTextButton.test.tsx @@ -18,7 +18,7 @@ import React from 'react'; import { render } from '@testing-library/react'; import { wrapInThemedTestApp } from '@backstage/test-utils'; import CopyTextButton from './CopyTextButton'; -import { ApiRegistry, errorApiRef, ApiProvider, ErrorApi } from 'api'; +import { ApiRegistry, errorApiRef, ApiProvider, ErrorApi } from '../../api'; jest.mock('popper.js', () => { const PopperJS = jest.requireActual('popper.js'); diff --git a/packages/core/src/components/CopyTextButton/CopyTextButton.tsx b/packages/core/src/components/CopyTextButton/CopyTextButton.tsx index 62295eb0ce..5af62f4380 100644 --- a/packages/core/src/components/CopyTextButton/CopyTextButton.tsx +++ b/packages/core/src/components/CopyTextButton/CopyTextButton.tsx @@ -19,9 +19,9 @@ import { IconButton, makeStyles, Tooltip } from '@material-ui/core'; import PropTypes from 'prop-types'; import CopyIcon from '@material-ui/icons/FileCopy'; import { BackstageTheme } from '@backstage/theme'; -import { errorApiRef, useApi } from 'api'; +import { errorApiRef, useApi } from '../../api'; -const useStyles = makeStyles(theme => ({ +const useStyles = makeStyles((theme) => ({ button: { '&:hover': { backgroundColor: theme.palette.highlight, @@ -56,7 +56,7 @@ const defaultProps = { tooltipText: 'Text copied to clipboard', }; -const CopyTextButton: FC = props => { +const CopyTextButton: FC = (props) => { const { text, tooltipDelay, tooltipText } = { ...defaultProps, ...props, @@ -66,7 +66,7 @@ const CopyTextButton: FC = props => { const inputRef = useRef(null); const [open, setOpen] = useState(false); - const handleCopyClick: MouseEventHandler = e => { + const handleCopyClick: MouseEventHandler = (e) => { e.stopPropagation(); setOpen(true); diff --git a/packages/core/src/components/ProgressBars/ProgressCard.tsx b/packages/core/src/components/ProgressBars/ProgressCard.tsx index 9b4a0d79e0..66dda771c3 100644 --- a/packages/core/src/components/ProgressBars/ProgressCard.tsx +++ b/packages/core/src/components/ProgressBars/ProgressCard.tsx @@ -16,7 +16,7 @@ import React, { FC } from 'react'; import { makeStyles } from '@material-ui/core'; -import InfoCard from 'layout/InfoCard'; +import InfoCard from '../../layout/InfoCard'; import { Props as BottomLinkProps } from '../../layout/BottomLink'; import CircleProgress from './CircleProgress'; @@ -36,7 +36,7 @@ const useStyles = makeStyles({ }, }); -const ProgressCard: FC = props => { +const ProgressCard: FC = (props) => { const classes = useStyles(props); const { title, subheader, progress, deepLink, variant } = props; diff --git a/packages/core/src/components/Status/Status.stories.tsx b/packages/core/src/components/Status/Status.stories.tsx index 33a8e51e65..7a6a58caa8 100644 --- a/packages/core/src/components/Status/Status.stories.tsx +++ b/packages/core/src/components/Status/Status.stories.tsx @@ -24,8 +24,8 @@ import { StatusRunning, StatusWarning, } from './Status'; -import Table from 'components/Table'; -import InfoCard from 'layout/InfoCard'; +import Table from '../Table'; +import InfoCard from '../../layout/InfoCard'; export default { title: 'Status', diff --git a/packages/core/src/components/TrendLine/TrendLine.stories.tsx b/packages/core/src/components/TrendLine/TrendLine.stories.tsx index 562feeff80..506fc4e387 100644 --- a/packages/core/src/components/TrendLine/TrendLine.stories.tsx +++ b/packages/core/src/components/TrendLine/TrendLine.stories.tsx @@ -16,8 +16,8 @@ import React from 'react'; import TrendLine from '.'; -import Table from 'components/Table'; -import InfoCard from 'layout/InfoCard'; +import Table from '../Table'; +import InfoCard from '../../layout/InfoCard'; export default { title: 'TrendLine', diff --git a/packages/core/src/icons/icons.tsx b/packages/core/src/icons/icons.tsx index a8debf56b4..ca3ef32859 100644 --- a/packages/core/src/icons/icons.tsx +++ b/packages/core/src/icons/icons.tsx @@ -18,7 +18,7 @@ import { SvgIconProps } from '@material-ui/core'; import PeopleIcon from '@material-ui/icons/People'; import PersonIcon from '@material-ui/icons/Person'; import React, { FC } from 'react'; -import { useApp } from 'api/app/AppContext'; +import { useApp } from '../api/app/AppContext'; import { IconComponent, SystemIconKey, SystemIcons } from './types'; export const defaultSystemIcons: SystemIcons = { @@ -27,7 +27,7 @@ export const defaultSystemIcons: SystemIcons = { }; const overridableSystemIcon = (key: SystemIconKey): IconComponent => { - const Component: FC = props => { + const Component: FC = (props) => { const app = useApp(); const Icon = app.getSystemIcon(key); return ; diff --git a/packages/core/src/layout/Header/Header.tsx b/packages/core/src/layout/Header/Header.tsx index 94de84ad8c..d8e7540349 100644 --- a/packages/core/src/layout/Header/Header.tsx +++ b/packages/core/src/layout/Header/Header.tsx @@ -19,11 +19,11 @@ import Helmet from 'react-helmet'; import { Typography, Tooltip, makeStyles } from '@material-ui/core'; import { BackstageTheme } from '@backstage/theme'; -import { Theme } from 'layout/Page/Page'; +import { Theme } from '../Page/Page'; // import { Link } from 'shared/components'; import Waves from './Waves'; -const useStyles = makeStyles(theme => ({ +const useStyles = makeStyles((theme) => ({ header: { gridArea: 'pageHeader', padding: theme.spacing(3), @@ -175,7 +175,7 @@ export const Header: FC = ({ - {theme => ( + {(theme) => (
diff --git a/packages/core/src/layout/Header/Waves.test.tsx b/packages/core/src/layout/Header/Waves.test.tsx index 02ea8da634..2c7d463052 100644 --- a/packages/core/src/layout/Header/Waves.test.tsx +++ b/packages/core/src/layout/Header/Waves.test.tsx @@ -16,7 +16,7 @@ import React from 'react'; import { render } from '@testing-library/react'; -import { pageTheme } from 'layout/Page/PageThemeProvider'; +import { pageTheme } from '../Page/PageThemeProvider'; import Waves from './Waves'; describe('', () => { diff --git a/packages/core/src/layout/Header/Waves.tsx b/packages/core/src/layout/Header/Waves.tsx index 001f3d61c4..f37ecf7b12 100644 --- a/packages/core/src/layout/Header/Waves.tsx +++ b/packages/core/src/layout/Header/Waves.tsx @@ -16,7 +16,7 @@ import React, { FC } from 'react'; import { makeStyles } from '@material-ui/core'; -import { PageTheme } from 'layout/Page'; +import { PageTheme } from '../Page'; const useStyles = makeStyles({ wave: { diff --git a/packages/core/src/layout/InfoCard/InfoCard.tsx b/packages/core/src/layout/InfoCard/InfoCard.tsx index 7077167828..fb5a14e18e 100644 --- a/packages/core/src/layout/InfoCard/InfoCard.tsx +++ b/packages/core/src/layout/InfoCard/InfoCard.tsx @@ -24,7 +24,7 @@ import { withStyles, makeStyles, } from '@material-ui/core'; -import ErrorBoundary from 'layout/ErrorBoundary/ErrorBoundary'; +import ErrorBoundary from '../ErrorBoundary'; import BottomLink, { Props as BottomLinkProps } from '../BottomLink'; const useStyles = makeStyles((theme) => ({ diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index 7b73db2f0f..5a3931ffce 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "include": ["src"], - "compilerOptions": { - "baseUrl": "src" - } + "compilerOptions": {} } diff --git a/packages/dev-utils/tsconfig.json b/packages/dev-utils/tsconfig.json index 7b73db2f0f..5a3931ffce 100644 --- a/packages/dev-utils/tsconfig.json +++ b/packages/dev-utils/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "include": ["src"], - "compilerOptions": { - "baseUrl": "src" - } + "compilerOptions": {} } diff --git a/packages/storybook/.storybook/main.js b/packages/storybook/.storybook/main.js index 12b9c34435..7243452357 100644 --- a/packages/storybook/.storybook/main.js +++ b/packages/storybook/.storybook/main.js @@ -22,7 +22,6 @@ module.exports = { // Point to dist version of theme and any other packages that might be needed in the future '@backstage/theme': path.resolve(__dirname, '../../theme'), }; - config.resolve.modules.push(coreSrc); // Remove the default babel-loader for js files, we're using ts-loader instead const [jsLoader] = config.module.rules.splice(0, 1); @@ -56,7 +55,7 @@ module.exports = { // Fail storybook build on CI if there are webpack warnings. if (process.env.CI) { - config.plugins.push(new WebpackPluginFailBuildOnWarning()) + config.plugins.push(new WebpackPluginFailBuildOnWarning()); } return config; diff --git a/packages/test-utils-core/tsconfig.json b/packages/test-utils-core/tsconfig.json index 7b73db2f0f..5a3931ffce 100644 --- a/packages/test-utils-core/tsconfig.json +++ b/packages/test-utils-core/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "include": ["src"], - "compilerOptions": { - "baseUrl": "src" - } + "compilerOptions": {} } diff --git a/packages/test-utils/tsconfig.json b/packages/test-utils/tsconfig.json index 7b73db2f0f..5a3931ffce 100644 --- a/packages/test-utils/tsconfig.json +++ b/packages/test-utils/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "include": ["src"], - "compilerOptions": { - "baseUrl": "src" - } + "compilerOptions": {} } diff --git a/packages/theme/src/themes.ts b/packages/theme/src/themes.ts index 9e9e2945fa..559b402369 100644 --- a/packages/theme/src/themes.ts +++ b/packages/theme/src/themes.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { createTheme } from 'baseTheme'; +import { createTheme } from './baseTheme'; import { blue, yellow } from '@material-ui/core/colors'; export const lightTheme = createTheme({ diff --git a/packages/theme/tsconfig.json b/packages/theme/tsconfig.json index 7b73db2f0f..5a3931ffce 100644 --- a/packages/theme/tsconfig.json +++ b/packages/theme/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "include": ["src"], - "compilerOptions": { - "baseUrl": "src" - } + "compilerOptions": {} } diff --git a/plugins/explore/tsconfig.json b/plugins/explore/tsconfig.json index 7b73db2f0f..5a3931ffce 100644 --- a/plugins/explore/tsconfig.json +++ b/plugins/explore/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "include": ["src"], - "compilerOptions": { - "baseUrl": "src" - } + "compilerOptions": {} } diff --git a/plugins/graphiql/src/components/GraphiQLBrowser/GraphiQLBrowser.tsx b/plugins/graphiql/src/components/GraphiQLBrowser/GraphiQLBrowser.tsx index 5885183b01..b41fc04b9e 100644 --- a/plugins/graphiql/src/components/GraphiQLBrowser/GraphiQLBrowser.tsx +++ b/plugins/graphiql/src/components/GraphiQLBrowser/GraphiQLBrowser.tsx @@ -17,8 +17,8 @@ import React, { FC, useState, Suspense } from 'react'; import { Tabs, Tab, makeStyles, Typography, Divider } from '@material-ui/core'; import 'graphiql/graphiql.css'; -import { StorageBucket } from 'lib/storage'; -import { GraphQLEndpoint } from 'lib/api'; +import { StorageBucket } from '../../lib/storage'; +import { GraphQLEndpoint } from '../../lib/api'; import { Progress } from '@backstage/core'; import { BackstageTheme } from '@backstage/theme'; diff --git a/plugins/graphiql/src/components/GraphiQLPage/GraphiQLPage.test.tsx b/plugins/graphiql/src/components/GraphiQLPage/GraphiQLPage.test.tsx index d19e05524e..d07155d338 100644 --- a/plugins/graphiql/src/components/GraphiQLPage/GraphiQLPage.test.tsx +++ b/plugins/graphiql/src/components/GraphiQLPage/GraphiQLPage.test.tsx @@ -20,7 +20,7 @@ import { ThemeProvider } from '@material-ui/core'; import { lightTheme } from '@backstage/theme'; import { ApiProvider, ApiRegistry } from '@backstage/core'; import { renderWithEffects } from '@backstage/test-utils'; -import { GraphQLBrowseApi, graphQlBrowseApiRef } from 'lib/api'; +import { GraphQLBrowseApi, graphQlBrowseApiRef } from '../../lib/api'; jest.mock('components/GraphiQLBrowser', () => ({ GraphiQLBrowser: () => '', diff --git a/plugins/graphiql/src/components/GraphiQLPage/GraphiQLPage.tsx b/plugins/graphiql/src/components/GraphiQLPage/GraphiQLPage.tsx index 39ee015bed..a16fdf3ee6 100644 --- a/plugins/graphiql/src/components/GraphiQLPage/GraphiQLPage.tsx +++ b/plugins/graphiql/src/components/GraphiQLPage/GraphiQLPage.tsx @@ -26,8 +26,8 @@ import { } from '@backstage/core'; import { useAsync } from 'react-use'; import 'graphiql/graphiql.css'; -import { graphQlBrowseApiRef } from 'lib/api'; -import { GraphiQLBrowser } from 'components'; +import { graphQlBrowseApiRef } from '../../lib/api'; +import { GraphiQLBrowser } from '../GraphiQLBrowser'; import { Typography } from '@material-ui/core'; export const GraphiQLPage: FC<{}> = () => { diff --git a/plugins/graphiql/tsconfig.json b/plugins/graphiql/tsconfig.json index 55fa1e2384..b663b01fa2 100644 --- a/plugins/graphiql/tsconfig.json +++ b/plugins/graphiql/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "include": ["src", "dev"], - "compilerOptions": { - "baseUrl": "src" - } + "compilerOptions": {} } diff --git a/plugins/home-page/src/components/HomePage/HomePage.tsx b/plugins/home-page/src/components/HomePage/HomePage.tsx index e9e71c3b0b..60b271892f 100644 --- a/plugins/home-page/src/components/HomePage/HomePage.tsx +++ b/plugins/home-page/src/components/HomePage/HomePage.tsx @@ -16,7 +16,7 @@ import React, { FC } from 'react'; import { Typography, Link, Grid } from '@material-ui/core'; -import HomePageTimer from 'components/HomepageTimer'; +import HomePageTimer from '../HomepageTimer'; import { Content, InfoCard, Header, Page, pageTheme } from '@backstage/core'; import SquadTechHealth from './SquadTechHealth'; import Table from '@material-ui/core/Table'; @@ -68,7 +68,7 @@ const HomePage: FC<{}> = () => { - {data.map(d => ( + {data.map((d) => ( {d.entity} {d.kind} diff --git a/plugins/home-page/src/plugin.ts b/plugins/home-page/src/plugin.ts index 7de760a849..182d43b9b8 100644 --- a/plugins/home-page/src/plugin.ts +++ b/plugins/home-page/src/plugin.ts @@ -15,7 +15,7 @@ */ import { createPlugin } from '@backstage/core'; -import HomePage from 'components/HomePage'; +import HomePage from './components/HomePage'; export const plugin = createPlugin({ id: 'home-page', diff --git a/plugins/home-page/tsconfig.json b/plugins/home-page/tsconfig.json index 55fa1e2384..b663b01fa2 100644 --- a/plugins/home-page/tsconfig.json +++ b/plugins/home-page/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "include": ["src", "dev"], - "compilerOptions": { - "baseUrl": "src" - } + "compilerOptions": {} } diff --git a/plugins/inventory-backend/tsconfig.json b/plugins/inventory-backend/tsconfig.json index 1a3f7ca819..dd13cfe1bc 100644 --- a/plugins/inventory-backend/tsconfig.json +++ b/plugins/inventory-backend/tsconfig.json @@ -1,7 +1,6 @@ { "include": ["src"], "compilerOptions": { - "baseUrl": "src", "outDir": "dist", "incremental": true, "sourceMap": true, diff --git a/plugins/inventory/tsconfig.json b/plugins/inventory/tsconfig.json index 7b73db2f0f..5a3931ffce 100644 --- a/plugins/inventory/tsconfig.json +++ b/plugins/inventory/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "include": ["src"], - "compilerOptions": { - "baseUrl": "src" - } + "compilerOptions": {} } diff --git a/plugins/scaffolder/tsconfig.json b/plugins/scaffolder/tsconfig.json index 7b73db2f0f..5a3931ffce 100644 --- a/plugins/scaffolder/tsconfig.json +++ b/plugins/scaffolder/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "include": ["src"], - "compilerOptions": { - "baseUrl": "src" - } + "compilerOptions": {} } diff --git a/plugins/tech-radar/tsconfig.json b/plugins/tech-radar/tsconfig.json index 7b73db2f0f..5a3931ffce 100644 --- a/plugins/tech-radar/tsconfig.json +++ b/plugins/tech-radar/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "include": ["src"], - "compilerOptions": { - "baseUrl": "src" - } + "compilerOptions": {} } diff --git a/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx b/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx index 307369f5fd..eea582ab55 100644 --- a/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx +++ b/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx @@ -24,7 +24,7 @@ import { ListItemText, Link, } from '@material-ui/core'; -import Timer from 'components/Timer'; +import Timer from '../Timer'; import { Content, InfoCard, diff --git a/plugins/welcome/src/plugin.ts b/plugins/welcome/src/plugin.ts index fbc1d14256..9690805c98 100644 --- a/plugins/welcome/src/plugin.ts +++ b/plugins/welcome/src/plugin.ts @@ -15,7 +15,7 @@ */ import { createPlugin } from '@backstage/core'; -import WelcomePage from 'components/WelcomePage'; +import WelcomePage from './components/WelcomePage'; export const plugin = createPlugin({ id: 'welcome', diff --git a/plugins/welcome/tsconfig.json b/plugins/welcome/tsconfig.json index 7b73db2f0f..5a3931ffce 100644 --- a/plugins/welcome/tsconfig.json +++ b/plugins/welcome/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "include": ["src"], - "compilerOptions": { - "baseUrl": "src" - } + "compilerOptions": {} }