Skip to content

Commit

Permalink
Upgrade documentalist, refactor CI config (#3482)
Browse files Browse the repository at this point in the history
  • Loading branch information
adidahiya committed Apr 18, 2019
1 parent 0f391fd commit 357ff5c
Show file tree
Hide file tree
Showing 32 changed files with 193 additions and 185 deletions.
170 changes: 81 additions & 89 deletions .circleci/config.yml
@@ -1,112 +1,108 @@
version: 2

# this block contains anchors to reusable blocks of config.
references:
setup_env: &setup_env
docker:
- image: circleci/node:8.10.0
save_cache: &save_cache
key: v9-dependency-cache-{{ checksum "yarn.lock" }}
aliases:
- &docker-node-lts
- image: circleci/node:lts

- &docker-node-browsers
- image: circleci/node:8.10.0-browsers
environment:
CHROME_BIN: "/usr/bin/google-chrome"

- &restore-node-modules-cache
name: Restore node_modules cache
key: v1-yarn-deps-{{ checksum "yarn.lock" }}

- &restore-yarn-cache
name: Restore yarnpkg cache
key: v1-yarn-cache

- &save-node-modules-cache
name: Save node_modules cache
paths:
- node_modules
# explicitly list each package node_modules
- packages/core/node_modules
- packages/datetime/node_modules
- packages/docs-app/node_modules
- packages/docs-data/node_modules
- packages/docs-theme/node_modules
- packages/icons/node_modules
- packages/karma-build-scripts/node_modules
- packages/labs/node_modules
- packages/landing-app/node_modules
- packages/node-build-scripts/node_modules
- packages/select/node_modules
- packages/table/node_modules
- packages/table-dev-app/node_modules
- packages/test-commons/node_modules
- packages/test-react15/node_modules
- packages/timezone/node_modules
- packages/tslint-config/node_modules
- packages/webpack-build-scripts/node_modules
restore_cache: &restore_cache
keys:
- v9-dependency-cache-{{ checksum "yarn.lock" }}
- v9-dependency-cache-
persist_to_workspace: &persist_to_workspace
root: '.'
key: v1-yarn-deps-{{ checksum "yarn.lock" }}

- &save-yarn-cache
name: Save yarnpkg cache
paths:
# directories to persist to workspace
- packages/*/dist
- packages/*/lib
- packages/*/src/generated
- ~/.cache/yarn
key: v1-yarn-cache

references:
reports_path: &reports_path
path: ./reports

jobs:
install-dependencies:
<<: *setup_env
checkout-code:
docker: *docker-node-lts
steps:
- checkout
- attach_workspace:
at: '.'
- restore_cache: *restore_cache
- run: yarn --frozen-lockfile
- run: npm rebuild node-sass
- save_cache: *save_cache
- restore_cache: *restore-yarn-cache
- restore_cache: *restore-node-modules-cache
- run: yarn install --non-interactive --cache-folder ~/.cache/yarn
- run:
name: Check if yarn.lock changed during install
command: git diff --exit-code
- save_cache: *save-node-modules-cache
- save_cache: *save-yarn-cache
- persist_to_workspace:
root: '.'
paths:
- yarn.lock
paths: [packages/*/node_modules]

clean-lockfile:
docker: *docker-node-lts
steps:
- checkout
- restore_cache: *restore-node-modules-cache
- run: ./scripts/verifyCleanLockfile.sh

compile:
<<: *setup_env
docker: *docker-node-lts
steps:
- checkout
- attach_workspace:
at: '.'
- restore_cache: *restore_cache
- restore_cache: *restore-node-modules-cache
- attach_workspace: { at: '.' }
- run: yarn compile
- persist_to_workspace: *persist_to_workspace
- persist_to_workspace:
root: '.'
paths: [packages/*/lib, packages/*/src/generated]

lint:
<<: *setup_env
docker: *docker-node-lts
environment:
JUNIT_REPORT_PATH: reports
steps:
- checkout
- attach_workspace:
at: '.'
- restore_cache: *restore_cache
- restore_cache: *restore-node-modules-cache
- attach_workspace: { at: '.' }
- run: mkdir -p ./reports/tslint ./reports/stylelint
- run: yarn compile --scope "@blueprintjs/tslint-config"
- run: yarn lint
- store_test_results: *reports_path
- store_artifacts: *reports_path
- store_test_results: { path: ./reports }
- store_artifacts: { path: ./reports }

dist:
<<: *setup_env
docker: *docker-node-lts
steps:
- checkout
- attach_workspace:
at: '.'
- restore_cache: *restore_cache
- restore_cache: *restore-node-modules-cache
- attach_workspace: { at: '.' }
- run: yarn dist:libs
- run: yarn dist:apps
- persist_to_workspace: *persist_to_workspace
- persist_to_workspace:
root: '.'
paths: [packages/*/dist]

test-react-16: &test-react
docker:
- image: circleci/node:8.10.0-browsers
environment:
CHROME_BIN: "/usr/bin/google-chrome"
docker: *docker-node-browsers
environment:
JUNIT_REPORT_PATH: reports
parallelism: 3
steps:
- checkout
- attach_workspace:
at: '.'
- restore_cache: *restore_cache
- restore_cache: *restore-node-modules-cache
- attach_workspace: { at: '.' }
- run: mkdir ./reports
- run:
command: |
Expand All @@ -116,8 +112,8 @@ jobs:
2) yarn lerna run --parallel test:karma ;; \
esac
when: always
- store_test_results: *reports_path
- store_artifacts: *reports_path
- store_test_results: { path: ./reports }
- store_artifacts: { path: ./reports }

test-react-15:
# copy test-react-16 and override environment
Expand All @@ -127,41 +123,37 @@ jobs:
REACT: 15 # use React 15 for this job

deploy-preview:
docker:
- image: circleci/node:8.10.0
docker: *docker-node-lts
steps:
- checkout
- attach_workspace:
at: '.'
- restore_cache: *restore_cache
- store_artifacts:
path: packages/docs-app/dist
- store_artifacts:
path: packages/landing-app/dist
- store_artifacts:
path: packages/table-dev-app/dist
- restore_cache: *restore-node-modules-cache
- attach_workspace: { at: '.' }
- store_artifacts: { path: packages/docs-app/dist }
- store_artifacts: { path: packages/landing-app/dist }
- store_artifacts: { path: packages/table-dev-app/dist }
- run:
name: Submit Github comment with links to built artifacts
command: node ./scripts/preview.js

deploy-npm:
<<: *setup_env
docker: *docker-node-lts
steps:
- checkout
- attach_workspace:
at: '.'
- restore_cache: *restore_cache
- restore_cache: *restore-node-modules-cache
- attach_workspace: { at: '.' }
- run: ./scripts/publish-npm-semver-tagged

workflows:
version: 2
compile_lint_test_dist_deploy:
jobs:
- install-dependencies
- checkout-code
- clean-lockfile:
requires: [checkout-code]
- compile:
requires: [install-dependencies]
requires: [checkout-code]
- lint:
requires: [install-dependencies]
requires: [checkout-code]
- dist:
requires: [compile]
- test-react-15:
Expand Down
1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -55,7 +55,8 @@
"sinon": "^7.2.4",
"stylelint-config-palantir": "^3.1.1",
"stylelint-scss": "^3.3.1",
"typescript": "~2.8.3"
"typescript": "~2.8.3",
"yarn-deduplicate": "^1.1.1"
},
"resolutions": {
"@types/enzyme": "3.1.15",
Expand Down
2 changes: 1 addition & 1 deletion packages/docs-app/src/components/blueprintDocs.tsx
Expand Up @@ -17,8 +17,8 @@
import { AnchorButton, Classes, setHotkeysDialogProps, Tag } from "@blueprintjs/core";
import { IDocsCompleteData } from "@blueprintjs/docs-data";
import { Documentation, IDocumentationProps, INavMenuItemProps, NavMenuItem } from "@blueprintjs/docs-theme";
import { IHeadingNode, IPageData, isPageNode, ITsDocBase } from "@documentalist/client";
import classNames from "classnames";
import { IHeadingNode, IPageData, isPageNode, ITsDocBase } from "documentalist/dist/client";
import * as React from "react";
import { NavHeader } from "./navHeader";
import { NavIcon } from "./navIcons";
Expand Down
2 changes: 1 addition & 1 deletion packages/docs-app/src/components/navHeader.tsx
Expand Up @@ -27,7 +27,7 @@ import {
Tag,
} from "@blueprintjs/core";
import { NavButton } from "@blueprintjs/docs-theme";
import { INpmPackage } from "documentalist/dist/client";
import { INpmPackage } from "@documentalist/client";
import * as React from "react";
import { Logo } from "./logo";

Expand Down
2 changes: 1 addition & 1 deletion packages/docs-data/compile-docs-data.js
Expand Up @@ -8,7 +8,7 @@
// @ts-check
const { Classes } = require("@blueprintjs/core/lib/cjs/common");
const { execSync, spawn } = require("child_process");
const dm = require("documentalist");
const dm = require("@documentalist/compiler");
const fs = require("fs");
const glob = require("glob");
const path = require("path");
Expand Down
10 changes: 5 additions & 5 deletions packages/docs-data/package.json
Expand Up @@ -12,14 +12,14 @@
"dependencies": {
"@blueprintjs/core": "^3.15.0",
"@blueprintjs/docs-theme": "^3.1.0",
"documentalist": "^1.4.0",
"@documentalist/compiler": "^2.0.1",
"better-handlebars": "github:wmeldon/better-handlebars",
"glob": "^7.1.2",
"glob": "^7.1.3",
"highlights": "^3.1.1",
"language-less": "github:atom/language-less",
"marked": "^0.3.6",
"semver": "^5.4.1",
"tree-sitter-typescript": "^0.13.3"
"marked": "^0.5.2",
"semver": "^6.0.0",
"tree-sitter-typescript": "^0.13.6"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/docs-data/src/index.d.ts
Expand Up @@ -2,7 +2,7 @@
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*/

import { INpmPluginData, IMarkdownPluginData, IKssExample, IKssPluginData, ITypescriptPluginData } from "documentalist/dist/client";
import { INpmPluginData, IMarkdownPluginData, IKssExample, IKssPluginData, ITypescriptPluginData } from "@documentalist/client";

export type IDocsCompleteData = IMarkdownPluginData & INpmPluginData & IKssPluginData & ITypescriptPluginData;

Expand Down
8 changes: 4 additions & 4 deletions packages/docs-theme/package.json
Expand Up @@ -32,19 +32,19 @@
"dependencies": {
"@blueprintjs/core": "^3.15.0",
"@blueprintjs/select": "^3.8.0",
"@documentalist/client": "^2.0.1",
"classnames": "^2.2",
"documentalist": "^1.4.0",
"fuzzaldrin-plus": "^0.6.0",
"tslib": "^1.9.0"
"tslib": "^1.9.3"
},
"devDependencies": {
"@blueprintjs/node-build-scripts": "^0.9.0",
"@types/fuzzaldrin-plus": "^0.6.0",
"npm-run-all": "^4.1.2",
"npm-run-all": "^4.1.5",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"typescript": "~2.8.3",
"webpack-cli": "^3.1.2"
"webpack-cli": "^3.3.0"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/docs-theme/src/common/context.ts
Expand Up @@ -22,7 +22,7 @@ import {
INpmPluginData,
ITsDocBase,
ITypescriptPluginData,
} from "documentalist/dist/client";
} from "@documentalist/client";

/** This docs theme requires Markdown data and optionally supports Typescript and KSS data. */
export type IDocsData = IMarkdownPluginData &
Expand Down
2 changes: 1 addition & 1 deletion packages/docs-theme/src/common/utils.ts
Expand Up @@ -15,7 +15,7 @@
*/

import { Utils } from "@blueprintjs/core";
import { IHeadingNode, IPageNode, isPageNode } from "documentalist/dist/client";
import { IHeadingNode, IPageNode, isPageNode } from "@documentalist/client";
import * as React from "react";

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/docs-theme/src/components/block.tsx
Expand Up @@ -15,8 +15,8 @@
*/

import { Classes, Code, H3 } from "@blueprintjs/core";
import { IBlock } from "@documentalist/client";
import classNames from "classnames";
import { IBlock } from "documentalist/dist/client";
import * as React from "react";
import { ITagRendererMap } from "../tags";

Expand Down
2 changes: 1 addition & 1 deletion packages/docs-theme/src/components/documentation.tsx
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import { IHeadingNode, IPageData, IPageNode, isPageNode, ITsDocBase, linkify } from "@documentalist/client";
import classNames from "classnames";
import { IHeadingNode, IPageData, IPageNode, isPageNode, ITsDocBase, linkify } from "documentalist/dist/client";
import * as React from "react";

import { Classes, Drawer, FocusStyleManager, Hotkey, Hotkeys, HotkeysTarget, IProps, Utils } from "@blueprintjs/core";
Expand Down
2 changes: 1 addition & 1 deletion packages/docs-theme/src/components/navMenu.tsx
Expand Up @@ -18,7 +18,7 @@ import { Classes, IProps } from "@blueprintjs/core";
import classNames from "classnames";
import * as React from "react";

import { IHeadingNode, IPageNode, isPageNode } from "documentalist/dist/client";
import { IHeadingNode, IPageNode, isPageNode } from "@documentalist/client";
import { INavMenuItemProps, NavMenuItem } from "./navMenuItem";

export interface INavMenuProps extends IProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/docs-theme/src/components/navMenuItem.tsx
Expand Up @@ -15,8 +15,8 @@
*/

import { Classes } from "@blueprintjs/core";
import { IHeadingNode, IPageNode } from "@documentalist/client";
import classNames from "classnames";
import { IHeadingNode, IPageNode } from "documentalist/dist/client";
import * as React from "react";

export interface INavMenuItemProps {
Expand Down

1 comment on commit 357ff5c

@blueprint-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrade documentalist, refactor CI config (#3482)

Previews: documentation | landing | table

Please sign in to comment.