diff --git a/.appveyor.yml b/.appveyor.yml index 76a1420a7..f0fdbf185 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -2,7 +2,6 @@ version: "{build}" clone_depth: 1 environment: matrix: - - nodejs_version: "0" - nodejs_version: "4" - nodejs_version: "6" matrix: diff --git a/.travis.yml b/.travis.yml index 4ef6fb286..f1059ab8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,18 +1,16 @@ --- language: node_js node_js: - - '0.10' - - '0.11' - - '0.12' - '4.0' - '4.1' - '5.0' + - '6.0' env: global: - COVERAGE=false matrix: include: - - node_js: "0.12" + - node_js: "4.0" env: COVERAGE=true after_success: - "[ $COVERAGE == false ] || npm run istanbul -- --report text-summary" diff --git a/README.md b/README.md index fb5121c45..fc2d4cf3b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ jspm CLI === -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jspm/jspm?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Support](https://supporterhq.com/api/b/33df4abbec4d39260f49015d2457eafe/JSPM)](https://supporterhq.com/support/33df4abbec4d39260f49015d2457eafe/JSPM) +[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jspm/jspm?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) Registry and format agnostic JavaScript package manager. diff --git a/cli.js b/cli.js index a325d38be..9976241be 100755 --- a/cli.js +++ b/cli.js @@ -114,6 +114,7 @@ process.on('uncaughtException', function(err) { + 'Global Flags\n' + ' --yes | -y Skip prompts / use default inputs\n' + ' --log Set log level\n' + + ' --cwd [path] Set the working directory\n' ); } @@ -228,6 +229,11 @@ process.on('uncaughtException', function(err) { args.splice(logArgIndex, 2); } + var cwdArgIndex = args.indexOf('--cwd'); + if (cwdArgIndex > -1) { + args.splice(cwdArgIndex, 2); + } + switch(args[0]) { case 'run': core.run(args[1]); diff --git a/docs/api.md b/docs/api.md index bf40674f8..6713e846b 100644 --- a/docs/api.md +++ b/docs/api.md @@ -76,7 +76,7 @@ jspm.bundle('app/main', 'build.js', { mangle: false }).then(function() { }); ``` -Set the `inject` option to inject the bundle tree into the configuration file. +Set the `injectConfig` option to inject the bundle tree into the configuration file. ### unbundle() -> Promise() diff --git a/docs/getting-started.md b/docs/getting-started.md index 0db0006fe..12b8f16c6 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -23,13 +23,14 @@ Create a new project configuration: jspm init Package.json file does not exist, create it? [yes]: -Would you like jspm to prefix the jspm package.json properties under jspm? [yes]: -Enter server baseURL (public folder path) [.]: -Enter jspm packages folder [./jspm_packages]: -Enter config file path [./config.js]: +Would you like jspm to prefix the jspm package.json properties under jspm? [yes]: +Enter server baseURL (public folder path) [./]: +Enter jspm packages folder [./jspm_packages]: +Enter config file path [./config.js]: Configuration file config.js doesn't exist, create it? [yes]: -Enter client baseURL (public folder URL) [/]: -Which ES6 transpiler would you like to use, Traceur or Babel? [traceur]: +Enter client baseURL (public folder URL) [/]: +Do you wish to use a transpiler? [yes]: +Which ES6 transpiler would you like to use, Babel, TypeScript or Traceur? [babel]: ``` Sets up the package.json and configuration file. diff --git a/docs/production-workflows.md b/docs/production-workflows.md index 83cbe5163..fdfc13397 100644 --- a/docs/production-workflows.md +++ b/docs/production-workflows.md @@ -2,15 +2,16 @@ There are three main workflows for production: 1. [Compile into a bundle](#creating-a-bundle) 2. [Create a self-executing bundle](#creating-a-self-executing-bundle) -3. [Cache the dependency tree for flat multiplexing via SPDY / HTTP2](#creating-a-dependency-cache) +3. [Cache the dependency tree for flat multiplexing via HTTP/2](#creating-a-dependency-cache) ### Creating a Bundle +***Important**: The module names such as `app/main` used in the examples below should only be `/` separated (On Windows, do NOT use `\` as your path separator for this argument). The module names are specified in URL space; in particular, they are not file-paths.* + ``` jspm bundle app/main build.js ``` - -Creates a file `build.js` containing `app/main` and all its dependencies referenced in config.js. +Creates a file `build.js` containing `app/main` and all its dependencies referenced in config.js. \ We can then load this with a script tag in the page: @@ -86,7 +87,7 @@ maintaining bindings and circular references as with normal bundles. ### Creating a Dependency Cache -The jspm CDN uses SPDY, optimal cache headers, and minified files, making this workflow suitable for production use. +The jspm CDN uses HTTP/2, optimal cache headers, and minified files, making this workflow suitable for production use. The remaining performance issue is the round trip latency required to load deep dependencies, as we only find out the dependencies of a module once we have fetched that module, before fetching its dependencies in turn. diff --git a/issue_template.md b/issue_template.md new file mode 100644 index 000000000..dd01bb095 --- /dev/null +++ b/issue_template.md @@ -0,0 +1,6 @@ + +**JSPM Version:** `$ jspm --version` + +**Transpiler Plugin(s):** babel / traceur / typescript / I do not use a transpiler + +**Details:** diff --git a/jspm.js b/jspm.js index 5c717b8a2..25ee54989 100755 --- a/jspm.js +++ b/jspm.js @@ -26,7 +26,14 @@ var jspmCLI = new Liftoff({ '.json': null } }); -jspmCLI.launch({}, function(env) { + +var args = process.argv.slice(2); +var cwdArgIndex = args.indexOf('--cwd'); +if (cwdArgIndex > -1) { + process.chdir(args[cwdArgIndex + 1]); +} + +jspmCLI.launch({ cwd: process.cwd() }, function(env) { process.env.jspmConfigPath = env.configPath || ''; process.env.globalJspm = !env.modulePath; if (env.modulePath) diff --git a/lib/common.js b/lib/common.js index f0e2dd310..5648d5c6a 100644 --- a/lib/common.js +++ b/lib/common.js @@ -104,6 +104,8 @@ exports.readJSONSync = function(file) { catch(e) { if (e.code === 'ENOENT') pjson = '{}'; + else + throw e; } if (pjson.startsWith('\uFEFF')) pjson = pjson.substr(1); diff --git a/lib/config/package.js b/lib/config/package.js index f51bcdb90..a5f8f40a1 100644 --- a/lib/config/package.js +++ b/lib/config/package.js @@ -96,7 +96,7 @@ PackageJSON.prototype.read = function(prompts, sync) { // if dependencies already existing, override with empty dependencies if (self.originalPjson.dependencies) pjson.dependencies = {}; - if (self.originalPjson.devDependencies) + if (self.originalPjson.devDependencies) pjson.devDependencies = {}; } @@ -160,10 +160,9 @@ PackageJSON.prototype.read = function(prompts, sync) { }; PackageJSON.prototype.write = function() { - var self = this; var pjson = this.jspmPrefix ? {} : this.originalPjson; - if (!this.jspmPrefix && self.registry !== 'jspm') + if (!this.jspmPrefix && this.registry !== 'jspm') pjson.jspm = true; // set the registry property @@ -198,7 +197,7 @@ PackageJSON.prototype.write = function() { pjson.directories = alphabetize(directories); - set('configFile', this.configFile, winPath(path.relative(this.dir, this.configFile))); + set('configFile', this.configFile, winPath(path.relative(this.dir, this.configFile))); pjson.map = alphabetize(this.map); @@ -209,6 +208,7 @@ PackageJSON.prototype.write = function() { pjson.buildConfig = this.buildConfig; pjson.overrides = this.overrides; + var self = this; // remove any empty object properties that aren't nulling a base property Object.keys(pjson).forEach(function(key) { var val = pjson[key]; @@ -227,8 +227,15 @@ PackageJSON.prototype.write = function() { this.originalPjson.jspm = pjson; } - // NB check that the file hasn't changed since we opened it and if so, prompt - return asp(fs.writeFile)(this.fileName, stringify(this.originalPjson) + config.newLine); + return asp(fs.readFile)(this.fileName).then(function(content) { + if (content.toString() === stringify(self.originalPjson) + config.newLine) { + return Promise.resolve(); + } else { + return asp(fs.writeFile)(self.fileName, stringify(self.originalPjson) + config.newLine); + } + }).catch(function() { + return asp(fs.writeFile)(self.fileName, stringify(self.originalPjson) + config.newLine); + }); }; function writeDependencies(dependencies, registry) { diff --git a/lib/core.js b/lib/core.js index 91fa068b6..fdb44c312 100644 --- a/lib/core.js +++ b/lib/core.js @@ -45,7 +45,7 @@ var tPackages = { 'core-js': 'npm:core-js@^1.1.4', 'traceur': 'github:jmcriffey/bower-traceur@0.0.93', 'traceur-runtime': 'github:jmcriffey/bower-traceur-runtime@0.0.93', - 'typescript': 'npm:typescript@^1.6.2' + 'typescript': 'npm:typescript@^2.0.7' }; exports.run = function(moduleName) { @@ -170,7 +170,7 @@ exports.dlTranspiler = function(transpilerName, update) { if (target) installObj[transpilerName] = target.exactName; else - installObj[transpilerName] = transpilerName === 'traceur' ? tPackages.traceur : transpilerName === 'typescript' ? tPackages.typescript : tPackages.babel; + installObj[transpilerName] = transpilerName === 'traceur' ? tPackages.traceur : transpilerName === 'typescript' || transpilerName == 'ts' ? tPackages.typescript : tPackages.babel; // typescript does not have runtime library if (transpilerName !== 'typescript') { diff --git a/lib/install.js b/lib/install.js index ad6b8ccc7..e9e2c993c 100644 --- a/lib/install.js +++ b/lib/install.js @@ -307,6 +307,9 @@ function install(name, target, options, seen) { return; seen.push(resolution.exactName); + // allow custom resolutions + if (!resolution.registry) + return; // -- download -- return Promise.resolve() @@ -705,7 +708,7 @@ function loadExistingRange(name, parent, inject) { if (depMap) return depMap; - return config.deps; + return config.deps[new PackageName(parent).exactName]; })); }); }) diff --git a/package.json b/package.json index 4496e7f1e..01eab4297 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jspm", "description": "Registry and format agnostic JavaScript package manager", - "version": "0.16.39", + "version": "0.16.53", "main": "./api.js", "author": "", "dependencies": { @@ -9,8 +9,8 @@ "core-js": "^1.2.6", "glob": "^6.0.1", "graceful-fs": "^4.1.2", - "jspm-github": "^0.13.13", - "jspm-npm": "^0.26.8", + "jspm-github": "^0.13.19", + "jspm-npm": "^0.26.12", "jspm-registry": "^0.4.0", "liftoff": "^2.2.0", "minimatch": "^3.0.0", @@ -21,8 +21,8 @@ "rimraf": "^2.4.4", "rsvp": "^3.1.0", "semver": "^5.1.0", - "systemjs": "0.19.31", - "systemjs-builder": "0.15.22", + "systemjs": "0.19.46", + "systemjs-builder": "0.15.36", "traceur": "0.0.105", "uglify-js": "^2.6.1" }, @@ -54,10 +54,15 @@ "directories": { "test": "test" }, - "ignore": [ - "sandbox", - "testlibs", - "test" + "files": [ + "lib", + "LICENSE", + "CONTRIBUTORS", + "README.md", + "api.js", + "cli.js", + "jspm.js", + "docs" ], "license": "Apache-2.0" } diff --git a/test/api.js b/test/api.js index 2cb9d003e..e2dfd8c3f 100644 --- a/test/api.js +++ b/test/api.js @@ -12,7 +12,7 @@ suite('API Calls', function() { test('Normalize', function(done) { api.normalize('jquery').then(function(normalized) { - assert(normalized === 'file://' + path.resolve('testlibs') + '/jspm_packages/github/components/jquery@2.1.4.js'); + assert(normalized === 'file://' + path.resolve('testlibs') + '/jspm_packages/github/components/jquery@2.2.4.js'); done(); }) .catch(done); diff --git a/testlibs/config.js b/testlibs/config.js index 3a68b1f60..16cd44cdd 100644 --- a/testlibs/config.js +++ b/testlibs/config.js @@ -21,7 +21,7 @@ System.config({ "css": "github:systemjs/plugin-css@master", "d3": "github:mbostock/d3@3.5.5", "ember": "github:components/ember@1.13.2", - "jquery": "github:components/jquery@2.1.4", + "jquery": "github:components/jquery@2.2.4", "mocha": "npm:mocha@1.21.5", "text": "github:systemjs/plugin-text@0.0.2", "traceur": "github:jmcriffey/bower-traceur@0.0.91", @@ -30,7 +30,7 @@ System.config({ "voxel-demo": "npm:voxel-demo@0.0.1", "github:components/ember@1.13.2": { "handlebars.js": "github:components/handlebars.js@1.3.0", - "jquery": "npm:jquery@2.2.4" + "jquery": "npm:jquery@3.1.1" }, "github:jspm/nodelibs-assert@0.1.0": { "assert": "npm:assert@1.3.0" diff --git a/testlibs/package.json b/testlibs/package.json index 422a4bc89..40200c3ff 100644 --- a/testlibs/package.json +++ b/testlibs/package.json @@ -7,7 +7,7 @@ "css": "systemjs/plugin-css@master", "d3": "d3/d3@^3.4.13", "ember": "components/ember@1.13.2", - "jquery": "components/jquery@^2.1.1", + "jquery": "components/jquery@^2.2.4", "mocha": "npm:mocha@^1.21.5", "text": "systemjs/plugin-text@^0.0.2", "voxel-demo": "npm:voxel-demo@^0.0.1"