Skip to content

Commit 44c948d

Browse files
committed
v1.0.0 pre-release update
1 parent 57ef77a commit 44c948d

File tree

9 files changed

+79
-86
lines changed

9 files changed

+79
-86
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,13 @@ package-lock.json
44

55
# Exclude coverage informations
66
coverage
7+
8+
# Example details
9+
example/*
10+
!example/index.js
11+
!example/config.js
12+
13+
# Config files
14+
jest.config.js
15+
tsconfig.json
16+
.jsbeautifyrc

.npmignore

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# Source files
22
src
33

4-
# Typescript configurations
5-
tsconfig.json
6-
7-
# Test configurations
8-
jest.config.js
9-
104
# Data
115
_contents
126

@@ -16,4 +10,14 @@ node_modules
1610
# Others
1711
.vscode
1812
package-lock.json
19-
coverage
13+
coverage
14+
15+
# Example details
16+
example/*
17+
!example/index.js
18+
!example/config.js
19+
20+
# Config files
21+
jest.config.js
22+
tsconfig.json
23+
.jsbeautifyrc

example/config.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
module.exports = {
2+
contentstack: {
3+
apiKey: '',
4+
deliveryToken: ''
5+
},
6+
contentStore: {
7+
dbName: 'contentstack',
8+
collection: {
9+
asset: 'dev_contents',
10+
entry: 'dev_contents',
11+
schema: 'dev_content_types',
12+
},
13+
},
14+
assetStore: {
15+
baseDir: './_development_contents'
16+
},
17+
syncManager: {
18+
inet: {
19+
dns: '8.8.8.8',
20+
host: 'google.com',
21+
port: 53,
22+
retries: 2,
23+
retryTimeout: 3 * 1000,
24+
retryIncrement: 1 * 1000,
25+
timeout: 6 * 1000,
26+
type: 'A',
27+
}
28+
}
29+
// filtering now available!
30+
// syncManager: {
31+
// filters: {
32+
// content_type_uid: ['authors'],
33+
// locale: ['en-us'],
34+
// action: ['publish']
35+
// }
36+
// }
37+
}

example/index.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
1-
const assetStore = require('contentstack-asset-store-filesystem')
2-
const contentStore = require('contentstack-content-store-filesystem')
3-
const listener = require('contentstack-webhook-listener')
4-
const syncManager = require('contentstack-sync-manager')
5-
const config = require('./mock/config')
1+
const assetStore = require('@contentstack/datasync-asset-store-filesystem')
2+
const contentStore = require('../dist/index')
3+
const listener = require('@contentstack/webhook-listener')
4+
const syncManager = require('@contentstack/datasync-manager')
5+
const config = require('./config')
66

77
syncManager.setAssetStore(assetStore)
88
syncManager.setContentStore(contentStore)
99
syncManager.setListener(listener)
1010
syncManager.setConfig(config)
1111

12-
syncManager.start()
13-
.then(() => {
14-
console.log('Contentstack sync started successfully!')
12+
syncManager.start().then(() => {
13+
console.log('Example: DataSync utility started successfully!')
14+
}).catch(console.error)
15+
16+
syncManager.notifications
17+
.on('publish', (obj) => {
18+
// console.log('SYNC-PUBLISH: ', obj)
19+
})
20+
.on('unpublish', (obj) => {
21+
// console.log('SYNC-UNPUBLISH: ', obj)
22+
})
23+
.on('delete', (obj) => {
24+
// console.log('SYNC-DELETE: ', obj)
1525
})
16-
.catch(console.error)
26+
.on('error', (obj) => {
27+
// console.log('SYNC-ERROR: ', obj)
28+
})

example/mock/asset-store.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

example/mock/config.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

example/mock/content-store.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

example/mock/listener.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

example/mock/logger.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)