Skip to content
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
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Next

### Improvements

- [internal] Improve publish script for creating github release ([#999](https://github.com/cssinjs/jss/pull/999))

### Bug fixes

- [jss-starter-kit] Fix react-jss exports and add missing jss exports ([#1001](https://github.com/cssinjs/jss/pull/1001))
Expand Down
8 changes: 1 addition & 7 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
{
"npmClient": "yarn",
"useWorkspaces": true,
"version": "10.0.0-alpha.9",
"command": {
"publish": {
"allowBranch": ["master"],
"forcePublish": "*"
}
}
"version": "10.0.0-alpha.9"
}
18 changes: 7 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,22 @@
],
"scripts": {
"build": "lerna run build",

"check:all": "yarn check:flow && yarn check:ts && yarn check:snapshots && yarn check:lint",
"check:flow": "flow check --max-warnings=0",
"check:ts": "tsc",
"check:snapshots": "lerna run check-snapshot",
"check:lint": "eslint scripts/ packages/ docs/ --ext js,md",

"format": "prettier \"*.{js,md,json}\" \"{docs,packages,scripts}/**/*.{js,md,json}\" --write",
"format:ci": "yarn format -- --list-different",

"format:ci": "yarn format --list-different",
"test": "karma start --single-run",
"test:watch": "karma start",
"posttest": "[ -z \"$TRAVIS\" ] || codecov",
"codecov": "codecov",
"bench": "cross-env BENCHMARK=true karma start --single-run",

"test:bench": "cross-env BENCHMARK=true karma start --single-run",
"pre-commit": "lint-staged && yarn check:all",

"---Release Scripts---": "",
"version": "yarn build && yarn test && node ./scripts/update-changelog && node ./scripts/add-git-files",
"prerelease": "yarn check:all && yarn format:ci",
"release": "lerna publish --no-push --exact",
"postrelease": "node ./scripts/create-git-tag && git push --tags",
"release": "lerna publish --exact --force-publish * --allow-branch master",
"postrelease": "node ./scripts/create-github-release",
"release:patch": "yarn release patch --dist-tag latest",
"release:minor": "yarn release minor --dist-tag latest",
"release:major": "yarn release major --dist-tag latest",
Expand Down Expand Up @@ -60,6 +53,8 @@
"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@lerna/prompt": "^3.6.0",
"axios": "^0.18.0",
"babel-loader": "^8.0.4",
"babel-plugin-dev-expression": "^0.2.1",
"camelcase": "^5.0.0",
Expand Down Expand Up @@ -89,6 +84,7 @@
"lerna": "^3.8.0",
"lint-staged": "^3.2.2",
"mocha": "^3.2.0",
"npmlog": "^4.1.2",
"pre-commit": "^1.1.3",
"prettier": "^1.13.5",
"raf": "^3.4.0",
Expand Down
39 changes: 0 additions & 39 deletions scripts/create-git-tag.js

This file was deleted.

61 changes: 61 additions & 0 deletions scripts/create-github-release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const fs = require('fs')
const path = require('path')
const axios = require('axios')
const log = require('npmlog/log')
const {input} = require('@lerna/prompt')

const lerna = require('../lerna')
const {CHANGELOG_FILENAME} = require('./constants')

function getChangelog() {
const content = fs.readFileSync(path.join(process.cwd(), CHANGELOG_FILENAME), 'utf-8')
const lines = content.split('\n')
let hasStarted = false
let hasFinished = false

return lines
.filter(line => {
if (hasFinished) {
return false
}

if (hasStarted) {
hasFinished = line.startsWith('## ')

return !hasFinished
}

hasStarted = line.startsWith(`## ${lerna.version}`)

return false
})
.join('\n')
}

input('Github Username:')
.then(username =>
input('Github password:').then(password => ({
username,
password
}))
)
.then(auth =>
axios.request({
method: 'POST',
url: `/repos/cssinjs/jss/releases`,
baseURL: `https://api.github.com`,
data: {
tag_name: `v${lerna.version}`,
name: `v${lerna.version}`,
body: getChangelog(),
prerelease: lerna.version.includes('alpha')
},
auth
})
)
.then(() => {
log.info('jss', 'Successfully created github release')
})
.catch(err => {
log.error('jss', `Error while creating github release: ${err.message}`)
})
24 changes: 16 additions & 8 deletions scripts/update-changelog.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
const fs = require('fs')
const Path = require('path')
const path = require('path')
const log = require('npmlog/log')

const lerna = require('../lerna')
const {CHANGELOG_FILENAME} = require('./constants')

const changelogPath = Path.join(process.cwd(), CHANGELOG_FILENAME)
const changelogPath = path.join(process.cwd(), CHANGELOG_FILENAME)
const content = fs.readFileSync(changelogPath, 'utf-8')

const lines = content
.split('\n')
.map(line => {
if (line.startsWith(`## ${lerna.version} (unreleased)`)) {
if (line === '## Next') {
const today = new Date()
return line.replace(
'unreleased',
`${today.getUTCFullYear()}-${today.getUTCMonth() + 1}-${today.getUTCDate()}`
)
const date = `${today.getUTCFullYear()}-${today.getUTCMonth() + 1}-${today.getUTCDate()}`

return `## ${lerna.version} (${date})`
}

return line
})
.join('\n')

fs.writeFile(changelogPath, lines, 'utf-8')
fs.writeFile(changelogPath, lines, 'utf-8', err => {
if (err) {
log.error('jss', 'Error while updating changelog')
process.exit(1)
} else {
log.info('jss', 'Successfully updated changelog')
}
})
19 changes: 17 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@
resolve-from "^4.0.0"
write-json-file "^2.3.0"

"@lerna/prompt@3.6.0":
"@lerna/prompt@3.6.0", "@lerna/prompt@^3.6.0":
version "3.6.0"
resolved "https://registry.yarnpkg.com/@lerna/prompt/-/prompt-3.6.0.tgz#b17cc464dec9d830619723e879dc747367378217"
integrity sha512-nyAjPMolJ/ZRAAVcXrUH89C4n1SiWvLh4xWNvWYKLcf3PI5yges35sDFP/HYrM4+cEbkNFuJCRq6CxaET4PRsg==
Expand Down Expand Up @@ -2089,6 +2089,14 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f"
integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==

axios@^0.18.0:
version "0.18.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.18.0.tgz#32d53e4851efdc0a11993b6cd000789d70c05102"
integrity sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=
dependencies:
follow-redirects "^1.3.0"
is-buffer "^1.1.5"

axobject-query@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.0.1.tgz#05dfa705ada8ad9db993fa6896f22d395b0b0a07"
Expand Down Expand Up @@ -3356,7 +3364,7 @@ debug@2.6.8:
dependencies:
ms "2.0.0"

debug@3.1.0:
debug@3.1.0, debug@=3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
Expand Down Expand Up @@ -4380,6 +4388,13 @@ follow-redirects@^1.0.0:
dependencies:
debug "^3.1.0"

follow-redirects@^1.3.0:
version "1.6.1"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.6.1.tgz#514973c44b5757368bad8bddfe52f81f015c94cb"
integrity sha512-t2JCjbzxQpWvbhts3l6SH1DKzSrx8a+SsaVf4h6bG4kOXUuPYS/kg2Lr4gQSb7eemaHqJkOThF1BGyjlUkO1GQ==
dependencies:
debug "=3.1.0"

for-in@^1.0.1, for-in@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
Expand Down