Skip to content

Housekeeping #2

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

Merged
merged 17 commits into from
Jul 26, 2024
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
8 changes: 0 additions & 8 deletions .babelrc

This file was deleted.

3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

23 changes: 1 addition & 22 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
{
"extends": ["standard"],
"plugins": ["standard"],
"rules": {
"semi": [2, "always"],
"space-before-function-paren": [2, "never"],
"max-len": [2, 80, 2],
"camelcase": [2, { "properties": "always" }],
"linebreak-style": [2, "unix"],
"new-cap": [2, { "newIsCap": true, "capIsNew": true }],
"arrow-body-style": [2, "as-needed"],
"arrow-parens": [2, "as-needed"],
"prefer-arrow-callback": 0,
"prefer-template": 0,

"no-var": 2,
"no-undef": 2,
"no-param-reassign": 2,
"comma-dangle": [2, "always-multiline"]
},
"env": {
"node": true
}
"extends": "plugin:bpmn-io/recommended"
}
23 changes: 23 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CI
on: [ push, pull_request ]
jobs:
Build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node-version: [ 20 ]

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{matrix.node-version}}
uses: actions/setup-node@v4
with:
node-version: ${{matrix.node-version}}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run all
21 changes: 2 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
node_modules
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
.DS_Store

pids
logs
results
node_modules
coverage
.nyc_output
dist
build

npm-debug.log
.nyc_output
8 changes: 0 additions & 8 deletions .npmignore

This file was deleted.

1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

All notable changes to [diffpatch](https://github.com/bpmn-io/diffpatch) are documented here. We use [semantic versioning](http://semver.org/) for releases.

## Unreleased

___Note:__ Yet to be released changes appear here._

* `CHORE`: make ESM only module
* `CHORE`: move library to `lib`
* `CHORE`: dependency bumps
* `CHORE`: drop `formatters` main export

## ...

See `git log` for older updates.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# diffpatch

[![Build Status](https://secure.travis-ci.com/bpmn-io/diffpatch.svg)](http://travis-ci.com/bpmn-io/diffpatch)
[![CI](https://github.com/bpmn-io/diffpatch/actions/workflows/CI.yml/badge.svg)](https://github.com/bpmn-io/diffpatch/actions/workflows/CI.yml)

Diff and patch JavaScript objects.

Expand Down Expand Up @@ -257,4 +257,4 @@ This library is a fork of [jsondiffpatch](https://github.com/benjamine/jsondiffp

## License

MIT
MIT
23 changes: 23 additions & 0 deletions bin/diffpatch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env node

/* eslint-env node */

import { DiffPatcher } from '../lib/index.js';
import ConsoleFormatter from '../lib/formatters/console.js';

import fs from 'node:fs';

const fileLeft = process.argv[2];
const fileRight = process.argv[3];

if (!fileLeft || !fileRight) {
console.log('\n USAGE: diffpatch left.json right.json');
process.exit(1);
}

const left = JSON.parse(fs.readFileSync(fileLeft));
const right = JSON.parse(fs.readFileSync(fileRight));

const delta = new DiffPatcher().diff(left, right);

console.log(new ConsoleFormatter().format(delta));
19 changes: 0 additions & 19 deletions bin/jsondiffpatch

This file was deleted.

File renamed without changes.
4 changes: 2 additions & 2 deletions src/contexts/context.js → lib/contexts/context.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Pipe from '../pipe';
import Pipe from '../pipe.js';

export default class Context {
setResult(result) {
Expand Down Expand Up @@ -32,7 +32,7 @@ export default class Context {
child.root = this.root || this;
child.options = child.options || this.options;
if (!this.children) {
this.children = [child];
this.children = [ child ];
this.nextAfterChildren = this.next || null;
this.next = child;
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/contexts/diff.js → lib/contexts/diff.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Context from './context';
import defaultClone from '../clone';
import Context from './context.js';
import defaultClone from '../clone.js';

class DiffContext extends Context {
constructor(left, right) {
Expand Down
2 changes: 1 addition & 1 deletion src/contexts/patch.js → lib/contexts/patch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Context from './context';
import Context from './context.js';

class PatchContext extends Context {
constructor(left, delta) {
Expand Down
2 changes: 1 addition & 1 deletion src/contexts/reverse.js → lib/contexts/reverse.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Context from './context';
import Context from './context.js';

class ReverseContext extends Context {
constructor(delta) {
Expand Down
File renamed without changes.
26 changes: 12 additions & 14 deletions src/diffpatcher.js → lib/diffpatcher.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import Processor from './processor';
import Pipe from './pipe';
import DiffContext from './contexts/diff';
import PatchContext from './contexts/patch';
import ReverseContext from './contexts/reverse';
import clone from './clone';
import Processor from './processor.js';
import Pipe from './pipe.js';
import DiffContext from './contexts/diff.js';
import PatchContext from './contexts/patch.js';
import ReverseContext from './contexts/reverse.js';
import clone from './clone.js';

import * as trivial from './filters/trivial';
import * as nested from './filters/nested';
import * as arrays from './filters/arrays';
import * as dates from './filters/dates';
import * as texts from './filters/texts';
import * as trivial from './filters/trivial.js';
import * as nested from './filters/nested.js';
import * as arrays from './filters/arrays.js';
import * as dates from './filters/dates.js';
import * as texts from './filters/texts.js';

class DiffPatcher {
export default class DiffPatcher {
constructor(options) {
this.processor = new Processor(options);
this.processor.pipe(
Expand Down Expand Up @@ -76,5 +76,3 @@ class DiffPatcher {
return clone(value);
}
}

export default DiffPatcher;
Loading