Skip to content

Commit

Permalink
Update payload-reducer@0.0.0 to graph-reducer@0.1.1, due to the bug i…
Browse files Browse the repository at this point in the history
…n v0.0.0
  • Loading branch information
mirismaili committed Dec 17, 2020
1 parent a527451 commit 70b080f
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 10 deletions.
38 changes: 38 additions & 0 deletions deploy-for-local-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import fs from 'fs/promises'
import path, {sep} from 'path'
import packageJson from './package.json' // `node --experimental-json-modules`
// // https://nodejs.org/api/esm.html#esm_no_json_module_loading

/**
* Created on 1399/9/27 (2020/12/17).
* Thank https://stackoverflow.com/a/64255382/5318303
* @author {@link https://mirismaili.github.io S. Mahdi Mir-Ismaili}
*/

async function copyDir(src, dest) {
const entries = await fs.readdir(src, {withFileTypes: true})

console.group(`${src}${sep} ==> ${dest}${sep}`)
{
for (const entry of entries) {
const srcPath = path.join(src, entry.name)
const destPath = path.join(dest, entry.name)

entry.isDirectory() ?
await copyDir(srcPath, destPath) :
await fs.copyFile(srcPath, destPath).then(() => console.log(`${srcPath} --> ${destPath}`))
}
}
console.groupEnd()
}

for (const projectPath of process.env.CONSUMER_PROJECT_PATH.split(',')) {
const dest = path.join(projectPath, 'node_modules', packageJson.name, 'dist')

if (!(await fs.stat(dest)).isDirectory()) {
console.error('The path is not a directory:', dest)
continue
}

await copyDir('dist', dest).catch(console.error.bind(console))
}
2 changes: 2 additions & 0 deletions deploy.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
xcopy /y dist ^
<PROJECT-PATH>\node_modules\@rahazad\roudex\dist\
2 changes: 1 addition & 1 deletion example
Submodule example updated 2 files
+1 −1 package.json
+9 −9 yarn.lock
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rahazad/roudex",
"version": "0.1.5",
"version": "0.1.8",
"description": "A first-router state manager, inspired by redux, with similar but different usage to be more comfortable and more usable, especially for react (for now)",
"keywords": [
"state-manager",
Expand Down Expand Up @@ -44,7 +44,7 @@
},
"dependencies": {
"@rahazad/deep-equal": "0.0.0",
"@rahazad/payload-reducer": "0.0.0"
"@rahazad/graph-reducer": "0.1.1"
},
"devDependencies": {
"microbundle-crl": "^0.13.11",
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import deepEqual from '@rahazad/deep-equal'
import {payloadReducer} from '@rahazad/payload-reducer'
import {graphReducer} from '@rahazad/graph-reducer'
import React, {useContext, useEffect, useReducer} from 'react'
import {defaultLogger} from './logger'

Expand Down Expand Up @@ -107,7 +107,7 @@ export const roudexInitializer = (
return state
}

const {noTransform, newState} = payloadReducer(state, payload)
const {noTransform, newState} = graphReducer(state, payload)

const url0 = window.location.href
const newUrl = new URL(url0).origin + createPathFromState(newState)
Expand Down
2 changes: 1 addition & 1 deletion src/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const defaultLogger = (state, action, newState = null) => {
'font-weight:normal;color:#888', '@', new Date().toLocaleTimeString(),
)
// console.groupCollapsed('%c%s', 'font-weight:bold;color:#9E9E9E', 'prev-state')
// console.log('%c%s', 'font-weight:bold;color:#9E9E9E', JSON.stringify(state0, null, '\t'))
// console.log('%c%s', 'font-weight:bold;color:#9E9E9E', JSON.stringify(state, null, '\t'))
// console.groupEnd()

console.log('%c%s\t%o', 'font-weight:bold;color:#9E9E9E', 'prev-state', state)
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -959,10 +959,10 @@
resolved "https://registry.yarnpkg.com/@rahazad/deep-equal/-/deep-equal-0.0.0.tgz#7fdaed9cffff9440294347cc53512ed048d9018f"
integrity sha512-drAbPBUk1mkotDIxCMJtCFr4qaLVH4n5afgUVYq5yv3rYMxByavq2vecEL6GgDTsoGPoZ8uAmJMBORqKAtH4+Q==

"@rahazad/payload-reducer@0.0.0":
version "0.0.0"
resolved "https://registry.yarnpkg.com/@rahazad/payload-reducer/-/payload-reducer-0.0.0.tgz#b0a7b11287cd65411f362cc41dc5ca0a089d20cc"
integrity sha512-crU3RNoQX+EBnVJ8ODsRzPaHFPT28q6K+Rk28QCfTgDGCHFZxqlGkfrqAaoLAL55mtn5mBOH9CMHaYV7tIQK4Q==
"@rahazad/graph-reducer@0.1.1":
version "0.1.1"
resolved "https://registry.yarnpkg.com/@rahazad/graph-reducer/-/graph-reducer-0.1.1.tgz#e8d835829b21dfb62b279f5a938cc9d615703092"
integrity sha512-/uA6GyBUxU/Z2a2f+Ae+hGgawGKkBuavblnkMRbXw+3B/yMNqGMtInUHYUBXdQfb36NglCgZ7sGHB5nOUpC50Q==

"@rollup/plugin-alias@^3.0.1":
version "3.1.1"
Expand Down

0 comments on commit 70b080f

Please sign in to comment.