Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: dogfood rollup #486

Merged
merged 4 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions packages/base-rollup-config/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import typescript from "rollup-plugin-typescript2";
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);

export const createSharedConfig = pkg => ({
export const createSharedConfig = (pkg) => ({
plugins: [
typescript({
// Use our own version of TypeScript, rather than the one bundled with the plugin:
Expand All @@ -34,7 +34,10 @@ export const createSharedConfig = pkg => ({
},
}),
],
external: Object.keys(pkg.dependencies),
external: [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
],
// The following option is useful because symlinks are used in monorepos
preserveSymlinks: true,
});
Expand Down
3 changes: 3 additions & 0 deletions packages/internal-playwright-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@
},
"peerDependencies": {
"@playwright/test": "^1.37.0"
},
"devDependencies": {
"@inrupt/base-rollup-config": "^2.4.1"
}
}
49 changes: 9 additions & 40 deletions packages/internal-playwright-helpers/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,36 +1,9 @@
// The following is only possible from Node 18 onwards
// import pkg from "./package.json" assert { type: "json" };

// Until we only support Node 18+, this should be used instead
// (see https://rollupjs.org/guide/en/#importing-packagejson)
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);
const pkg = require("./package.json");

import typescript from "rollup-plugin-typescript2";

const external = [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
];

const plugins = [
typescript({
// Use our own version of TypeScript, rather than the one bundled with the plugin:
typescript: require("typescript"),
tsconfigOverride: {
compilerOptions: {
module: "esnext",
},
},
}),
];

const rollupDefaultConfig = { external, plugins };
import { createSharedConfig } from "@inrupt/base-rollup-config";
import pkg from "./package.json" assert { type: "json" };

export default [
{
...rollupDefaultConfig,
...createSharedConfig(pkg),
input: "src/index.ts",
output: [
{
Expand All @@ -42,16 +15,12 @@ export default [
entryFileNames: "[name].es.js",
format: "esm",
},
{
dir: "dist",
entryFileNames: "[name].mjs",
format: "esm",
preserveModules: true,
}
],
},
{
...rollupDefaultConfig,
input: ["src/index.ts"],
output: {
dir: "dist",
entryFileNames: "[name].mjs",
format: "esm",
preserveModules: true,
},
},
];
3 changes: 3 additions & 0 deletions packages/internal-playwright-testids/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@
"require": "./dist/index.js",
"import": "./dist/index.mjs"
}
},
"devDependencies": {
"@inrupt/base-rollup-config": "^2.4.1"
}
}
48 changes: 9 additions & 39 deletions packages/internal-playwright-testids/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,35 +1,9 @@
// The following is only possible from Node 18 onwards
// import pkg from "./package.json" assert { type: "json" };

// Until we only support Node 18+, this should be used instead
// (see https://rollupjs.org/guide/en/#importing-packagejson)
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);
const pkg = require("./package.json");

import typescript from "rollup-plugin-typescript2";

const external = [
...Object.keys(pkg.dependencies || {}),
];

const plugins = [
typescript({
// Use our own version of TypeScript, rather than the one bundled with the plugin:
typescript: require("typescript"),
tsconfigOverride: {
compilerOptions: {
module: "esnext",
},
},
}),
];

const rollupDefaultConfig = { external, plugins };
import { createSharedConfig } from "@inrupt/base-rollup-config";
import pkg from "./package.json" assert { type: "json" };

export default [
{
...rollupDefaultConfig,
...createSharedConfig(pkg),
input: "src/index.ts",
output: [
{
Expand All @@ -41,16 +15,12 @@ export default [
entryFileNames: "[name].es.js",
format: "esm",
},
{
dir: "dist",
entryFileNames: "[name].mjs",
format: "esm",
preserveModules: true,
},
],
},
{
...rollupDefaultConfig,
input: ["src/index.ts"],
output: {
dir: "dist",
entryFileNames: "[name].mjs",
format: "esm",
preserveModules: true,
},
},
];
3 changes: 3 additions & 0 deletions packages/internal-test-env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@
"@jeswr/css-auth-utils": "^1.4.0",
"deepmerge-json": "^1.5.0",
"dotenv": "^16.3.1"
},
"devDependencies": {
"@inrupt/base-rollup-config": "^2.4.1"
}
}
54 changes: 3 additions & 51 deletions packages/internal-test-env/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,44 +1,9 @@
// The following is only possible from Node 18 onwards
// import pkg from "./package.json" assert { type: "json" };

// Until we only support Node 18+, this should be used instead
// (see https://rollupjs.org/guide/en/#importing-packagejson)
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);
const pkg = require("./package.json");

import typescript from "rollup-plugin-typescript2";

const external = [
...Object.keys(pkg.dependencies || {}),
"@inrupt/solid-client-authn-node",
"@inrupt/solid-client",
];

const plugins = [
typescript({
// Use our own version of TypeScript, rather than the one bundled with the plugin:
typescript: require("typescript"),
tsconfigOverride: {
compilerOptions: {
module: "esnext",
},
},
}),
];

const rollupDefaultConfig = { external, plugins };
import { createSharedConfig } from "@inrupt/base-rollup-config";
import pkg from "./package.json" assert { type: "json" };

export default [
{
...rollupDefaultConfig,
external: [
"dotenv",
"path",
"deepmerge-json",
"@inrupt/solid-client-authn-node",
"@inrupt/solid-client",
],
...createSharedConfig(pkg),
input: "index.ts",
output: [
{
Expand All @@ -50,19 +15,6 @@ export default [
entryFileNames: "[name].es.js",
format: "esm",
},
],
},
{
...rollupDefaultConfig,
external: [
"dotenv",
"path",
"deepmerge-json",
"@inrupt/solid-client-authn-node",
"@inrupt/solid-client",
],
input: ["index.ts"],
output: [
{
dir: "dist",
entryFileNames: "[name].d.ts",
Expand Down