-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from hot-loader/publishing-automation
Publishing automation - start
- Loading branch information
Showing
19 changed files
with
4,036 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
version: 2 | ||
jobs: | ||
sanity_check: | ||
working_directory: ~/project | ||
docker: | ||
- image: circleci/node:10 | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
name: Restore Yarn Package Cache | ||
keys: | ||
- yarn-packages-{{ checksum "yarn.lock" }} | ||
- run: | ||
name: Install Dependencies | ||
command: yarn install --frozen-lockfile | ||
- save_cache: | ||
name: Save Yarn Package Cache | ||
key: yarn-packages-{{ checksum "yarn.lock" }} | ||
paths: | ||
- ~/.cache/yarn | ||
- run: | ||
name: Run Tests | ||
command: yarn test | ||
|
||
publish_if_needed: | ||
working_directory: ~/project | ||
docker: | ||
- image: circleci/node:10 | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
name: Restore Yarn Package Cache | ||
keys: | ||
- yarn-packages-{{ checksum "yarn.lock" }} | ||
- run: | ||
name: Install Dependencies | ||
command: yarn install --frozen-lockfile | ||
- save_cache: | ||
name: Save Yarn Package Cache | ||
key: yarn-packages-{{ checksum "yarn.lock" }} | ||
paths: | ||
- ~/.cache/yarn | ||
- run: | ||
name: Run Tests | ||
command: node auto-publish/index.js | ||
|
||
workflows: | ||
version: 2 | ||
|
||
for_every_push: | ||
jobs: | ||
- sanity_check | ||
|
||
publish_if_needed: | ||
triggers: | ||
- schedule: | ||
cron: "0,30 * * * *" | ||
filters: | ||
branches: | ||
only: | ||
- publishing-automation | ||
jobs: | ||
- publish_if_needed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
node_modules | ||
target | ||
yarn-error.log | ||
yarn-error.log | ||
auto-publish/staging-area | ||
auto-publish/staging-area-for-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
//registry.npmjs.org/:_authToken=${NPM_TOKEN} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lts/Dubnium |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["orta.vscode-jest", "editorconfig.editorconfig", "orta.vscode-jest"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"debug.node.autoAttach": "on", | ||
"jest.debugMode": false, | ||
"jest.autoEnable": false, | ||
"jest.enableCodeLens": true, | ||
"jest.enableInlineErrorMessages": true, | ||
"jest.runAllTestsFirst": true, | ||
"jest.debugCodeLens.showWhenTestStateIn": ["fail", "unknown", "pass", "skip"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
registry "https://registry.npmjs.org" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const path = require("path"); | ||
const fs = require("fs-extra"); | ||
const { getAndPatchGivenReactDOMVersionWithGivenRHLVersion } = require("./utils"); | ||
|
||
(async () => { | ||
const targetDir = await getAndPatchGivenReactDOMVersionWithGivenRHLVersion(path.resolve(__dirname, "staging-area"), "16.8.6", "4.12.3", "@hot-loader/react-dom"); | ||
await fs.copy(targetDir, path.resolve(__dirname, "../target")) | ||
|
||
console.log("Done!", { targetDir }); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
const path = require("path"); | ||
const fs = require("fs-extra"); | ||
const { | ||
execFile, | ||
doesReactDOMOrHotLoaderHasNewerVersionThanUs, | ||
getAndPatchGivenReactDOMVersionWithGivenRHLVersion | ||
} = require("./utils"); | ||
|
||
// test with https://github.com/verdaccio/verdaccio ??? | ||
|
||
(async () => { | ||
const ourDistTag = "latest"; | ||
|
||
// TODO: cover more dist tags | ||
const answer = await doesReactDOMOrHotLoaderHasNewerVersionThanUs( | ||
"latest", | ||
"latest", | ||
"test-org-bnaya-2", | ||
"_rc" | ||
); | ||
|
||
if (answer) { | ||
console.info("Going to publish!", answer) | ||
if ( | ||
answer.reactDOMVersion === null || | ||
answer.reactHotLoaderVersion === null | ||
) { | ||
throw new Error("Versions to publish by can't be null"); | ||
} | ||
|
||
const patchedPackageDir = await getAndPatchGivenReactDOMVersionWithGivenRHLVersion( | ||
path.resolve(__dirname, "staging-area"), | ||
answer.reactDOMVersion, | ||
answer.reactHotLoaderVersion, | ||
"test-org-bnaya-2" | ||
); | ||
|
||
console.info("don't really publish yet", { patchedPackageDir }); | ||
|
||
// const publishStdOut = await execFile( | ||
// "yarn", | ||
// [ | ||
// "publish", | ||
// "--tag", | ||
// ourDistTag + "_rc", | ||
// "-y", | ||
// "--access", | ||
// "public", | ||
// "--json" | ||
// ], | ||
// patchedPackageDir, | ||
// 10000 | ||
// ); | ||
|
||
// console.info("Done publishing!", { publishStdOut }); | ||
} else { | ||
console.info("Nothing to publish"); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
export interface yarnInfoJsonResponse { | ||
type: "inspect"; | ||
data: { | ||
name: string; | ||
"dist-tags": Partial<{ | ||
[k: string]: string | ||
}>; | ||
versions: string[]; | ||
time: { [key: string]: string }; | ||
maintainers: Array<{ | ||
name: string; | ||
email: string; | ||
}>; | ||
description: string; | ||
homepage: string; | ||
repository: { | ||
type: string; | ||
url: string; | ||
}; | ||
bugs: { | ||
url: string; | ||
}; | ||
license: string; | ||
readmeFilename: string; | ||
keywords: string[]; | ||
version: string; | ||
}; | ||
/* | ||
example data: | ||
{ | ||
"type": "inspect", | ||
"data": { | ||
"name": "@hot-loader/react-dom", | ||
"dist-tags": { "latest": "16.8.6" }, | ||
"versions": [ | ||
"16.7.0-alpha.2", | ||
"16.7.0-alpha.2.1", | ||
"16.7.0-alpha.2.2", | ||
"16.7.0-alpha.2.3", | ||
"16.7.0-alpha.2.4", | ||
"16.7.0", | ||
"16.8.0-alpha.0", | ||
"16.8.1", | ||
"16.8.2", | ||
"16.8.3", | ||
"16.8.4", | ||
"16.8.5", | ||
"16.8.6" | ||
], | ||
"time": { | ||
"created": "2018-11-21T10:47:51.342Z", | ||
"16.7.0-alpha.2": "2018-11-21T10:47:51.742Z", | ||
"modified": "2019-03-28T09:32:10.123Z", | ||
"16.7.0-alpha.2.1": "2018-11-21T21:35:44.318Z", | ||
"16.7.0-alpha.2.2": "2018-12-07T12:21:53.582Z", | ||
"16.7.0-alpha.2.3": "2018-12-17T06:55:29.788Z", | ||
"16.7.0-alpha.2.4": "2018-12-19T09:23:40.548Z", | ||
"16.7.0": "2018-12-20T09:22:04.981Z", | ||
"16.8.0-alpha.0": "2019-01-10T04:39:04.893Z", | ||
"16.8.1": "2019-02-07T00:17:32.764Z", | ||
"16.8.2": "2019-02-18T21:58:30.554Z", | ||
"16.8.3": "2019-02-25T21:15:23.701Z", | ||
"16.8.4": "2019-03-07T09:04:23.315Z", | ||
"16.8.5": "2019-03-25T11:19:27.329Z", | ||
"16.8.6": "2019-03-28T09:32:06.816Z" | ||
}, | ||
"maintainers": [{ "name": "kashey", "email": "thekashey@gmail.com" }], | ||
"description": "The Hot version of React-DOM", | ||
"homepage": "https://github.com/hot-loader/react-dom#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/hot-loader/react-dom.git" | ||
}, | ||
"bugs": { "url": "https://github.com/hot-loader/react-dom/issues" }, | ||
"license": "MIT", | ||
"readmeFilename": "README.md", | ||
"keywords": ["HMR", "react", "hot-loader"], | ||
"version": "latest" | ||
} | ||
} | ||
*/ | ||
} |
Oops, something went wrong.