Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: 3.3.x to master #6169

Merged
merged 10 commits into from
Feb 26, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ $ npm run release
$ npm run release -- --publish-only
$ npm run release -- --skip-git-status-check
$ npm run release -- --skip-build
$ npm run release -- --otp
```

## Create new package
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
"benchmark": "^2.1.4",
"escape-goat": "^3.0.0",
"father-build": "^1.19.0",
"git-repo-info": "^2.1.1",
"inquirer": "^7.3.3",
"lerna": "^3.22.1",
"lint-staged": "^10.2.11",
"new-github-release-url": "^1.0.0",
Expand Down
4 changes: 3 additions & 1 deletion packages/bundler-webpack/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,14 @@ class Bundler {
bundleImplementor?: typeof defaultWebpack;
}): IServerOpts {
const compiler = bundleImplementor.webpack(bundleConfigs);
const { devServer } = this.config;
const { ssr, devServer } = this.config;
// 这里不做 winPath 处理,是为了和下方的 path.sep 匹配上
const compilerMiddleware = webpackDevMiddleware(compiler, {
// must be /, otherwise it will exec next()
publicPath: '/',
logLevel: 'silent',
// if `ssr` set false, next() into server-side render
...(ssr ? { index: false } : {}),
writeToDisk: devServer && devServer?.writeToDisk,
watchOptions: {
// not watch outputPath dir and node_modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function (api: IApi) {

api.modifyBundleConfig((bundleConfig, { env, type, bundler: { id } }) => {
const enableWriteToDisk =
api.config.devServer && api.config.devServer?.writeToDisk;
api.config.devServer && api.config.devServer.writeToDisk;
if (
(env === 'production' || enableWriteToDisk) &&
id === 'webpack' &&
Expand Down
51 changes: 31 additions & 20 deletions scripts/release.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const { yParser, execa, chalk } = require('@umijs/utils');
const { join } = require('path');
const { writeFileSync } = require('fs');
const getRepoInfo = require('git-repo-info');
const inquirer = require('inquirer');
const newGithubReleaseUrl = require('new-github-release-url');
const open = require('open');
const exec = require('./utils/exec');
Expand Down Expand Up @@ -121,7 +123,8 @@ async function release() {

// Push
logStep(`git push`);
await exec('git', ['push', 'origin', 'master', '--tags']);
const { branch } = getRepoInfo();
await exec('git', ['push', 'origin', branch, '--tags']);
}

// Publish
Expand All @@ -130,27 +133,35 @@ async function release() {
logStep(`publish packages: ${chalk.blue(pkgs.join(', '))}`);
const currVersion = require('../lerna').version;
const isNext = isNextVersion(currVersion);
pkgs
.sort((a) => {
return a === 'umi' ? 1 : -1;
})
.forEach((pkg, index) => {
const pkgPath = join(cwd, 'packages', pkg);
const { name, version } = require(join(pkgPath, 'package.json'));
if (version === currVersion) {
console.log(
`[${index + 1}/${pkgs.length}] Publish package ${name} ${
isNext ? 'with next tag' : ''
}`,
);
const cliArgs = isNext ? ['publish', '--tag', 'next'] : ['publish'];
const { stdout } = execa.sync('npm', cliArgs, {
cwd: pkgPath,
const releasePkgs = pkgs.sort((a) => {
return a === 'umi' ? 1 : -1;
});
for (const [index, pkg] of releasePkgs.entries()) {
const pkgPath = join(cwd, 'packages', pkg);
const { name, version } = require(join(pkgPath, 'package.json'));
if (version === currVersion) {
console.log(
`[${index + 1}/${pkgs.length}] Publish package ${name} ${
isNext ? 'with next tag' : ''
}`,
);
let cliArgs = isNext ? ['publish', '--tag', 'next'] : ['publish'];
// one-time password from your authenticator
if (args.otp) {
const { otp } = await inquirer.prompt({
ycjcl868 marked this conversation as resolved.
Show resolved Hide resolved
name: 'otp',
type: 'input',
message: 'This operation requires a one-time password:',
validate: (msg) => !!msg,
});
console.log(stdout);
cliArgs = cliArgs.concat(['--otp', otp]);
}
});

const { stdout } = execa.sync('npm', cliArgs, {
cwd: pkgPath,
});
console.log(stdout);
}
}
logStep('create github release');
const tag = `v${currVersion}`;
const changelog = releaseNotes(tag);
Expand Down
42 changes: 39 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5051,6 +5051,11 @@ cli-width@^2.0.0:
resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.1.tgz#b0433d0b4e9c847ef18868a4ef16fd5fc8271c48"
integrity sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==

cli-width@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6"
integrity sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==

clipboard@^2.0.0:
version "2.0.6"
resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.6.tgz#52921296eec0fdf77ead1749421b21c968647376"
Expand Down Expand Up @@ -6906,7 +6911,7 @@ figures@^2.0.0:
dependencies:
escape-string-regexp "^1.0.5"

figures@^3.2.0:
figures@^3.0.0, figures@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af"
integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==
Expand Down Expand Up @@ -7296,6 +7301,11 @@ git-remote-origin-url@^2.0.0:
gitconfiglocal "^1.0.0"
pify "^2.3.0"

git-repo-info@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/git-repo-info/-/git-repo-info-2.1.1.tgz#220ffed8cbae74ef8a80e3052f2ccb5179aed058"
integrity sha512-8aCohiDo4jwjOwma4FmYFd3i97urZulL8XL24nIPxuE+GZnfsAyy/g2Shqx6OjUiFKUXZM+Yy+KHnOmmA3FVcg==

git-semver-tags@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-2.0.3.tgz#48988a718acf593800f99622a952a77c405bfa34"
Expand Down Expand Up @@ -8184,6 +8194,25 @@ inquirer@^6.2.0:
strip-ansi "^5.1.0"
through "^2.3.6"

inquirer@^7.3.3:
version "7.3.3"
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.3.3.tgz#04d176b2af04afc157a83fd7c100e98ee0aad003"
integrity sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==
dependencies:
ansi-escapes "^4.2.1"
chalk "^4.1.0"
cli-cursor "^3.1.0"
cli-width "^3.0.0"
external-editor "^3.0.3"
figures "^3.0.0"
lodash "^4.17.19"
mute-stream "0.0.8"
run-async "^2.4.0"
rxjs "^6.6.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"
through "^2.3.6"

invariant@^2.2.4:
version "2.2.4"
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
Expand Down Expand Up @@ -10561,7 +10590,7 @@ mute-stream@0.0.7:
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=

mute-stream@~0.0.4:
mute-stream@0.0.8, mute-stream@~0.0.4:
version "0.0.8"
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d"
integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==
Expand Down Expand Up @@ -13441,7 +13470,7 @@ rsvp@^4.8.4:
resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734"
integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==

run-async@^2.2.0:
run-async@^2.2.0, run-async@^2.4.0:
version "2.4.1"
resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455"
integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==
Expand All @@ -13460,6 +13489,13 @@ rxjs@^6.4.0, rxjs@^6.6.3:
dependencies:
tslib "^1.9.0"

rxjs@^6.6.0:
version "6.6.6"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.6.tgz#14d8417aa5a07c5e633995b525e1e3c0dec03b70"
integrity sha512-/oTwee4N4iWzAMAL9xdGKjkEHmIwupR3oXbQjCKywF1BeFohswF3vZdogbmEF6pZkOsXTzWkrZszrWpQTByYVg==
dependencies:
tslib "^1.9.0"

safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.2"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
Expand Down