Skip to content

publish packages publicly #3368

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

Merged
merged 2 commits into from
Jul 7, 2020
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
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"changelog": ["@changesets/changelog-github", { "repo": "firebase/firebase-js-sdk"}],
"commit": false,
"linked": [],
"access": "restricted",
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": [
Expand Down
3 changes: 3 additions & 0 deletions .changeset/perfect-terms-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---

---
8 changes: 5 additions & 3 deletions scripts/release/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const prompt = createPromptModule();
/**
* Determine if the current release is a staging or production release
*/
const releaseType = await (async () => {
const releaseType: string = await (async () => {
if (argv.canary) return ReleaseType.Canary;
/**
* Capture the release type if it was passed to the CLI via args
Expand All @@ -77,7 +77,9 @@ const prompt = createPromptModule();
/**
* Prompt for the release type (i.e. staging/prod)
*/
const responses = await prompt([releaseTypePrompt]);
const responses = await prompt<{ [key: string]: string }>([
releaseTypePrompt
]);
return responses.releaseType;
})();

Expand Down Expand Up @@ -133,7 +135,7 @@ const prompt = createPromptModule();
* Release new versions to NPM using changeset
* It will also create tags
*/
await publish();
await publish(releaseType);

/**
* Changeset creats tags for staging releases as well,
Expand Down
10 changes: 8 additions & 2 deletions scripts/release/utils/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@

import { spawn } from 'child-process-promise';
import { projectRoot as root } from '../../utils';
import { ReleaseType } from './enums';

export async function publish() {
await spawn('yarn', ['changeset', 'publish'], {
export async function publish(releaseType: string) {
let tag: string[] = [];
if (releaseType === ReleaseType.Staging) {
tag = ['--tag', 'next'];
}

await spawn('yarn', ['changeset', 'publish', ...tag], {
cwd: root,
stdio: 'inherit'
});
Expand Down