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

Commit 45256be

Browse files
author
Julio Farah
authored
Add --declaration back to build scripts and remove lib from .npmignore (#178)
* Add --declaration back to build scripts * update history * update package.json * remove lib from npm ignore * export interfaces
1 parent 11eefc5 commit 45256be

File tree

8 files changed

+33
-26
lines changed

8 files changed

+33
-26
lines changed

.circleci/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
key: yarn-dependency-cache-{{ checksum "yarn.lock" }}
3333
paths:
3434
- node_modules
35-
- run: yarn run tsc
35+
- run: yarn run tsc --declaration
3636
- run: yarn run karma start karma.conf.coverage.js
3737
- store_test_results:
3838
path: junit-reports
@@ -55,7 +55,7 @@ jobs:
5555
- checkout
5656
- attach_workspace: { at: . }
5757
- run: npm config set "//registry.npmjs.org/:_authToken" $NPM_AUTH
58-
- run: yarn add -D typescript && yarn run tsc
58+
- run: yarn add -D typescript && yarn run tsc --declaration
5959
- run: npm publish .
6060

6161
workflows:

.npmignore

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
.github
33
node_modules
44
test/**/*
5-
lib/**/*
65
test-e2e/**/*
76
steps_file.ts
87
steps.d.ts

HISTORY.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2+
4.0.0-beta.1 / 2020-07-30
3+
=========================
4+
5+
* export interfaces
6+
* fix importing types issues
7+
8+
3.13.8 / 2020-07-29
9+
===================
10+
11+
* Add --declaration back to build scripts
12+
* Publish v3.13.7 (#176)
113
# 3.13.7 / 2020-07-29
214

315
- Publish types to npm

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ install:
4747

4848
# Build typescript
4949
build: clean install
50-
yarn tsc
50+
yarn tsc --declaration
5151
.PHONY: build
5252

5353
# Remove temporary files and build artifacts.

lib/global-modules.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import { SegmentAnalytics } from './index.d'
1+
import { SegmentAnalytics } from './index.d';
22

33
declare global {
44
namespace NodeJS {
55
interface Global {
6-
analytics: SegmentAnalytics.AnalyticsJS
6+
analytics: SegmentAnalytics.AnalyticsJS;
77
}
88
}
99
interface Window {
10-
analytics: SegmentAnalytics.AnalyticsJS
10+
analytics: SegmentAnalytics.AnalyticsJS;
1111
jQuery: any;
1212
Zepto: any;
1313
}
1414
}
1515

16-
export {};
16+
export {};

lib/index.d.ts

+12-16
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
export namespace SegmentAnalytics {
2-
export interface SegmentOpts {
1+
export declare namespace SegmentAnalytics {
2+
interface SegmentOpts {
33
integrations?: any;
44
anonymousId?: string;
55
context?: object;
66
}
77

8-
export interface IntegrationsSettings {
8+
interface IntegrationsSettings {
99
// TODO remove `any`
1010
[key: string]: any;
1111
}
1212

13-
export interface CookieOptions {
13+
interface CookieOptions {
1414
maxage?: number;
1515
domain?: string;
1616
path?: string;
1717
secure?: boolean;
1818
}
1919

20-
export interface MetricsOptions {
20+
interface MetricsOptions {
2121
host?: string;
2222
sampleRate?: number;
2323
flushTimer?: number;
2424
maxQueueSize?: number;
2525
}
2626

27-
export interface StoreOptions {
27+
interface StoreOptions {
2828
enabled?: boolean;
2929
}
3030

31-
export interface UserOptions {
31+
interface UserOptions {
3232
cookie?: {
3333
key: string;
3434
oldKey: string;
@@ -39,7 +39,7 @@ export namespace SegmentAnalytics {
3939
persist?: boolean;
4040
}
4141

42-
export interface GroupOptions {
42+
interface GroupOptions {
4343
cookie?: {
4444
key: string;
4545
};
@@ -49,12 +49,12 @@ export namespace SegmentAnalytics {
4949
persist?: boolean;
5050
}
5151

52-
export interface SegmentIntegration {
52+
interface SegmentIntegration {
5353
All?: boolean;
5454
[integration: string]: boolean | undefined;
5555
}
5656

57-
export interface InitOptions {
57+
interface InitOptions {
5858
initialPageview?: boolean;
5959
cookie?: CookieOptions;
6060
metrics?: MetricsOptions;
@@ -64,7 +64,7 @@ export namespace SegmentAnalytics {
6464
integrations?: SegmentIntegration;
6565
}
6666

67-
export interface AnalyticsJS {
67+
interface AnalyticsJS {
6868
Integrations: { [name: string]: unknown };
6969
require: any;
7070
VERSION: any;
@@ -270,8 +270,4 @@ export namespace SegmentAnalytics {
270270
}
271271

272272
declare var analytics: SegmentAnalytics.AnalyticsJS;
273-
274-
declare module '@segment/analytics.js-core' {
275-
var analytics: SegmentAnalytics.AnalyticsJS;
276-
export default analytics;
277-
}
273+
export default analytics;

lib/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
import { SegmentAnalytics } from './index.d'
3+
import { SegmentAnalytics } from './index.d';
44

55
/**
66
* Analytics.js

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@segment/analytics.js-core",
33
"author": "Segment <[email protected]>",
4-
"version": "3.13.7",
4+
"version": "4.0.0-beta.1",
55
"description": "The hassle-free way to integrate analytics into any web application.",
66
"types": "lib/index.d.ts",
77
"keywords": [

0 commit comments

Comments
 (0)