Skip to content
This repository was archived by the owner on Aug 15, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ tmp/
.yml
_site
coverage
tests/sea-modules/
spm_modules
tests/spm_modules
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ all:
@chmod -R +x .git/hooks/


specs := $(shell find ./tests -name '*.js' ! -path "*node_modules/*" ! -path "*sea-modules/*" ! -path "*build/*")
specs := $(shell find ./tests -name '*.js' ! -path "*node_modules/*" ! -path "*spm-modules/*" ! -path "*build/*")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spm-modules ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

多谢提醒,fixed

reporter = spec
test:
./node_modules/.bin/istanbul cover \
Expand Down
2 changes: 1 addition & 1 deletion bin/spm-install
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ commander
.usage('[options] name[@version]')
.option('--registry <url>', 'registry url of yuan server')
.option('-I, --input-directory <dir>', 'input directory, default: current working directory')
.option('-d, --destination <dir>', 'output directory, default: sea-modules')
.option('-d, --destination <dir>', 'output directory, default: spm_modules')
.option('-f, --force', 'force to download a unstable module')
.option('-q, --quiet', 'show less logs')
.option('-S, --save', 'save alias to package.json')
Expand Down
5 changes: 3 additions & 2 deletions bin/spm-tree
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if (query) {
spm.install.fetch(query, function(err, dest) {
spm.install({
source: commander.source,
destination: dest + '/sea-modules/',
destination: dest + '/' + spmrc.get('install.path') + '/',
force: commander.force,
parallel: commander.parallel,
query: commander.args
Expand Down Expand Up @@ -64,8 +64,9 @@ function tree(f, paths, depth) {
return {};
}
var pkg = require(f);
var installPath = spmrc.get('install.path');

paths = paths || ['sea-modules', path.join(spmrc.get('user.home'), '.spm', 'sea-modules')];
paths = paths || [installPath, path.join(spmrc.get('user.home'), '.spm', installPath)];

var node = {};
var title = pkg.name;
Expand Down
6 changes: 4 additions & 2 deletions lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var glob = require('glob');
var log = require('./utils/log');
var umi = require('umi');
var gulp = require('gulp');
var spmrc = require('spmrc');
var multipipe = require('multipipe');
var $ = require('gulp-load-plugins')({
config: require('../package.json')
Expand Down Expand Up @@ -33,7 +34,8 @@ function build(args, cb) {
try {
var pkg = new umi.Package(args.cwd, {
skip: args.skip || [],
ignore: args.ignore || []
ignore: args.ignore || [],
moduleDir: spmrc.get('install.path')
});
if (!args.noPkgLog) {
log.info('package', 'analyse infomation');
Expand Down Expand Up @@ -78,7 +80,7 @@ function build(args, cb) {
var depPkgs = pkg.getPackages();
for (var id in depPkgs) {
files = files.concat(getFiles(depPkgs[id]).map(function(f) {
return 'sea-modules/'+id.replace('@','/')+'/' + f;
return spmrc.get('install.path') + '/' + id.replace('@','/') + '/' + f;
}));
}
log.info('withDeps', 'files: ' + files);
Expand Down
2 changes: 1 addition & 1 deletion lib/init-template/root/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ Thumbs.db
.build
node_modules
_site
sea-modules
spm_modules
.cache
dist
2 changes: 1 addition & 1 deletion lib/init-template/root/.spmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dist
_site
sea-modules
spm_modules
node_modules
.git
tests
Expand Down
5 changes: 4 additions & 1 deletion lib/sdk/module.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var file = require('./file');
var path = require('path');
var fs = require('fs');
var spmrc = require('spmrc');
var Package = require('umi').Package;

function parseDependencies(deps) {
Expand All @@ -11,7 +12,9 @@ function parseDependencies(deps) {
exports.parseDependencies = parseDependencies;

exports.getSourceFiles = function(root) {
var pkg = new Package(root || process.cwd());
var pkg = new Package(root || process.cwd(), {
moduleDir: spmrc.get('install.path')
});
return Object.keys(pkg.files).map(function(file) {
return file.replace(/\.js$/, '');
});
Expand Down
3 changes: 2 additions & 1 deletion lib/theme/nico.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var path = require('path');
var fs = require('fs');
var spmrc = require('spmrc');
var serveSPM = require('serve-spm');

var pkg = require(path.join(process.cwd(), 'package.json'));
Expand All @@ -21,7 +22,7 @@ exports.ignorefilter = function(filepath, subdir) {
if (/\.DS_Store/.test(filepath)) {
return false;
}
if (/^sea-modules/.test(subdir) &&
if (new RegExp('^' + spmrc.get('install.path')).test(subdir) &&
/\.(md|markdown|html|psd|zip|yml)/.test(path.extname(filepath))) {
return false;
}
Expand Down
5 changes: 3 additions & 2 deletions lib/theme/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var fs = require('fs');
var path = require('path');
var SEA_MODULES = exports.SEA_MODULES = 'sea-modules';
var spmrc = require('spmrc');
var SEA_MODULES = exports.SEA_MODULES = spmrc.get('install.path');

// load all css files in dependencies
exports.cssDependencies = function() {
Expand All @@ -19,7 +20,7 @@ exports.cssDependencies = function() {
tempPkg.spm = tempPkg.spm || {};
var main = tempPkg.spm.main || '';
if (tempPkg.spm && /\.css$/.test(main)) {
ret[tempPkg.name] = 'sea-modules/' + tempPkg.name + '/' + tempPkg.version + '/' + main;
ret[tempPkg.name] = SEA_MODULES + '/' + tempPkg.name + '/' + tempPkg.version + '/' + main;
}
});
});
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
],
"dependencies": {
"archy": "~0.0.2",
"colorful": "~2.1.0",
"co": "3.1.0",
"colorful": "~2.1.0",
"commander": "~2.3.0",
"exeq": "~1.0.0",
"form-data": "~0.1.2",
Expand Down Expand Up @@ -55,12 +55,12 @@
"request": "~2.36.0",
"rimraf": "~2.2.5",
"semver": "~2.2.1",
"serve-spm": "~0.3.1",
"spmrc": "~1.1.0",
"serve-spm": "~0.4.0",
"spm-client": "~0.2.0",
"spmrc": "^1.2.0",
"tar": "~0.1.19",
"umi": "~0.5.0",
"win-spawn": "~2.0.0",
"spm-client": "~0.2.0"
"win-spawn": "~2.0.0"
},
"devDependencies": {
"sinon": "*",
Expand Down