Skip to content

Commit

Permalink
Merge pull request #223 from alibaba/dev
Browse files Browse the repository at this point in the history
更新到 1.9.0 (update 默认不清理 lockfile) & 其他
  • Loading branch information
jeasonstudio committed Jul 2, 2020
2 parents 544ae34 + 7ae2bdb commit ff5a05e
Show file tree
Hide file tree
Showing 26 changed files with 1,127 additions and 403 deletions.
5 changes: 3 additions & 2 deletions bin/cli-core.js
Expand Up @@ -93,11 +93,12 @@ cmdline
}, false)

.root.command(['template', 'middleware', 'update', 'u', 'config', 'c'])
.action(async function (cmd, env) {
.option(['-f', '--force'], 'switch')
.action(async function (cmd, force) {
cmd = ALIAS[cmd] || cmd;
this.set('command', cmd);
try {
await core.commands[cmd].call(this, cmd);
await core.commands[cmd].call(this, force);
cmdline.onDone(this);
} catch (err) {
cmdline.onFail(err);
Expand Down
5 changes: 3 additions & 2 deletions lib/commands/update.js
Expand Up @@ -7,13 +7,14 @@ const console = require('../common/console');
const store = require('../store');
const mod = require('../mod');

module.exports = async function () {
module.exports = async function (cleanLock) {
console.info('Updating...');
if (cleanLock) console.log('Clean lockfile..')
await Promise.all([
store.clean('stamps'),
store.clean('caches'),
store.clean('modules'),
mod.clean()
mod.clean(cleanLock)
]);
await mod.install();
console.info('Done');
Expand Down
11 changes: 6 additions & 5 deletions lib/mod.js
Expand Up @@ -128,9 +128,10 @@ exports.getDocUrl = async function (name, prefix) {
return url;
};

exports.clean = async function () {
await del([
path.normalize(`${process.cwd()}/node_modules/`),
path.normalize(`${process.cwd()}/package-lock.json`)
], { force: true });
exports.clean = async function (cleanLock) {
const items = [path.normalize(`${process.cwd()}/node_modules/`)];
if (cleanLock) {
items.push(path.normalize(`${process.cwd()}/package-lock.json`));
}
await del(items, { force: true });
};
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "dawn",
"version": "1.8.5",
"version": "1.9.0",
"description": "dawn cli",
"main": "./lib/index.js",
"bin": {
Expand Down
17 changes: 3 additions & 14 deletions packages/dn-middleware-e2e/.dawn/pipe.yml
@@ -1,15 +1,4 @@
init:
- name: tnpm-install
- name: pkginfo

dev:
- name: $local
location: ./lib/index.js

#中间工程并非要发布到 CDN
#不放到 aliyun group 下也不会发到 CND
#只是中间件的版本管理是基于 tag 的,恰好使用
publish:
- name: shell
script:
- tnpm pu
- name: ./lib/index.js
puppeteer:
version: latest
2 changes: 2 additions & 0 deletions packages/dn-middleware-e2e/.dawn/rc.yml
@@ -0,0 +1,2 @@
registry: https://registry.npm.taobao.org
server: https://query.aliyun.com/rest/dc.service.cli?team=general&conf=
139 changes: 0 additions & 139 deletions packages/dn-middleware-e2e/.eslintrc.json

This file was deleted.

103 changes: 0 additions & 103 deletions packages/dn-middleware-e2e/.eslintrc.yml

This file was deleted.

26 changes: 26 additions & 0 deletions packages/dn-middleware-e2e/e2e/demo.e2e.ts
@@ -0,0 +1,26 @@
import assert from 'assert';
import { launch, Browser } from 'puppeteer';

describe('demo test', function () {

let browser: Browser;
beforeEach(async function () {
browser = await launch({
headless: true,
slowMo: 0,
defaultViewport: {
width: 1000,
height: 600,
}
});
});

it('check title', async function () {
const page = await browser.newPage();
browser
await page.goto('https:/www.baidu.com/');
const title = await page.title();
assert.equal(title, '百度一下,你就知道');
});

});

0 comments on commit ff5a05e

Please sign in to comment.