Skip to content

Commit

Permalink
Merge pull request #7 from FirstWhack/NX
Browse files Browse the repository at this point in the history
NX, not sure if this is gonna go to GH pages correctly
  • Loading branch information
FirstWhack committed Dec 14, 2022
2 parents 41a2c69 + 0e08fda commit b1b38d5
Show file tree
Hide file tree
Showing 28 changed files with 1,553 additions and 626 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ jobs:
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: packages/game/dist
folder: projects/game/dist
target-folder: game
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
node_modules
.vscode
packages/**/dist
**/dist
.yarn/cache
.yarn/install-state.gz
types/*
28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

4 changes: 0 additions & 4 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: .yarn/releases/yarn-3.1.1.cjs
29 changes: 29 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build"],
"parallel": 10
}
}
},
"namedInputs": {
"production": ["!{projectRoot}/**/*.spec.tsx"]
},
"targetDefaults": {
"serve": {
"dependsOn": ["build"],
"outputs": ["{projectRoot}/dist"]
},
"build": {
"inputs": ["production"],
"outputs": ["{projectRoot}/dist"]
}
},
"defaultBase": "main",
"workspaceLayout": {
"appsDir": "projects",
"libsDir": "packages"
}
}
16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"private": true,
"workspaces": {
"packages": [
"packages/**"
"packages/**",
"projects/**"
]
},
"homepage": "https://firstwhack.github.io/a-game-of-micro-frontends",
Expand All @@ -11,9 +12,9 @@
"url": "https://github.com/FirstWhack/a-game-of-micro-frontends"
},
"scripts": {
"start:sandbox": "yarn install && yarn start",
"start": "yarn workspaces foreach -piv run start",
"build": "yarn workspaces foreach -pivt run build",
"start:sandbox": "yarn install && nx start-game @micro-snake/game --output-style=stream",
"start": "nx start-game @micro-snake/game --output-style=stream",
"build": "nx run-many --target=build --output-style=stream",
"postinstall": "husky install",
"pretty-quick": "pretty-quick"
},
Expand All @@ -22,8 +23,13 @@
"description": "",
"packageManager": "[email protected]",
"devDependencies": {
"@nrwl/cli": "^15.3.3",
"@nrwl/workspace": "^15.3.3",
"husky": "^7.0.0",
"nx": "15.3.3",
"prettier": "^2.6.0",
"pretty-quick": "^3.1.3"
"webpack": "5.75.0",
"webpack-cli": "4.9.0",
"webpack-dev-server": "3.11.2"
}
}
7 changes: 2 additions & 5 deletions packages/fruit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@
"@types/react-dom": "^17.0.11",
"babel-loader": "8.2.2",
"html-webpack-plugin": "5.3.1",
"serve": "11.3.2",
"serve": "14.1.2",
"ts-loader": "^9.2.6",
"typescript": "^4.5.5",
"webpack": "5.37.1",
"webpack-cli": "4.9.0",
"webpack-dev-server": "3.11.2"
"typescript": "^4.5.5"
},
"scripts": {
"start": "webpack serve --mode development",
Expand Down
6 changes: 6 additions & 0 deletions packages/fruit/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@micro-snake/plugin-fruit",
"sourceRoot": "{projectRoot}/src",
"projectType": "library",
"tags": ["scope:federated"]
}
8 changes: 7 additions & 1 deletion packages/fruit/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ const { ModuleFederationPlugin } = webpack.container;
const storeHomepage = require('@micro-snake/engine/package.json').homepage;
const deps = require('./package.json').dependencies;

// some webpack5/Node18 quirk, better than going with legacy openssl provider :shrug:
const crypto = require("crypto");
const crypto_orig_createHash = crypto.createHash;
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);

module.exports = (_, argv) => ({
entry: './index.js',
mode: argv.mode,
Expand All @@ -15,7 +20,8 @@ module.exports = (_, argv) => ({
port: 1338
},
output: {
publicPath: 'auto'
publicPath: 'auto',
hashFunction: "sha256"
},

module: {
Expand Down
7 changes: 2 additions & 5 deletions packages/store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@
"@types/react-dom": "^17.0.11",
"babel-loader": "8.2.2",
"html-webpack-plugin": "5.3.1",
"serve": "11.3.2",
"serve": "14.1.2",
"ts-loader": "^9.2.6",
"typescript": "^4.5.5",
"webpack": "5.37.1",
"webpack-cli": "4.9.0",
"webpack-dev-server": "3.11.2"
"typescript": "^4.5.5"
},
"scripts": {
"start": "webpack serve --mode development",
Expand Down
6 changes: 6 additions & 0 deletions packages/store/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@micro-snake/engine",
"sourceRoot": "{projectRoot}/src",
"projectType": "library",
"tags": ["scope:federated"]
}
18 changes: 7 additions & 11 deletions packages/store/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const { ModuleFederationPlugin } = webpack.container;

// some webpack5/Node18 quirk, better than going with legacy openssl provider :shrug:
const crypto = require("crypto");
const crypto_orig_createHash = crypto.createHash;
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);

module.exports = {
entry: {},
mode: 'development',
Expand All @@ -13,22 +16,15 @@ module.exports = {
port: 1339
},
output: {
publicPath: 'auto'
publicPath: 'auto',
hashFunction: "sha256"
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
options: {
presets: ['@babel/preset-react']
}
}
]
},
Expand Down
9 changes: 3 additions & 6 deletions packages/wildcard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,14 @@
"@types/react-dom": "^17.0.11",
"babel-loader": "8.2.2",
"html-webpack-plugin": "5.3.1",
"serve": "11.3.2",
"serve": "14.1.2",
"ts-loader": "^9.2.6",
"typescript": "^4.5.5",
"webpack": "5.37.1",
"webpack-cli": "4.9.0",
"webpack-dev-server": "3.11.2"
"typescript": "^4.5.5"
},
"scripts": {
"start": "webpack serve --mode development",
"build": "webpack --mode production",
"serve": "serve dist -p 1338",
"serve": "serve dist -p 1340",
"clean": "rm -rf dist"
},
"dependencies": {
Expand Down
6 changes: 6 additions & 0 deletions packages/wildcard/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@micro-snake/plugin-wildcard",
"sourceRoot": "{projectRoot}/src",
"projectType": "library",
"tags": ["scope:federated"]
}
9 changes: 8 additions & 1 deletion packages/wildcard/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ const { ModuleFederationPlugin } = webpack.container;
const storeHomepage = require('@micro-snake/engine/package.json').homepage;
const deps = require('./package.json').dependencies;

// some webpack5/Node18 quirk, better than going with legacy openssl provider :shrug:
const crypto = require("crypto");
const crypto_orig_createHash = crypto.createHash;
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);


module.exports = (_, argv) => ({
entry: './index.js',
mode: 'development',
Expand All @@ -15,7 +21,8 @@ module.exports = (_, argv) => ({
port: 1340
},
output: {
publicPath: 'auto'
publicPath: 'auto',
hashFunction: "sha256"
},
module: {
rules: [
Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 4 additions & 5 deletions packages/game/package.json → projects/game/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@
"html-webpack-plugin": "5.3.1",
"less": "^4.1.2",
"less-loader": "^10.2.0",
"serve": "11.3.2",
"serve": "14.1.2",
"style-loader": "^3.3.1",
"ts-loader": "^9.2.6",
"typescript": "^4.5.5",
"webpack": "5.37.1",
"webpack-cli": "4.9.0",
"webpack-dev-server": "3.11.2"
"typescript": "^4.5.5"
},
"scripts": {
"start": "webpack serve --mode development",
Expand All @@ -32,6 +29,8 @@
"@emotion/react": "^11.8.2",
"@emotion/styled": "^11.8.1",
"@micro-snake/engine": "workspace:*",
"@micro-snake/plugin-fruit": "workspace:*",
"@micro-snake/plugin-wildcard": "workspace:*",
"@mui/material": "^5.5.2",
"konva": "^8.3.4",
"mobx": "^6.3.13",
Expand Down
18 changes: 18 additions & 0 deletions projects/game/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@micro-snake/game",
"sourceRoot": "{projectRoot}/src",
"projectType": "application",
"targets": {
"start-game": {
"executor": "nx:run-commands",
"options": {
"commands": [
{ "command": "nx run-many --target=serve --exclude @micro-snake/game" },
{ "command": "nx run @micro-snake/game:serve" }
]
},
"outputs": ["{projectRoot}/dist"]
}
},
"tags": ["scope:game"]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ const path = require('path');
const storeHomepage = require('@micro-snake/engine/package.json').homepage;
const deps = require('./package.json').dependencies;

// some webpack5/Node18 quirk, better than going with legacy openssl provider :shrug:
const crypto = require("crypto");
const crypto_orig_createHash = crypto.createHash;
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);


module.exports = (_, argv) => ({
entry: './index.js',
mode: argv.mode,
Expand All @@ -14,7 +20,8 @@ module.exports = (_, argv) => ({
port: 1337
},
output: {
publicPath: 'auto'
publicPath: 'auto',
hashFunction: "sha256"
},
module: {
rules: [
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"strict": true,
"esModuleInterop": true,
"lib": ["dom", "es2015"],
"target": "es5",
"target": "es6",
"module": "esnext",
"jsx": "react",
"experimentalDecorators": true,
"moduleResolution": "node",
Expand Down
Loading

0 comments on commit b1b38d5

Please sign in to comment.