Skip to content

Commit

Permalink
Use npm packages, rename archivist to archivist-js.
Browse files Browse the repository at this point in the history
  • Loading branch information
Integral committed Nov 30, 2017
1 parent c407222 commit 9376e72
Show file tree
Hide file tree
Showing 30 changed files with 57 additions and 56 deletions.
2 changes: 1 addition & 1 deletion client/publisher/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { substanceGlobals } from 'substance'
import { Archivist, ArchivistConfigurator } from 'archivist'
import { Archivist, ArchivistConfigurator } from 'archivist-js'
import Package from './package'

substanceGlobals.DEBUG_RENDERING = true;
Expand Down
2 changes: 1 addition & 1 deletion client/publisher/package.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ProseEditorPackage } from 'substance'
import { ArchivistPackage, ArchivistSubConfigurator, CommentsPackage, DocumentsPackage, IndentationPackage, MetadataEditorPackage, ResourcesPackage, TimecodeAnnotatorPackage, UsersPackage, WhitespacePackage } from 'archivist'
import { ArchivistPackage, ArchivistSubConfigurator, CommentsPackage, DocumentsPackage, IndentationPackage, MetadataEditorPackage, ResourcesPackage, TimecodeAnnotatorPackage, UsersPackage, WhitespacePackage } from 'archivist-js'
import InterviewPackage from '../../packages/interview/package'
import FormsPackage from '../../packages/forms/package'
import DefinitionManagerPackage from '../../packages/definition-manager/package'
Expand Down
2 changes: 1 addition & 1 deletion config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
"sender": "archivist@archivist"
},
"db_url": "postgres://archivist_user:archivist_pw@localhost:5432/archivist"
}
}
2 changes: 1 addition & 1 deletion import.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let uniq = require('lodash/uniq')
let JSONConverter = require('substance').JSONConverter
let documentHelpers = require('substance').documentHelpers
let Database = require('./packages/server/Database')
let Configurator = require('archivist').ServerConfigurator
let Configurator = require('archivist-js').ServerConfigurator
let EnginePackage = require('./packages/engine/package')
let IndexerPackage = require('./packages/indexer/package')
let InterviewPackage = require('./dist/ost.cjs').InterviewPackage
Expand Down
33 changes: 17 additions & 16 deletions make.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ function buildApp(app, production) {
}],
commonjs: {
include: [
'node_modules/moment/moment.js',
'node_modules/plyr/src/js/plyr.js',
'node_modules/moment/moment.js',
'node_modules/plyr/src/js/plyr.js',
'node_modules/leaflet/dist/leaflet-src.js',
'node_modules/leaflet.markercluster/dist/leaflet.markercluster-src.js',
'node_modules/leaflet-control-geocoder/dist/Control.Geocoder.js'
Expand All @@ -65,20 +65,20 @@ function buildApp(app, production) {
external: ['substance', 'archivist'],
globals: {
'substance': 'substance',
'archivist': 'archivist'
'archivist-js': 'archivist-js'
},
buble: production === true,
useStrict: production !== true
})

b.custom('injecting config', {
src: './dist/' + app + '/app.js',
dest: './dist/' + app + '/' + app + '.js',
execute: function(file) {
const code = fs.readFileSync(file[0], 'utf8')
const result = code.replace(/ARCHIVISTCONFIG/g, JSON.stringify(config.get('app')))
fs.writeFileSync(this.outputs[0], result, 'utf8')
}
}
})
if(production) {
b.minify('./dist/' + app + '/' + app + '.js')
Expand All @@ -92,10 +92,10 @@ function buildApp(app, production) {

function buildServerJS() {
b.js('./index.es.js', {
external: ['substance', 'archivist'],
external: ['substance', 'archivist-js'],
globals: {
'substance': 'substance',
'archivist': 'archivist'
'archivist-js': 'archivist-js'
},
targets: [{
dest: 'dist/ost.cjs.js',
Expand All @@ -106,27 +106,28 @@ function buildServerJS() {

/* HELPERS */

/* HELPERS */

function _buildDeps(min) {
b.make('substance', 'lib')
b.copy('node_modules/substance/dist', './dist/libs/substance')

if(min) {
b.minify('./dist/libs/substance/substance.js', './dist/libs/substance/substance.min.js')
b.custom('applying modification', {
src: './dist/libs/substance/substance.es5.js',
dest: './dist/libs/substance/substance.legacy.js',
execute: function(file) {
const code = fs.readFileSync(file[0], 'utf8')
const result = code.replace(/(\(ref = this\)._initialize.apply\(ref, args\);)[\s\S]{13}/g, 'var ref;(ref = this)._initialize.apply(ref, args);')
fs.writeFileSync(this.outputs[0], result, 'utf8')
}
}
})

b.minify('./dist/libs/substance/substance.legacy.js')
}

//if(min) b.minify('./dist/libs/substance/substance.js', './dist/libs/substance/substance.min.js')

b.make('archivist', 'lib')
b.copy('node_modules/archivist/dist', './dist/libs/archivist')
if(min) b.minify('./dist/libs/archivist/archivist.es5.js')
}
b.copy('node_modules/archivist-js/dist', './dist/libs/archivist')
if(min) {
b.minify('./dist/libs/archivist/archivist.js', './dist/libs/archivist/archivist.min.js')
b.minify('./dist/libs/archivist/archivist.es5.js')
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "",
"main": "dist/ost.cjs.js",
"dependencies": {
"archivist": "archivist/archivist#b9927ef94f4159b5ec8be14abf936d04e6ca4240",
"archivist-js": "preview",
"bluebird": "^3.4.7",
"body-parser": "^1.15.2",
"config": "^1.21.0",
Expand All @@ -15,7 +15,7 @@
"massive": "^2.5.0",
"moment": "^2.17.1",
"plyr": "^2.0.11",
"substance": "substance/substance#cafe7eb5a8bccb9c64feee6926b8acfb45c13a5b",
"substance": "container-annos",
"ws": "^1.1.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/definition-manager/DefinitionsPage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FontAwesomeIcon as Icon } from 'substance'
import { AbstractEntityPage } from 'archivist'
import { AbstractEntityPage } from 'archivist-js'

const definitionTypes = [
'общий комментарий',
Expand Down
2 changes: 1 addition & 1 deletion packages/engine/document/DocumentEngine.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let ArchivistDocumentEngine = require('archivist').DocumentEngine
let ArchivistDocumentEngine = require('archivist-js').DocumentEngine
let Err = require('substance').SubstanceError
let filter = require('lodash/filter')
let forEach = require('lodash/forEach')
Expand Down
8 changes: 4 additions & 4 deletions packages/engine/package.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
let ArchivistStorePackage = require('archivist').ArchivistStorePackage
let ArchivistStorePackage = require('archivist-js').ArchivistStorePackage

module.exports = {
name: 'engine',
configure: function(config) {
config.import(ArchivistStorePackage);
config.import(require('./mailer/package'))
config.import(require('archivist').AuthEnginePackage)
config.import(require('archivist').CollabEnginePackage)
config.import(require('archivist').SnapshotEnginePackage)
config.import(require('archivist-js').AuthEnginePackage)
config.import(require('archivist-js').CollabEnginePackage)
config.import(require('archivist-js').SnapshotEnginePackage)
config.import(require('./document/package'))
config.import(require('./resource/package'))
}
Expand Down
2 changes: 1 addition & 1 deletion packages/engine/resource/ResourceEngine.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let Err = require('substance').SubstanceError
let ArchivistResourceEngine = require('archivist').ResourceEngine
let ArchivistResourceEngine = require('archivist-js').ResourceEngine
let each = require('lodash/each')
let isEmpty = require('lodash/isEmpty')
let isNull = require('lodash/isNull')
Expand Down
2 changes: 1 addition & 1 deletion packages/forms/OstForms.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DefaultDOMElement } from 'substance'
import { Forms } from 'archivist'
import { Forms } from 'archivist-js'
import GeocodedField from './geocoded-field/GeocodedField'
import MapField from './map-field/MapField'

Expand Down
2 changes: 1 addition & 1 deletion packages/forms/OstNodeForm.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NodeForm } from 'archivist'
import { NodeForm } from 'archivist-js'
import { each } from 'lodash-es'
import OstForms from './OstForms'

Expand Down
2 changes: 1 addition & 1 deletion packages/indexer/Indexer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let Err = require('substance').SubstanceError
let ArchivistIndexer = require('archivist').Indexer
let ArchivistIndexer = require('archivist-js').Indexer
let findIndex = require('lodash/findIndex')
let forEach = require('lodash/forEach')
let isEmpty = require('lodash/isEmpty')
Expand Down
2 changes: 1 addition & 1 deletion packages/interview/Interview.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Document } from 'substance'
import { EntityIndex } from 'archivist'
import { EntityIndex } from 'archivist-js'
import { map } from 'lodash-es'
/*
Archivist Interview model.
Expand Down
2 changes: 1 addition & 1 deletion packages/interview/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import MetaNode from './MetaNode'
import InterviewSeed from './InterviewSeed'

import { BasePackage, ParagraphPackage, PersistencePackage, HeadingPackage, BlockquotePackage, LinkPackage, EmphasisPackage, StrongPackage} from 'substance'
import { CommentPackage, TimecodePackage } from 'archivist'
import { CommentPackage, TimecodePackage } from 'archivist-js'
import SubjectPackage from '../subject/package'
import DefinitionPackage from '../definition/package'
import PersonPackage from '../person/package'
Expand Down
2 changes: 1 addition & 1 deletion packages/ost-publisher/OstPublisher.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// import { ContainerEditor, Highlights, Layout, ProseEditor, SplitPane, Toolbar } from 'substance'
import { findIndex, forEach, map } from 'lodash-es'
import OstPublisherContext from './OstPublisherContext'
import { Publisher } from 'archivist'
import { Publisher } from 'archivist-js'

class OstPublisher extends Publisher {
constructor(...args) {
Expand Down
2 changes: 1 addition & 1 deletion packages/ost-publisher/OstPublisherContext.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// import { Component } from 'substance'
// import { forEach } from 'lodash-es'

import { PublisherContext } from 'archivist'
import { PublisherContext } from 'archivist-js'

class OstPublisherContext extends PublisherContext {

Expand Down
2 changes: 1 addition & 1 deletion packages/ost-publisher/OstPublisherLayout.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { async, JSONConverter, substanceGlobals } from 'substance'
import { PublisherLayout, PublisherSession } from 'archivist'
import { PublisherLayout, PublisherSession } from 'archivist-js'
import OstPublisher from './OstPublisher'

const {series} = async
Expand Down
2 changes: 1 addition & 1 deletion packages/ost-publisher/package.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import OstPublisherLayout from './OstPublisherLayout'
import { BracketsPackage, CollaboratorsPackage, TabbedContextPackage } from 'archivist'
import { BracketsPackage, CollaboratorsPackage, TabbedContextPackage } from 'archivist-js'
import { ContainerAnnotationPackage, FindAndReplacePackage } from 'substance'

export default {
Expand Down
2 changes: 1 addition & 1 deletion packages/person-manager/PersonsPage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AbstractEntityPage } from 'archivist'
import { AbstractEntityPage } from 'archivist-js'

class PersonsPage extends AbstractEntityPage {}

Expand Down
2 changes: 1 addition & 1 deletion packages/prison-manager/PrisonsPage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AbstractEntityPage } from 'archivist'
import { AbstractEntityPage } from 'archivist-js'

class PrisonsPage extends AbstractEntityPage {}

Expand Down
2 changes: 1 addition & 1 deletion packages/reader/package.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ContainerAnnotationPackage } from 'substance'
import { BracketsPackage, TabbedContextPackage } from 'archivist'
import { BracketsPackage, TabbedContextPackage } from 'archivist-js'
import ReaderLayout from './ReaderLayout'

export default {
Expand Down
2 changes: 1 addition & 1 deletion packages/scholar/Scholar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AbstractApplication } from 'archivist'
import { AbstractApplication } from 'archivist-js'
import { cloneDeep, forEach } from 'lodash-es'
import ScholarRouter from './ScholarRouter'

Expand Down
2 changes: 1 addition & 1 deletion packages/scholar/package.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BasePackage } from 'substance'
import { DocumentPackage, PagerPackage, SpinnerPackage, ToolboxPackage } from 'archivist'
import { DocumentPackage, PagerPackage, SpinnerPackage, ToolboxPackage } from 'archivist-js'

export default {
name: 'scholar',
Expand Down
2 changes: 1 addition & 1 deletion packages/server/document/DocumentServer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let ArchivistDocumentServer = require('archivist').DocumentServer
let ArchivistDocumentServer = require('archivist-js').DocumentServer
let Promise = require('bluebird')
let each = require('lodash/each')

Expand Down
10 changes: 5 additions & 5 deletions packages/server/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ let IndexerPackage = require('../indexer/package')
let ResourceServerPackage = require('./resource/package')
let ConverterServerPackage = require('./converter/package')
let DocumentServerPackage = require('./document/package')
let ArchivistSubConfigurator = require('archivist').ArchivistSubConfigurator
let AuthServerPackage = require('archivist').AuthServerPackage
let CollabServerPackage = require('archivist').CollabServerPackage
let UserServerPackage = require('archivist').UserServerPackage
let InspectorPackage = require('archivist').InspectorPackage
let ArchivistSubConfigurator = require('archivist-js').ArchivistSubConfigurator
let AuthServerPackage = require('archivist-js').AuthServerPackage
let CollabServerPackage = require('archivist-js').CollabServerPackage
let UserServerPackage = require('archivist-js').UserServerPackage
let InspectorPackage = require('archivist-js').InspectorPackage

let db = new Database()

Expand Down
6 changes: 3 additions & 3 deletions packages/server/resource/ResourceServer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let ArchivistResourceServer = require('archivist').ResourceServer
let ArchivistResourceServer = require('archivist-js').ResourceServer

/*
ResourceServer module. Can be bound to an express instance
Expand Down Expand Up @@ -57,7 +57,7 @@ class ResourceServer extends ArchivistResourceServer {
filters = filters ? JSON.parse(filters) : {}

///refs = refs ? JSON.parse(refs) : []

this.engine.getResourcesTreeFacets(filters, type)
.then(function(entities) {
res.json(entities)
Expand Down Expand Up @@ -87,7 +87,7 @@ class ResourceServer extends ArchivistResourceServer {
let letter = req.query.letter
let options = req.query.options
options = options ? JSON.parse(options) : {}

this.engine.getPersonsList(letter, options)
.then(function(persons) {
res.json(persons)
Expand Down
2 changes: 1 addition & 1 deletion packages/toponym-manager/ToponymsPage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AbstractEntityPage } from 'archivist'
import { AbstractEntityPage } from 'archivist-js'

class ToponymsPage extends AbstractEntityPage {}

Expand Down
4 changes: 2 additions & 2 deletions seed.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

var Database = require('./packages/server/Database');
var Configurator = require('archivist').ServerConfigurator;
var StorePackage = require('archivist').ArchivistStorePackage;
var Configurator = require('archivist-js').ServerConfigurator;
var StorePackage = require('archivist-js').ArchivistStorePackage;

var db = new Database();
var configurator = new Configurator().import(StorePackage);
Expand Down
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ app.use(bodyParser.urlencoded({ extended: true, limit: '3mb', parameterLimit: 30
/*
Config
*/
var ServerConfigurator = require('archivist').ServerConfigurator;
var ServerConfigurator = require('archivist-js').ServerConfigurator;
var ServerPackage = require('./packages/server/package');
var configurator = new ServerConfigurator();
configurator.setServerApp(app);
Expand Down

0 comments on commit 9376e72

Please sign in to comment.