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

misc: add instructions about test release #2486

Merged
merged 11 commits into from
Apr 2, 2020
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ node_modules
.eslintcache

yarn-error.log
admin/tmp
build
.docusaurus
.cache-loader
Expand Down
30 changes: 30 additions & 0 deletions admin/publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,36 @@ If you are not currently logged into npm on your CLI, do the following:

If you're publishing new v2 versions, 2FA might get in the way as the pin might expire during the publishing as there are over 10 packages to publish. You're encouraged not to use the "Authorization and Publishing" 2FA option.

### 0. Test build

First run your own private npm proxy registry (by default it will be available at http://localhost:4000/):

```bash
yarn test:registry
```

Do not close this bash session and then open a new one and build packages in it:

```bash
yarn test:release
```

Now install the skeleton website with the new version of Docusaurus:

```bash
NPM_CONFIG_REGISTRY=http://localhost:4000/ npx @docusaurus/init@latest init test-website classic
```

All ready for start the dev server and build the website:

```bash
cd test-website
yarn start
yarn build # after manual testing in browser
```

If there are no errors, you can start preparing for the new release. The bash session running private npm registry can be closed.

### 1. Update the v2 changelog

Generate a GitHub auth token by going to https://github.com/settings/tokens. Save the token somewhere for future reference.
Expand Down
28 changes: 28 additions & 0 deletions admin/scripts/test-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

set -euo pipefail

CUSTOM_REGISTRY_URL="http://localhost:4000"
ORIGINAL_NPM_REGISTRY_URL=`npm get registry`
ORIGINAL_YARN_REGISTRY_URL=`yarn config get registry`
NEW_VERSION="$(node -p "require('./packages/docusaurus/package.json').version").NEW"

# Clean up
rm -rf admin/tmp

# Building packages
yarn tsc

# Set registry to local registry
npm set registry "$CUSTOM_REGISTRY_URL"
yarn config set registry "$CUSTOM_REGISTRY_URL"

# Publish the monorepo
lerna publish --yes --no-verify-access --no-git-tag-version --no-push --registry "$CUSTOM_REGISTRY_URL" "$NEW_VERSION"

# Revert version changes
git diff --name-only -- '*.json' | sed 's, ,\\&,g' | xargs git checkout --

# Restore the original NPM and Yarn registry URLs
npm set registry "$ORIGINAL_NPM_REGISTRY_URL"
yarn config set registry "$ORIGINAL_YARN_REGISTRY_URL"
31 changes: 31 additions & 0 deletions admin/verdaccio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# This is the default config file. It allows all users to do anything,
# so don't use it on production systems.
#
# Look here for more config file examples:
# https://github.com/verdaccio/verdaccio/tree/master/conf
#

# File paths are relative to this configuration file.

# Path to a directory with all packages
storage: ./tmp/verdaccio

# A list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/

packages:
'**':
# Allow all users (including non-authenticated users) to read and
# publish all packages
access: $all
publish: $all

# Download from npm if a package is not available in the local registry
proxy: npmjs

# Log settings
logs:
- {type: stdout, format: pretty, level: http}
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const ignorePatterns = [
'/packages/docusaurus-plugin-content-blog/lib',
'/packages/docusaurus-plugin-content-docs/lib',
'/packages/docusaurus-plugin-content-pages/lib',
'/admin/',
];

module.exports = {
Expand All @@ -24,6 +25,7 @@ module.exports = {
testEnvironment: 'node',
testPathIgnorePatterns: ignorePatterns,
coveragePathIgnorePatterns: ignorePatterns,
modulePathIgnorePatterns: ignorePatterns,
transform: {
'^.+\\.[jt]sx?$': 'babel-jest',
},
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"lint": "eslint --cache \"**/*.js\" && stylelint \"**/*.css\"",
"lerna": "lerna",
"test": "jest",
"test:registry": "verdaccio --listen 4002 --config ./admin/verdaccio.yaml",
"test:release": "./admin/scripts/test-release.sh",
"tsc": "lerna run tsc --no-private"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-1.x/lib/core/DocsSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
const React = require('react');
const fs = require('fs');
const SideNav = require('./nav/SideNav.js');
const Metadata = require('../core/metadata.js');
const Metadata = require('./core/metadata.js');
lex111 marked this conversation as resolved.
Show resolved Hide resolved

const readCategories = require('../server/readCategories.js');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ exports[`blogFeed rss can show feed without posts 1`] = `
<link>https://docusaurus.io/blog</link>
<description>Hello Blog</description>
<lastBuildDate>Sun, 25 Oct 2015 23:29:00 GMT</lastBuildDate>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<docs>https://validator.w3.org/feed/docs/rss2.html</docs>
lex111 marked this conversation as resolved.
Show resolved Hide resolved
<generator>https://github.com/jpmonette/feed</generator>
<copyright>Copyright</copyright>
</channel>
Expand All @@ -72,27 +72,27 @@ exports[`blogFeed rss shows feed item for each post 1`] = `
<link>https://docusaurus.io/blog</link>
<description>Hello Blog</description>
<lastBuildDate>Thu, 27 Feb 2020 00:00:00 GMT</lastBuildDate>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<docs>https://validator.w3.org/feed/docs/rss2.html</docs>
<generator>https://github.com/jpmonette/feed</generator>
<copyright>Copyright</copyright>
<item>
<title><![CDATA[draft]]></title>
<link>https://docusaurus.io/blog/2020/02/27/draft</link>
<guid>https://docusaurus.io/blog/2020/02/27/draft</guid>
<guid>draft</guid>
<pubDate>Thu, 27 Feb 2020 00:00:00 GMT</pubDate>
<description><![CDATA[this post should not be published yet]]></description>
</item>
<item>
<title><![CDATA[date-matter]]></title>
<link>https://docusaurus.io/blog/2019/01/01/date-matter</link>
<guid>https://docusaurus.io/blog/2019/01/01/date-matter</guid>
<guid>date-matter</guid>
<pubDate>Tue, 01 Jan 2019 00:00:00 GMT</pubDate>
<description><![CDATA[date inside front matter]]></description>
</item>
<item>
<title><![CDATA[Happy 1st Birthday Slash!]]></title>
<link>https://docusaurus.io/blog/2018/12/14/Happy-First-Birthday-Slash</link>
<guid>https://docusaurus.io/blog/2018/12/14/Happy-First-Birthday-Slash</guid>
<guid>Happy 1st Birthday Slash!</guid>
<pubDate>Fri, 14 Dec 2018 00:00:00 GMT</pubDate>
<description><![CDATA[pattern name]]></description>
</item>
Expand Down
Loading