Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Add --declaration back to build scripts and remove lib from .npmignore #178

Merged
merged 9 commits into from
Jul 30, 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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
key: yarn-dependency-cache-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run: yarn run tsc
- run: yarn run tsc --declaration
- run: yarn run karma start karma.conf.coverage.js
- store_test_results:
path: junit-reports
Expand All @@ -55,7 +55,7 @@ jobs:
- checkout
- attach_workspace: { at: . }
- run: npm config set "//registry.npmjs.org/:_authToken" $NPM_AUTH
- run: yarn add -D typescript && yarn run tsc
- run: yarn add -D typescript && yarn run tsc --declaration
- run: npm publish .

workflows:
Expand Down
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.github
node_modules
test/**/*
lib/**/*
test-e2e/**/*
steps_file.ts
steps.d.ts
Expand Down
12 changes: 12 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@

4.0.0-beta.1 / 2020-07-30
=========================

* export interfaces
* fix importing types issues

3.13.8 / 2020-07-29
===================

* Add --declaration back to build scripts
* Publish v3.13.7 (#176)
# 3.13.7 / 2020-07-29

- Publish types to npm
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ install:

# Build typescript
build: clean install
yarn tsc
yarn tsc --declaration
.PHONY: build

# Remove temporary files and build artifacts.
Expand Down
8 changes: 4 additions & 4 deletions lib/global-modules.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { SegmentAnalytics } from './index.d'
import { SegmentAnalytics } from './index.d';

declare global {
namespace NodeJS {
interface Global {
analytics: SegmentAnalytics.AnalyticsJS
analytics: SegmentAnalytics.AnalyticsJS;
}
}
interface Window {
analytics: SegmentAnalytics.AnalyticsJS
analytics: SegmentAnalytics.AnalyticsJS;
jQuery: any;
Zepto: any;
}
}

export {};
export {};
28 changes: 12 additions & 16 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
export namespace SegmentAnalytics {
export interface SegmentOpts {
export declare namespace SegmentAnalytics {
interface SegmentOpts {
integrations?: any;
anonymousId?: string;
context?: object;
}

export interface IntegrationsSettings {
interface IntegrationsSettings {
// TODO remove `any`
[key: string]: any;
}

export interface CookieOptions {
interface CookieOptions {
maxage?: number;
domain?: string;
path?: string;
secure?: boolean;
}

export interface MetricsOptions {
interface MetricsOptions {
host?: string;
sampleRate?: number;
flushTimer?: number;
maxQueueSize?: number;
}

export interface StoreOptions {
interface StoreOptions {
enabled?: boolean;
}

export interface UserOptions {
interface UserOptions {
cookie?: {
key: string;
oldKey: string;
Expand All @@ -39,7 +39,7 @@ export namespace SegmentAnalytics {
persist?: boolean;
}

export interface GroupOptions {
interface GroupOptions {
cookie?: {
key: string;
};
Expand All @@ -49,12 +49,12 @@ export namespace SegmentAnalytics {
persist?: boolean;
}

export interface SegmentIntegration {
interface SegmentIntegration {
All?: boolean;
[integration: string]: boolean | undefined;
}

export interface InitOptions {
interface InitOptions {
initialPageview?: boolean;
cookie?: CookieOptions;
metrics?: MetricsOptions;
Expand All @@ -64,7 +64,7 @@ export namespace SegmentAnalytics {
integrations?: SegmentIntegration;
}

export interface AnalyticsJS {
interface AnalyticsJS {
Integrations: { [name: string]: unknown };
require: any;
VERSION: any;
Expand Down Expand Up @@ -270,8 +270,4 @@ export namespace SegmentAnalytics {
}

declare var analytics: SegmentAnalytics.AnalyticsJS;

declare module '@segment/analytics.js-core' {
var analytics: SegmentAnalytics.AnalyticsJS;
export default analytics;
}
export default analytics;
2 changes: 1 addition & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

import { SegmentAnalytics } from './index.d'
import { SegmentAnalytics } from './index.d';

/**
* Analytics.js
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@segment/analytics.js-core",
"author": "Segment <[email protected]>",
"version": "3.13.7",
"version": "4.0.0-beta.1",
"description": "The hassle-free way to integrate analytics into any web application.",
"types": "lib/index.d.ts",
"keywords": [
Expand Down