Comments (3)
##Desired Implementation
Option 2, kinda.
Each phrase will look like this:
{
name: 'thisPhrase',
version: '0.3.2',
dependencies: [
require('lacona-phrase-simplePhrase'),
require('lacona-phrase-anotherPhrase')
],
extends: {
'notAsCoolPhrase': '*'
},
precedes: {
'someDumbPhrase': '2.3.x-4.x'
},
root: ...
}
So notice that with this configuration, dependencies are specified with their full grammars, but extends and precedes are only specified by name.
When a phrase's root
property contains references to another phrase beyond the built-in 5, it will look for that phrase in and ONLY in the dependencies
phrases. If it doesn't find it, it will throw a runtime error. All version management here is done entirely within package.json
and npm
.
However, extends
and precedes
effect the full lacona parser. Whenever any phrase is referenced called notAsCoolPhrase
or someDumbPhrase
and it matches the specified version, it will extend or precede it with thisPhrase
.
The only confusing part here is versioning. You will notice that thisPhrase
has a version, but it is completely independent of it's module's package.json
. It still uses semver
and it could be the same, but it by no means needs to. The reason for this is twofold:
- There is no way to get the version of another module that is easily Browserifiable.
- One module can contain many phrases, which should be able to be versioned independently.
To simplify things, the version
property defaults to 0.0.0
. The extends
and precedes
properties can be specified as a String
or an Array
. In that case, the version defaults to 0.0.0
.
extends: 'notAsCoolPhrase' == ['notAsCoolPhrase'] == {notAsCoolPhrase: '0.0.0'}
That is to say, if you ignore versioning in both your extends
/precedes
properties and your version
property, everything will work fine (until you make a breaking change). When you do make a breaking change, you can just call it 0.0.1
or 1.0.0
and users who did not specify a version will now need to specify one to refer to the new version.
Pros:
- Simple to implement
- Completely avoids dependency hell
- Allows basic users to avoid versioning altogether (For now, I believe this is an advantage)
- Automatically browserifiable
- Assuming that phrase authors follow
semver
, version-safe
Cons:
- Requires basic knowledge of node/npm in order to write a phrase
- Phrases that rely upon non-builtin phrases cannot be JSON files (they need to call
require
)- Doesn't matter too much, since language-splitting would encourage a root
index.js
anyways
- Doesn't matter too much, since language-splitting would encourage a root
- Somewhat confusing as each phrase now has two versions, a module version and a phrase version. A module version can change without a phrase version changing. Hopefully breaking changes don't happen in this way, but it is possible.
from elliptical.
Other con: name conflicts.
We'll just deal with that for now.
from elliptical.
Implemented with 5afc088
from elliptical.
Related Issues (16)
- brew cask apps aren't detected to be opened as an Application HOT 2
- Issue: Command List HOT 4
- Getting more done in GitHub with ZenHub HOT 2
- Submit to JSDelivr HOT 1
- Submit to JSDelivr HOT 3
- Can't get examples to work. HOT 2
- Closed
- Documentation links don't work. HOT 2
- How to create phrase that can choose multiple items in one 'branch'?
- How it works under the hood? HOT 2
- Cannot make this work - only returns 'undefined' HOT 2
- Moving to a new Phrase structure HOT 1
- What's the best way to unit test custom phrases? HOT 3
- Cannot read property 'defaultProps' of undefined HOT 2
- need bare-bone example HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elliptical.