Skip to content

Commit

Permalink
Fit submodule to AdminJS dev workspace (SoftwareBrothers#1017)
Browse files Browse the repository at this point in the history
* chore: fit sumbodule to AdminJS dev workspace

* chore: upgrade React

* chore: fixed tabs indent

* chore: restored watch mode

* chore: fixed tests conf

* chore: removed global cleanup after each test
  • Loading branch information
ariansobczak-rst authored Feb 18, 2022
1 parent 0ca8662 commit 731d630
Show file tree
Hide file tree
Showing 6 changed files with 291 additions and 77 deletions.
12 changes: 10 additions & 2 deletions bin/bundle-globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@ const run = async () => {
extensions: ['.mjs', '.js', '.jsx', '.json'],
mainFields: ['browser'],
preferBuiltins: true,
browser: true,
}),
replace({
'process.env.NODE_ENV': JSON.stringify(env),
'process.env.IS_BROWSER': 'true',
'process.stderr.fd': 'false',
preventAssignment: true,
'process.browser': true,
}),
json(),
commonjs({
include: ['node_modules/**'],
include: ['node_modules/**', env === 'development' ? '../../node_modules/**' : ''],
ignoreGlobal: true,
}),
globals(),
Expand Down Expand Up @@ -62,4 +65,9 @@ const run = async () => {
})
}

run()
run().catch((error) => {
console.log(error)
process.exit(1)
}).finally(() => {
process.exit()
})
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"bundle:globals": "node bin/bundle-globals.js",
"cspell": "cspell src/**/*.ts src/**/*.js src/**/*.tsx src/**/*.jsx",
"check:all": "yarn types && yarn cspell && yarn lint && yarn test && ONCE=true yarn bundle && ONCE=true NODE_ENV=production yarn bundle",
"dev": "concurrently \"yarn build --watch\" \"yarn bundle\" \"yarn types --watch\"",
"dev": "npm-run-all --parallel \"build --watch\" \"bundle\" \"types --watch\"",
"release": "semantic-release"
},
"bin": {
Expand Down Expand Up @@ -85,7 +85,7 @@
"@babel/preset-typescript": "^7.10.1",
"@babel/register": "^7.10.1",
"@rollup/plugin-babel": "^5.2.1",
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@rollup/plugin-replace": "^2.3.3",
Expand All @@ -99,9 +99,9 @@
"lodash": "^4.17.21",
"ora": "^5.4.1",
"prop-types": "^15.7.2",
"react": "=16.13.1",
"react": "17.0.2",
"react-beautiful-dnd": "^13.0.0",
"react-dom": "=16.13.1",
"react-dom": "17.0.2",
"react-i18next": "^11.14.3",
"react-is": "=16.13.1",
"react-redux": "=7.2.0",
Expand Down Expand Up @@ -137,7 +137,6 @@
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"chai-change": "^2.1.2",
"concurrently": "^5.1.0",
"core-js": "2.5.7",
"cspell": "^4.0.44",
"eslint": "^7.12.1",
Expand All @@ -152,6 +151,7 @@
"jsdom": "^15.1.0",
"jsdom-global": "^3.0.2",
"mocha": "^8.1.3",
"npm-run-all": "^4.1.5",
"nyc": "^14.1.1",
"react-testing-library": "^7.0.0",
"recharts": "^1.7.1",
Expand Down
1 change: 0 additions & 1 deletion spec/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ beforeEach(function () {

afterEach(function () {
this.sinon.restore()
this.jsdom()
})
2 changes: 2 additions & 0 deletions src/backend/bundler/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ const plugins = ({ babelConfig = {}, commonJSConfig = {}, minify = false } = {})
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
'process.env.IS_BROWSER': 'true',
'process.env.': 'AdminJS.env.',
preventAssignment: true,
'process.browser': true,
}),
commonjs({
...commonJSConfig,
Expand Down
2 changes: 1 addition & 1 deletion src/backend/bundler/generate-user-component-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import slash from 'slash'
*/
const generateUserComponentEntry = (admin, entryPath: string): string => {
const { env = {} } = admin.options
const { UserComponents } = global
const { UserComponents } = global as any

const absoluteEntryPath = path.resolve(entryPath)

Expand Down
Loading

0 comments on commit 731d630

Please sign in to comment.