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

Feat/monorepo cleanup #455

Merged
merged 16 commits into from
Apr 8, 2024
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
36 changes: 36 additions & 0 deletions .changeset/dirty-poets-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
'@flatfile/plugin-webhook-event-forwarder': patch
'@flatfile/plugin-foreign-db-extractor': patch
'@flatfile/plugin-convert-sql-ddl': patch
'@flatfile/plugin-connect-via-merge': patch
'@flatfile/util-response-rejection': patch
'@flatfile/plugin-export-workbook': patch
'@flatfile/plugin-space-configure': patch
'@flatfile/plugin-json-extractor': patch
'@flatfile/plugin-convert-openapi-schema': patch
'@flatfile/plugin-webhook-egress': patch
'@flatfile/plugin-xlsx-extractor': patch
'@flatfile/plugin-dxp-configure': patch
'@flatfile/plugin-pdf-extractor': patch
'@flatfile/plugin-psv-extractor': patch
'@flatfile/plugin-tsv-extractor': patch
'@flatfile/plugin-xml-extractor': patch
'@flatfile/plugin-zip-extractor': patch
'@flatfile/common-plugin-utils': patch
'@flatfile/plugin-constraints': patch
'@flatfile/plugin-job-handler': patch
'@flatfile/plugin-convert-json-schema': patch
'@flatfile/plugin-record-hook': patch
'@flatfile/plugin-convert-yaml-schema': patch
'@flatfile/util-fetch-schema': patch
'@flatfile/util-file-buffer': patch
'@flatfile/plugin-autocast': patch
'@flatfile/plugin-automap': patch
'@flatfile/util-extractor': patch
'@flatfile/plugin-dedupe': patch
'@flatfile/utils-testing': patch
'@flatfile/util-common': patch
'@flatfile/rollup-config': minor
---

This release refactors and optimizes import statements across all plugins and utility files, particularly emphasizing the use of TypeScript's type keyword for type-only imports. Additionally, this release centralizes the Rollup configuration and replaces axios with cross-fetch for HTTP requests. These changes streamline the codebase, enhance type safety, and unify HTTP request handling across the project.
carlbrugger marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
test:
name: Test
timeout-minutes: 15
timeout-minutes: 20
runs-on: ubuntu-latest
if: ${{ github.head_ref != 'changeset-release/main' }}
steps:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flatfile-plugins
# Flatfile Plugins

Library of open-source plugins for developing with the Flatfile Platform

Expand All @@ -9,9 +9,9 @@ To get started building plugins:

Additional Commands

There are more commands that you can run on every plugin at the root level. For instance, the release is run by Github so you don't have to do this manually.
There are more commands that you can run on every plugin at the root level. For instance, the release is run by GitHub, so you don't have to do this manually.


Each plugin has its own package.json that you can run.

1. `build` command uses what's in index.ts and builds a minified compiled version of the code using tsup. That is what gets published to npm.
1. The `npm run build` command uses what's in index.ts and builds a minified compiled version of the code using Rollup. That is what gets published to npm.
109 changes: 109 additions & 0 deletions bundlers/rollup-config/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import resolve from '@rollup/plugin-node-resolve'
import sucrase from '@rollup/plugin-sucrase'
import terser from '@rollup/plugin-terser'
import { dts } from 'rollup-plugin-dts'
import peerDepsExternal from 'rollup-plugin-peer-deps-external'

import dotenv from 'dotenv'
dotenv.config()

const PROD = process.env.NODE_ENV !== 'development'
if (!PROD) {
console.log('Not in production mode - skipping minification')
}

function commonPlugins(browser, umd = false) {
return [
!umd && peerDepsExternal(),
json(),
commonjs({
include: '**/node_modules/**',
requireReturnsDefault: 'auto',
esmExternals: true,
}),
resolve({ browser, preferBuiltins: !browser }),
sucrase({
include: ['src/**'],
exclude: ['**/node_modules/**', '**/.*/', '**/*.spec.ts'],
transforms: ['typescript'],
}),
PROD && terser(),
carlbrugger marked this conversation as resolved.
Show resolved Hide resolved
]
}

export function buildConfig({
external = [],
includeBrowser = true,
includeUmd = false,
umdConfig = { name: undefined, external: [] },
}) {
return [
// Node.js build
{
input: 'src/index.ts',
output: [
{
exports: 'auto',
file: 'dist/index.cjs',
format: 'cjs',
},
{
exports: 'auto',
file: 'dist/index.mjs',
sourcemap: false,
format: 'es',
},
],
plugins: commonPlugins(false),
external,
},
// Browser build
...(includeBrowser
? [
{
input: 'src/index.ts',
output: [
{
exports: 'auto',
file: 'dist/index.browser.cjs',
format: 'cjs',
},
{
exports: 'auto',
file: 'dist/index.browser.mjs',
sourcemap: false,
format: 'es',
},
],
plugins: commonPlugins(true),
external,
},
]
: []),
// Definition file
{
input: 'src/index.ts',
output: [{ file: 'dist/index.d.ts', format: 'es' }],
plugins: [dts()],
},
// UMD build
...(includeUmd
? [
{
input: 'src/index.ts',
output: [
{
file: 'dist/index.js',
format: 'umd',
name: umdConfig.name,
},
],
plugins: commonPlugins(true, true),
external: umdConfig.external,
},
]
: []),
]
}
20 changes: 20 additions & 0 deletions bundlers/rollup-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@flatfile/rollup-config",
"version": "0.0.0",
"description": "",
"private": true,
"main": "index.mjs",
"scripts": {},
carlbrugger marked this conversation as resolved.
Show resolved Hide resolved
"author": "Flatfile, Inc.",
"license": "ISC",
"dependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-sucrase": "^5.0.2",
"@rollup/plugin-terser": "^0.4.4",
"rollup": "^4.12.0",
"rollup-plugin-dts": "^6.1.0",
"rollup-plugin-peer-deps-external": "^2.2.4"
}
}
22 changes: 9 additions & 13 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
const path = require('path')

module.exports = {
verbose: true,
testEnvironment: 'node',
testRegex: '.*\\.(e2e-)?spec\\.ts$',
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
setupFiles: [path.join(__dirname, './testing/setup-tests.js')],
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
setupFiles: ['<rootDir>/test/dotenv-config.js'],
setupFilesAfterEnv: [
'<rootDir>/test/betterConsoleLog.js',
'<rootDir>/test/unit.cleanup.js',
],
testTimeout: 30_000,
globalSetup: './testing/setup-global.js',
globalSetup: '<rootDir>/test/setup-global.js',
forceExit: true,
}
Loading
Loading