mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
DRY on the version number: it should be in package.json and nowhere else (#4400)
This commit is contained in:
6
Cakefile
6
Cakefile
@@ -90,7 +90,11 @@ task 'build:parser', 'rebuild the Jison parser (run build first)', ->
|
||||
|
||||
|
||||
task 'build:browser', 'rebuild the merged script for inclusion in the browser', ->
|
||||
code = ''
|
||||
code = """
|
||||
require['../../package.json'] = (function() {
|
||||
return #{fs.readFileSync "./package.json"};
|
||||
})();
|
||||
"""
|
||||
for name in ['helpers', 'rewriter', 'lexer', 'parser', 'scope', 'nodes', 'sourcemap', 'coffee-script', 'browser']
|
||||
code += """
|
||||
require['./#{name}'] = (function() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Generated by CoffeeScript 1.12.1
|
||||
(function() {
|
||||
var Lexer, SourceMap, base64encode, compile, ext, fn1, formatSourcePosition, fs, getSourceMap, helpers, i, len, lexer, parser, path, ref, sourceMaps, vm, withPrettyErrors,
|
||||
var Lexer, SourceMap, base64encode, compile, ext, fn1, formatSourcePosition, fs, getSourceMap, helpers, i, len, lexer, packageJson, parser, path, ref, sourceMaps, vm, withPrettyErrors,
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
fs = require('fs');
|
||||
@@ -17,7 +17,9 @@
|
||||
|
||||
SourceMap = require('./sourcemap');
|
||||
|
||||
exports.VERSION = '1.12.1';
|
||||
packageJson = require('../../package.json');
|
||||
|
||||
exports.VERSION = packageJson.version;
|
||||
|
||||
exports.FILE_EXTENSIONS = ['.coffee', '.litcoffee', '.coffee.md'];
|
||||
|
||||
|
||||
@@ -10,9 +10,12 @@ path = require 'path'
|
||||
{parser} = require './parser'
|
||||
helpers = require './helpers'
|
||||
SourceMap = require './sourcemap'
|
||||
# Require `package.json`, which is two levels above this file, as this file is
|
||||
# evaluated from `lib/coffee-script`.
|
||||
packageJson = require '../../package.json'
|
||||
|
||||
# The current CoffeeScript version number.
|
||||
exports.VERSION = '1.12.1'
|
||||
exports.VERSION = packageJson.version
|
||||
|
||||
exports.FILE_EXTENSIONS = ['.coffee', '.litcoffee', '.coffee.md']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user