Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

refactor(docz-rollup): win tolerant (rollup-plugin-peer-deps-external) #820

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 2 additions & 1 deletion core/docz-rollup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"lodash": "^4.17.11",
"log-update": "^3.2.0",
"rollup": "^1.10.0",
"rollup-plugin-babel": "^4.3.2"
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-peer-deps-external": "^2.2.0"
}
}
14 changes: 5 additions & 9 deletions core/docz-rollup/src/index.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
const { omit, get } = require('lodash')
const typescript = require('@pedronauck/rollup-plugin-typescript2')
const babel = require('rollup-plugin-babel')
const peerDepsExternal = require('rollup-plugin-peer-deps-external')

const sizePlugin = require('./plugins/size')
const copyPlugin = require('./plugins/copy')

const defaultExternal = id => {
return (
!id.startsWith('\0') &&
!id.startsWith('.') &&
!id.startsWith(process.platform === 'win32' ? process.cwd() : '/')
)
}

const output = (format, outputDir, { plugins = [], external, ...opts }) => ({
...opts,
external: external || defaultExternal,
external,
output: {
format,
dir: outputDir,
chunkFileNames: `[name]${format !== 'cjs' ? '.[format]' : ''}.js`,
entryFileNames: `[name]${format !== 'cjs' ? '.[format]' : ''}.js`,
},
plugins: [
peerDepsExternal({
includeDependencies: true,
}),
babel({
exclude: 'node_modules/**',
runtimeHelpers: false,
Expand Down
3 changes: 0 additions & 3 deletions core/docz-theme-default/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import { config } from 'docz-rollup'
export default config({
input: 'src/index.tsx',
external: id =>
!id.startsWith('\0') &&
!id.startsWith('.') &&
!id.startsWith(process.platform === 'win32' ? process.cwd() : '/') &&
!id.startsWith('@components') &&
!id.startsWith('@utils') &&
!id.startsWith('@styles'),
Expand Down
6 changes: 1 addition & 5 deletions core/docz/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { config } from 'docz-rollup'

export default config({
input: 'src/index.ts',
external: id =>
!id.startsWith('\0') &&
!id.startsWith('.') &&
!id.startsWith(process.platform === 'win32' ? process.cwd() : '/')
input: 'src/index.ts'
})
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15219,6 +15219,11 @@ rollup-plugin-babel@^4.3.2:
"@babel/helper-module-imports" "^7.0.0"
rollup-pluginutils "^2.3.0"

rollup-plugin-peer-deps-external@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-peer-deps-external/-/rollup-plugin-peer-deps-external-2.2.0.tgz#99ef9231aa01736f3e9605b7c3084a0d627f665b"
integrity sha512-BmJMHUWQcvjS2dQMwJ7dzvdbwpRChnq4AYk2sTU/4aySt9Kumk8y8W3HhTHss31wxzKb0AC/wsiX1AqDcOBIEA==

rollup-pluginutils@2.3.3:
version "2.3.3"
resolved "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.3.3.tgz#3aad9b1eb3e7fe8262820818840bf091e5ae6794"
Expand Down