Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move packages #61

Merged
merged 3 commits into from
Mar 20, 2021
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
1,480 changes: 1,462 additions & 18 deletions package-lock.json

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
64 changes: 64 additions & 0 deletions packages/cheeket-aws/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
const fs = require('fs');
const path = require("path");

const { src, dest, series } = require('gulp');
const sourcemaps = require('gulp-sourcemaps');
const gulpif = require('gulp-if');
const ts = require('gulp-typescript');
const uglify = require('gulp-uglify');
const merge = require('deepmerge')

function getTsconfigName() {
if (!process.env.NODE_ENV) return 'tsconfig.json';

const specificConfig = `tsconfig.${process.env.NODE_ENV.toLowerCase()}.json`;
if (fs.existsSync(specificConfig)) {
return specificConfig;
}

return 'tsconfig.json';
}

function getFinalTsConfig(config, currentPath) {
const { extends: parentConfigPath, ...rest } = config;

if (parentConfigPath) {
const finalParentConfigPath = path.join(currentPath, parentConfigPath);
const parentProject = ts.createProject(finalParentConfigPath);

const parentConfig = getFinalTsConfig(parentProject.rawConfig, parentProject.projectDirectory);
return merge(parentConfig, rest);
}
return rest;
}

function getTsconfig(tsProject) {
return getFinalTsConfig(tsProject.rawConfig, tsProject.projectDirectory)
}

const tsProject = ts.createProject(getTsconfigName());
const tsconfig = getTsconfig(tsProject);

function compile() {
const useSourcemaps = tsconfig.compilerOptions.sourceMap;

return tsProject.src()
.pipe(gulpif(useSourcemaps, sourcemaps.init()))
.pipe(tsProject())
.pipe(gulpif(useSourcemaps, sourcemaps.write('.')))
.pipe(dest(tsconfig.compilerOptions.outDir));
}

function compression() {
const isProduction = process.env.NODE_ENV === 'production';

return src(path.join(tsconfig.compilerOptions.outDir, '**/*.js'))
.pipe(gulpif(isProduction, sourcemaps.init()))
.pipe(gulpif(isProduction, uglify()))
.pipe(gulpif(isProduction, sourcemaps.write('.')))
.pipe(dest(tsconfig.compilerOptions.outDir));
}

const build = series(compile, compression);

exports.default = series(build);
10 changes: 10 additions & 0 deletions packages/cheeket-aws/lib/dynamo-db.provider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { interfaces } from "cheeket";
import * as AWS from "aws-sdk";

function dynamoDBProvider(
configuration: AWS.DynamoDB.ClientConfiguration
): interfaces.Provider<AWS.DynamoDB> {
return () => new AWS.DynamoDB(configuration);
}

export default dynamoDBProvider;
1 change: 1 addition & 0 deletions packages/cheeket-aws/lib/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test.todo("Add test");
2 changes: 2 additions & 0 deletions packages/cheeket-aws/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as s3Provider } from "./s3.provider";
export { default as dynamoDBProvider } from "./dynamo-db.provider";
12 changes: 12 additions & 0 deletions packages/cheeket-aws/lib/s3.provider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { interfaces } from "cheeket";
import * as AWS from "aws-sdk";

function s3Provider(
configuration: AWS.S3.ClientConfiguration
): interfaces.Provider<AWS.S3> {
return () => {
return new AWS.S3(configuration);
};
}

export default s3Provider;
26 changes: 26 additions & 0 deletions packages/cheeket-aws/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@cheeket/aws",
"version": "1.0.0",
"description": "",
"license": "ISC",
"author": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"test": "jest",
"build": "npm run clean && npm run compile",
"clean": "rm -rf ./dist",
"compile": "gulp",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"prepublishOnly": "cross-env NODE_ENV=production npm run build"
},
"devDependencies": {
"aws-sdk": "^2.868.0",
"cheeket": "^2.3.5"
},
"peerDependencies": {
"aws-sdk": "^2.x",
"cheeket": "^2.3.x"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function autoInjected<T>(Target: interfaces.Type<T>): interfaces.Provider<T> {
})
);

return new Target(...parameters);
return new Target(...(parameters as never[]));
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"name": "@cheeket/injector",
"version": "2.3.5",
"description": "a decorator-based injector plugin for of cheeket",
"homepage": "https://github.com/siyual-park/cheeket.js",
"license": "MIT",
"author": "siyual.park",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
Expand All @@ -14,9 +17,6 @@
"lint:fix": "eslint --fix .",
"prepublishOnly": "cross-env NODE_ENV=production npm run build"
},
"author": "siyual.park",
"license": "MIT",
"homepage": "https://github.com/siyual-park/cheeket.js",
"devDependencies": {
"cheeket": "^2.3.5",
"reflect-metadata": "^0.1.13"
Expand Down
5 changes: 5 additions & 0 deletions packages/cheeket-koa/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
script
node_modules
dist
*.js
*.json
8 changes: 8 additions & 0 deletions packages/cheeket-koa/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": [
"../../.eslintrc.json"
],
"parserOptions": {
"project": "tsconfig.eslint.json"
}
}
119 changes: 119 additions & 0 deletions packages/cheeket-koa/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# intelliJ
.idea/
3 changes: 3 additions & 0 deletions packages/cheeket-koa/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!dist/*
!dist/**/*
File renamed without changes.
16 changes: 16 additions & 0 deletions packages/cheeket-koa/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
verbose: true,
transform: {
'^.+\\.ts$': 'ts-jest'
},
testRegex: '\\.spec\\.ts$',
moduleFileExtensions: [
'ts',
'js'
],
globals: {
'ts-jest': {
'diagnostics': true
}
}
};
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"name": "@cheeket/koa",
"version": "1.0.0-alpha.3",
"description": "use cheeket in koa",
"homepage": "https://github.com/siyual-park/cheeket.js",
"license": "MIT",
"author": "siyual.park",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
Expand All @@ -14,9 +17,6 @@
"lint:fix": "eslint --fix .",
"prepublishOnly": "cross-env NODE_ENV=production npm run build"
},
"author": "siyual.park",
"license": "MIT",
"homepage": "https://github.com/siyual-park/cheeket.js",
"devDependencies": {
"@types/accepts": "^1.3.5",
"@types/cookies": "^0.7.5",
Expand Down
7 changes: 7 additions & 0 deletions packages/cheeket-koa/tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"include": [
"lib",
"test"
]
}
9 changes: 9 additions & 0 deletions packages/cheeket-koa/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist"
},
"include": [
"lib/**/*"
]
}
8 changes: 8 additions & 0 deletions packages/cheeket-koa/tsconfig.production.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"exclude": [
"*/**/*.test.ts",
"*/**/*.spec.ts",
"*/**/*.mock.ts"
]
}
5 changes: 5 additions & 0 deletions packages/cheeket-typerom/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
script
node_modules
dist
*.js
*.json
8 changes: 8 additions & 0 deletions packages/cheeket-typerom/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": [
"../../.eslintrc.json"
],
"parserOptions": {
"project": "tsconfig.eslint.json"
}
}
Loading