Skip to content

Commit

Permalink
Merge pull request #651 from ArcaneDiver/allow-external-dep-in-custom…
Browse files Browse the repository at this point in the history
…-components

Allow external dependecies in custom components
  • Loading branch information
wojtek-krysiak authored Oct 31, 2020
2 parents 04fbc09 + 7a5f495 commit aa39df9
Show file tree
Hide file tree
Showing 9 changed files with 2,586 additions and 2,380 deletions.
2 changes: 1 addition & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"camelize", "datepicker", "camelcase", "fullwidth", "wysiwig", "Helvetica", "Neue",
"Arial", "nowrap", "textfield", "scrollable", "flexbox", "treal", "xxxl",
"adminbro", "Checkmark", "overridable", "Postgres", "Hana", "Wojtek", "Krysiak", "bigint",
"borderless", "metadetaksamosone", "esrever"
"borderless", "metadetaksamosone", "esrever", "jsnext"
],
"ignorePaths": [
"src/frontend/assets/**/*"
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
28 changes: 14 additions & 14 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup
uses: actions/setup-node@v1
with:
node-version: '10.x'
node-version: "10.x"
- uses: actions/cache@v1
id: yarn-cache
with:
Expand All @@ -36,7 +36,7 @@ jobs:
- name: Setup
uses: actions/setup-node@v1
with:
node-version: '10.x'
node-version: "10.x"
- uses: actions/cache@v1
id: yarn-cache
with:
Expand All @@ -47,12 +47,12 @@ jobs:
- name: Install
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install

- uses: actions/cache@v1
id: assets-cache
with:
path: src/frontend/assets/scripts
key: assets-${{ hashFiles('**/src/frontend/global-entry.js') }}-${{ hashFiles('**/yarn.lock') }}
key: assets-${{ hashFiles('**/src/frontend/global-entry.js') }}-${{ hashFiles('**/yarn.lock') }}-{{ hashFiles('**/bin/bundle-globals.js') }}
restore-keys: |
assets-
- name: bundle globals production
Expand All @@ -71,7 +71,7 @@ jobs:
- name: types
run: yarn types
- name: Upload Build
if: |
if: |
contains(github.ref, 'refs/heads/next')
|| contains(github.ref, 'refs/heads/master')
|| contains(github.ref, 'refs/heads/next-major')
Expand All @@ -81,7 +81,7 @@ jobs:
name: lib
path: lib
- name: Upload Types
if: |
if: |
contains(github.ref, 'refs/heads/next')
|| contains(github.ref, 'refs/heads/master')
|| contains(github.ref, 'refs/heads/next-major')
Expand All @@ -91,7 +91,7 @@ jobs:
name: types
path: types
- name: Upload Bundle
if: |
if: |
contains(github.ref, 'refs/heads/next')
|| contains(github.ref, 'refs/heads/master')
|| contains(github.ref, 'refs/heads/next-major')
Expand All @@ -111,7 +111,7 @@ jobs:
- name: Setup
uses: actions/setup-node@v1
with:
node-version: '10.x'
node-version: "10.x"
- uses: actions/cache@v1
id: yarn-cache
with:
Expand All @@ -133,7 +133,7 @@ jobs:
if: contains(github.ref, 'refs/heads/master')
run: yarn codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: test
if: "!contains(github.ref, 'refs/heads/master')"
run: yarn test
Expand Down Expand Up @@ -179,7 +179,7 @@ jobs:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
runs-on: ubuntu-latest
Expand All @@ -189,7 +189,7 @@ jobs:
- name: Setup
uses: actions/setup-node@v1
with:
node-version: '10.x'
node-version: "10.x"
- uses: actions/cache@v1
id: yarn-cache
with:
Expand All @@ -203,7 +203,7 @@ jobs:
- name: Download Build
uses: actions/download-artifact@v1
with:
name: lib
name: lib
- name: Download Types
uses: actions/download-artifact@v1
with:
Expand Down Expand Up @@ -277,7 +277,7 @@ jobs:
- name: Setup
uses: actions/setup-node@v1
with:
node-version: '10.x'
node-version: "10.x"
- uses: actions/cache@v1
id: yarn-cache
with:
Expand All @@ -291,7 +291,7 @@ jobs:
- name: Download Build
uses: actions/download-artifact@v1
with:
name: lib
name: lib
- name: Download Types
uses: actions/download-artifact@v1
with:
Expand Down
19 changes: 6 additions & 13 deletions bin/bundle-globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
* to the `global-bundle.js`.
*/

const rollup = require('rollup')
const resolve = require('rollup-plugin-node-resolve')
const commonjs = require('rollup-plugin-commonjs')
const replace = require('rollup-plugin-replace')
const json = require('rollup-plugin-json')
const { rollup } = require('rollup')
const { nodeResolve: resolve } = require('@rollup/plugin-node-resolve')
const commonjs = require('@rollup/plugin-commonjs')
const replace = require('@rollup/plugin-replace')
const json = require('@rollup/plugin-json')
const builtins = require('rollup-plugin-node-builtins')
const globals = require('rollup-plugin-node-globals')
const { terser } = require('rollup-plugin-terser')
Expand Down Expand Up @@ -38,21 +38,14 @@ const run = async () => {
json(),
commonjs({
include: ['node_modules/**'],
namedExports: {
react: Object.keys(React),
'react-dom': Object.keys(ReactDOM),
'react-is': reactIsExport,
'node_modules/react-redux/node_modules/react-is/index.js': reactIsExport,
'node_modules/react-router/node_modules/react-is/index.js': reactIsExport,
},
ignoreGlobal: true,
}),
globals(),
builtins(),
...(env === 'production' ? [terser()] : []),
],
}
const bundle = await rollup.rollup(inputOptions)
const bundle = await rollup(inputOptions)

return bundle.write({
format: 'iife',
Expand Down
19 changes: 10 additions & 9 deletions bin/watch-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* It reruns whenever user changes something.
*/

const runtime = require('@babel/plugin-transform-runtime')
const styled = require('babel-plugin-styled-components')
const { default: runtime } = require('@babel/plugin-transform-runtime')
const { default: styled } = require('babel-plugin-styled-components')
const bundler = require('../src/backend/bundler/bundler')
const env = require('../src/backend/bundler/bundler-env')

Expand All @@ -21,19 +21,20 @@ async function build() {
watch: !once,
babelConfig: {
plugins: [runtime, styled],
runtimeHelpers: true,
babelHelpers: 'runtime',
include: [
`${__dirname}/../src/frontend/**`,
`${__dirname}/../src/locale/*`,
`${__dirname}/../src/utils/**`,
`${__dirname}/../src/backend/utils/view-helpers/view-helpers.ts`,
`${__dirname}/../src/backend/utils/filter/filter.ts`,
`${__dirname}/../src/backend/decorators/**`,
'src/frontend/**',
'src/locale/*',
'src/utils/**',
'src/backend/utils/view-helpers/view-helpers.ts',
'src/backend/utils/filter/filter.ts',
'src/backend/decorators/**',
],
},
})
}

build().catch((error) => {
console.log(error)
process.exit(1)
})
Loading

0 comments on commit aa39df9

Please sign in to comment.