Skip to content

Commit

Permalink
build: Simplifying format and covering json and yml files (#1227)
Browse files Browse the repository at this point in the history
* Simplifying format and covering json and yml files
* Updating .prettierignore
  • Loading branch information
fjavierv committed Aug 16, 2021
1 parent 6814966 commit 045ba5e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 16 deletions.
13 changes: 13 additions & 0 deletions .prettierignore
Expand Up @@ -2,3 +2,16 @@ examples/create-react-app/README.md
examples/create-react-app-typescript/README.md
CHANGELOG.md
**/CHANGELOG.md

coverage
node_modules

/themes/*
packages/*/es
packages/*/lib
packages/*/bin
packages/*/dist
packages/*/types
packages/*/.next
packages/documentation/src/constants/sassdoc
packages/documentation/src/constants/sandboxes
13 changes: 2 additions & 11 deletions package.json
Expand Up @@ -33,10 +33,7 @@
"lint-styles": "sass-lint -c .sass-lint.yml -v",
"lint": "npm-run-all lint-scripts lint-styles typecheck",
"test": "jest",
"format-examples": "prettier --write \"examples/*/src/**/*.{js,jsx,ts,tsx,scss}\"",
"format-root": "prettier --write \"*.{js,ts,md}\" \"{.github,testSetup}/*\"",
"format-pkgs": "prettier --write \"packages/*/{src,components,constants,hooks,pages,scripts,server,utils}/**/*.{ts,tsx,scss,js,jsx,md}\"",
"format": "npm-run-all format-root format-pkgs format-examples",
"format": "prettier --write \"**/*.{ts,tsx,scss,js,jsx,md,yml,json}\"",
"clean": "dev-utils clean",
"clean-dev-utils": "yarn workspace @react-md/dev-utils clean",
"clean-all": "npm-run-all clean clean-dev-utils",
Expand Down Expand Up @@ -93,13 +90,7 @@
"typescript": "^4.3.5"
},
"lint-staged": {
"**/*.{js,jsx,md}": [
"prettier --write"
],
"{.github,testSetup}/*": [
"prettier --write"
],
"packages/*/src/**/*.{ts,tsx,scss,js,jsx}": [
"**/*.{ts,tsx,scss,js,jsx,md,yml,json}": [
"prettier --write"
]
},
Expand Down
24 changes: 19 additions & 5 deletions packages/dev-utils/src/configs.ts
Expand Up @@ -9,7 +9,7 @@ import {
packagesRoot,
TSConfigType,
} from "./constants";
import { clean, getDependencies, getPackages, glob } from "./utils";
import { clean, getDependencies, getPackages, glob, format } from "./utils";

const NPM_IGNORE_CONTENTS = `src/**/__tests__
src/**/*.scss
Expand Down Expand Up @@ -123,16 +123,30 @@ export async function configs(): Promise<void> {
const promises: Promise<void>[] = [];
if (!NO_STYLES_PACKAGES.test(name) && name !== "react-md") {
const varConfig = createTSConfig("var", []);
promises.push(writeJson(join(path, "tsconfig.var.json"), varConfig));
promises.push(
writeFile(
join(path, "tsconfig.var.json"),
format(JSON.stringify(varConfig))
)
);
}

if (!NO_SCRIPT_PACKAGES.test(name)) {
const ejsConfig = createTSConfig("ejs", rmdTsDependencies);
const cjsConfig = createTSConfig("cjs", rmdTsDependencies);
promises.push(
writeJson(join(path, "tsconfig.json"), TSCONFIG),
writeJson(join(path, "tsconfig.ejs.json"), ejsConfig),
writeJson(join(path, "tsconfig.cjs.json"), cjsConfig),
writeFile(
join(path, "tsconfig.json"),
format(JSON.stringify(TSCONFIG))
),
writeFile(
join(path, "tsconfig.ejs.json"),
format(JSON.stringify(ejsConfig))
),
writeFile(
join(path, "tsconfig.cjs.json"),
format(JSON.stringify(cjsConfig))
),
writeFile(join(path, ".npmignore"), NPM_IGNORE_CONTENTS)
);
}
Expand Down

1 comment on commit 045ba5e

@vercel
Copy link

@vercel vercel bot commented on 045ba5e Aug 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.