feat(project, cli): remove .config folder
BREAKING CHANGE: rome will not look for a configuration file inside the .config folder.
It will look for a configuration file inside the project root folder.
The "rome init" command will create the configuration file in the project root folder.
MODIFY
internal/core/server/ServerRequest.test.ts
internal/core/server/ServerRequest.test.ts
@@ -48,7 +48,7 @@ test(
}
});
- await h.writeFile(".config/rome.json", "");
+ await h.writeFile("rome.json", "");
await sub.release();

MODIFY
internal/core/server/commands/init.ts
internal/core/server/commands/init.ts
@@ -9,7 +9,7 @@ import {
getFileHandlerFromExtension,
getFileHandlerFromPath,
} from "@internal/core/common/file-handlers";
-import {IndentStyle, PROJECT_CONFIG_DIRECTORY} from "@internal/project";
+import {IndentStyle} from "@internal/project";
import {AbsoluteFilePathMap} from "@internal/path";
import {
Diagnostic,
@@ -135,10 +135,7 @@ export default createServerCommand<Flags>({
reporter.heading(markup`Welcome to Rome! Let's get you started...`);
- const configPath = cwd.append(
- PROJECT_CONFIG_DIRECTORY,
- `rome.${configType}`,
- );
+ const configPath = cwd.append(`rome.${configType}`);
// Track some information about our project generation
const files: AbsoluteFilePathMap<StaticMarkup> = new AbsoluteFilePathMap();

MODIFY
internal/core/server/fs/MemoryFileSystem.ts
internal/core/server/fs/MemoryFileSystem.ts
@@ -12,7 +12,6 @@ import {
normalizeManifest,
} from "@internal/codec-js-manifest";
import {
- PROJECT_CONFIG_DIRECTORY,
PROJECT_CONFIG_FILENAMES,
PROJECT_CONFIG_PACKAGE_JSON_FIELD,
ProjectDefinition,
@@ -90,7 +89,7 @@ function isValidManifest(path: AbsoluteFilePath): boolean {
}
// Whenever we're performing an operation on a set of files, always do these first as they may influence how the rest are processed
-const PRIORITY_FILES = new Set([PROJECT_CONFIG_DIRECTORY, "package.json"]);
+const PRIORITY_FILES = new Set(["package.json"]);
type DeclareManifestOpts = {
diagnostics: DiagnosticsProcessor;
@@ -1044,10 +1043,7 @@ export default class MemoryFileSystem {
//this.logger.info(markup`Found: <emphasis>${path}</emphasis>`);
// Add project if this is a config
- if (
- dirname.getBasename() === PROJECT_CONFIG_DIRECTORY &&
- PROJECT_CONFIG_FILENAMES.includes(basename)
- ) {
+ if (PROJECT_CONFIG_FILENAMES.includes(basename)) {
if (projectManager.hasLoadedProjectDirectory(dirname.getParent())) {
opts.diagnostics.addDiagnostic({
description: descriptions.PROJECT_MANAGER.MULTIPLE_CONFIGS,

MODIFY
internal/core/server/project/ProjectManager.test.ts
internal/core/server/project/ProjectManager.test.ts
@@ -11,7 +11,7 @@ test(
root: true,
},
files: {
- "bar/.config/rome.json": `name: "bar"`,
+ "bar/rome.json": `name: "bar"`,
"bar/test.ts": "",
},
},

MODIFY
internal/core/server/project/ProjectManager.ts
internal/core/server/project/ProjectManager.ts
import Server from "../Server";
import {
- PROJECT_CONFIG_DIRECTORY,
PROJECT_CONFIG_FILENAMES,
PROJECT_CONFIG_PACKAGE_JSON_FIELD,
PROJECT_CONFIG_SENSITIVE_DIRECTORIES,
@@ -891,7 +890,7 @@ export default class ProjectManager {
// Check for dedicated project configs
for (const configFilename of PROJECT_CONFIG_FILENAMES) {
// Check in root
- const configPath = dir.append(PROJECT_CONFIG_DIRECTORY, configFilename);
+ const configPath = dir.append(configFilename);
const hasProject = await this.server.memoryFs.existsHard(configPath);
if (hasProject) {
@@ -957,10 +956,7 @@ export default class ProjectManager {
});
}
- if (
- PROJECT_CONFIG_FILENAMES.includes(path.getBasename()) &&
- path.getParent().getBasename() !== PROJECT_CONFIG_DIRECTORY
- ) {
+ if (PROJECT_CONFIG_FILENAMES.includes(path.getBasename())) {
diagnostics.addDiagnostic({
description: descriptions.PROJECT_MANAGER.MISPLACED_CONFIG(
path.getBasename(),

MODIFY
internal/diagnostics/descriptions/projectManager.ts
internal/diagnostics/descriptions/projectManager.ts
@@ -107,7 +107,7 @@ export const projectManager = createDiagnosticsCategory({
{
type: "log",
category: "info",
- text: markup`This should be inside of a <emphasis>.config</emphasis> folder`,
+ text: markup`This should be inside your project root folder`,
},
],
}),

MODIFY
internal/project/constants.ts
internal/project/constants.ts
@@ -22,7 +22,6 @@ export const INTEGRATIONS_IGNORE_FILES: string[] = [
];
export const PROJECT_CONFIG_PACKAGE_JSON_FIELD = "rome";
-export const PROJECT_CONFIG_DIRECTORY = ".config";
export const PROJECT_CONFIG_FILENAMES: string[] = [];
export const PROJECT_CONFIG_WARN_FILENAMES: string[] = [
".romeconfig",

MODIFY
internal/project/utils.ts
internal/project/utils.ts
@@ -100,7 +100,7 @@ export function getParentConfigDependencies(
for (const configFilename of PROJECT_CONFIG_FILENAMES) {
basenames.push(configFilename);
- deps.add(directory.append(".config", configFilename));
+ deps.add(directory.append(configFilename));
}
for (const basename of basenames) {

feat(project, cli): remove .config folder (#1655)

BREAKING CHANGE: rome will not look for a configuration file inside the .config folder.
It will look for a configuration file inside the project root folder.

The "rome init" command will create the configuration file in the project root folder.