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(package json example): remove example from workspace #21

Merged
merged 1 commit into from
Jan 28, 2019
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,7 @@ package-lock.json
@types

.vscode

# ignore yarn lock on example
example/*/yarn.lock
example/*/package-lock.json
8 changes: 4 additions & 4 deletions example/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"author": "",
"license": "ISC",
"dependencies": {
"@airy/maleo-css-plugin": "1.0.0",
"@airy/maleo-typescript-plugin": "1.0.0",
"@airy/maleo-redux-plugin": "^1.0.0",
"@airy/maleo": "1.0.0",
"@airy/maleo-css-plugin": "latest",
"@airy/maleo-typescript-plugin": "latest",
"@airy/maleo-redux-plugin": "latest",
"@airy/maleo": "latest",
"react": "16.5.2",
"react-redux": "^5.1.1",
"react-router-dom": "^4.4.0-beta.1",
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
"webpack"
],
"workspaces": [
"packages/**",
"example/**"
"packages/**"
],
"typeScriptVersion": "3.1.1",
"engines": {
Expand Down
4 changes: 3 additions & 1 deletion packages/Maleo.js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
"gulp-clean": "^0.4.0",
"gulp-sourcemaps": "^2.6.4",
"gulp-uglify": "^3.0.1",
"gulp-watch": "^5.0.1"
"gulp-watch": "^5.0.1",
"react": "^16.5.2",
"react-router-dom": "^4.4.0-beta.1"
}
}
4 changes: 2 additions & 2 deletions packages/Maleo.js/src/bin/maleo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ console.log('==> Environment (isDevelopment): ', env, '(' + isDev + ')');
console.log('==> Running Command: ', type);
console.log('==> Command Args: ', args);

if (type === 'build' || !type) {
if (type === 'build') {
console.log('==> Running build');
build({
env,
buildType,
});
} else if (type === 'run') {
} else if (type === 'run' || !type) {
console.log('[MALEO] Running Application');

const serverPath = path.join(buildDirectory, 'server.js');
Expand Down
19 changes: 13 additions & 6 deletions packages/Maleo.js/src/build/webpack/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ import {
RUNTIME_CHUNK_FILE,
SERVER_ASSETS_ROUTE,
MALEO_PROJECT_ROOT_NODE_MODULES,
} from '@src/constants';
PROJECT_ROOT_NODE_MODULES,
} from '@src/constants/index';
import {
Context,
CustomConfig,
Expand Down Expand Up @@ -108,8 +109,10 @@ export const createWebpackConfig = (context: Context, customConfig: CustomConfig
resolve: {
extensions: ['.js', '.jsx', '.json'],
alias,
symlinks: true,
modules: [
MALEO_PROJECT_ROOT_NODE_MODULES,
PROJECT_ROOT_NODE_MODULES,
'node_modules',
...nodePathList, // Support for NODE_PATH environment variable
],
Expand All @@ -135,13 +138,17 @@ export const createWebpackConfig = (context: Context, customConfig: CustomConfig
baseConfigs = {
...baseConfigs,

// Extract all server node_modules from bundles except React
// Extract all server node_modules from bundles
externals: [
nodeExternals({
whitelist: [/react/],
whitelist: [
/react/,
/@airy[/\\]maleo/,
/@babel[/\\]runtime[/\\]/,
/@babel[/\\]runtime-corejs2[/\\]/,
],
}),
],

node: {
// Keep __dirname relative to file not root project
__dirname: true,
Expand Down Expand Up @@ -182,8 +189,8 @@ export const getDefaultEntry = (context: BuildContext): Configuration['entry'] =

return {
main: [
'webpack-hot-middleware/client?name=client',
'react-hot-loader/patch',
require.resolve('webpack-hot-middleware/client'),
require.resolve('react-hot-loader/patch'),
path.join(projectDir, CLIENT_ENTRY_NAME),
],
};
Expand Down
2 changes: 2 additions & 0 deletions packages/Maleo.js/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ export const MALEO_PROJECT_ROOT_NODE_MODULES: string = path.join(
'node_modules',
);

export const PROJECT_ROOT_NODE_MODULES: string = path.join(process.cwd(), 'node_modules');

export const AUTODLL_PATH: string = './static/dll';
32 changes: 23 additions & 9 deletions packages/plugins/typescript-plugin/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,31 @@ const path = require('path');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const TsConfigPathPlugin = require('tsconfig-paths-webpack-plugin');

const whitelistEntries = /(webpack-hot-middleware|react-hot-loader)/;

const replaceJStoTS = (entries = {}) =>
Object.keys(entries).reduce(
(p, c) => ({
Object.keys(entries).reduce((p, c) => {
let entry = entries[c];

if (typeof entry === 'string') {
if (whitelistEntries.test(entry)) {
return {
...p,
[c]: entry,
};
}

return {
...p,
[c]: entry.replace(/\.js$/, '.ts'),
};
}

return {
...p,
[c]:
typeof entries[c] === 'string'
? entries[c].replace(/\.js$/, '.ts')
: entries[c].map((e) => e.replace(/\.js$/, '.ts')),
}),
{},
);
[c]: Object.values(replaceJStoTS(entry)),
};
}, {});

module.exports = (customConfig = {}) => {
return Object.assign({}, customConfig, {
Expand Down
55 changes: 16 additions & 39 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7287,7 +7287,7 @@ longest@^1.0.1:
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
integrity sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=

loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1, loose-envify@^1.4.0:
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
Expand Down Expand Up @@ -9103,12 +9103,12 @@ react-hot-loader@4.3.12:
react-lifecycles-compat "^3.0.4"
shallowequal "^1.0.2"

react-is@^16.3.2, react-is@^16.5.2, react-is@^16.6.0:
react-is@^16.3.2, react-is@^16.5.2:
version "16.7.0"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.7.0.tgz#c1bd21c64f1f1364c6f70695ec02d69392f41bfa"
integrity sha512-Z0VRQdF4NPDoI0tsXVMLkJLiwEBa+RP66g0xDHxgxysxSoCUccSten4RTF/UFvZF1dZvZ9Zu1sx+MDXwcOR34g==

react-lifecycles-compat@^3.0.0, react-lifecycles-compat@^3.0.4:
react-lifecycles-compat@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==
Expand All @@ -9120,19 +9120,6 @@ react-loadable@5.5.0:
dependencies:
prop-types "^15.5.0"

react-redux@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-5.1.1.tgz#88e368682c7fa80e34e055cd7ac56f5936b0f52f"
integrity sha512-LE7Ned+cv5qe7tMV5BPYkGQ5Lpg8gzgItK07c67yHvJ8t0iaD9kPFPAli/mYkiyJYrs2pJgExR2ZgsGqlrOApg==
dependencies:
"@babel/runtime" "^7.1.2"
hoist-non-react-statics "^3.1.0"
invariant "^2.2.4"
loose-envify "^1.1.0"
prop-types "^15.6.1"
react-is "^16.6.0"
react-lifecycles-compat "^3.0.0"

react-router-config@4.4.0-beta.6:
version "4.4.0-beta.6"
resolved "https://registry.yarnpkg.com/react-router-config/-/react-router-config-4.4.0-beta.6.tgz#bb2a29acb22b6458ed044cc48c5d69db71ab0cfd"
Expand Down Expand Up @@ -9191,15 +9178,15 @@ react-side-effect@^1.1.0:
exenv "^1.2.1"
shallowequal "^1.0.1"

react@16.5.2:
version "16.5.2"
resolved "https://registry.yarnpkg.com/react/-/react-16.5.2.tgz#19f6b444ed139baa45609eee6dc3d318b3895d42"
integrity sha512-FDCSVd3DjVTmbEAjUNX6FgfAmQ+ypJfHUsqUJOYNCBUp1h8lqmtC+0mXJ+JjsWx4KAVTkk1vKd1hLQPvEviSuw==
react@^16.5.2:
version "16.7.0"
resolved "https://registry.yarnpkg.com/react/-/react-16.7.0.tgz#b674ec396b0a5715873b350446f7ea0802ab6381"
integrity sha512-StCz3QY8lxTb5cl2HJxjwLFOXPIFQp+p+hxQfc8WE0QiLfCtIlKj8/+5tjjKm8uSTlAW+fCPaavGFS06V9Ar3A==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"
schedule "^0.5.0"
scheduler "^0.12.0"

read-cmd-shim@^1.0.1:
version "1.0.1"
Expand Down Expand Up @@ -9343,19 +9330,6 @@ redent@^2.0.0:
indent-string "^3.0.0"
strip-indent "^2.0.0"

redux-devtools-extension@^2.13.7:
version "2.13.7"
resolved "https://registry.yarnpkg.com/redux-devtools-extension/-/redux-devtools-extension-2.13.7.tgz#14bd7a1a7c8bee7f397beb1116fd16fc9633b752"
integrity sha512-F2GlWMWxCTJGRjJ+GSZcGDcVAj6Pbf77FKb4C9S8eni5Eah6UBGNwxNj8K1MTtmItdZH1Wx+EvIifHN2KKcQrw==

redux@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/redux/-/redux-4.0.1.tgz#436cae6cc40fbe4727689d7c8fae44808f1bfef5"
integrity sha512-R7bAtSkk7nY6O/OYMVR9RiBI+XghjF9rlbl5806HJbQph0LJVHZrU5oaO4q70eUKiqMRqm4y07KLTlMZ2BlVmg==
dependencies:
loose-envify "^1.4.0"
symbol-observable "^1.2.0"

referrer-policy@1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/referrer-policy/-/referrer-policy-1.1.0.tgz#35774eb735bf50fb6c078e83334b472350207d79"
Expand Down Expand Up @@ -9786,6 +9760,14 @@ schedule@^0.5.0:
dependencies:
object-assign "^4.1.1"

scheduler@^0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.12.0.tgz#8ab17699939c0aedc5a196a657743c496538647b"
integrity sha512-t7MBR28Akcp4Jm+QoR63XgAi9YgCUmgvDHqf5otgAj4QvdoBE4ImCX0ffehefePPG+aitiYHp0g/mW6s4Tp+dw==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"

schema-utils@^0.4.4, schema-utils@^0.4.5:
version "0.4.7"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187"
Expand Down Expand Up @@ -10393,11 +10375,6 @@ sver-compat@^1.5.0:
es6-iterator "^2.0.1"
es6-symbol "^3.1.1"

symbol-observable@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804"
integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==

symbol-tree@^3.2.2:
version "3.2.2"
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6"
Expand Down