Skip to content

Commit

Permalink
fix(build): use relative paths, run api-extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Sep 1, 2019
1 parent 5fbe772 commit 8ec8039
Show file tree
Hide file tree
Showing 189 changed files with 1,246 additions and 1,225 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export DEBUG_PORT ?= 9229
export MAKE_PATH ?= $(abspath $(lastword $(MAKEFILE_LIST)))
export ROOT_PATH ?= $(dir $(MAKE_PATH))
export CONFIG_PATH ?= $(ROOT_PATH)/config
export DOCS_PATH ?= $(ROOT_PATH)/docs
export SCRIPT_PATH ?= $(ROOT_PATH)/scripts
export SOURCE_PATH ?= $(ROOT_PATH)/src
export TARGET_PATH ?= $(ROOT_PATH)/out
Expand All @@ -37,7 +38,6 @@ NODE_DEBUG ?= --inspect-brk=$(DEBUG_BIND):$(DEBUG_PORT) --nolazy
export NODE_OPTIONS ?= --max-old-space-size=5500

# Tool options
BUNDLE_OPTS ?= --config "$(CONFIG_PATH)/webpack.js" --display-optimization-bailout --display-error-details
COVER_CHECK ?= --check-coverage --branches 70 --functions 85 --lines 85 --statements 85 # increase this every so often
COVER_OPTS ?= --reporter=lcov --reporter=text-summary --reporter=html --report-dir="$(TARGET_PATH)/coverage" --exclude-after-remap
DOCKER_IMAGE ?= ssube/isolex:master
Expand All @@ -49,7 +49,6 @@ RELEASE_OPTS ?= --commit-all
# Versions
export NODE_VERSION := $(shell node -v)
export RUNNER_VERSION := $(CI_RUNNER_VERSION)
export WEBPACK_VERSION := $(shell $(NODE_BIN)/webpack -v)

all: build test run-terminal
@echo Success!
Expand Down Expand Up @@ -102,7 +101,8 @@ test: ## run mocha unit tests
test: test-cover

test-check: ## run mocha unit tests with coverage reports
$(NODE_BIN)/nyc $(COVER_OPTS) $(NODE_BIN)/mocha $(MOCHA_OPTS) $(TARGET_PATH)/test.js
#$(NODE_BIN)/nyc $(COVER_OPTS)
$(NODE_BIN)/mocha $(MOCHA_OPTS) $(TARGET_PATH)/test.js

test-cover: ## run mocha unit tests with coverage reports
test-cover: test-check
Expand Down Expand Up @@ -174,4 +174,4 @@ pid-reload:
$(shell kill --signal HUP $(shell cat "$(TARGET_PATH)/isolex.pid"))

pid-reset:
$(shell kill --signal INT $(shell cat "$(TARGET_PATH)/isolex.pid"))
$(shell kill --signal INT $(shell cat "$(TARGET_PATH)/isolex.pid"))
43 changes: 43 additions & 0 deletions config/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"projectFolder": "..",
"mainEntryPointFilePath": "<projectFolder>/out/src/index.d.ts",
"apiReport": {
"enabled": true,
"reportFolder": "<projectFolder>/out/",
"reportTempFolder": "<projectFolder>/out/tmp/"
},
"docModel": {
"enabled": true,
"apiJsonFilePath": "<projectFolder>/out/api/<unscopedPackageName>.api.json"
},

"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "<projectFolder>/out/noicejs.d.ts",
"betaTrimmedFilePath": "<projectFolder>/out/noicejs-beta.d.ts",
"publicTrimmedFilePath": "<projectFolder>/out/noicejs-public.d.ts"
},

"tsdocMetadata": {
},

"messages": {
"compilerMessageReporting": {
"default": {
"logLevel": "warning"
}
},

"extractorMessageReporting": {
"default": {
"logLevel": "warning"
}
},
"tsdocMessageReporting": {
"default": {
"logLevel": "warning"
}
}
}
}
94 changes: 88 additions & 6 deletions config/rollup.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,19 @@ const bundle = {
external: [
'async_hooks',
],
input: [
'src/index.ts',
'test/harness.ts',
'test/**/Test*.ts',
],
input: {
include: [
'src/index.ts',
'test/harness.ts',
'test/**/Test*.ts',
],
exclude: [
'node_modules/mongodb',
'node_modules/mysql',
'node_modules/mysql2',
'node_modules/oracledb',
],
},
manualChunks(id) {
if (id.includes('/test/') || id.includes('/node_modules/')) {
return 'test';
Expand Down Expand Up @@ -52,6 +60,15 @@ const bundle = {
NODE_VERSION: process.env['NODE_VERSION'],
},
}),
replace({
delimiters: ['from \'', '\''],
values: {
'mongodb': 'empty-module',
'mysql': 'empty-module',
'mysql2': 'empty-module',
'oracledb': 'empty-module',
},
}),
resolve({
preferBuiltins: true,
}),
Expand All @@ -61,16 +78,81 @@ const bundle = {
'expect',
'use',
],
'node_modules/cron/lib/cron.js': [
'CronJob',
],
'node_modules/lodash/lodash.js': [
'flatten',
'get',
'isBoolean',
'isEmpty',
'isFunction',
'isMap',
'isNil',
'isNumber',
'isObject',
'isString',
'kebabCase',
'trim',
],
'node_modules/mathjs/index.js': [
'max',
'min',
'random',
'randomInt',
],
'node_modules/express/index.js': [
'json',
'Request',
'Response',
'Router',
],
'node_modules/typeorm/index.js': [
'AfterLoad',
'BeforeInsert',
'BeforeUpdate',
'CreateDateColumn',
'Column',
'Entity',
'EntityRepository',
'Equal',
'FindManyOptions',
'In',
'JoinColumn',
'LessThan',
'ManyToOne',
'OneToOne',
'PrimaryColumn',
'PrimaryGeneratedColumn',
'Table',
'TableColumn',
'UpdateDateColumn',
],
/*
'': [
'GraphQLID',
'GraphQLInputObjectType',
'GraphQLList',
'GraphQLObjectType',
'GraphQLString',
],
*/
'node_modules/js-yaml/index.js': [
'DEFAULT_SAFE_SCHEMA',
'safeLoad',
'Schema',
'Type',
],
'node_modules/@slack/client/dist/index.js': [
'WebAPICallResult',
'WebClient',
],
'node_modules/node-emoji/index.js': [
'find',
],
},
}),
typescript({
typescript({
cacheRoot: 'out/cache/rts2',
rollupCommonJSResolveHack: true,
}),
Expand Down
4 changes: 3 additions & 1 deletion config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"compileOnSave": false,
"compilerOptions": {
"allowJs": true,
"allowJs": false,
"allowSyntheticDefaultImports": true,
"declaration": true,
"declarationMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
Expand Down
169 changes: 0 additions & 169 deletions config/webpack.js

This file was deleted.

Loading

0 comments on commit 8ec8039

Please sign in to comment.