chore: setup markdown formatting (#3224)
* chore(deps): upgrade prettier to v1.8.2 * chore: setup lint-docs script * docs: add `<!-- prettier-ignore -->`s * docs: format docs * Revert "docs: format docs" This reverts commit 6dba903987dddc498cb589ca311905f25b6aee53. * chore(prettierrc): set `--no-prose-wrap` * docs: format docs * Revert "docs: format docs" This reverts commit 139bd744b6921916be8fac4fa3bab83bae5d12df. * docs: tweak * docs: format docs * chore: rename .prettierrc * chore: rename back to .prettierrc * chore: split out third-party * refactor: fix linting * chore: do not split out third-party on website
This commit is contained in:
1 parent
a0c95cf862
commit
76efb33e75
35 files changed
+525
-436
No files matched your search
@@ -40,6 +40,9 @@ shell.echo("Bundling lib bin...");
|
||||
shell.exec("rollup -c scripts/build/rollup.bin.config.js");
|
||||
shell.chmod("+x", "./dist/bin/prettier.js");
|
||||
|
||||
shell.echo("Bundling lib third-party...");
|
||||
shell.exec("rollup -c scripts/build/rollup.third-party.config.js");
|
||||
|
||||
for (const parser of parsers) {
|
||||
if (parser === "postcss") {
|
||||
continue;
|
||||
@@ -66,9 +69,13 @@ shell.echo();
|
||||
// --- Docs ---
|
||||
|
||||
shell.echo("Bundling docs index...");
|
||||
shell.cp("dist/index.js", `${docs}/index.js`);
|
||||
shell.exec(
|
||||
`node_modules/babel-cli/bin/babel.js dist/index.js --out-file ${
|
||||
`rollup -c scripts/build/rollup.index.config.js --environment BUILD_TARGET:website -o ${
|
||||
docs
|
||||
}/index.js`
|
||||
);
|
||||
shell.exec(
|
||||
`node_modules/babel-cli/bin/babel.js ${docs}/index.js --out-file ${
|
||||
docs
|
||||
}/index.js --presets=es2015`
|
||||
);
|
||||
|
||||
@@ -3,6 +3,7 @@ import resolve from "rollup-plugin-node-resolve";
|
||||
import commonjs from "rollup-plugin-commonjs";
|
||||
import json from "rollup-plugin-json";
|
||||
import replace from "rollup-plugin-replace";
|
||||
import * as path from "path";
|
||||
|
||||
export default Object.assign(baseConfig, {
|
||||
entry: "bin/prettier.js",
|
||||
@@ -10,19 +11,22 @@ export default Object.assign(baseConfig, {
|
||||
format: "cjs",
|
||||
banner: "#!/usr/bin/env node",
|
||||
plugins: [
|
||||
replace({
|
||||
"#!/usr/bin/env node": "",
|
||||
// The require-from-string module (a dependency of cosmiconfig) assumes
|
||||
// that `module.parent` exists, but it only does for `require`:ed modules.
|
||||
// Usually, require-from-string is _always_ `require`:ed, but when bundled
|
||||
// with rollup the module is turned into a plain function located directly
|
||||
// in bin/prettier.js so `module.parent` does not exist. Defaulting to
|
||||
// `module` instead seems to work.
|
||||
"module.parent": "(module.parent || module)"
|
||||
}),
|
||||
replace({ "#!/usr/bin/env node": "" }),
|
||||
json(),
|
||||
resolve({ preferBuiltins: true }),
|
||||
commonjs()
|
||||
],
|
||||
external: ["fs", "readline", "path", "module", "assert", "util", "events"]
|
||||
external: [
|
||||
"fs",
|
||||
"readline",
|
||||
"path",
|
||||
"module",
|
||||
"assert",
|
||||
"util",
|
||||
"events",
|
||||
path.resolve("src/third-party.js")
|
||||
],
|
||||
paths: {
|
||||
[path.resolve("src/third-party.js")]: "../third-party"
|
||||
}
|
||||
});
|
||||
@@ -3,6 +3,13 @@ import resolve from "rollup-plugin-node-resolve";
|
||||
import commonjs from "rollup-plugin-commonjs";
|
||||
import json from "rollup-plugin-json";
|
||||
import replace from "rollup-plugin-replace";
|
||||
import * as path from "path";
|
||||
|
||||
const external = ["assert"];
|
||||
|
||||
if (process.env.BUILD_TARGET !== "website") {
|
||||
external.push(path.resolve("src/third-party.js"));
|
||||
}
|
||||
|
||||
export default Object.assign(baseConfig, {
|
||||
entry: "index.js",
|
||||
@@ -10,18 +17,14 @@ export default Object.assign(baseConfig, {
|
||||
format: "cjs",
|
||||
plugins: [
|
||||
replace({
|
||||
// The require-from-string module (a dependency of cosmiconfig) assumes
|
||||
// that `module.parent` exists, but it only does for `require`:ed modules.
|
||||
// Usually, require-from-string is _always_ `require`:ed, but when bundled
|
||||
// with rollup the module is turned into a plain function located directly
|
||||
// in index.js so `module.parent` does not exist. Defaulting to `module`
|
||||
// instead seems to work.
|
||||
"module.parent": "(module.parent || module)",
|
||||
"process.env.NODE_ENV": JSON.stringify("production")
|
||||
}),
|
||||
json(),
|
||||
resolve({ preferBuiltins: true }),
|
||||
commonjs()
|
||||
],
|
||||
external: ["assert"]
|
||||
external,
|
||||
paths: {
|
||||
[path.resolve("src/third-party.js")]: "./third-party"
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,26 @@
|
||||
import baseConfig from "./rollup.base.config.js";
|
||||
import resolve from "rollup-plugin-node-resolve";
|
||||
import commonjs from "rollup-plugin-commonjs";
|
||||
import json from "rollup-plugin-json";
|
||||
import replace from "rollup-plugin-replace";
|
||||
|
||||
export default Object.assign(baseConfig, {
|
||||
entry: "src/third-party.js",
|
||||
dest: "dist/third-party.js",
|
||||
format: "cjs",
|
||||
plugins: [
|
||||
replace({
|
||||
// The require-from-string module (a dependency of cosmiconfig) assumes
|
||||
// that `module.parent` exists, but it only does for `require`:ed modules.
|
||||
// Usually, require-from-string is _always_ `require`:ed, but when bundled
|
||||
// with rollup the module is turned into a plain function located directly
|
||||
// in index.js so `module.parent` does not exist. Defaulting to `module`
|
||||
// instead seems to work.
|
||||
"module.parent": "(module.parent || module)"
|
||||
}),
|
||||
json(),
|
||||
resolve({ preferBuiltins: true }),
|
||||
commonjs()
|
||||
],
|
||||
external: ["assert"]
|
||||
});
|
||||
Reference in new issue
Block a user