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

A treed fork that works in 2021 #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
28 changes: 14 additions & 14 deletions db.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ Db.prototype = {
},

set: function (id, attr, value, done) {
this.nodes[id] = {
...this.nodes[id],
this.nodes[id] = Object.assign({},
this.nodes[id], {
[attr]: value,
modified: Date.now()
}
})
this.pl.set('node', id, attr, value, done)
},

Expand Down Expand Up @@ -197,20 +197,20 @@ Db.prototype = {
const update = {}
if (Array.isArray(value)) {
ids.forEach((id, i) => {
this.nodes[id] = {
...this.nodes[id],
this.nodes[id] = Object.assign({},
this.nodes[id], {
[attr]: value[i],
modified: now,
}
})
update[id] = this.nodes[id]
})
} else {
ids.forEach((id, i) => {
this.nodes[id] = {
...this.nodes[id],
this.nodes[id] = Object.assign({},
this.nodes[id], {
[attr]: value,
modified: now,
}
})
update[id] = this.nodes[id]
})
}
Expand All @@ -219,11 +219,11 @@ Db.prototype = {
},

update: function (id, update, done) {
this.nodes[id] = {
...this.nodes[id],
...update,
modified: Date.now(),
}
this.nodes[id] = Object.assign({},
this.nodes[id],
update,
{ modified: Date.now() }
)
this.pl.update('node', id, update, done)
},
}
2 changes: 1 addition & 1 deletion demo/plugins/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype>
<!doctype html>
<meta charset="utf-8">
<title>Treed Plugins Demo</title>
<link rel="stylesheet" href="build.css">
Expand Down
19 changes: 11 additions & 8 deletions demo/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,31 @@ dirs.forEach(function (name) {
module.exports = {
entry: entries,
output: {
path: './',
path: path.resolve(__dirname),
filename: '[name]/build.js',
},

module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader?optional=runtime' },
{ test: /\.json$/, loader: 'json' },
{ test: /\.js$/
, exclude: /node_modules/
, loader: 'babel-loader'
}

{
test: /\.css$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader")
, { test: /\.json$/, loader: 'json' }

, { test: /\.css$/,
loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' })
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader")
loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: "css-loader!less-loader"})
}
],
},

devtool: 'eval',
colors: true,
// colors: true,

plugins: [
new ExtractTextPlugin("[name]/build.css")
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"url": "https://github.com/jaredly/listless/issues"
},
"dependencies": {
"aphrodite": "^2.4.0",
"async": "~0.9.0",
"bluebird": "~1.2.4",
"classnames": "^1.2.0",
Expand All @@ -34,7 +35,8 @@
"levelup": "~1.3.2",
"localforage": "~0.9.2",
"marked": "~0.3.2",
"react": "^0.12.1",
"react": "^0.14.10",
"react-dom": "^0.14.10",
"sublevel": "~2.4.0"
},
"devDependencies": {
Expand All @@ -46,12 +48,12 @@
"babel-runtime": "^4.7.13",
"broccoli": "~0.12.3",
"css-loader": "^0.9.1",
"extract-text-webpack-plugin": "^0.3.8",
"extract-text-webpack-plugin": "^2.1.2",
"json-loader": "^0.5.1",
"less": "^2.4.0",
"less-loader": "^2.1.0",
"style-loader": "^0.8.3",
"webpack": "^1.7.3"
"webpack": "^2.0.1"
},
"browserify": {
"transform": [
Expand Down
4 changes: 3 additions & 1 deletion plugins/types/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ module.exports = {
return data
}
} else {
getUpdate = () => ({...update, type})
getUpdate = () => {
return Object.assign({}, update, {type})
}
}

if (ids.length > 1) {
Expand Down
Loading