Skip to content

Commit

Permalink
Add update notifier
Browse files Browse the repository at this point in the history
  • Loading branch information
yuqu committed Jan 22, 2021
1 parent 96a4ea8 commit 0774101
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"name": "@zeplin/cli-connect-react-plugin",
"version": "0.2.8",
"description": "Zeplin CLI Connected Components - React Plugin",
"main": "./dist/index",
"main": "./dist/src/index",
"scripts": {
"test": "jest",
"copy-templates": "copyfiles -u 1 src/template/** dist/",
"copy-templates": "copyfiles -u 1 src/template/** dist/src",
"build:dev": "npm run build -- --sourceMap",
"build": "rimraf dist/ && npm run copy-templates && tsc",
"lint": "eslint --ext .js,.ts .",
Expand All @@ -31,6 +31,7 @@
"@types/node": "^13.13.5",
"@types/pug": "^2.0.4",
"@types/react": "^17.0.0",
"@types/update-notifier": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^2.31.0",
"@typescript-eslint/parser": "^2.31.0",
"@zeplin/cli": "^1.0.4",
Expand All @@ -49,6 +50,7 @@
"fs-extra": "^9.0.1",
"pug": "^2.0.4",
"react-docgen": "^5.3.1",
"react-docgen-typescript": "^1.20.5"
"react-docgen-typescript": "^1.20.5",
"update-notifier": "^5.0.1"
}
}
11 changes: 11 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,23 @@ import pug from "pug";
import { readFile, pathExists } from "fs-extra";
import { ComponentDoc, parse, PreparedComponentDoc, Props } from "react-docgen";
import * as docgen from "react-docgen-typescript";
import updateNotifier from "update-notifier";
import { name as packageName, version as packageVersion } from "../package.json";

interface ReactPluginConfig {
tsDocgen?: "react-docgen" | "react-docgen-typescript";
tsConfigPath?: string;
}

updateNotifier({
pkg: {
name: packageName,
version: packageVersion
},
updateCheckInterval: 0,
shouldNotifyInNpmScript: true
}).notify();

export default class implements ConnectPlugin {
supportedFileExtensions = [".js", ".jsx", ".ts", ".tsx"];
tsExtensions = [".ts", ".tsx"];
Expand Down
1 change: 1 addition & 0 deletions tsconfig.test.json → test/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"lib": ["es5", "es6", "dom"],
"noImplicitAny": false,
"esModuleInterop": true,
"resolveJsonModule": true,
"sourceMap": true,
"outDir": "lib",
"jsx": "react"
Expand Down
10 changes: 5 additions & 5 deletions test/typescript.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe("Connected Components React Plugin - TypeScript", () => {

processor.config = {
tsDocgen: "react-docgen-typescript",
tsConfigPath: "./tsconfig.test.json"
tsConfigPath: "./test/tsconfig.test.json"
};

const componentCode = await processor.process(
Expand All @@ -92,7 +92,7 @@ describe("Connected Components React Plugin - TypeScript", () => {

processor.config = {
tsDocgen: "react-docgen-typescript",
tsConfigPath: "./tsconfig.test.json"
tsConfigPath: "./test/tsconfig.test.json"
};

const componentCode = await processor.process(
Expand All @@ -110,7 +110,7 @@ describe("Connected Components React Plugin - TypeScript", () => {

processor.config = {
tsDocgen: "react-docgen-typescript",
tsConfigPath: "./tsconfig.test.json"
tsConfigPath: "./test/tsconfig.test.json"
};

const componentCode = await processor.process(
Expand All @@ -128,7 +128,7 @@ describe("Connected Components React Plugin - TypeScript", () => {

processor.config = {
tsDocgen: "react-docgen-typescript",
tsConfigPath: "./tsconfig.test.json"
tsConfigPath: "./test/tsconfig.test.json"
};

const componentCode = await processor.process(
Expand All @@ -146,7 +146,7 @@ describe("Connected Components React Plugin - TypeScript", () => {

processor.config = {
tsDocgen: "react-docgen-typescript",
tsConfigPath: "./tsconfig.test.json"
tsConfigPath: "./test/tsconfig.test.json"
};

const componentCode = await processor.process(
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"moduleResolution": "node",
"baseUrl": ".",
"paths": {
Expand Down

0 comments on commit 0774101

Please sign in to comment.